Commit bde990bb authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

support and test context params

parent 0b67bac1
...@@ -125,20 +125,26 @@ package body TASTE.Backend.Code_Generators is ...@@ -125,20 +125,26 @@ package body TASTE.Backend.Code_Generators is
CP_Tmpl : constant Translate_Set := CP_Template (F => F); CP_Tmpl : constant Translate_Set := CP_Template (F => F);
CP_Text : constant String := CP_Text : constant String :=
(Parse (Prefix_Skeletons & "context_parameters.tmplt", CP_Tmpl)); (Parse (Prefix_Skeletons & "context_parameters.tmplt", CP_Tmpl));
CP_File : constant String := "Context-" CP_File : constant String :=
& To_Lower (To_String (F.Name)) "Context-" & To_Lower (To_String (F.Name)) & ".asn";
& ".asn"; CP_File_Dash : Unbounded_String;
begin begin
-- To keep backward compatibility, file name uses dash
for C of CP_File loop
CP_File_Dash := CP_File_Dash & (if C = '_' then '-' else C);
end loop;
if not F.Context_Params.Is_Empty then if not F.Context_Params.Is_Empty then
Create_Path (Output_Lang); Create_Path (Output_Lang);
Put_Debug ("Generating " & CP_File); Put_Debug ("Generating " & To_String (CP_File_Dash));
Create (File => Output_File, Create (File => Output_File,
Mode => Out_File, Mode => Out_File,
Name => Output_Lang & CP_File); Name => Output_Lang & To_String (CP_File_Dash));
Put_Line (Output_File, CP_Text); Put_Line (Output_File, CP_Text);
Close (Output_File); Close (Output_File);
All_CP_Files := All_CP_Files :=
All_CP_Files & ("../" & Output_Lang & CP_File); All_CP_Files & ("../" & Output_Lang & To_String (CP_File_Dash));
end if; end if;
exception exception
when E : End_Error when E : End_Error
......
...@@ -33,10 +33,11 @@ ...@@ -33,10 +33,11 @@
*/ */
#include "@_LOWER:Name_@.h" #include "@_LOWER:Name_@.h"
//#include <stdio.h>
@@IF@@ @_Has_Context_@ @@IF@@ @_Has_Context_@
/* Include Context Parameters (constants defined in the Interface View) */ /* Include Context Parameters (constants defined in the Interface View) */
#include "Context-@_LOWER:Name_@.h" #include "Context-@_REPLACE_ALL(_/-):LOWER:Name_@.h"
@@END_IF@@ @@END_IF@@
void @_LOWER:Name_@_startup(void) void @_LOWER:Name_@_startup(void)
......
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
#include "@_LOWER:Name_@.h" #include "@_LOWER:Name_@.h"
@@IF@@ @_Has_Context_@ @@IF@@ @_Has_Context_@
/* Include Context Parameters (constants defined in the Interface View) */ // Include Context Parameters (constants defined in the Interface View)
#include "Context-@_REPLACE((_)/-):LOWER:Name_@.h" #include "Context-@_REPLACE_ALL(_/-):LOWER:Name_@.h"
@@END_IF@@ @@END_IF@@
void @_LOWER:Name_@_startup() void @_LOWER:Name_@_startup()
......
--------------------------------------------------------
--! File generated by asn2aadl v2.2-r416b8c8: DO NOT EDIT !
--------------------------------------------------------
--! MadeInFastMode:True:
--! InputASN1FileChecksum:c4cca3f50df525b08cac54f4b04c5297:/home/taste/tool-src/kazoo/test/Demo_ContextParams/DataView.asn:
--! InputASN1FileChecksum:ee8a7e01f29874c0d50f437d5abb9599:/home/taste/tool-inst/share/taste-types/taste-types.asn:
--------------------------------------------------------
package DataView
public
with Data_Model;
with Taste;
with Base_Types;
with Deployment;
DATA Simulink_Tunable_Parameter
PROPERTIES
TASTE::Ada_Package_Name => "TASTE_Directives";
Type_Source_Name => "Simulink-Tunable-Parameter";
Deployment::ASN1_Module_Name => "TASTE-Directives";
TASTE::Forbid_in_PI => true;
END Simulink_Tunable_Parameter;
DATA Timer
PROPERTIES
TASTE::Ada_Package_Name => "TASTE_Directives";
Type_Source_Name => "Timer";
Deployment::ASN1_Module_Name => "TASTE-Directives";
TASTE::Forbid_in_PI => true;
END Timer;
DATA Taste_directive
PROPERTIES
TASTE::Ada_Package_Name => "TASTE_Directives";
Type_Source_Name => "Taste-directive";
Deployment::ASN1_Module_Name => "TASTE-Directives";
TASTE::Forbid_in_PI => true;
END Taste_directive;
data Stream_Element_Buffer
-- Root type for buffer elements
properties
Data_Model::Data_Representation => Character;
end Stream_Element_Buffer;
DATA T_Boolean
PROPERTIES
-- name of the ASN.1 source file:
Source_Text => ("/home/taste/tool-inst/share/taste-types/taste-types.asn");
TASTE::Ada_Package_Name => "TASTE_BasicTypes";
Deployment::ASN1_Module_Name => "TASTE-BasicTypes";
Source_Language => (ASN1);
-- name of the corresponding data type in the source file:
Type_Source_Name => "T-Boolean";
TASTE::Position_In_File => [ line => 14 ; column => 1 ; ];
-- what kind of type is this?
TASTE::ASN1_Basic_Type =>aBOOLEAN;
END T_Boolean;
DATA IMPLEMENTATION T_Boolean.impl
END T_Boolean.impl;
DATA T_Boolean_Buffer_Max
END T_Boolean_Buffer_Max;
DATA IMPLEMENTATION T_Boolean_Buffer_Max.impl
-- Buffer to hold a marshalled data of type T_Boolean
PROPERTIES
Data_Model::Data_Representation => array;
Data_Model::Base_Type => (classifier (DataView::Stream_Element_Buffer));
END T_Boolean_Buffer_Max.impl;
DATA T_Boolean_Buffer
END T_Boolean_Buffer;
DATA IMPLEMENTATION T_Boolean_Buffer.impl
-- Buffer to hold a marshalled data of type T_Boolean
SUBCOMPONENTS
Buffer : data T_Boolean_Buffer_Max.impl;
Length : data Base_Types::Unsigned_32;
PROPERTIES
Data_Model::Data_Representation => Struct;
END T_Boolean_Buffer.impl;
DATA T_INTEGER
PROPERTIES
-- name of the ASN.1 source file:
Source_Text => ("/home/taste/tool-src/kazoo/test/Demo_ContextParams/DataView.asn");
TASTE::Ada_Package_Name => "DataView";
Deployment::ASN1_Module_Name => "DataView";
Source_Language => (ASN1);
-- name of the corresponding data type in the source file:
Type_Source_Name => "T-INTEGER";
TASTE::Position_In_File => [ line => 3 ; column => 1 ; ];
-- what kind of type is this?
TASTE::ASN1_Basic_Type =>aINTEGER;
END T_INTEGER;
DATA IMPLEMENTATION T_INTEGER.impl
END T_INTEGER.impl;
DATA T_INTEGER_Buffer_Max
END T_INTEGER_Buffer_Max;
DATA IMPLEMENTATION T_INTEGER_Buffer_Max.impl
-- Buffer to hold a marshalled data of type T_INTEGER
PROPERTIES
Data_Model::Data_Representation => array;
Data_Model::Base_Type => (classifier (DataView::Stream_Element_Buffer));
END T_INTEGER_Buffer_Max.impl;
DATA T_INTEGER_Buffer
END T_INTEGER_Buffer;
DATA IMPLEMENTATION T_INTEGER_Buffer.impl
-- Buffer to hold a marshalled data of type T_INTEGER
SUBCOMPONENTS
Buffer : data T_INTEGER_Buffer_Max.impl;
Length : data Base_Types::Unsigned_32;
PROPERTIES
Data_Model::Data_Representation => Struct;
END T_INTEGER_Buffer.impl;
DATA T_Int32
PROPERTIES
-- name of the ASN.1 source file:
Source_Text => ("/home/taste/tool-inst/share/taste-types/taste-types.asn");
TASTE::Ada_Package_Name => "TASTE_BasicTypes";
Deployment::ASN1_Module_Name => "TASTE-BasicTypes";
Source_Language => (ASN1);
-- name of the corresponding data type in the source file:
Type_Source_Name => "T-Int32";
TASTE::Position_In_File => [ line => 6 ; column => 1 ; ];
-- what kind of type is this?
TASTE::ASN1_Basic_Type =>aINTEGER;
END T_Int32;
DATA IMPLEMENTATION T_Int32.impl
END T_Int32.impl;
DATA T_Int32_Buffer_Max
END T_Int32_Buffer_Max;
DATA IMPLEMENTATION T_Int32_Buffer_Max.impl
-- Buffer to hold a marshalled data of type T_Int32
PROPERTIES
Data_Model::Data_Representation => array;
Data_Model::Base_Type => (classifier (DataView::Stream_Element_Buffer));
END T_Int32_Buffer_Max.impl;
DATA T_Int32_Buffer
END T_Int32_Buffer;
DATA IMPLEMENTATION T_Int32_Buffer.impl
-- Buffer to hold a marshalled data of type T_Int32
SUBCOMPONENTS
Buffer : data T_Int32_Buffer_Max.impl;
Length : data Base_Types::Unsigned_32;
PROPERTIES
Data_Model::Data_Representation => Struct;
END T_Int32_Buffer.impl;
DATA T_Int8
PROPERTIES
-- name of the ASN.1 source file:
Source_Text => ("/home/taste/tool-inst/share/taste-types/taste-types.asn");
TASTE::Ada_Package_Name => "TASTE_BasicTypes";
Deployment::ASN1_Module_Name => "TASTE-BasicTypes";
Source_Language => (ASN1);
-- name of the corresponding data type in the source file:
Type_Source_Name => "T-Int8";
TASTE::Position_In_File => [ line => 10 ; column => 1 ; ];
-- what kind of type is this?
TASTE::ASN1_Basic_Type =>aINTEGER;
END T_Int8;
DATA IMPLEMENTATION T_Int8.impl
END T_Int8.impl;
DATA T_Int8_Buffer_Max
END T_Int8_Buffer_Max;
DATA IMPLEMENTATION T_Int8_Buffer_Max.impl
-- Buffer to hold a marshalled data of type T_Int8
PROPERTIES
Data_Model::Data_Representation => array;
Data_Model::Base_Type => (classifier (DataView::Stream_Element_Buffer));
END T_Int8_Buffer_Max.impl;
DATA T_Int8_Buffer
END T_Int8_Buffer;
DATA IMPLEMENTATION T_Int8_Buffer.impl
-- Buffer to hold a marshalled data of type T_Int8
SUBCOMPONENTS
Buffer : data T_Int8_Buffer_Max.impl;
Length : data Base_Types::Unsigned_32;
PROPERTIES
Data_Model::Data_Representation => Struct;
END T_Int8_Buffer.impl;
DATA T_SEQUENCE
PROPERTIES
-- name of the ASN.1 source file:
Source_Text => ("/home/taste/tool-src/kazoo/test/Demo_ContextParams/DataView.asn");
TASTE::Ada_Package_Name => "DataView";
Deployment::ASN1_Module_Name => "DataView";
Source_Language => (ASN1);
-- name of the corresponding data type in the source file:
Type_Source_Name => "T-SEQUENCE";
TASTE::Position_In_File => [ line => 11 ; column => 1 ; ];
-- what kind of type is this?
TASTE::ASN1_Basic_Type =>aSEQUENCE;
END T_SEQUENCE;
DATA IMPLEMENTATION T_SEQUENCE.impl
END T_SEQUENCE.impl;
DATA T_SEQUENCE_Buffer_Max
END T_SEQUENCE_Buffer_Max;
DATA IMPLEMENTATION T_SEQUENCE_Buffer_Max.impl
-- Buffer to hold a marshalled data of type T_SEQUENCE
PROPERTIES
Data_Model::Data_Representation => array;
Data_Model::Base_Type => (classifier (DataView::Stream_Element_Buffer));
END T_SEQUENCE_Buffer_Max.impl;
DATA T_SEQUENCE_Buffer
END T_SEQUENCE_Buffer;
DATA IMPLEMENTATION T_SEQUENCE_Buffer.impl
-- Buffer to hold a marshalled data of type T_SEQUENCE
SUBCOMPONENTS
Buffer : data T_SEQUENCE_Buffer_Max.impl;
Length : data Base_Types::Unsigned_32;
PROPERTIES
Data_Model::Data_Representation => Struct;
END T_SEQUENCE_Buffer.impl;
DATA T_UInt32
PROPERTIES
-- name of the ASN.1 source file:
Source_Text => ("/home/taste/tool-inst/share/taste-types/taste-types.asn");
TASTE::Ada_Package_Name => "TASTE_BasicTypes";
Deployment::ASN1_Module_Name => "TASTE-BasicTypes";
Source_Language => (ASN1);
-- name of the corresponding data type in the source file:
Type_Source_Name => "T-UInt32";
TASTE::Position_In_File => [ line => 8 ; column => 1 ; ];
-- what kind of type is this?
TASTE::ASN1_Basic_Type =>aINTEGER;
END T_UInt32;
DATA IMPLEMENTATION T_UInt32.impl
END T_UInt32.impl;
DATA T_UInt32_Buffer_Max
END T_UInt32_Buffer_Max;
DATA IMPLEMENTATION T_UInt32_Buffer_Max.impl
-- Buffer to hold a marshalled data of type T_UInt32
PROPERTIES
Data_Model::Data_Representation => array;
Data_Model::Base_Type => (classifier (DataView::Stream_Element_Buffer));
END T_UInt32_Buffer_Max.impl;
DATA T_UInt32_Buffer
END T_UInt32_Buffer;
DATA IMPLEMENTATION T_UInt32_Buffer.impl
-- Buffer to hold a marshalled data of type T_UInt32
SUBCOMPONENTS
Buffer : data T_UInt32_Buffer_Max.impl;
Length : data Base_Types::Unsigned_32;
PROPERTIES
Data_Model::Data_Representation => Struct;
END T_UInt32_Buffer.impl;
DATA T_UInt8
PROPERTIES
-- name of the ASN.1 source file:
Source_Text => ("/home/taste/tool-inst/share/taste-types/taste-types.asn");
TASTE::Ada_Package_Name => "TASTE_BasicTypes";
Deployment::ASN1_Module_Name => "TASTE-BasicTypes";
Source_Language => (ASN1);
-- name of the corresponding data type in the source file:
Type_Source_Name => "T-UInt8";
TASTE::Position_In_File => [ line => 12 ; column => 1 ; ];
-- what kind of type is this?
TASTE::ASN1_Basic_Type =>aINTEGER;
END T_UInt8;
DATA IMPLEMENTATION T_UInt8.impl
END T_UInt8.impl;
DATA T_UInt8_Buffer_Max
END T_UInt8_Buffer_Max;
DATA IMPLEMENTATION T_UInt8_Buffer_Max.impl
-- Buffer to hold a marshalled data of type T_UInt8
PROPERTIES
Data_Model::Data_Representation => array;
Data_Model::Base_Type => (classifier (DataView::Stream_Element_Buffer));
END T_UInt8_Buffer_Max.impl;
DATA T_UInt8_Buffer
END T_UInt8_Buffer;
DATA IMPLEMENTATION T_UInt8_Buffer.impl
-- Buffer to hold a marshalled data of type T_UInt8
SUBCOMPONENTS
Buffer : data T_UInt8_Buffer_Max.impl;
Length : data Base_Types::Unsigned_32;
PROPERTIES
Data_Model::Data_Representation => Struct;
END T_UInt8_Buffer.impl;
SYSTEM Taste_DataView
END Taste_DataView;
SYSTEM IMPLEMENTATION Taste_DataView.others
SUBCOMPONENTS
T_Boolean : DATA T_Boolean.impl;
T_INTEGER : DATA T_INTEGER.impl;
T_Int32 : DATA T_Int32.impl;
T_Int8 : DATA T_Int8.impl;
T_SEQUENCE : DATA T_SEQUENCE.impl;
T_UInt32 : DATA T_UInt32.impl;
T_UInt8 : DATA T_UInt8.impl;
END Taste_DataView.others;
end DataView;
DataView DEFINITIONS AUTOMATIC TAGS ::= BEGIN
T-INTEGER ::= INTEGER (0..255)
--T-BOOL ::= BOOLEAN
--
--T-ENUM ::= ENUMERATED { one(1), two(2), three(3) }
--
--T-REAL ::= REAL (0.0 .. 7.7)
T-SEQUENCE ::= SEQUENCE {
x T-INTEGER,
y T-INTEGER
}
--T-SEQOF ::= SEQUENCE (SIZE (0..5)) OF T-INTEGER
--
--T-CHOICE ::= CHOICE {
-- boolchoice T-BOOL,
-- enumchoice T-ENUM,
-- intchoice T-INTEGER
--}
--
--T-SET ::= SET {
-- ii T-INTEGER,
-- jj T-BOOL
--}
--
--T-SETOF ::= SET (SIZE(0..5)) OF T-INTEGER
--
--T-OCTSTR ::= OCTET STRING (SIZE(0..5))
--
--T-NESTED ::= SEQUENCE {
-- myint T-INTEGER,
-- mybool T-BOOL,
-- myenum T-ENUM,
-- myreal T-REAL,
-- myseq T-SEQUENCE,
-- myseqof T-SEQOF,
-- mychoice T-CHOICE,
-- myset T-SET,
-- mysetof T-SETOF,
-- myoctstr T-OCTSTR
--}
END
---------------------------------------------------
-- AADL2.2
-- TASTE type deploymentview
--
-- generated code: do not edit
---------------------------------------------------
PACKAGE deploymentview::DV::Node1
PUBLIC
WITH Taste;
WITH Deployment;
WITH TASTE_DV_Properties;
PROCESS demo
END demo;
PROCESS IMPLEMENTATION demo.others
END demo.others;
END deploymentview::DV::Node1;
PACKAGE deploymentview::DV
PUBLIC
WITH interfaceview::IV::cyclic_function;
WITH interfaceview::IV::passive_function;
WITH ocarina_processors_x86;
WITH deploymentview::DV::Node1;
WITH Taste;
WITH Deployment;
WITH interfaceview::IV;
WITH TASTE_DV_Properties;
SYSTEM Node1
END Node1;
SYSTEM IMPLEMENTATION Node1.others
SUBCOMPONENTS
IV_cyclic_function : SYSTEM interfaceview::IV::cyclic_function::cyclic_function.others {
Taste::FunctionName => "cyclic_function";
};
IV_passive_function : SYSTEM interfaceview::IV::passive_function::passive_function.others {
Taste::FunctionName => "passive_function";
};
demo : PROCESS deploymentview::DV::Node1::demo.others {
Taste::coordinates => "112762 62064 152193 88336";
Deployment::Port_Number => 0;
};
x86_linux : PROCESSOR ocarina_processors_x86::x86.linux {
Taste::coordinates => "108453 56108 157742 93639";
};
PROPERTIES
Taste::APLC_Binding => (reference (demo)) APPLIES TO IV_cyclic_function;
Taste::APLC_Binding => (reference (demo)) APPLIES TO IV_passive_function;
Actual_Processor_Binding => (reference (x86_linux)) APPLIES TO demo;
END Node1.others;
SYSTEM deploymentview
END deploymentview;
SYSTEM IMPLEMENTATION deploymentview.others
SUBCOMPONENTS
Node1 : SYSTEM Node1.others {
Taste::coordinates => "102292 45385 163903 99000";
};
interfaceview : SYSTEM interfaceview::IV::interfaceview.others;
END deploymentview.others;
PROPERTIES
Taste::coordinates => "0 0 297000 210000";
Taste::version => "2.2";
Taste::interfaceView => "InterfaceView.aadl";
Taste::HWLibraries => ("../../../../tool-inst/share/ocarina/AADLv2/ocarina_components.aadl");
END deploymentview::DV;
---------------------------------------------------
-- AADL2.2
-- TASTE type interfaceview
--
-- generated code: do not edit
---------------------------------------------------
PACKAGE interfaceview::IV::cyclic_function
PUBLIC
WITH interfaceview::IV::passive_function;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_cyclic_activation
PROPERTIES
Taste::Associated_Queue_Size => 1;
END PI_cyclic_activation;
SUBPROGRAM IMPLEMENTATION PI_cyclic_activation.others
PROPERTIES
Compute_Execution_Time => 0 ms .. 500 ms;
END PI_cyclic_activation.others;
SUBPROGRAM RI_compute_data
FEATURES
my_in : IN PARAMETER DataView::T_SEQUENCE {
Taste::encoding => NATIVE;
};
result : OUT PARAMETER DataView::T_INTEGER {
Taste::encoding => NATIVE;
};
END RI_compute_data;
SUBPROGRAM IMPLEMENTATION RI_compute_data.others
END RI_compute_data.others;
SYSTEM cyclic_function
FEATURES
PI_cyclic_activation : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::cyclic_function::PI_cyclic_activation.others {
Taste::coordinates => "33 132";
Taste::RCMoperationKind => cyclic;
Taste::RCMperiod => 500 ms;
Taste::Deadline => 500 ms;
Taste::InterfaceName => "cyclic_activation";
};
RI_compute_data : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::passive_function::PI_compute_data.others {
Taste::coordinates => "203 161";
Taste::RCMoperationKind => unprotected;
Taste::InterfaceName => "compute_data";
Taste::labelInheritance => "true";
};
PROPERTIES
Source_Language => (C);
Taste::Active_Interfaces => enabled;
END cyclic_function;
SYSTEM IMPLEMENTATION cyclic_function.others
END cyclic_function.others;
END interfaceview::IV::cyclic_function;
PACKAGE interfaceview::IV::passive_function
PUBLIC
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_compute_data
FEATURES
my_in : IN PARAMETER DataView::T_SEQUENCE {
Taste::encoding => NATIVE;
};
result : OUT PARAMETER DataView::T_INTEGER {
Taste::encoding => NATIVE;
};
PROPERTIES
Taste::Associated_Queue_Size => 1;
END PI_compute_data;
SUBPROGRAM IMPLEMENTATION PI_compute_data.others