Commit fca3678e authored by Julien's avatar Julien
Browse files

Start to generate DEOS specific code

parent ab215fe1
...@@ -390,7 +390,7 @@ package body Ocarina.Backends.POK_C.Deployment is ...@@ -390,7 +390,7 @@ package body Ocarina.Backends.POK_C.Deployment is
U : Node_Id; U : Node_Id;
Processes : List_Id; Processes : List_Id;
begin begin
if POK_Flavor = ARINC653 then if POK_Flavor = ARINC653 or else POK_Flavor = DEOS then
CTU.Append_Node_To_List CTU.Append_Node_To_List
(RE (RE_Pok_Sched_Rr), (RE (RE_Pok_Sched_Rr),
CTN.Values (System_Partitions_Scheduler)); CTN.Values (System_Partitions_Scheduler));
......
...@@ -113,14 +113,14 @@ package body Ocarina.Backends.POK_C.Main is ...@@ -113,14 +113,14 @@ package body Ocarina.Backends.POK_C.Main is
and then ARINC653_Discipline = Priority_Based and then ARINC653_Discipline = Priority_Based
then then
if POK_Flavor = ARINC653 then if Use_ARINC653_API then
return RE (RE_Priority); return RE (RE_Priority);
else else
return RE (RE_Pok_Port_Queueing_Discipline_Fifo); return RE (RE_Pok_Port_Queueing_Discipline_Fifo);
end if; end if;
end if; end if;
if POK_Flavor = ARINC653 then if Use_ARINC653_API then
return RE (RE_Fifo); return RE (RE_Fifo);
else else
return RE (RE_Pok_Port_Queueing_Discipline_Fifo); return RE (RE_Pok_Port_Queueing_Discipline_Fifo);
...@@ -138,7 +138,7 @@ package body Ocarina.Backends.POK_C.Main is ...@@ -138,7 +138,7 @@ package body Ocarina.Backends.POK_C.Main is
Member_Value : Node_Id; Member_Value : Node_Id;
begin begin
-- Initializes thread attributes. -- Initializes thread attributes.
if POK_Flavor = POK then if Use_ARINC653_API then
N := N :=
POK_Make_Function_Call_With_Assert POK_Make_Function_Call_With_Assert
(RF (RE_Pok_Thread_Attr_Init), (RF (RE_Pok_Thread_Attr_Init),
...@@ -151,7 +151,7 @@ package body Ocarina.Backends.POK_C.Main is ...@@ -151,7 +151,7 @@ package body Ocarina.Backends.POK_C.Main is
-- Make tattr.entry = entrypoint -- Make tattr.entry = entrypoint
if POK_Flavor = ARINC653 then if Use_ARINC653_API then
N := N :=
Make_Expression Make_Expression
(Left_Expr => (Left_Expr =>
...@@ -183,7 +183,7 @@ package body Ocarina.Backends.POK_C.Main is ...@@ -183,7 +183,7 @@ package body Ocarina.Backends.POK_C.Main is
if Get_Thread_Priority (E) /= 0 then if Get_Thread_Priority (E) /= 0 then
N := Make_Literal (New_Int_Value (Get_Thread_Priority (E), 1, 10)); N := Make_Literal (New_Int_Value (Get_Thread_Priority (E), 1, 10));
if POK_Flavor = ARINC653 then if Use_ARINC653_API then
N := N :=
Make_Expression Make_Expression
(Left_Expr => (Left_Expr =>
...@@ -207,7 +207,7 @@ package body Ocarina.Backends.POK_C.Main is ...@@ -207,7 +207,7 @@ package body Ocarina.Backends.POK_C.Main is
end if; end if;
if Get_Thread_Deadline (E) /= Null_Time then if Get_Thread_Deadline (E) /= Null_Time then
if POK_Flavor = ARINC653 then if Use_ARINC653_API then
Member_Value := Member_Value :=
Map_Time_To_Millisecond (Get_Thread_Deadline (E)); Map_Time_To_Millisecond (Get_Thread_Deadline (E));
else else
...@@ -326,7 +326,7 @@ package body Ocarina.Backends.POK_C.Main is ...@@ -326,7 +326,7 @@ package body Ocarina.Backends.POK_C.Main is
end if; end if;
if POK_Flavor = ARINC653 then if Use_ARINC653_API then
Append_Node_To_List Append_Node_To_List
(POK_Make_Function_Call_With_Assert (POK_Make_Function_Call_With_Assert
(RF (RE_Create_Process), (RF (RE_Create_Process),
......
...@@ -124,6 +124,10 @@ package body Ocarina.Backends.POK_C.Runtime is ...@@ -124,6 +124,10 @@ package body Ocarina.Backends.POK_C.Runtime is
Initialized := True; Initialized := True;
if POK_Flavor = DEOS then
RE_Header_Table (RE_Create_Process) := RH_Apex;
end if;
if POK_Flavor = ARINC653 then if POK_Flavor = ARINC653 then
RH_Service_Table (RH_Assert) := RHS_Null; RH_Service_Table (RH_Assert) := RHS_Null;
RH_Service_Table (RH_Thread) := RHS_Core; RH_Service_Table (RH_Thread) := RHS_Core;
...@@ -327,7 +331,7 @@ package body Ocarina.Backends.POK_C.Runtime is ...@@ -327,7 +331,7 @@ package body Ocarina.Backends.POK_C.Runtime is
-- members are in upper case. Otherwise, we use -- members are in upper case. Otherwise, we use
-- lower case. -- lower case.
if POK_Flavor = ARINC653 then if POK_Flavor = ARINC653 or else POK_Flavor = DEOS then
Name := To_Upper (Name); Name := To_Upper (Name);
else else
Name := To_Lower (Name); Name := To_Lower (Name);
...@@ -562,7 +566,7 @@ package body Ocarina.Backends.POK_C.Runtime is ...@@ -562,7 +566,7 @@ package body Ocarina.Backends.POK_C.Runtime is
function Get_Errcode_OK return Node_Id is function Get_Errcode_OK return Node_Id is
begin begin
if POK_Flavor = ARINC653 then if POK_Flavor = ARINC653 or else POK_Flavor = DEOS then
return RE (RE_No_Error); return RE (RE_No_Error);
else else
return RE (RE_Pok_Errno_Ok); return RE (RE_Pok_Errno_Ok);
......
...@@ -38,6 +38,7 @@ package Ocarina.Backends.POK_C.Runtime is ...@@ -38,6 +38,7 @@ package Ocarina.Backends.POK_C.Runtime is
type RH_Id is type RH_Id is
(RH_Null, -- Workaround to denote a null RH (RH_Null, -- Workaround to denote a null RH
RH_Activity, -- Activity.h from generated code RH_Activity, -- Activity.h from generated code
RH_Apex, -- apex.h from deos
RH_Assert, -- Assert.h from POK RH_Assert, -- Assert.h from POK
RH_Blackboard, -- Middleware/blackboard.h from POK RH_Blackboard, -- Middleware/blackboard.h from POK
RH_Buffer, -- Middleware/buffer.h from POK RH_Buffer, -- Middleware/buffer.h from POK
...@@ -512,6 +513,7 @@ package Ocarina.Backends.POK_C.Runtime is ...@@ -512,6 +513,7 @@ package Ocarina.Backends.POK_C.Runtime is
(RH_Null => RHS_Null, (RH_Null => RHS_Null,
RH_Activity => RHS_Generated, RH_Activity => RHS_Generated,
RH_Assert => RHS_Null, RH_Assert => RHS_Null,
RH_Apex => RHS_Null,
RH_Blackboard => RHS_Middleware, RH_Blackboard => RHS_Middleware,
RH_Buffer => RHS_Middleware, RH_Buffer => RHS_Middleware,
RH_Event => RHS_Core, RH_Event => RHS_Core,
...@@ -534,7 +536,7 @@ package Ocarina.Backends.POK_C.Runtime is ...@@ -534,7 +536,7 @@ package Ocarina.Backends.POK_C.Runtime is
RH_Subprograms => RHS_Generated, RH_Subprograms => RHS_Generated,
RH_Deployment => RHS_Generated); RH_Deployment => RHS_Generated);
RE_Header_Table : constant array (RE_Id) of RH_Id := RE_Header_Table : array (RE_Id) of RH_Id :=
( (
-- Runtime functions associations -- Runtime functions associations
RE_Pok_Thread_Sleep => RH_Thread, RE_Pok_Thread_Sleep => RH_Thread,
......
...@@ -196,6 +196,11 @@ package body Ocarina.Backends.POK_C is ...@@ -196,6 +196,11 @@ package body Ocarina.Backends.POK_C is
Leave_Directory; Leave_Directory;
end Generate; end Generate;
function Use_ARINC653_API return Boolean is
begin
return POK_Flavor = ARINC653 or else POK_Flavor = DEOS;
end Use_ARINC653_API;
---------- ----------
-- Init -- -- Init --
---------- ----------
...@@ -214,6 +219,10 @@ package body Ocarina.Backends.POK_C is ...@@ -214,6 +219,10 @@ package body Ocarina.Backends.POK_C is
POK_Flavor := ARINC653; POK_Flavor := ARINC653;
end if; end if;
if Parameter = "deos" then
POK_Flavor := DEOS;
end if;
if Parameter = "no-assert" then if Parameter = "no-assert" then
Add_Assertions := False; Add_Assertions := False;
end if; end if;
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
package Ocarina.Backends.POK_C is package Ocarina.Backends.POK_C is
type POK_Flavor_Type is (POK, ARINC653); type POK_Flavor_Type is (POK, ARINC653, DEOS);
POK_Flavor : POK_Flavor_Type := POK; POK_Flavor : POK_Flavor_Type := POK;
...@@ -54,6 +54,9 @@ package Ocarina.Backends.POK_C is ...@@ -54,6 +54,9 @@ package Ocarina.Backends.POK_C is
-- Display a message when a modeling pattern is not correct -- Display a message when a modeling pattern is not correct
-- about ports. -- about ports.
function Use_ARINC653_API return Boolean;
-- Indicate if the Flavor uses the ARINC653 API.
private private
C_Root : Node_Id; C_Root : Node_Id;
-- The root of the C trees -- The root of the C trees
......
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