Commit dd7f358e authored by yoogx's avatar yoogx
Browse files

* Minor reformatting

parent 9dd73496
......@@ -69,11 +69,13 @@ package body Ocarina.Backends.Deos_Conf.Hm is
procedure Visit_Bus_Instance (E : Node_Id);
procedure Visit_Virtual_Processor_Instance (E : Node_Id);
procedure Add_System_Error (XML_Node : Node_Id;
procedure Add_System_Error
(XML_Node : Node_Id;
Identifier : String;
Description : String);
procedure Add_Error_Action (XML_Node : Node_Id;
procedure Add_Error_Action
(XML_Node : Node_Id;
Identifier : String;
Level : String;
Action : String);
......@@ -186,34 +188,36 @@ package body Ocarina.Backends.Deos_Conf.Hm is
-- Add_System_Error --
------------------------
procedure Add_System_Error (XML_Node : Node_Id;
procedure Add_System_Error
(XML_Node : Node_Id;
Identifier : String;
Description : String) is
Description : String)
is
Intermediate : Node_Id;
begin
Intermediate := Make_XML_Node ("SystemError");
XTU.Add_Attribute ("ErrorIdentifier", Identifier, Intermediate);
XTU.Add_Attribute ("Description", Description, Intermediate);
Append_Node_To_List
(Intermediate, XTN.Subitems (XML_Node));
Append_Node_To_List (Intermediate, XTN.Subitems (XML_Node));
end Add_System_Error;
------------------------
-- Add_Error_Action --
------------------------
procedure Add_Error_Action (XML_Node : Node_Id;
procedure Add_Error_Action
(XML_Node : Node_Id;
Identifier : String;
Level : String;
Action : String) is
Action : String)
is
Intermediate : Node_Id;
begin
Intermediate := Make_XML_Node ("ErrorAction");
XTU.Add_Attribute ("ErrorIdentifierRef", Identifier, Intermediate);
XTU.Add_Attribute ("ErrorLevel", Level, Intermediate);
XTU.Add_Attribute ("ModuleRecoveryAction", Action, Intermediate);
Append_Node_To_List
(Intermediate, XTN.Subitems (XML_Node));
Append_Node_To_List (Intermediate, XTN.Subitems (XML_Node));
end Add_Error_Action;
------------------------------
......@@ -245,15 +249,11 @@ package body Ocarina.Backends.Deos_Conf.Hm is
HM_Node := Make_XML_Node ("HealthMonitoring");
Append_Node_To_List
(HM_Node,
XTN.Subitems (Current_XML_Node));
Append_Node_To_List (HM_Node, XTN.Subitems (Current_XML_Node));
System_Errors := Make_XML_Node ("SystemErrors");
Append_Node_To_List
(System_Errors,
XTN.Subitems (HM_Node));
Append_Node_To_List (System_Errors, XTN.Subitems (HM_Node));
Add_System_Error (System_Errors, "1", "processorSpecific");
Add_System_Error (System_Errors, "2", "floatingPoint");
Add_System_Error (System_Errors, "3", "accessViolation");
......@@ -271,12 +271,11 @@ package body Ocarina.Backends.Deos_Conf.Hm is
Multi_Partition_HM := Make_XML_Node ("MultiPartitionHM");
XTU.Add_Attribute ("TableIdentifier", "1", Multi_Partition_HM);
XTU.Add_Attribute ("TableName",
XTU.Add_Attribute
("TableName",
"default MultiPartitionHM",
Multi_Partition_HM);
Append_Node_To_List
(Multi_Partition_HM,
XTN.Subitems (HM_Node));
Append_Node_To_List (Multi_Partition_HM, XTN.Subitems (HM_Node));
Add_Error_Action (Multi_Partition_HM, "1", "MODULE", "IGNORE");
Add_Error_Action (Multi_Partition_HM, "2", "MODULE", "IGNORE");
Add_Error_Action (Multi_Partition_HM, "3", "MODULE", "IGNORE");
......@@ -301,21 +300,20 @@ package body Ocarina.Backends.Deos_Conf.Hm is
--
Partition_HM := Make_XML_Node ("PartitionHM");
Append_Node_To_List
(Partition_HM,
XTN.Subitems (HM_Node));
Append_Node_To_List (Partition_HM, XTN.Subitems (HM_Node));
XTU.Add_Attribute ("TableIdentifier",
Trim (Unsigned_Long_Long'Image
(Partition_Identifier), Left),
XTU.Add_Attribute
("TableIdentifier",
Trim (Unsigned_Long_Long'Image (Partition_Identifier), Left),
Partition_HM);
XTU.Add_Attribute ("TableName",
XTU.Add_Attribute
("TableName",
"Unique name for partition " &
Trim (Unsigned_Long_Long'Image
(Partition_Identifier), Left),
Trim (Unsigned_Long_Long'Image (Partition_Identifier), Left),
Partition_HM);
XTU.Add_Attribute ("MultiPartitionHMTableNameRef",
XTU.Add_Attribute
("MultiPartitionHMTableNameRef",
"default MultiPartitionHM",
Partition_HM);
Partition_Identifier := Partition_Identifier + 1;
......
......@@ -183,8 +183,10 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
XTU.Add_Attribute ("hmShutdownRegistry", "platreg.bin", Root);
XTU.Add_Attribute ("xsi:schemaLocation", "deos653.xsd", Root);
XTU.Add_Attribute ("comment", "please insert comment", Root);
XTU.Add_Attribute ("xmlns:xsi",
"http://www.w3.org/2001/XMLSchema-instance", Root);
XTU.Add_Attribute
("xmlns:xsi",
"http://www.w3.org/2001/XMLSchema-instance",
Root);
XTU.Add_Attribute ("xmlns", "http://ddci.com/ARINC653", Root);
Set_Str_To_Name_Buffer ("name");
......@@ -1011,16 +1013,15 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
Source_Runtime : Node_Id;
begin
Sampling_Port := Make_XML_Node ("SamplingPort");
Size := To_Bytes (Get_Data_Size
(Corresponding_Instance (Port)));
Size := To_Bytes (Get_Data_Size (Corresponding_Instance (Port)));
XTU.Add_Attribute ("Name",
Get_Name_String
(Map_Port_Name (Port)),
XTU.Add_Attribute
("Name",
Get_Name_String (Map_Port_Name (Port)),
Sampling_Port);
XTU.Add_Attribute ("MaxMessageSize",
Trim (Unsigned_Long_Long'Image
(Size), Left),
XTU.Add_Attribute
("MaxMessageSize",
Trim (Unsigned_Long_Long'Image (Size), Left),
Sampling_Port);
if Is_In (Port) then
......@@ -1031,22 +1032,16 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
if Is_In (Port) then
Source_Port := Item (AIN.First_Node (Sources (Port)));
Source_Process := Parent_Component
(Source_Port);
Source_Runtime := Parent_Subcomponent
(Get_Partition_Runtime
(Source_Process));
Source_Process := Parent_Component (Source_Port);
Source_Runtime :=
Parent_Subcomponent (Get_Partition_Runtime (Source_Process));
XTU.Add_Attribute
("SourcePortName",
Get_Name_String
(Map_Port_Name (Source_Port)),
Get_Name_String (Map_Port_Name (Source_Port)),
Sampling_Port);
XTU.Add_Attribute
("SourcePartitionName",
Get_Name_String
(Display_Name
(Identifier
(Source_Runtime))),
Get_Name_String (Display_Name (Identifier (Source_Runtime))),
Sampling_Port);
else
XTU.Add_Attribute ("SourcePartitionName", "", Sampling_Port);
......@@ -1071,26 +1066,25 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
Source_Runtime : Node_Id;
begin
Queuing_Port := Make_XML_Node ("QueuingPort");
Size := To_Bytes (Get_Data_Size
(Corresponding_Instance (Port)));
Size := To_Bytes (Get_Data_Size (Corresponding_Instance (Port)));
Queue_Size := Get_Queue_Size (Port);
if Queue_Size = -1 then
Queue_Size := 1;
end if;
XTU.Add_Attribute ("Name",
Get_Name_String
(Map_Port_Name (Port)),
XTU.Add_Attribute
("Name",
Get_Name_String (Map_Port_Name (Port)),
Queuing_Port);
XTU.Add_Attribute ("MaxMessageSize",
Trim (Unsigned_Long_Long'Image
(Size), Left),
XTU.Add_Attribute
("MaxMessageSize",
Trim (Unsigned_Long_Long'Image (Size), Left),
Queuing_Port);
XTU.Add_Attribute ("MaxNbMessage",
Trim (Long_Long'Image
(Queue_Size), Left),
XTU.Add_Attribute
("MaxNbMessage",
Trim (Long_Long'Image (Queue_Size), Left),
Queuing_Port);
if Is_In (Port) then
......@@ -1101,22 +1095,16 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
if Is_In (Port) then
Source_Port := Item (AIN.First_Node (Sources (Port)));
Source_Process := Parent_Component
(Source_Port);
Source_Runtime := Parent_Subcomponent
(Get_Partition_Runtime
(Source_Process));
Source_Process := Parent_Component (Source_Port);
Source_Runtime :=
Parent_Subcomponent (Get_Partition_Runtime (Source_Process));
XTU.Add_Attribute
("SourcePortName",
Get_Name_String
(Map_Port_Name (Source_Port)),
Get_Name_String (Map_Port_Name (Source_Port)),
Queuing_Port);
XTU.Add_Attribute
("SourcePartitionName",
Get_Name_String
(Display_Name
(Identifier
(Source_Runtime))),
Get_Name_String (Display_Name (Identifier (Source_Runtime))),
Queuing_Port);
else
XTU.Add_Attribute ("SourcePartitionName", "", Queuing_Port);
......@@ -1131,7 +1119,8 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
-- Map_Partition --
-------------------
function Map_Partition (Process : Node_Id;
function Map_Partition
(Process : Node_Id;
Runtime : Node_Id;
Partition_Identifier : Integer;
Nb_Threads : Unsigned_Long_Long;
......@@ -1140,8 +1129,8 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
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
Buffers_Size : Unsigned_Long_Long) return Node_Id
is
pragma Unreferenced (Nb_Buffers);
pragma Unreferenced (Nb_Events);
pragma Unreferenced (Nb_Lock_Objects);
......@@ -1170,47 +1159,43 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
Partition_Node := Make_XML_Node ("Partition");
XTU.Add_Attribute ("Name",
XTU.Add_Attribute
("Name",
Get_Name_String
(AIN.Name
(Identifier
(Parent_Subcomponent
(Runtime)))),
(AIN.Name (Identifier (Parent_Subcomponent (Runtime)))),
Partition_Node);
--
-- Integer'Image adds a space in the beginning. To avoid that,
-- see http://rosettacode.org/wiki/
-- Strip_whitespace_from_a_string/Top_and_tail#Ada
--
XTU.Add_Attribute ("Identifier",
XTU.Add_Attribute
("Identifier",
Trim (Integer'Image (Partition_Identifier), Left),
Partition_Node);
XTU.Add_Attribute ("Period",
Trim
(Unsigned_Long_Long'Image
(Period_Ns),
Left),
XTU.Add_Attribute
("Period",
Trim (Unsigned_Long_Long'Image (Period_Ns), Left),
Partition_Node);
XTU.Add_Attribute ("Duration",
Trim
(Unsigned_Long_Long'Image
(Duration_Ns),
Left),
XTU.Add_Attribute
("Duration",
Trim (Unsigned_Long_Long'Image (Duration_Ns), Left),
Partition_Node);
if Get_Source_Name (Runtime) = No_Name then
XTU.Add_Attribute ("ExecutableImageName",
XTU.Add_Attribute
("ExecutableImageName",
Get_Name_String
(AIN.Name
(Identifier
(Parent_Subcomponent
(Runtime)))) & ".exe", Partition_Node);
(AIN.Name (Identifier (Parent_Subcomponent (Runtime)))) &
".exe",
Partition_Node);
else
XTU.Add_Attribute ("ExecutableImageName",
Get_Name_String
(Get_Source_Name (Runtime)), Partition_Node);
XTU.Add_Attribute
("ExecutableImageName",
Get_Name_String (Get_Source_Name (Runtime)),
Partition_Node);
end if;
XTU.Add_Attribute ("MainProcessStackSizeInPages", "1", Partition_Node);
XTU.Add_Attribute ("BreakAtStartup", "no", Partition_Node);
......@@ -1219,20 +1204,22 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
XTU.Add_Attribute ("ExecuteFrom", "RAM", Partition_Node);
XTU.Add_Attribute ("PartitionUsesFPU", "no", Partition_Node);
XTU.Add_Attribute ("ProcessStackSpaceInPages", "6", Partition_Node);
XTU.Add_Attribute ("MinimumProcessStackSizeInBytes",
"512", Partition_Node);
XTU.Add_Attribute ("ProcessQuota",
Trim (Unsigned_Long_Long'Image
(Nb_Threads + 2), Left),
XTU.Add_Attribute
("MinimumProcessStackSizeInBytes",
"512",
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),
XTU.Add_Attribute
("BlackboardQuota",
Trim (Unsigned_Long_Long'Image (Nb_Blackboards), Left),
Partition_Node);
XTU.Add_Attribute ("BlackboardMessageSpaceInBytes",
Trim (Unsigned_Long_Long'Image
(Blackboards_Size), Left),
XTU.Add_Attribute
("BlackboardMessageSpaceInBytes",
Trim (Unsigned_Long_Long'Image (Blackboards_Size), Left),
Partition_Node);
XTU.Add_Attribute ("BufferQuota", "0", Partition_Node);
XTU.Add_Attribute ("BufferMessageSpaceInBytes", "0", Partition_Node);
......@@ -1242,16 +1229,20 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
XTU.Add_Attribute ("MinimumProcessPriority", "1", Partition_Node);
XTU.Add_Attribute ("MaximumProcessPriority", "239", Partition_Node);
XTU.Add_Attribute ("LoggingFunction", "", Partition_Node);
XTU.Add_Attribute ("DeosKernelAttributeAccess",
"no", Partition_Node);
XTU.Add_Attribute ("ProcessStackGapSizeInDwords",
"0", Partition_Node);
XTU.Add_Attribute ("ProcessStackTagIntervalInDwords",
"0", Partition_Node);
XTU.Add_Attribute ("SourcePortSharedMemoryType",
"DeosSharedMemory", Partition_Node);
XTU.Add_Attribute ("PlatformResourcePhysicalAddress",
"0x0", Partition_Node);
XTU.Add_Attribute ("DeosKernelAttributeAccess", "no", Partition_Node);
XTU.Add_Attribute ("ProcessStackGapSizeInDwords", "0", Partition_Node);
XTU.Add_Attribute
("ProcessStackTagIntervalInDwords",
"0",
Partition_Node);
XTU.Add_Attribute
("SourcePortSharedMemoryType",
"DeosSharedMemory",
Partition_Node);
XTU.Add_Attribute
("PlatformResourcePhysicalAddress",
"0x0",
Partition_Node);
XTU.Add_Attribute ("PlatformResourceSizeInPages", "0", Partition_Node);
XTU.Add_Attribute ("PlatformResourceCachePolicy", "off", Partition_Node);
XTU.Add_Attribute ("HealthMonitorEventLogSize", "30", Partition_Node);
......@@ -1263,12 +1254,10 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
-- Map_Port_Name --
-------------------
function Map_Port_Name (E : Node_Id) return Name_Id
is
function Map_Port_Name (E : Node_Id) return Name_Id is
N : Name_Id;
begin
Get_Name_String
(Display_Name (Identifier (E)));
Get_Name_String (Display_Name (Identifier (E)));
N := Name_Find;
return (To_Lower (N));
......
......@@ -47,7 +47,8 @@ package Ocarina.Backends.Deos_Conf.Mapping is
function Map_Data_Size (T : Size_Type) return Unsigned_Long_Long;
function Map_Virtual_Processor (E : Node_Id) return Node_Id;
function Map_Processor (E : Node_Id) return Node_Id;
function Map_Partition (Process : Node_Id;
function Map_Partition
(Process : Node_Id;
Runtime : Node_Id;
Partition_Identifier : Integer;
Nb_Threads : Unsigned_Long_Long;
......@@ -56,8 +57,7 @@ package Ocarina.Backends.Deos_Conf.Mapping is
Nb_Lock_Objects : Unsigned_Long_Long;
Nb_Blackboards : Unsigned_Long_Long;
Blackboards_Size : Unsigned_Long_Long;
Buffers_Size : Unsigned_Long_Long)
return Node_Id;
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;
......
......@@ -84,8 +84,7 @@ package body Ocarina.Backends.Deos_Conf.Naming is
---------------------
procedure Visit_Component (E : Node_Id) is
Category : constant Component_Category :=
Get_Category_Of_Component (E);
Category : constant Component_Category := Get_Category_Of_Component (E);
begin
case Category is
when CC_System =>
......
......@@ -84,21 +84,23 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
procedure Visit_Processor_Instance (E : Node_Id);
procedure Visit_Bus_Instance (E : Node_Id);
procedure Visit_Virtual_Processor_Instance (E : Node_Id);
function Find_Associated_Process (Runtime : Node_Id;
Current_Node : Node_Id := Root_Node)
return Node_Id;
function Find_Associated_Process
(Runtime : Node_Id;
Current_Node : Node_Id := Root_Node) return Node_Id;
function Find_Associated_Memory_Segment
(Process : Node_Id;
Current_Node : Node_Id := Root_Node)
return Node_Id;
Current_Node : Node_Id := Root_Node) return Node_Id;
function Make_Default_Memory_Region return Node_Id;
function Make_Memory_Region (Segment : Node_Id) return Node_Id;
function Hex_Print (Num : in Integer;
function Hex_Print
(Num : in Integer;
Num_Of_Digits : in Positive) return String;
function Hex_Print (Num : in Integer;
Num_Of_Digits : in Positive) return String is
function Hex_Print
(Num : in Integer;
Num_Of_Digits : in Positive) return String
is
Temp_Str : String (1 .. Num_Of_Digits + 5) := (others => '0');
New_Str : String (1 .. Num_Of_Digits) := (others => '0');
First_Digit : Positive;
......@@ -141,8 +143,7 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
-- Make_Memory_Region --
------------------------
function Make_Memory_Region (Segment : Node_Id)
return Node_Id is
function Make_Memory_Region (Segment : Node_Id) return Node_Id is
N : Node_Id;
begin
N := Make_XML_Node ("MemoryRegion");
......@@ -150,17 +151,15 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
XTU.Add_Attribute ("Name", "Initial RAM Pool", N);
XTU.Add_Attribute ("Type", "Initial RAM Pool", N);
XTU.Add_Attribute ("Address",
"0x" & Hex_Print
(Integer
(Get_Base_Address (Segment)), 8),
XTU.Add_Attribute
("Address",
"0x" & Hex_Print (Integer (Get_Base_Address (Segment)), 8),
N);
-- Put (Size_Str, To_Bytes
-- (Get_Memory_Size (Segment)), 16);
XTU.Add_Attribute ("Size",
"0x" & Hex_Print
(Integer (To_Bytes
(Get_Memory_Size (Segment))), 8),
XTU.Add_Attribute
("Size",
"0x" & Hex_Print (Integer (To_Bytes (Get_Memory_Size (Segment))), 8),
N);
XTU.Add_Attribute ("AccessRights", "READ_WRITE", N);
XTU.Add_Attribute ("PlatformMemoryPool", "0", N);
......@@ -172,14 +171,15 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
-- Find_Associated_Process --
-----------------------------
function Find_Associated_Process (Runtime : Node_Id;
Current_Node : Node_Id := Root_Node)
return Node_Id is
function Find_Associated_Process
(Runtime : Node_Id;
Current_Node : Node_Id := Root_Node) return Node_Id
is
T : Node_Id;
S : Node_Id;
begin
if Get_Category_Of_Component (Current_Node) = CC_Process and then
Get_Bound_Processor (Current_Node) = Runtime
if Get_Category_Of_Component (Current_Node) = CC_Process
and then Get_Bound_Processor (Current_Node) = Runtime
then
return Current_Node;
end if;
......@@ -187,8 +187,7 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
if not AINU.Is_Empty (Subcomponents (Current_Node)) then
S := First_Node (Subcomponents (Current_Node));
while Present (S) loop
T := Find_Associated_Process
(Runtime, Corresponding_Instance (S));
T := Find_Associated_Process (Runtime, Corresponding_Instance (S));
if T /= No_Node then
return T;
......@@ -207,13 +206,13 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
function Find_Associated_Memory_Segment
(Process : Node_Id;
Current_Node : Node_Id := Root_Node)
return Node_Id is
Current_Node : Node_Id := Root_Node) return Node_Id
is
T : Node_Id;
S : Node_Id;
begin
if Get_Category_Of_Component (Current_Node) = CC_Memory and then
Get_Bound_Memory (Process) = Current_Node
if Get_Category_Of_Component (Current_Node) = CC_Memory
and then Get_Bound_Memory (Process) = Current_Node
then
return Current_Node;
end if;
......@@ -221,8 +220,10 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
if not AINU.Is_Empty (Subcomponents (Current_Node)) then
S := First_Node (Subcomponents (Current_Node));
while Present (S) loop
T := Find_Associated_Memory_Segment
(Process, Corresponding_Instance (S));
T :=
Find_Associated_Memory_Segment
(Process,
Corresponding_Instance (S));
if T /= No_Node then
return T;
......@@ -315,15 +316,14 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
Process_Nb_Blackboards := Process_Nb_Blackboards + 1;
Process_Blackboards_Size :=
Process_Blackboards_Size +
To_Bytes
(Get_Data_Size
(Corresponding_Instance (F)));
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",
Display_Error
("Communication Pattern not handled",