Commit e6a977f7 authored by Julien's avatar Julien
Browse files

Generation of DeOS configuration works

parent c1b6edcd
......@@ -21,6 +21,7 @@ package body Ocarina.Backends.Deos_Conf.Hm is
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;
HM_Node : Node_Id := No_Node;
......@@ -33,6 +34,14 @@ 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;
Identifier : String;
Description : String);
procedure Add_Error_Action (XML_Node : Node_Id;
Identifier : String;
Level : String;
Action : String);
-----------
-- Visit --
-----------
......@@ -138,14 +147,51 @@ package body Ocarina.Backends.Deos_Conf.Hm is
null;
end Visit_Bus_Instance;
------------------------
-- Add_System_Error --
------------------------
procedure Add_System_Error (XML_Node : Node_Id;
Identifier : String;
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));
end Add_System_Error;
------------------------
-- Add_Error_Action --
------------------------
procedure Add_Error_Action (XML_Node : Node_Id;
Identifier : String;
Level : String;
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));
end Add_Error_Action;
------------------------------
-- Visit_Processor_Instance --
------------------------------
procedure Visit_Processor_Instance (E : Node_Id) is
S : Node_Id;
U : Node_Id;
P : Node_Id;
S : Node_Id;
U : Node_Id;
P : Node_Id;
System_Errors : Node_Id;
Multi_Partition_HM : Node_Id;
Partition_HM : Node_Id;
begin
U := XTN.Unit (Backend_Node (Identifier (E)));
P := XTN.Node (Backend_Node (Identifier (E)));
......@@ -155,12 +201,70 @@ package body Ocarina.Backends.Deos_Conf.Hm is
Current_XML_Node := XTN.Root_Node (XTN.XML_File (U));
--
-- For now, just generate the default HM policy.
--
HM_Node := Make_XML_Node ("HealthMonitoring");
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));
Add_System_Error (System_Errors, "1", "processorSpecific");
Add_System_Error (System_Errors, "2", "floatingPoint");
Add_System_Error (System_Errors, "3", "accessViolation");
Add_System_Error (System_Errors, "4", "powerTransient");
Add_System_Error (System_Errors, "5", "platformSpecific");
Add_System_Error (System_Errors, "6", "frameResync");
Add_System_Error (System_Errors, "7", "deadlineMissed");
Add_System_Error (System_Errors, "8", "applicationError");
Add_System_Error (System_Errors, "9", "illegalRequest");
Add_System_Error (System_Errors, "10", "stackOverflow");
--
-- The MultiPartitionHM
--
Multi_Partition_HM := Make_XML_Node ("MultiPartitionHM");
XTU.Add_Attribute ("TableIdentifier", "1", Multi_Partition_HM);
XTU.Add_Attribute ("TableName",
"default MultiPartitionHM",
Multi_Partition_HM);
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");
Add_Error_Action (Multi_Partition_HM, "4", "MODULE", "IGNORE");
Add_Error_Action (Multi_Partition_HM, "5", "MODULE", "IGNORE");
Add_Error_Action (Multi_Partition_HM, "6", "MODULE", "IGNORE");
Add_Error_Action (Multi_Partition_HM, "7", "MODULE", "IGNORE");
Add_Error_Action (Multi_Partition_HM, "8", "MODULE", "IGNORE");
Add_Error_Action (Multi_Partition_HM, "9", "MODULE", "IGNORE");
Add_Error_Action (Multi_Partition_HM, "10", "MODULE", "IGNORE");
--
-- The PartitionHM
--
Partition_HM := Make_XML_Node ("PartitionHM");
Append_Node_To_List
(Partition_HM,
XTN.Subitems (HM_Node));
XTU.Add_Attribute ("TableIdentifier", "1", Partition_HM);
XTU.Add_Attribute ("TableName", "1", Partition_HM);
XTU.Add_Attribute ("MultiPartitionHMTableNameRef",
"default MultiPartitionHM",
Partition_HM);
if not AINU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
while Present (S) loop
......
......@@ -146,7 +146,8 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
XTU.Add_Attribute ("hmShutdownHyperstartIndex", "2", Root);
XTU.Add_Attribute ("minimumWindowDurationInNs", "100000", Root);
XTU.Add_Attribute ("hmShutdownRegistry", "platreg.bin", Root);
XTU.Add_Attribute ("xsi.schemaLocation", "deos653.xsd", 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", "http://ddci.com/ARINC653", Root);
......
......@@ -26,7 +26,7 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
Root_Node : Node_Id := No_Node;
Partitions_Node : Node_Id := No_Node;
Memory_Regions : Node_Id := No_Node;
Partition_Identifier : Integer := 0;
Partition_Identifier : Integer := 1;
procedure Visit_Architecture_Instance (E : Node_Id);
procedure Visit_Component_Instance (E : Node_Id);
......@@ -213,7 +213,7 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
Push_Entity (P);
Push_Entity (U);
Partition_Identifier := 0;
Partition_Identifier := 1;
Current_XML_Node := XTN.Root_Node (XTN.XML_File (U));
......@@ -240,20 +240,6 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
end loop;
end if;
--
-- Then, make the <MemoryRegions> nodes
--
Memory_Regions := Make_XML_Node ("MemoryRegions");
Append_Node_To_List
(Make_Default_Memory_Region,
XTN.Subitems (Memory_Regions));
Append_Node_To_List
(Memory_Regions,
XTN.Subitems (Partitions_Node));
Pop_Entity;
Pop_Entity;
end Visit_Processor_Instance;
......@@ -265,15 +251,38 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
procedure Visit_Virtual_Processor_Instance (E : Node_Id) is
S : Node_Id;
Corresponding_Process : Node_Id := No_Node;
Partition_Node : Node_Id;
begin
Corresponding_Process := Find_Associated_Process (E);
if Corresponding_Process /= No_Node then
Append_Node_To_List
(Map_Partition (Corresponding_Process,
--
-- First, we create the description of the partition.
--
Partition_Node := Map_Partition (Corresponding_Process,
E,
Partition_Identifier),
Partition_Identifier);
Append_Node_To_List
(Partition_Node,
XTN.Subitems (Partitions_Node));
--
-- Then, we associate the partition with memory region
--
Memory_Regions := Make_XML_Node ("MemoryRegions");
--
-- FIXME: for now, we associate with the default
-- memory. Has to work to get the AADL memory component.
--
Append_Node_To_List
(Make_Default_Memory_Region,
XTN.Subitems (Memory_Regions));
Append_Node_To_List
(Memory_Regions,
XTN.Subitems (Partition_Node));
end if;
if not AINU.Is_Empty (Subcomponents (E)) then
......
......@@ -199,7 +199,7 @@ package body Ocarina.Backends.Deos_Conf.Schedule is
XTU.Add_Attribute ("Duration", "6000000", Time_Window_Node);
XTU.Add_Attribute ("Offset", "0", Time_Window_Node);
XTU.Add_Attribute ("PeriodicProcessingStart", "", Time_Window_Node);
XTU.Add_Attribute ("PeriodicProcessingStart", "true", Time_Window_Node);
XTU.Add_Attribute ("RepeatWindowAtNanosecondInterval",
"PartitionPeriod", Time_Window_Node);
XTU.Add_Attribute ("InhibitEarlyCompletion", "false", Time_Window_Node);
......
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