Commit 9e09f330 authored by Maxime Perrotin's avatar Maxime Perrotin

Sync with subversion

parent 8b7df180
Pipeline #20 skipped
This diff is collapsed.
......@@ -815,43 +815,51 @@ void Set_Interface_Queue_Size (const unsigned long long s)
}
/* New interface: set the name and distant FV to which it is connected */
void New_Interface(char *name, size_t length, char *dist_fv,
size_t distant_length,
void New_Interface(char *name, size_t length,
char *dist_fv, size_t distant_length,
char *distant_name, size_t dist_name_length,
IF_type direction)
{
interface = NULL;
Create_Interface(&interface);
if (NULL != interface) {
build_string(&(interface->name), name, length);
/* RI can have a local identifier which may be different from
* the corresponding PI it is connected to. In that case we set
* the "distant_name" field of the interface to make sure that
* the connection will be properly handled
*/
if (NULL != distant_name) {
build_string (&(interface->distant_name),
distant_name, dist_name_length);
}
assert (NULL != interface);
build_string(&(interface->name), name, length);
/* Set the port name as the interface name, so that if later
* the interface name is changed, we still know to which port we
* have to connect it (in case of distributed systems */
build_string (&(interface->port_name), name, length);
if (distant_length > 0)
build_string (&(interface->distant_fv), dist_fv,
distant_length);
else
interface->distant_fv = NULL;
interface->direction = direction;
interface->wcet_low = 0;
interface->wcet_high = 0;
interface->wcet_low_unit = NULL;
interface->wcet_high_unit = NULL;
interface->queue_size = 1;
/* RI can have a local identifier which may be different from
* the corresponding PI it is connected to. In that case we set
* the "distant_name" field of the interface to make sure that
* the connection will be properly handled
*/
if (NULL != distant_name) {
build_string (&(interface->distant_name),
distant_name, dist_name_length);
}
/* Set the port name as the interface name, so that if later
* the interface name is changed, we still know to which port we
* have to connect it (in case of distributed systems */
build_string (&(interface->port_name), name, length);
if (distant_length > 0) {
build_string (&(interface->distant_fv), dist_fv, distant_length);
}
else {
interface->distant_fv = NULL;
}
interface->direction = direction;
interface->wcet_low = 0;
interface->wcet_high = 0;
interface->wcet_low_unit = NULL;
interface->wcet_high_unit = NULL;
interface->queue_size = 1;
/* ignore params will be kept to true if all callers of a given PI
* are located in the same node (binary) - in that case the parameters
* will not be copied from the sender to the receiver through the orb
* but made available directly through global pointers.
*/
interface->ignore_params = true;
}
/* New Provided interface */
......@@ -872,21 +880,21 @@ void Add_RI(char *ri, size_t length,
char *dist_fv, size_t distant_length,
char *dist_name, size_t dist_name_length)
{
size_t tmp = 0;
char *local_name = ri;
size_t tmp = 0;
char *local_name = ri;
assert (NULL != ri);
assert (NULL != dist_fv);
assert (NULL != dist_name);
tmp = remove_objXXX_suffix (ri, length);
tmp = remove_objXXX_suffix (ri, length);
dist_name_length = remove_objXXX_suffix (dist_name, dist_name_length);
/* If the first 3 characters of the local RI name are "obj" we suppose
* it is a name generated randomly by TASTE-IV. In that case we replace
* the local RI name with the name of the remote PI.
* Whenever TASTE-IV is fixed (after version 1.1.2)
* this should become obsolete */
* This is kept only for backward compatibility
*/
if (tmp >= 4 && !strncmp (ri, "obj", 3)) {
local_name = dist_name;
length = dist_name_length;
......@@ -900,9 +908,9 @@ void Add_RI(char *ri, size_t length,
}
/* add an IN parameter to the list */
void Add_In_Param(char *name, size_t l1,
char *type, size_t l2,
char *module, size_t l3,
void Add_In_Param(char *name, size_t l1,
char *type, size_t l2,
char *module, size_t l3,
char *filename, size_t l4)
{
type = asn2underscore(type, l2);
......@@ -1038,13 +1046,15 @@ void CompareFVname(FV * fv_local, FV ** result)
}
}
/* main function to be called */
FV *FindFV(char *fv_name)
{ /* main function to be called */
{
FV *result_fv = NULL;
SetSearchName(fv_name);
FOREACH(f, FV, system_ast->functions, {
CompareFVname(f, &result_fv);})
SetSearchName(NULL);
CompareFVname(f, &result_fv);
});
SetSearchName(NULL);
return result_fv;
}
......@@ -1074,9 +1084,24 @@ Interface *FindInterface(FV * function, char *interface_name)
return result;
}
/* Given a PI (from any function) and a known caller, find the corresponding
* RI in the remote function
*/
Interface *FindCorrespondingRI(FV *remote, Interface *pi)
{
FOREACH (i, Interface, remote->interfaces, {
if (RI == i->direction &&
!strcmp (i->distant_name, pi->name) &&
!strcmp (i->distant_fv, pi->parent_fv->name)) {
return i;
}
});
return NULL;
}
/* End Find Interface functions */
/* Return the list of FV calling a given PI
/* Return the list of FV calling a given PI
the conditions are, for each RI of each FV that :
- RI's distant name = PI's name
- RI's distant FV = PI's parent FV
......@@ -1133,18 +1158,17 @@ void Delete_System_AST()
Clear_System(system_ast);
}
/* Get dataview file name based (same as dataview.aadl
* passed with -d but replace with .asn extension */
/* Get dataview file name based (same as dataview.aadl
* passed with -d but replace with .asn extension
*/
char *getASN1DataView()
{
char *p = strrchr (get_context()->dataview,'/');
if (NULL == p) p = get_context()->dataview - 1;
return make_string
("%.*s.asn",
strlen (p + 1) - strlen (".aadl"),
p + 1);
return make_string ("%.*s.asn", strlen (p + 1) - strlen (".aadl"), p + 1);
}
/* Get dataView path */
char *getDataViewPath()
{
......@@ -1190,11 +1214,12 @@ void Print_Interface(Interface * i)
printf("\tperiod/miat = %lld\n", i->period);
printf("\tdistant_fv = %s\n", i->distant_fv);
printf("\tdistant_name = %s\n", i->distant_name);
printf("\twcet = %llu %s .. %llu %s\n\n",
printf("\twcet = %llu %s .. %llu %s\n",
(unsigned long long) i->wcet_low,
i->wcet_low_unit,
(unsigned long long) i->wcet_high,
i->wcet_high_unit);
printf("\tignore params = %s\n\n", i->ignore_params ? "true": "false");
}
void Dump_Interfaces(Interface_list * l)
......
/* Buildsupport is (c) 2008-2015 European Space Agency
/* Buildsupport is (c) 2008-2016 European Space Agency
* contact: maxime.perrotin@esa.int
* License is LGPL, check LICENSE file */
/*
......@@ -46,8 +46,8 @@ void C_End()
Semantic_Checks();
/*
* Temporary support for OpenGEODE - Will be removed when TASTE-IV supports it
* Replace SDL language with Ada for building glue code
* Temporary support for OpenGEODE
* Replace SDL language with Ada for building glue code
*/
if (get_context()->glue) {
FOREACH(fv, FV, get_system_ast()->functions, {
......@@ -57,21 +57,22 @@ void C_End()
/* Mark the callers of QGen functions */
FOREACH(fv, FV, get_system_ast()->functions, {
FOREACH(i, Interface, fv->interfaces, {
if (RI == i->direction) {
FV *connected_fv = NULL;
Interface *connected_pi = NULL;
connected_fv = FindFV (i->distant_fv);
if ((connected_fv != NULL) && ((qgenada == connected_fv->language) || (qgenc == connected_fv->language))) {
i->distant_qgen->language = connected_fv->language;
i->distant_qgen->fv_name = connected_fv->name;
connected_pi = FindInterface (connected_fv, i->distant_name);
if (connected_pi != NULL) {
connected_pi->distant_qgen->language = connected_fv->language;
connected_pi->distant_qgen->fv_name = fv->name;
}
FOREACH(i, Interface, fv->interfaces, {
if (RI == i->direction) {
FV *connected_fv = NULL;
Interface *connected_pi = NULL;
connected_fv = FindFV (i->distant_fv);
if ((connected_fv != NULL) &&
((qgenada == connected_fv->language) || (qgenc == connected_fv->language))) {
i->distant_qgen->language = connected_fv->language;
i->distant_qgen->fv_name = connected_fv->name;
connected_pi = FindInterface (connected_fv, i->distant_name);
if (connected_pi != NULL) {
connected_pi->distant_qgen->language = connected_fv->language;
connected_pi->distant_qgen->fv_name = fv->name;
}
}
}
});
});
......@@ -95,9 +96,9 @@ void C_End()
});
});
/*
/*
* If Semantic errors have been found (erros in the user AADL models),
* then the application is exited with an error message.
* then the application is exited with an error message.
*/
if (error_count > 0) {
fprintf(stderr, "\nFound %d errors.. Aborting...\n", error_count);
......@@ -143,7 +144,7 @@ void C_End()
})
/*
/*
* Perform the first part of the Vertical transformation (-glue flag):
* Tranform the interface view to allow a one-to-one mapping Function-Thread
*/
......@@ -155,35 +156,33 @@ void C_End()
* Debug mode (userflag -test) : dump the result of the transformation
* TODO: generate an AADL model (equivalent to the Concurrency View)
*/
if (get_system_ast()->context->test)
if (get_system_ast()->context->test) {
Dump_model(get_system_ast());
}
/*
/*
* Execute various backends applicable to each FV
*/
FOREACH(fv, FV, get_system_ast()->functions, {
/*
* Call 'asn2dataModel' if glue code is not required
* (to avoid slowing down the orchestrator, which is
* the only place where the glue code is requested
*/
if (get_context()->gw &&
!get_context()->glue &&
NULL == fv->zipfile) {
FOREACH(fv, FV, get_system_ast()->functions, {
/*
* Call 'asn2dataModel' if glue code is not required
* (to avoid slowing down the orchestrator, which is
* the only place where the glue code is requested
*/
if (get_context()->gw && !get_context()->glue && NULL == fv->zipfile) {
Call_asn2dataModel(fv);
}
}
/* Process all functional states declared in the interface view */
if (get_context()->gw &&
(NULL == fv->zipfile || get_context()->glue)) {
Process_Context_Parameters(fv);
}
/* Process all functional states declared in the interface view */
if (get_context()->gw && (NULL == fv->zipfile || get_context()->glue)) {
Process_Context_Parameters(fv);
}
/* Process function directives */
if (get_context()->glue || get_context()->test) {
Process_Directives (fv);
}
if (get_context()->glue) {
GLUE_OG_Backend(fv);
GLUE_RTDS_Backend(fv);
......@@ -197,7 +196,7 @@ void C_End()
})
/*
* Perform the second part of the Vertical transformation:
* Perform the second part of the Vertical transformation:
* Generate driver configuration
* Generate the full concurrency view (process.aadl et al.)
* Additionnally create an AADL file of the concurrency view
......@@ -212,15 +211,9 @@ void C_End()
(get_system_ast()->name));
AADL_CV_Unparser ();
}
/* Generation of system configuration used by C_ASN1_Types.h */
System_Config(get_system_ast());
}
/*
* Free the memory used by the system AST
* Removed, this is useless at the end of the application
*/
// Delete_System_AST();
}
......@@ -92,15 +92,19 @@ void Process_Context_Parameters(FV *fv)
* In the future this namespace shall comme automatically from Asn1Scc
*/
fprintf(asn, "\nContext-%s ::= SEQUENCE {", fv_no_underscore);
bool first = true;
FOREACH (cp, Context_Parameter, fv->context_parameters, {
if (strcmp (cp->type.name, "Taste-directive") &&
strcmp (cp->type.name, "Simulink-Tunable-Parameter") &&
strcmp(cp->type.name, "Timer")) {
cp_no_underscore = underscore_to_dash
(cp->name, strlen(cp->name));
fprintf(asn, "%s\t%s %s",
cp != fv->context_parameters->value? ",\n": "\n",
cp_no_underscore,
if (false == first) {
fprintf(asn, ",");
}
first = false;
fprintf(asn, "\n\t%s %s",
cp_no_underscore,
cp->type.name);
free (cp_no_underscore);
}
......@@ -113,16 +117,19 @@ void Process_Context_Parameters(FV *fv)
fprintf(asn, "\n%s-ctxt Context-%s ::= {",
fv_no_underscore,
fv_no_underscore);
first = true;
FOREACH (cp, Context_Parameter, fv->context_parameters, {
if (strcmp (cp->type.name, "Taste-directive") &&
strcmp (cp->type.name, "Simulink-Tunable-Parameter") &&
strcmp(cp->type.name, "Timer")) {
cp_no_underscore = underscore_to_dash
(cp->name, strlen(cp->name));
fprintf(asn, "%s\t%s %s",
cp != fv->context_parameters->value? ",\n": "\n",
cp_no_underscore,
if (false == first) {
fprintf(asn, ",");
}
first = false;
fprintf(asn, "\n\t%s %s",
cp_no_underscore,
cp->value);
free (cp_no_underscore);
}
......
This diff is collapsed.
/* Buildsupport is (c) 2008-2015 European Space Agency
/* Buildsupport is (c) 2008-2016 European Space Agency
* contact: maxime.perrotin@esa.int
* License is LGPL, check LICENSE file */
#ifndef __C_AST_CONSTRUCTION_H__
......@@ -6,6 +6,7 @@
Interface *FindInterface(FV *fv,char *interface_name);
Interface *FindCorrespondingRI(FV *remote, Interface *pi);
void CompareIFname(Interface *i,Interface **result);
void CompareFVname(FV *fv_local,FV **result);
void SetSearchName(char *name);
......
/* Buildsupport is (c) 2008-2015 European Space Agency
/* Buildsupport is (c) 2008-2016 European Space Agency
* contact: maxime.perrotin@esa.int
* License is LGPL, check LICENSE file */
/* Types used for description of the C AST of TASTE systems */
......@@ -87,15 +87,15 @@ typedef enum {
/* Basic ASN.1 type */
typedef enum {
sequenceof,
sequence,
enumerated,
set,
setof,
integer,
boolean,
real,
choice,
sequenceof,
sequence,
enumerated,
set,
setof,
integer,
boolean,
real,
choice,
octetstring,
string,
unknown_type
......@@ -104,8 +104,8 @@ typedef enum {
/* Function nature: thread or shared resource */
typedef enum {
thread_runtime,
passive_runtime,
thread_runtime,
passive_runtime,
unknown_runtime
} Nature;
......@@ -193,8 +193,9 @@ typedef struct t_interface {
char *distant_fv;
struct t_qgen *distant_qgen;
struct t_FV_list *calling_threads;
char *distant_name;
char *distant_name;
unsigned long long queue_size;
bool ignore_params;
} Interface;
DECLARE_LIST (Interface)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment