Commit 55ed4b44 authored by Maxime Perrotin's avatar Maxime Perrotin

Work on the interface with POHIAda

parent e4af4b74
......@@ -444,10 +444,9 @@ package body TASTE.AADL_Parser is
PI => PI,
others => <>);
begin
New_PI.PI.RCM := (if F.Provided.Length = 1
then (if PI.RCM = Protected_Operation
then PI.RCM
else Unprotected_Operation)
-- Convert cyclic/sporadic to Protected
New_PI.PI.RCM := (if PI.RCM = Unprotected_Operation
then Unprotected_Operation
else Protected_Operation);
-- Check in the DV if any caller is remote
for Remote of PI.Remote_Interfaces loop
......
Subproject commit 844cfcc630139c0c9c3c2c41f549946a26ee06c0
Subproject commit 0655d36712e079dcf975afb4a1075353cbfdad14
......@@ -43,7 +43,7 @@ features
@@IF@@ @_Use_POHIC_@
Compute_Entrypoint_Source_Text => "call_@_LOWER:Thread_Name_@"; };
@@ELSE@@
Compute_Entrypoint_Source_Text => "@_CAPITALIZE:Partition_Name_@_Polyorb_Interface.@_CAPITALIZE:Thread_Name_@_@_Entry_Port_Name_@"; };
Compute_Entrypoint_Source_Text => "@_CAPITALIZE:Partition_Name_@_TASTE_Interface.@_CAPITALIZE:Thread_Name_@_@_Entry_Port_Name_@"; };
@@END_IF@@
@@END_IF@@
@@TABLE@@
......@@ -62,7 +62,7 @@ properties
@@IF@@ @_Use_POHIC_@
Initialize_Entrypoint_Source_Text => "init_@_LOWER:Pro_Block_Name_@";
@@ELSE@@
Initialize_Entrypoint_Source_Text => "@_CAPITALIZE:Partition_Name_@_Polyorb_Interface.@_CAPITALIZE:Thread_Name_@_Init";
Initialize_Entrypoint_Source_Text => "@_CAPITALIZE:Partition_Name_@_TASTE_Interface.@_CAPITALIZE:Thread_Name_@_Init";
@@END_IF@@
@@INLINE( )(\n )()@@
@@IF@@ @_RCM_@ = "SPORADIC_OPERATION"
......@@ -71,7 +71,7 @@ properties
@@IF@@ @_Use_POHIC_@
Compute_Entrypoint_Source_Text => "call_@_LOWER:Thread_Name_@";
@@ELSE@@
Compute_Entrypoint_Source_Text => "@_CAPITALIZE:Partition_Name_@_Polyorb_Interface.@_CAPITALIZE:Thread_Name_@_@_Entry_Port_Name_@";
Compute_Entrypoint_Source_Text => "@_CAPITALIZE:Partition_Name_@_TASTE_Interface.@_CAPITALIZE:Thread_Name_@_@_Entry_Port_Name_@";
@@END_IF@@
Dispatch_Protocol => Periodic;
@@END_IF@@
......
These templates generate the wrappers that connect Polyorb-HI-Ada with the threads generated by TASTE
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : Protected block name
@@-- @_Language_@ : Implementation language
@@-- @_Calling_Threads_@ : List of calling threads
@@-- @_Node name_@ : Node name
@@-- @_Protected_PIs_@ : Protected Provided interfaces (from pi.tmplt)
@@-- @_Unprotected_PIs_@ : Unprotected Provided interfaces (from pi.tmplt)
@@-- @_Required_@ : Required interfaces (from ri.tmplt)
@@-- Specify the file name for a protected block
@@-- @_Block_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@@-- The following tags are available in this template:
@@--
@@-- @_Node_Name_@ : Name of the node as defined in the Deployment View
@@-- The content of this file is generated from node.tmplt
@@-- If there is no string defined here, no file will be generated per node,
@@-- (that's an option if the intent is to generate only one file per system)
@@-- Specify the file name for a partition
@@-- @_Partition_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@_LOWER:Partition_Name_@/required_interfaces.ads
@@-- Specify the file name for the complete system (including nodes)
@@-- (no template tag)
@@-- Specify the file name for a thread
@@-- @_Thread_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@@-- The following tags are available in this template:
@@--
@@-- @_Node_Name_@ : Name of the node from deployment view
@@-- @_Partition_Names_@ : Tag listing the partitions in this node
@@-- @_Partitions_@ : List of rendered code for partitions
@@-- @_CPU_Name_@, _Platform_@, _Classifier_@, _Ada_Runtime_@ : Info about CPU
@@-- In standard TASTE systems there is only one partition per node
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : Partition name (usually the name of the binary)
@@-- @_Threads_@ : Code generated for the threads
@@-- @_Thread_Names_@ : Tag: list of thread names
@@-- @_Node_Name_@ : Name of the node containing this partition
@@-- @_Blocks_@ : Code generated for protected functions
@@-- @_Coverage_@ : True if user requested code coverage enable
@@-- @_Package_Name_@ : AADL Package name for the target (e.g. ocarina_porocessors_x86)
@@-- @_CPU_Name_@ : CPU Name (e.g. x86_linux)
@@-- @_CPU_Platform_@ : AADL CPU_Platform (e.g. PLATFORM_NATIVE)
@@-- @_CPU_Classifier_@ : AADL CPU Classifier (e.g. ocarina_processors_x86::x86.linux)
@@-- @_Bound_Functions_@ : List of user functions from Interface view
@@-- @_Thread_Src_Name_@ : Vector tag : connection thread name (source)
@@-- @_Thread_Dst_Name_@ : Vector tag : connection thread name (dest)
@@-- @_Thread_Src_Port_@ : Vector tag : connection port name (source)
@@-- @_Thread_Dst_Port_@ : Vector tag : connection port name (dest)
with Interfaces.C;
package Required_Interfaces is
-- generated from templates/concurrency_view/ada_ri_wrappers_source/partition.tmplt
@_Threads'Indent_@
end Required_Interfaces;
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the interface
@@-- @_Direction_@ : "PI" or "RI"
@@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the interface
@@-- @_Direction_@ : "PI" or "RI"
@@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- The following tags are available in this template:
@@--
@@-- @_Nodes_@ : Code generated for the nodes
@@-- @_Node_Names_@ : Vector Tag of node names
@@-- @_Node_CPU_@ : |_ Corresponding CPU name (eg x86_linux)
@@-- @_Node_CPU_Classifier_@ : |_ CPU Classifier (ocarina...::x86_linux)
@@-- @_Partition_Names_@ : Vector Tag of partition names
@@-- @_Partition_Node_@ : |_ Corresponding node name
@@-- @_Partition_CPU_@ : |_ Corresponding CPU name
@@-- @_Threads_@ : Code generated for the threads
@@-- @_Thread_Names_@ : List of all threads in the complete system
@@-- @_Target_Packages_@ : List of all target package names in the complete system
@@-- And all the system configuration obtained from the command line:
@@-- Interface_View, Deployment_View, Data_View, Binary_Path, Check_Data_View,
@@-- Output_Dir, Skeletons, Glue, Use_POHIC, Timer_Resolution, Debug_Flag,
@@-- No_Stdlib_Flag, Timer_Resolution, Other_Files (list of aadl files)
@@-- The following tags are available in this template:
@@--
@@-- @_Thread_Name_@ : Thread name
@@-- @_Entry_Port_Name_@ : Name of the PI
@@-- @_RCM_@ : One of "CYCLIC_OPERATION", "SPORADIC_OPERATION"
@@-- @_Pro_Block_Name_@ : Name of the protected function
@@-- @_Node_Name_@ : Name of the deployment node
@@-- @_Remote_Threads_@ : Vector tag: output remote thread list
@@-- @_RI_Port_Names_@ : |_ Corresponding local RI name
@@-- @_Remote_PIs_@ : |_ Associated PI Name
@@-- @_Remote_PI_Sorts_@ : |_ Optional param type of the remote thread
@@-- @_Remote_PI_Modules_@ : |_ Asn1 module of the optional param type
@@-- Tags related to the PI that is at the origin of the thread creation:
@@-- @_Name_@, @_Kind_@, @_Parent_Function_@ : shoud be useless here
@@-- @_Param_Names_@, _Types_@, _ASN1_Modules, _Encodings_@, _Directions_@ : param vector tag
@@-- @_Period_@, @_WCET_@, @_Queue_Size_@ : relevant here
@@-- @_IF_Property_Names_@, _Values_@ : user properties (vector tag)
@@--
@@-- Matrix of output ports: Remote thread/corresponding remote PI @_Name_@
package @_CAPITALIZE:Thread_Name_@ is
--- generated from templates/concurrency_view/ada_ri_wrappers_source/thread.tmplt
@@INLINE( )(\n )(\n)@@
@@TABLE@@
@@IF@@ @_Remote_PI_Sorts'Length_@ > 0
procedure @_CAPITALIZE:RI_Port_Names_@ (Param : Interfaces.C.Char_Array; Param_Size : Integer)
with Export, Convention => C, Link_Name => "vm_async_@_LOWER:Thread_Name_@_@_LOWER:RI_Port_Names_@";
@@ELSE@@
procedure @_CAPITALIZE:RI_Port_Names_@
with Export, Convention => C, Link_Name => "vm_async_@_LOWER:Thread_Name_@_@_LOWER:RI_Port_Names_@";
@@END_IF@@
@@END_TABLE@@
@@END_INLINE@@
end @_CAPITALIZE:Thread_Name_@;
@@-- The following boolean tags are available to decide if the file
@@-- shall be generated or not:
@@-- Filename_Is_Present
@@-- Skeletons
@@-- Glue
@@-- Use_POHIC
@@-- Debug
@@-- No_Stdlib
@@IF@@ not @_Use_POHIC_@
TRUE
@@END_IF@@
......@@ -10,10 +10,21 @@
package body @_CAPITALIZE:Name_@ is
@@IF@@ @_Protected_PIs_@ /= ""
-- Protected provided interfaces (incl. Sporadic and cyclics)
-- from templates/concurrency_view/ada_wrappers_body/pi.tmplt)
protected body @_CAPITALIZE:Name_@_Protected is
@_Protected_PIs'Indent_@
end @_CAPITALIZE:Name_@_Protected;
@@END_IF@@
-- Unprotected provided interfaces
-- from templates/concurrency_view/ada_wrappers_body/pi.tmplt
@_Unprotected_PIs'Indent_@
-- End if unprotected interfaces
@@IF@@ @_Required_@ /= ""
-- Required interfaces (templates/concurrency_view/ada_wrappers_body/ri.tmplt)
@_Required'Indent_@
@@END_IF@@
end @_CAPITALIZE:Name_@;
@@-- Specify the file name for a partition
@@-- @_Partition_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@_LOWER:Partition_Name_@/@_LOWER:Partition_Name_@_polyorb_interface.adb
@_LOWER:Partition_Name_@/@_LOWER:Partition_Name_@_taste_interface.adb
......@@ -16,8 +16,17 @@
@@-- @_Thread_Dst_Name_@ : Vector tag : connection thread name (dest)
@@-- @_Thread_Src_Port_@ : Vector tag : connection port name (source)
@@-- @_Thread_Dst_Port_@ : Vector tag : connection port name (dest)
package body @_CAPITALIZE:Name_@_Polyorb_Interface is
with PolyORB_HI.Utils;
use PolyORB_HI.Utils;
@@IF@@ @_Thread_Src_Name'Length_@ > 0
with PolyORB_HI_Generated.Activity,
PolyORB_HI.Errors;
use PolyORB_HI_Generated.Activity;
@@END_IF@@
package body @_CAPITALIZE:Name_@_TASTE_Interface is
-- generated from templates/concurrency_view/ada_wrappers_body/partition.tmplt
@_Blocks'Indent_@
@_Threads'Indent_@
end @_CAPITALIZE:Name_@_Polyorb_Interface;
end @_CAPITALIZE:Name_@_TASTE_Interface;
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the interface
@@-- @_Direction_@ : "PI" or "RI"
@@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- @_Name_@ : The name of the interface
@@-- @_Direction_@ : "PI" or "RI"
@@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Language_@ : The implementation language of the function
@@-- @_Partition_Name_@ : Partition name for parent function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- @_Remote_Function_Names_@ : List of callees
@@-- @_Remote_Interface_Names_@ : |_ callee's interface name
@@-- @_Calling_Threads_@ : Calling threads of the containing block
@@IF@@ @_Param_Names'Length_@ = 0
@@SET@@ No_Param=True
@@END_IF@@
@@IF@@ @_No_Param_@
procedure @_CAPITALIZE:Name_@
@@ELSE@@
procedure @_CAPITALIZE:Name_@
@@INLINE( \()(;\n )(\))@@
@@TABLE'ALIGN_ON(":")@@
@_CAPITALIZE:Param_Names_@ : Interfaces.C.char_array; @_CAPITALIZE:Param_Names_@_Size : Integer
@@END_TABLE@@
@@END_INLINE@@
@@END_IF@@
is
begin
@@IF@@ @_Kind_@ = SPORADIC_OPERATION
-- Sporadic call
case Get_Task_Id is
@@TABLE@@
when @_Partition_Name_@_@_Calling_Threads_@_k =>
declare
Value : @_Calling_Threads_@_Thread_@_Calling_Threads_@_others_Interface
(@_Calling_Threads_@_Thread_@_Calling_Threads_@_others_Port_Type'(OUTPORT_@_Name_@));
Err : PolyORB_Hi.Errors.Error_Kind with Unreferenced;
use type PolyORB_HI.Errors.Error_Kind;
begin
@@IF@@ not @_No_Param_@
@@TABLE@@
for I in 1 .. @_Param_Names_@_Size loop
Value.OUTPORT_@_Name_@_DATA.Buffer (I) :=
PolyORB_HI_Generated.Types.Stream_Element_Buffer (@_Param_Names_@ (Interfaces.C.size_t (I - 1)));
end loop;
Value.OUTPORT_@_Name_@_DATA.Length := PolyORB_HI_Generated.Types.Unsigned_32 (@_Param_Names_@_Size);
@@END_TABLE@@
@@END_IF@@ @@-- Has param
Put_Value (@_Partition_Name_@_@_Calling_Threads_@_k, Value);
Err := Send_Output (@_Partition_Name_@_@_Calling_Threads_@_k,
@_Calling_Threads_@_Thread_@_Calling_Threads_@_others_Port_Type'(OUTPORT_@_Name_@));
-- TODO : Report the error if any
end;
@@-- End of the "case" block
@@END_TABLE@@
when others => null;
end case;
@@ELSIF@@ @_Kind_@ = UNPROTECTED_OPERATION
-- Unprotected call (call function defined in vm_if or SIMULINK.Simulink.c function)
@@TABLE@@
@@IF@@ @_No_Param_@
@_Remote_Function_Names_@.@_Remote_Interface_Names_@;
@@ELSE@@
@_Remote_Function_Names_@.@_Remote_Interface_Names_@
@@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@
@_LOWER:Param_Names_@, @_LOWER:Param_Names_@_Size
@@END_TABLE@@
@@END_INLINE@@
@@END_IF@@
@@END_TABLE@@
@@ELSE@@ @@-- Protected call
-- Protected call of @_Name_@;
@@TABLE@@
@@IF@@ @_No_Param_@
@_Remote_Function_Names_@.@_Remote_Function_Names_@_Protected.@_Remote_Interface_Names_@;
@@ELSE@@
@_Remote_Function_Names_@.@_Remote_Function_Names_@_Protected.@_Remote_Interface_Names_@
@@INLINE( \()(,\n )(\);\n)@@
@@TABLE@@
@_LOWER:Param_Names_@, @_LOWER:Param_Names_@_Size
@@END_TABLE@@
@@END_INLINE@@
@@END_IF@@
@@END_TABLE@@
@@END_IF@@
end;
......@@ -27,7 +27,7 @@ procedure @_CAPITALIZE:Thread_Name_@_@_CAPITALIZE:Entry_Port_Name_@
@@ELSE@@
procedure @_CAPITALIZE:Thread_Name_@_@_CAPITALIZE:Entry_Port_Name_@
(dummy_Entity : Entity_Type)
is
is
@@END_IF@@
@@IF@@ @_Param_Names'Length_@ > 0
@@TABLE@@
......@@ -42,11 +42,7 @@ begin
@@END_IF@@
(@_CAPITALIZE:Param_Names_@_AdaBuffer, @_CAPITALIZE:Param_Names_@_AdaBuffer'Length);
@@ELSE@@
begin
@@IF@@ @_Need_Mutex_@
begin @@-- no param
@_CAPITALIZE:Pro_Block_Name_@.@_CAPITALIZE:Pro_Block_Name_@_Protected.@_CAPITALIZE:Entry_Port_Name_@;
@@ELSE@@
@_CAPITALIZE:Pro_Block_Name_@.@_CAPITALIZE:Entry_Port_Name_@;
@@END_IF@@
@@END_IF@@
end @_CAPITALIZE:Thread_Name_@_@_CAPITALIZE:Entry_Port_Name_@;
......@@ -7,8 +7,11 @@
@@-- @_Protected_PIs_@ : Protected Provided interfaces (from pi.tmplt)
@@-- @_Unprotected_PIs_@ : Unprotected Provided interfaces (from pi.tmplt)
@@-- @_Required_@ : Required interfaces (from ri.tmplt)
-- Package wrapping function @_Name_@ : manages the call to functions in vm_if.c
-- Provides mutex to handle protected, cyclic and sporadic provided interfaces
-- Exports the interface functions called by invoke_ri (vm_...)
-- generated from templates/concurrency_view/ada_wrappers_source/block.tmplt
package @_CAPITALIZE:Name_@ is
-- generated from templates/concurrency_view/ada_wrappers_source/block.tmplt
-- This package interfaces with the user code directly
-- It may contain a protected object if a PI requires mutual exclusion
......@@ -17,11 +20,21 @@ package @_CAPITALIZE:Name_@ is
with Import, Convention => C, Link_Name => "init_@_LOWER:Name_@";
@@IF@@ @_Protected_PIs_@ /= ""
-- Protected provided interfaces (incl. Sporadic and cyclics)
-- from templates/concurrency_view/ada_wrappers_source/pi.tmplt)
protected @_CAPITALIZE:Name_@_Protected is
@_Protected_PIs'Indent_@
end @_CAPITALIZE:Name_@_Protected;
@@END_IF@@
@@IF@@ @_Unprotected_PIs_@ /= ""
-- Unprotected provided interfaces
-- from templates/concurrency_view/ada_wrappers_source/pi.tmplt
@_Unprotected_PIs'Indent_@
@@END_IF@@
@@IF@@ @_Required_@ /= ""
-- Required interfaces (templates/concurrency_view/ada_wrappers_source/ri.tmplt)
@_Required'Indent_@
@@END_IF@@
end @_CAPITALIZE:Name_@;
@@-- Specify the file name for a partition
@@-- @_Partition_Name_@ is available.
@@-- Don't specify anything if you don't want the file to be created
@_LOWER:Partition_Name_@/@_LOWER:Partition_Name_@_polyorb_interface.ads
@_LOWER:Partition_Name_@/@_LOWER:Partition_Name_@_taste_interface.ads
......@@ -45,11 +45,12 @@ use PolyORB_HI_Generated.Types;
@@TABLE@@
@@IF@@ @_Block_Languages_@ = SDL or @_Block_Languages_@ = Ada
with @_CAPITALIZE:Block_Names_@;
pragma Unreferenced (@_CAPITALIZE:Block_Names_@);
@@END_IF@@
@@END_TABLE@@
package @_CAPITALIZE:Name_@_Polyorb_Interface is
package @_CAPITALIZE:Name_@_TASTE_Interface is
-- generated from templates/concurrency_view/ada_wrappers_source/partition.tmplt
@_Blocks'Indent_@
@_Threads'Indent_@
end @_CAPITALIZE:Name_@_Polyorb_Interface;
end @_CAPITALIZE:Name_@_TASTE_Interface;
......@@ -11,13 +11,11 @@
@@-- @_Remote_Function_Names_@ : List of callees
@@-- @_Remote_Interface_Names_@ : |_ callee's interface name
@@-- @_Calling_Threads_@ : Calling threads of the containing block
-- generated from templates/concurrency_view/ada_wrappers_source/ri.tmplt
@@IF@@ @_Param_Names'Length_@ = 0
procedure @_CAPITALIZE:Name_@
@@ELSE@@
procedure @_CAPITALIZE:Name_@
@@INLINE( \()(;\n )(\);)@@
@@INLINE( \()(;\n )(\))@@
@@TABLE'ALIGN_ON(":")@@
@_CAPITALIZE:Param_Names_@ : Interfaces.C.char_array; @_CAPITALIZE:Param_Names_@_Size : Integer
@@END_TABLE@@
......
......@@ -3,17 +3,14 @@ KAZOO=../../kazoo
all: c
ada: test-parse-ada
make -C output.ada && \
cp input_data/obsw.pr output.ada/obsw/SDL/src && \
cp input_data/gnc.c output.ada/gnc/C/src && \
cd output.ada/build && \
ocarina -x main.aadl && \
make -f Makefile.taste
cp input_data/obsw.pr output.ada/obsw/SDL/src
cp input_data/gnc.c output.ada/gnc/C/src
make -C output.ada
c: test-parse-c # Polyorb_HI_C output
cp input_data/obsw.pr output.pohic/obsw/SDL/src && \
cp input_data/gnc.c output.pohic/gnc/C/src && \
make -C output.pohic
cp input_data/obsw.pr output.pohic/obsw/SDL/src
cp input_data/gnc.c output.pohic/gnc/C/src
$(MAKE) -C output.pohic
test-parse-ada: clean-ada
$(KAZOO) --gw \
......
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