Commit a1febead authored by yoogx's avatar yoogx

Merge branch 'master' of https://github.com/OpenAADL/ocarina

parents a328bb45 e28e0618
......@@ -61,7 +61,7 @@ public
D_Spg : subprogram collecte_donnee;
};
connections
parameter D_Spg.d_source -> evenement;
conn1: parameter D_Spg.d_source -> evenement;
properties
Dispatch_Protocol => Periodic;
Period => 110 ms;
......@@ -72,8 +72,8 @@ public
T_Spg : subprogram traite;
};
connections
parameter info_capteur -> T_Spg.d_info;
parameter T_Spg.d_ordre -> comm_servo;
conn1: parameter info_capteur -> T_Spg.d_info;
conn2: parameter T_Spg.d_ordre -> comm_servo;
properties
Dispatch_Protocol => Sporadic;
Period => 110 ms;
......@@ -85,7 +85,7 @@ public
A_Spg : subprogram action;
};
connections
parameter ordre -> A_Spg.d_action;
conn1: parameter ordre -> A_Spg.d_action;
properties
Dispatch_Protocol => Aperiodic;
Deployment::Priority => 1;
......@@ -122,7 +122,7 @@ public
subcomponents
th_c : thread capteur.i;
connections
port th_c.evenement -> evenement;
conn1: port th_c.evenement -> evenement;
end p_capteur.i;
process implementation p_controle.i
......@@ -130,17 +130,17 @@ public
th_ctrl_droit : thread controle.i;
th_ctrl_gauche : thread controle.i;
connections
port info_capteur_droit -> th_ctrl_droit.info_capteur;
port th_ctrl_droit.comm_servo -> comm_servo_droit;
port info_capteur_gauche -> th_ctrl_gauche.info_capteur;
port th_ctrl_gauche.comm_servo -> comm_servo_gauche;
conn1: port info_capteur_droit -> th_ctrl_droit.info_capteur;
conn2: port th_ctrl_droit.comm_servo -> comm_servo_droit;
conn3: port info_capteur_gauche -> th_ctrl_gauche.info_capteur;
conn4: port th_ctrl_gauche.comm_servo -> comm_servo_gauche;
end p_controle.i;
process implementation p_servomoteur.i
subcomponents
th_servomoteur : thread servomoteur.i;
connections
port ordre -> th_servomoteur.ordre;
conn1: port ordre -> th_servomoteur.ordre;
end p_servomoteur.i;
--------------
......@@ -169,19 +169,19 @@ public
CPU1 : processor the_processor;
connections
port proc_capteur_droit.evenement -> proc_controle.info_capteur_droit;
port proc_capteur_gauche.evenement -> proc_controle.info_capteur_gauche;
conn1: port proc_capteur_droit.evenement -> proc_controle.info_capteur_droit;
conn2: port proc_capteur_gauche.evenement -> proc_controle.info_capteur_gauche;
port proc_controle.comm_servo_droit -> proc_servomoteur_droit.ordre;
port proc_controle.comm_servo_gauche -> proc_servomoteur_gauche.ordre;
conn3: port proc_controle.comm_servo_droit -> proc_servomoteur_droit.ordre;
conn4: port proc_controle.comm_servo_gauche -> proc_servomoteur_gauche.ordre;
properties
actual_processor_binding => reference (CPU1) applies to proc_capteur_droit;
actual_processor_binding => reference (CPU1) applies to proc_capteur_gauche;
actual_processor_binding => (reference (CPU1)) applies to proc_capteur_droit;
actual_processor_binding => (reference (CPU1)) applies to proc_capteur_gauche;
actual_processor_binding => reference (CPU1) applies to proc_controle;
actual_processor_binding => (reference (CPU1)) applies to proc_controle;
actual_processor_binding => reference (CPU1) applies to proc_servomoteur_droit;
actual_processor_binding => reference (CPU1) applies to proc_servomoteur_gauche;
actual_processor_binding => (reference (CPU1)) applies to proc_servomoteur_droit;
actual_processor_binding => (reference (CPU1)) applies to proc_servomoteur_gauche;
end robot.i;
end Robot;
......@@ -522,13 +522,13 @@ package body Ocarina.Backends.POK_C.Deployment is
end if;
--
-- If we are using DEOS, we do not need
-- If we are using DEOS or VxWorks, we do not need
-- to write code to configure the kernel, this
-- is done through the XML file of the deos_conf
-- backend.
--
if POK_Flavor = DEOS then
if POK_Flavor = DEOS or else POK_Flavor = VXWORKS then
Reset_Handlings;
Pop_Entity;
......@@ -2488,7 +2488,7 @@ package body Ocarina.Backends.POK_C.Deployment is
-- backend.
--
if POK_Flavor = DEOS then
if POK_Flavor = DEOS or else POK_Flavor = VXWORKS then
Pop_Entity;
Pop_Entity;
......
......@@ -152,7 +152,7 @@ package body Ocarina.Backends.POK_C.Main is
-- Make strcpy(tattr.NAME, "prname")
if POK_Flavor = DEOS then
if POK_Flavor = DEOS or else POK_Flavor = VXWORKS then
N :=
Make_Call_Profile
(Make_Defining_Identifier
......@@ -254,7 +254,7 @@ package body Ocarina.Backends.POK_C.Main is
if POK_Flavor = POK then
Member_Value := Map_Time_To_Millisecond
(Get_Thread_Period (E));
elsif POK_Flavor = DEOS then
elsif POK_Flavor = DEOS or else POK_Flavor = VXWORKS then
Member_Value := Map_Time_To_Nanosecond
(Get_Thread_Period (E));
end if;
......@@ -313,6 +313,8 @@ package body Ocarina.Backends.POK_C.Main is
Capacity := Map_Time_To_Millisecond (TA (1));
elsif POK_Flavor = DEOS then
Capacity := Map_Time_To_Nanosecond (TA (1));
elsif POK_Flavor = VXWORKS then
Capacity := Map_Time_To_Nanosecond (TA (1));
else
Capacity := No_Node;
end if;
......@@ -647,13 +649,15 @@ package body Ocarina.Backends.POK_C.Main is
if Get_POK_Refresh_Time (F) /= Null_Time then
if Use_ARINC653_API then
N :=
Map_Time_To_Millisecond
Map_Time_To_Nanosecond
(Get_POK_Refresh_Time (F));
else
N := Map_Time (Get_POK_Refresh_Time (F));
end if;
else
if POK_Flavor = DEOS then
if POK_Flavor = DEOS
or else POK_Flavor = VXWORKS
then
--
-- DeOS needs a value to refresh the port.
......@@ -805,6 +809,10 @@ package body Ocarina.Backends.POK_C.Main is
end if;
end if;
if POK_Flavor = VXWORKS then
N := RE (RE_Infinite_Time_Value);
end if;
Append_Node_To_List (N, Call_Parameters);
Append_Node_To_List
......
......@@ -162,6 +162,65 @@ package body Ocarina.Backends.POK_C.Runtime is
end loop;
end if;
if POK_Flavor = VXWORKS then
for E in ART_Id loop
RE_Header_Table (E) := RH_ApexType;
end loop;
RE_Header_Table (RE_Periodic_Wait) := RH_ApexTime;
RE_Header_Table (RE_Create_Process) := RH_ApexProcess;
RE_Header_Table (RE_Start) := RH_ApexProcess;
RE_Header_Table (RE_Create_Process) := RH_ApexProcess;
RE_Header_Table (RE_Set_Partition_Mode) := RH_ApexPartition;
RE_Header_Table (RE_Create_Blackboard) := RH_ApexBlackboard;
RE_Header_Table (RE_Display_Blackboard) := RH_ApexBlackboard;
RE_Header_Table (RE_Read_Blackboard) := RH_ApexBlackboard;
RE_Header_Table (RE_Clear_Blackboard) := RH_ApexBlackboard;
RE_Header_Table (RE_Blackboard_Id_Type) := RH_ApexBlackboard;
RE_Header_Table (RE_Queuing_Port_Id_Type) := RH_ApexQueuing;
RE_Header_Table (RE_Create_Queuing_Port) := RH_ApexQueuing;
RE_Header_Table (RE_Send_Queuing_Message) := RH_ApexQueuing;
RE_Header_Table (RE_Receive_Queuing_Message) := RH_ApexQueuing;
RE_Header_Table (RE_Get_Queuing_Port_Id) := RH_ApexQueuing;
RE_Header_Table (RE_Sampling_Port_Id_Type) := RH_ApexSampling;
RE_Header_Table (RE_Create_Sampling_Port) := RH_ApexSampling;
RE_Header_Table (RE_Write_Sampling_Message) := RH_ApexSampling;
RE_Header_Table (RE_Read_Sampling_Message) := RH_ApexSampling;
RE_Header_Table (RE_Get_Sampling_Port_Id) := RH_ApexSampling;
RE_Header_Table (RE_Create_Buffer) := RH_ApexBuffer;
RE_Header_Table (RE_Send_Buffer) := RH_ApexBuffer;
RE_Header_Table (RE_Receive_Buffer) := RH_ApexBuffer;
RE_Header_Table (RE_Buffer_Id_Type) := RH_ApexBuffer;
RE_Header_Table (RE_Normal) := RH_ApexType;
RE_Header_Table (RE_Process_Attribute_Type) := RH_ApexType;
RE_Header_Table (RE_Fifo) := RH_ApexType;
RE_Header_Table (RE_Pok_Port_Kind_Sampling) := RH_ApexType;
RE_Header_Table (RE_Infinite_Time_Value) := RH_ApexType;
RE_Header_Table (RE_Pok_Port_Kind_Queueing) := RH_ApexType;
RE_Header_Table (RE_Source) := RH_ApexType;
RE_Header_Table (RE_Destination) := RH_ApexType;
RE_Header_Table (RE_Pok_Errno_Empty) := RH_ApexType;
RE_Header_Table (RE_Null) := RH_ApexType;
RE_Header_Table (RE_Normal) := RH_ApexType;
RE_Header_Table (RE_Bool_T) := RH_ApexType;
RE_Header_Table (RE_Uint8_T) := RH_ApexType;
RE_Header_Table (RE_Uint16_T) := RH_ApexType;
RE_Header_Table (RE_Uint32_T) := RH_ApexType;
RE_Header_Table (RE_Uint64_T) := RH_ApexType;
RE_Header_Table (RE_Int8_T) := RH_ApexType;
RE_Header_Table (RE_Int16_T) := RH_ApexType;
RE_Header_Table (RE_Int32_T) := RH_ApexType;
RE_Header_Table (RE_Int64_T) := RH_ApexType;
end if;
if POK_Flavor = ARINC653 then
RH_Service_Table (RH_Assert) := RHS_Null;
RH_Service_Table (RH_Thread) := RHS_Core;
......@@ -365,7 +424,9 @@ package body Ocarina.Backends.POK_C.Runtime is
-- members are in upper case. Otherwise, we use
-- lower case.
if POK_Flavor = ARINC653 or else POK_Flavor = DEOS then
if POK_Flavor = ARINC653 or else POK_Flavor = DEOS
or else POK_Flavor = VXWORKS
then
Name := To_Upper (Name);
else
Name := To_Lower (Name);
......
......@@ -39,6 +39,17 @@ package Ocarina.Backends.POK_C.Runtime is
(RH_Null, -- Workaround to denote a null RH
RH_Activity, -- Activity.h from generated code
RH_Apex, -- apex.h from deos
RH_ApexType, -- apexType.h from vxworks653
RH_ApexProcess, -- apexProcess.h from vxworks653
RH_ApexPartition, -- apexPartition.h from vxworks653
RH_ApexBuffer, -- apexBuffer.h from vxworks653
RH_ApexBlackboard, -- apexBlackboard.h from vxworks653
RH_ApexEvent, -- apexEvent.h from vxworks653
RH_ApexError, -- apexError.h from vxworks653
RH_ApexQueuing, -- apexQueuing.h from vxworks653
RH_ApexSampling, -- apexSampling.h from vxworks653
RH_ApexSemaphore, -- apexSemaphore.h from vxworks653
RH_ApexTime, -- apexTime.h from vxworks653
RH_Assert, -- Assert.h from POK
RH_Blackboard, -- Middleware/blackboard.h from POK
RH_Buffer, -- Middleware/buffer.h from POK
......@@ -67,6 +78,7 @@ package Ocarina.Backends.POK_C.Runtime is
(RHS_Null,
RHS_Generated,
RHS_ARINC653,
RHS_Apex,
RHS_Middleware,
RHS_Protocols,
RHS_Core);
......@@ -303,6 +315,7 @@ package Ocarina.Backends.POK_C.Runtime is
RE_Error_Status_Type, -- ARINC653 Error Status Type
RE_Process_Attribute_Type, -- ARINC653 Process Attribute Type
RE_Process_Id_Type, -- ARIND653 Process_Id_Type
RE_Infinite_Time_Value, -- ARIND653 INFINITE_TIME_VALUE
RE_Message_Size_Type, -- ARINC653 Message_size_type
RE_Validity_Type, -- ARINC653 Validity_type
RE_Buffer_Id_Type, -- ARINC653 Buffer_Id_Type
......@@ -522,7 +535,18 @@ package Ocarina.Backends.POK_C.Runtime is
RH_Thread => RHS_Core,
RH_Time => RHS_Core,
RH_Errno => RHS_Null,
RH_Kernel => RHS_Core,
RH_ApexType => RHS_Apex,
RH_ApexProcess => RHS_Apex,
RH_ApexPartition => RHS_Apex,
RH_ApexBuffer => RHS_Apex,
RH_ApexBlackboard => RHS_Apex,
RH_ApexEvent => RHS_Apex,
RH_ApexError => RHS_Apex,
RH_ApexQueuing => RHS_Apex,
RH_ApexSampling => RHS_Apex,
RH_ApexSemaphore => RHS_Apex,
RH_ApexTime => RHS_Apex,
RH_Kernel => RHS_Core,
RH_Error => RHS_Core,
RH_Partition => RHS_Core,
RH_Port => RHS_Middleware,
......@@ -640,6 +664,7 @@ package Ocarina.Backends.POK_C.Runtime is
RE_Apex_Char => RH_Types,
RE_Process_Attribute_Type => RH_Types,
RE_Process_Id_Type => RH_Types,
RE_Infinite_Time_Value => RH_Types,
RE_Sampling_Port_Id_Type => RH_Types,
RE_Semaphore_Id_Type => RH_Semaphore,
RE_Validity_Type => RH_Types,
......
......@@ -128,7 +128,7 @@ package body Ocarina.Backends.POK_C is
C_Tree.Generator.Generate (C_Root);
end if;
if POK_Flavor /= DEOS then
if POK_Flavor /= DEOS and then POK_Flavor /= VXWORKS then
Makefile.Visit (Instance_Root);
end if;
......@@ -200,7 +200,8 @@ package body Ocarina.Backends.POK_C is
function Use_ARINC653_API return Boolean is
begin
return POK_Flavor = ARINC653 or else POK_Flavor = DEOS;
return POK_Flavor = ARINC653 or else POK_Flavor = DEOS
or else POK_Flavor = VXWORKS;
end Use_ARINC653_API;
----------
......@@ -225,6 +226,10 @@ package body Ocarina.Backends.POK_C is
POK_Flavor := DEOS;
end if;
if Parameter = "vxworks653" then
POK_Flavor := VXWORKS;
end if;
if Parameter = "no-assert" then
Add_Assertions := False;
end if;
......
......@@ -33,7 +33,7 @@
package Ocarina.Backends.POK_C is
type POK_Flavor_Type is (POK, ARINC653, DEOS);
type POK_Flavor_Type is (POK, ARINC653, DEOS, VXWORKS);
POK_Flavor : POK_Flavor_Type := POK;
......
......@@ -3897,4 +3897,99 @@ package body Ocarina.Backends.Utils is
return No_Node;
end Get_Associated_Bus;
------------------------
-- Get_Root_Component --
------------------------
function Get_Root_Component (C : Node_Id)
return Node_Id is
begin
if (Parent_Subcomponent (C) = No_Node) then
return C;
end if;
return Get_Root_Component
(Parent_Component (Parent_Subcomponent (C)));
end Get_Root_Component;
-----------------------------
-- Find_Associated_Process --
-----------------------------
function Find_Associated_Process (Runtime : Node_Id;
Root_Node : Node_Id := No_Node)
return Node_Id is
T : Node_Id;
S : Node_Id;
Current_Node : Node_Id;
begin
if Root_Node = No_Node then
Current_Node := Get_Root_Component (Runtime);
else
Current_Node := Root_Node;
end if;
if Get_Category_Of_Component (Current_Node) = CC_Process and then
Get_Bound_Processor (Current_Node) = Runtime
then
return Current_Node;
end if;
if not AAU.Is_Empty (Subcomponents (Current_Node)) then
S := First_Node (Subcomponents (Current_Node));
while Present (S) loop
T := Find_Associated_Process
(Runtime, Corresponding_Instance (S));
if T /= No_Node then
return T;
end if;
S := Next_Node (S);
end loop;
end if;
return No_Node;
end Find_Associated_Process;
---------------------------
-- Get_Partition_Runtime --
---------------------------
function Get_Partition_Runtime (Process : Node_Id;
Root_Node : Node_Id := No_Node)
return Node_Id is
T : Node_Id;
S : Node_Id;
Current_Node : Node_Id;
begin
if Root_Node = No_Node then
Current_Node := Get_Root_Component (Process);
else
Current_Node := Root_Node;
end if;
if Get_Category_Of_Component (Current_Node) = CC_Virtual_Processor
and then Get_Bound_Processor (Process) = Current_Node
then
return Current_Node;
end if;
if not AAU.Is_Empty (Subcomponents (Current_Node)) then
S := First_Node (Subcomponents (Current_Node));
while Present (S) loop
T := Get_Partition_Runtime
(Process, Corresponding_Instance (S));
if T /= No_Node then
return T;
end if;
S := Next_Node (S);
end loop;
end if;
return No_Node;
end Get_Partition_Runtime;
end Ocarina.Backends.Utils;
......@@ -486,4 +486,15 @@ package Ocarina.Backends.Utils is
function Get_Associated_Bus (Port : Node_Id) return Node_Id;
function Find_Associated_Process (Runtime : Node_Id;
Root_Node : Node_Id := No_Node)
return Node_Id;
function Get_Partition_Runtime (Process : Node_Id;
Root_Node : Node_Id := No_Node)
return Node_Id;
function Get_Root_Component (C : Node_Id)
return Node_Id;
end Ocarina.Backends.Utils;
-- with Locations;
with Ocarina.Backends.Utils;
with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.ME_AADL;
with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nutils;
with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Backends.C_Common.Mapping;
with Ocarina.Backends.XML_Tree.Nodes;
with Ocarina.Backends.XML_Tree.Nutils;
-- with Ocarina.Backends.Vxworks653_Conf.Mapping;
package body Ocarina.Backends.Vxworks653_Conf.Connections is
-- use Locations;
use Ocarina.ME_AADL;
use Ocarina.Backends.Utils;
use Ocarina.ME_AADL.AADL_Instances.Nodes;
use Ocarina.ME_AADL.AADL_Instances.Entities;
use Ocarina.Backends.XML_Tree.Nutils;
-- use Ocarina.Backends.Vxworks653_Conf.Mapping;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
Root_Node : Node_Id := No_Node;
Connections_Node : Node_Id := No_Node;
procedure Visit_Architecture_Instance (E : Node_Id);
procedure Visit_Component_Instance (E : Node_Id);
procedure Visit_System_Instance (E : Node_Id);
procedure Visit_Processor_Instance (E : Node_Id);
procedure Visit_Bus_Instance (E : Node_Id);
procedure Visit_Virtual_Processor_Instance (E : Node_Id);
-----------
-- Visit --
-----------
procedure Visit (E : Node_Id) is
begin
case Kind (E) is
when K_Architecture_Instance =>
Visit_Architecture_Instance (E);
when K_Component_Instance =>
Visit_Component_Instance (E);
when others =>
null;
end case;
end Visit;
---------------------------------
-- Visit_Architecture_Instance --
---------------------------------
procedure Visit_Architecture_Instance (E : Node_Id) is
begin
Root_Node := Root_System (E);
Visit (Root_Node);
end Visit_Architecture_Instance;
------------------------------
-- Visit_Component_Instance --
------------------------------
procedure Visit_Component_Instance (E : Node_Id) is
Category : constant Component_Category := Get_Category_Of_Component (E);
begin
case Category is
when CC_System =>
Visit_System_Instance (E);
when CC_Processor =>
Visit_Processor_Instance (E);
when CC_Bus =>
Visit_Bus_Instance (E);
when CC_Virtual_Processor =>
Visit_Virtual_Processor_Instance (E);
when others =>
null;
end case;
end Visit_Component_Instance;
---------------------------
-- Visit_System_Instance --
---------------------------
procedure Visit_System_Instance (E : Node_Id) is
S : Node_Id;
begin
if not AINU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
while Present (S) loop
-- Visit the component instance corresponding to the
-- subcomponent S.
if AINU.Is_Processor (Corresponding_Instance (S)) then
Visit (Corresponding_Instance (S));
end if;
S := Next_Node (S);
end loop;
end if;
end Visit_System_Instance;
------------------------
-- Visit_Bus_Instance --
------------------------
procedure Visit_Bus_Instance (E : Node_Id) is
pragma Unreferenced (E);
begin
null;
end Visit_Bus_Instance;
------------------------------
-- Visit_Processor_Instance --
------------------------------
procedure Visit_Processor_Instance (E : Node_Id) is
U : Node_Id;
P : Node_Id;
S : Node_Id;
begin
U := XTN.Unit (Backend_Node (Identifier (E)));
P := XTN.Node (Backend_Node (Identifier (E)));
Push_Entity (P);
Push_Entity (U);
Current_XML_Node := XTN.Root_Node (XTN.XML_File (U));
Connections_Node := Make_XML_Node ("Connections");
if not AINU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
while Present (S) loop
-- Visit the component instance corresponding to the
-- subcomponent S.
if AINU.Is_Virtual_Processor (Corresponding_Instance (S)) then
Visit (Corresponding_Instance (S));
end if;
S := Next_Node (S);
end loop;
end if;
Append_Node_To_List
(Connections_Node,
XTN.Subitems (Current_XML_Node));
Pop_Entity;
Pop_Entity;
end Visit_Processor_Instance;
--------------------------------------
-- Visit_Virtual_Processor_Instance --
--------------------------------------
procedure Visit_Virtual_Processor_Instance (E : Node_Id) is
Corresponding_Process : Node_Id;
Connection_Node : Node_Id;
Source_Node : Node_Id;
Destination_Node : Node_Id;
Feature : Node_Id;
Port_Source : Node_Id;
Port_Destination : Node_Id;
Partition_Destination : Node_Id;
begin
Corresponding_Process := Find_Associated_Process (E);
Feature := First_Node (Features (Corresponding_Process));
while Present (Feature) loop
if Is_Data (Feature) and then Is_Out (Feature)
then
Port_Source := Feature;
Port_Destination := Item (First_Node (Destinations (Feature)));
Partition_Destination := Parent_Component (Port_Destination);
Connection_Node := Make_XML_Node ("Connection");
Source_Node := Make_XML_Node ("Source");
Add_Attribute ("PartitionNameRef",
Get_Name_String
(AIN.Name
(AIN.Identifier
(Parent_Subcomponent
(E)))),
Source_Node);