Commit cca5c050 authored by yoogx's avatar yoogx
Browse files

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

parents 43f8f420 54ffd1cf
......@@ -423,7 +423,9 @@ package body Ocarina.Backends.C_Common.Types is
Type_Uint64 := PHR.RE (RE_Uint64_T);
Type_Int64 := PHR.RE (RE_Int64_T);
elsif Get_Current_Backend_Kind = PolyORB_Kernel_C then
Add_Include (PKR.RH (RH_Types));
if Use_ARINC653_API = False then
Add_Include (PKR.RH (RH_Types));
end if;
Type_Uint8 := PKR.RE (RE_Uint8_T);
Type_Int8 := PKR.RE (RE_Int8_T);
Type_Uint16 := PKR.RE (RE_Uint16_T);
......
......@@ -973,8 +973,19 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
function Map_Partition (Process : Node_Id;
Runtime : Node_Id;
Partition_Identifier : Integer)
Partition_Identifier : Integer;
Nb_Threads : Unsigned_Long_Long;
Nb_Buffers : Unsigned_Long_Long;
Nb_Events : Unsigned_Long_Long;
Nb_Lock_Objects : Unsigned_Long_Long;
Nb_Blackboards : Unsigned_Long_Long;
Blackboards_Size : Unsigned_Long_Long;
Buffers_Size : Unsigned_Long_Long)
return Node_Id is
pragma Unreferenced (Nb_Buffers);
pragma Unreferenced (Nb_Events);
pragma Unreferenced (Nb_Lock_Objects);
pragma Unreferenced (Buffers_Size);
pragma Unreferenced (Process);
Partition_Node : Node_Id;
begin
......@@ -1012,10 +1023,19 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
XTU.Add_Attribute ("ProcessStackSpaceInPages", "6", Partition_Node);
XTU.Add_Attribute ("MinimumProcessStackSizeInBytes",
"512", Partition_Node);
XTU.Add_Attribute ("ProcessQuota", "4", Partition_Node);
XTU.Add_Attribute ("BlackboardQuota", "1", Partition_Node);
XTU.Add_Attribute ("ProcessQuota",
Trim (Unsigned_Long_Long'Image
(Nb_Threads + 2), Left),
Partition_Node);
XTU.Add_Attribute ("BlackboardQuota",
Trim (Unsigned_Long_Long'Image
(Nb_Blackboards), Left),
Partition_Node);
XTU.Add_Attribute ("BlackboardMessageSpaceInBytes",
"256", Partition_Node);
Trim (Unsigned_Long_Long'Image
(Blackboards_Size), Left),
Partition_Node);
XTU.Add_Attribute ("BufferQuota", "0", Partition_Node);
XTU.Add_Attribute ("BufferMessageSpaceInBytes", "0", Partition_Node);
XTU.Add_Attribute ("SemaphoreQuota", "0", Partition_Node);
......
......@@ -18,7 +18,15 @@ package Ocarina.Backends.Deos_Conf.Mapping is
function Map_Processor (E : Node_Id) return Node_Id;
function Map_Partition (Process : Node_Id;
Runtime : Node_Id;
Partition_Identifier : Integer) return Node_Id;
Partition_Identifier : Integer;
Nb_Threads : Unsigned_Long_Long;
Nb_Buffers : Unsigned_Long_Long;
Nb_Events : Unsigned_Long_Long;
Nb_Lock_Objects : Unsigned_Long_Long;
Nb_Blackboards : Unsigned_Long_Long;
Blackboards_Size : Unsigned_Long_Long;
Buffers_Size : Unsigned_Long_Long)
return Node_Id;
function Map_Bus (E : Node_Id) return Node_Id;
function Map_Port_Connection (E : Node_Id) return Node_Id;
function Map_Process_Memory (Process : Node_Id) return Node_Id;
......
......@@ -31,12 +31,13 @@
-- --
------------------------------------------------------------------------------
-- with Locations;
with Ocarina.Backends.Messages;
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.Utils;
with Ocarina.Backends.Properties;
with Ocarina.Backends.XML_Tree.Nodes;
with Ocarina.Backends.XML_Tree.Nutils;
......@@ -44,27 +45,38 @@ with Ocarina.Backends.Deos_Conf.Mapping;
package body Ocarina.Backends.Deos_Conf.Partitions is
-- use Locations;
use Ocarina.ME_AADL;
use Ocarina.Backends.Utils;
use Ocarina.Backends.Messages;
use Ocarina.ME_AADL.AADL_Instances.Nodes;
use Ocarina.ME_AADL.AADL_Instances.Entities;
use Ocarina.Backends.XML_Tree.Nutils;
use Ocarina.Backends.Properties;
use Ocarina.Backends.Deos_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;
package XTU renames Ocarina.Backends.XML_Tree.Nutils;
Root_Node : Node_Id := No_Node;
Partitions_Node : Node_Id := No_Node;
Memory_Regions : Node_Id := No_Node;
Partition_Identifier : Integer := 1;
Root_Node : Node_Id := No_Node;
Partitions_Node : Node_Id := No_Node;
Memory_Regions : Node_Id := No_Node;
Partition_Identifier : Integer := 1;
Process_Nb_Threads : Unsigned_Long_Long := 0;
Process_Nb_Buffers : Unsigned_Long_Long := 0;
Process_Nb_Events : Unsigned_Long_Long := 0;
Process_Nb_Lock_Objects : Unsigned_Long_Long := 0;
Process_Nb_Blackboards : Unsigned_Long_Long := 0;
Process_Blackboards_Size : Unsigned_Long_Long := 0;
Process_Buffers_Size : Unsigned_Long_Long := 0;
procedure Visit_Architecture_Instance (E : Node_Id);
procedure Visit_Component_Instance (E : Node_Id);
procedure Visit_System_Instance (E : Node_Id);
procedure Visit_Process_Instance (E : Node_Id);
procedure Visit_Thread_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);
......@@ -168,6 +180,9 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
when CC_Process =>
Visit_Process_Instance (E);
when CC_Thread =>
Visit_Thread_Instance (E);
when CC_Processor =>
Visit_Processor_Instance (E);
......@@ -182,6 +197,48 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
end case;
end Visit_Component_Instance;
---------------------------
-- Visit_Thread_Instance --
---------------------------
procedure Visit_Thread_Instance (E : Node_Id) is
F : Node_Id;
begin
Process_Nb_Threads := Process_Nb_Threads + 1;
if not AINU.Is_Empty (Features (E)) then
F := First_Node (Features (E));
while Present (F) loop
if Kind (F) = K_Port_Spec_Instance then
if Get_Connection_Pattern (F) = Intra_Process
and then Is_In (F)
then
if AIN.Is_Data (F) and then not AIN.Is_Event (F) then
Process_Nb_Blackboards := Process_Nb_Blackboards + 1;
Process_Blackboards_Size :=
Process_Blackboards_Size +
To_Bytes
(Get_Data_Size
(Corresponding_Instance (F)));
elsif AIN.Is_Data (F) and then AIN.Is_Event (F) then
Process_Nb_Buffers := Process_Nb_Buffers + 1;
elsif AIN.Is_Event (F) and then not AIN.Is_Data (F) then
Process_Nb_Events := Process_Nb_Events + 1;
else
Display_Error ("Communication Pattern not handled",
Fatal => True);
end if;
Process_Nb_Lock_Objects := Process_Nb_Lock_Objects + 1;
end if;
end if;
F := Next_Node (F);
end loop;
end if;
end Visit_Thread_Instance;
----------------------------
-- Visit_Process_Instance --
----------------------------
......@@ -289,12 +346,30 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
Corresponding_Process := Find_Associated_Process (E);
if Corresponding_Process /= No_Node then
Process_Nb_Threads := 0;
Process_Nb_Buffers := 0;
Process_Nb_Events := 0;
Process_Nb_Lock_Objects := 0;
Process_Nb_Blackboards := 0;
Process_Blackboards_Size := 0;
Process_Buffers_Size := 0;
Visit (Corresponding_Process);
--
-- First, we create the description of the partition.
--
Partition_Node := Map_Partition (Corresponding_Process,
E,
Partition_Identifier);
Partition_Identifier,
Process_Nb_Threads,
Process_Nb_Buffers,
Process_Nb_Events,
Process_Nb_Lock_Objects,
Process_Nb_Blackboards,
Process_Blackboards_Size,
Process_Buffers_Size);
Append_Node_To_List
(Partition_Node,
XTN.Subitems (Partitions_Node));
......
......@@ -2302,7 +2302,7 @@ package body Ocarina.Backends.POK_C.Deployment is
and then Get_Connection_Pattern (F) = Intra_Process
then
if AIN.Is_Data (F) and then not AIN.Is_Event (F) then
if POK_Flavor = ARINC653 then
if Use_ARINC653_API then
Type_Used := RE (RE_Blackboard_Id_Type);
else
Type_Used := RE (RE_Uint8_T);
......@@ -2325,7 +2325,7 @@ package body Ocarina.Backends.POK_C.Deployment is
(N,
CTN.Declarations (CTU.Current_File));
elsif AIN.Is_Data (F) and then AIN.Is_Event (F) then
if POK_Flavor = ARINC653 then
if Use_ARINC653_API then
Type_Used := RE (RE_Buffer_Id_Type);
else
Type_Used := RE (RE_Uint8_T);
......@@ -2346,7 +2346,7 @@ package body Ocarina.Backends.POK_C.Deployment is
(N,
CTN.Declarations (CTU.Current_File));
elsif AIN.Is_Event (F) and then not AIN.Is_Data (F) then
if POK_Flavor = ARINC653 then
if Use_ARINC653_API then
Type_Used := RE (RE_Event_Id_Type);
Partition_ARINC653_Nb_Events :=
Partition_ARINC653_Nb_Events + 1;
......
......@@ -150,6 +150,23 @@ package body Ocarina.Backends.POK_C.Main is
POK_Add_Return_Assertion (Statements);
end if;
-- Make strcpy(tattr.NAME, "prname")
if POK_Flavor = DEOS then
N :=
Make_Call_Profile
(Make_Defining_Identifier
(Get_String_Name ("strcpy")),
Make_List_Id (
Make_Member_Designator
(RE (RE_Name),
Copy_Node (Tattr)),
Make_Literal
(CV.New_Pointed_Char_Value
(Name (Identifier (S))))));
Append_Node_To_List (N, Statements);
end if;
-- Make tattr.entry = entrypoint
if Use_ARINC653_API then
......
......@@ -135,6 +135,15 @@ package body Ocarina.Backends.POK_C.Runtime is
RE_Header_Table (E) := RH_Apex;
RE_Header_Table (RE_Null) := RH_Apex;
RE_Header_Table (RE_Normal) := RH_Apex;
RE_Header_Table (RE_Bool_T) := RH_Apex;
RE_Header_Table (RE_Uint8_T) := RH_Apex;
RE_Header_Table (RE_Uint16_T) := RH_Apex;
RE_Header_Table (RE_Uint32_T) := RH_Apex;
RE_Header_Table (RE_Uint64_T) := RH_Apex;
RE_Header_Table (RE_Int8_T) := RH_Apex;
RE_Header_Table (RE_Int16_T) := RH_Apex;
RE_Header_Table (RE_Int32_T) := RH_Apex;
RE_Header_Table (RE_Int64_T) := RH_Apex;
end loop;
for E in ART_Id loop
......
......@@ -362,6 +362,7 @@ package Ocarina.Backends.POK_C.Runtime is
RE_Pok_Blackboards_Names, -- pok_blackboards_names
RE_Entry_Point,
RE_Name,
RE_Entry,
RE_Deadline,
RE_Time_Capacity,
......@@ -833,6 +834,7 @@ package Ocarina.Backends.POK_C.Runtime is
-- Runtime member elements
RE_Entry_Point => RH_Null,
RE_Name => RH_Null,
RE_Entry => RH_Null,
RE_Stack_Size => RH_Null,
RE_Deadline => RH_Null,
......
......@@ -119,6 +119,7 @@ package body Ocarina.Backends.Properties is
Real_Range : Name_Id;
Data_Required_Access : Name_Id;
Data_Provided_Access : Name_Id;
Source_Data_Size : Name_Id;
Data_Size : Name_Id;
Code_Size : Name_Id;
Data_Concurrency_Protocol : Name_Id;
......@@ -1129,10 +1130,17 @@ package body Ocarina.Backends.Properties is
-------------------
function Get_Data_Size (D : Node_Id) return Size_Type is
Ret : Size_Type;
begin
pragma Assert (AINU.Is_Data (D) or else AINU.Is_Process (D));
return (Get_Size_Property_Value (D, Data_Size));
Ret := Get_Size_Property_Value (D, Data_Size);
if Ret = Null_Size then
Ret := Get_Size_Property_Value (D, Source_Data_Size);
end if;
return Ret;
end Get_Data_Size;
-------------------
......@@ -3058,7 +3066,8 @@ package body Ocarina.Backends.Properties is
Real_Range := Get_String_Name ("data_model::real_range");
Data_Required_Access := Get_String_Name ("required_access");
Data_Provided_Access := Get_String_Name ("provided_access");
Data_Size := Get_String_Name ("source_data_size");
Data_Size := Get_String_Name ("data_size");
Source_Data_Size := Get_String_Name ("source_data_size");
Code_Size := Get_String_Name ("source_code_size");
Data_Representation :=
Get_String_Name ("data_model::data_representation");
......
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