Commit ffe3e41f authored by Julien's avatar Julien

Continue the work on the Vxworks653 configuration file

parent 01762e11
......@@ -1087,31 +1087,22 @@ package body Ocarina.Backends.Vxworks653_Conf.Mapping is
return Node_Id is
pragma Unreferenced (Nb_Buffers);
pragma Unreferenced (Nb_Events);
pragma Unreferenced (Nb_Threads);
pragma Unreferenced (Nb_Blackboards);
pragma Unreferenced (Blackboards_Size);
pragma Unreferenced (Nb_Lock_Objects);
pragma Unreferenced (Buffers_Size);
pragma Unreferenced (Process);
Partition_Node : Node_Id;
Partition_Period : Time_Type;
Partition_Duration : Time_Type;
Period_Ns : Unsigned_Long_Long;
Duration_Ns : Unsigned_Long_Long;
Partition_Description_Node : Node_Id;
Application_Node : Node_Id;
Shared_Library_Region_Node : Node_Id;
Settings_Node : Node_Id;
begin
Partition_Period := Get_Period (Runtime);
Partition_Duration := Get_Execution_Time (Runtime);
if Partition_Period = Null_Time then
Period_Ns := 0;
else
Period_Ns := To_Nanoseconds (Partition_Period);
end if;
if Partition_Duration = Null_Time then
Duration_Ns := 0;
else
Duration_Ns := To_Nanoseconds (Partition_Duration);
end if;
Partition_Node := Make_XML_Node ("Partition");
Partition_Description_Node := Make_XML_Node ("PartitionDescription");
Append_Node_To_List (Partition_Description_Node,
XTN.Subitems (Partition_Node));
XTU.Add_Attribute ("Name",
Get_Name_String
......@@ -1125,74 +1116,46 @@ package body Ocarina.Backends.Vxworks653_Conf.Mapping is
-- see http://rosettacode.org/wiki/
-- Strip_whitespace_from_a_string/Top_and_tail#Ada
--
XTU.Add_Attribute ("Identifier",
XTU.Add_Attribute ("Id",
Trim (Integer'Image (Partition_Identifier), Left),
Partition_Node);
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),
Partition_Node);
XTU.Add_Attribute ("ExecutableImageName",
Settings_Node := Make_XML_Node ("Settings");
Append_Node_To_List (Settings_Node,
XTN.Subitems (Partition_Description_Node));
XTU.Add_Attribute ("RequiredMemorySize", "0x300000", Settings_Node);
XTU.Add_Attribute ("PartitionHMTable", "part1Hm", Settings_Node);
XTU.Add_Attribute ("watchDogDuration", "0", Settings_Node);
XTU.Add_Attribute ("allocDisable", "0", Settings_Node);
XTU.Add_Attribute ("numWorkerTasks", "0", Settings_Node);
XTU.Add_Attribute ("numStackGuardPages", "0xffffffff", Settings_Node);
XTU.Add_Attribute ("isrStackSize", "0xffffffff", Settings_Node);
XTU.Add_Attribute ("selScrQSize", "0xffffffff", Settings_Node);
XTU.Add_Attribute ("syscallPermissions", "0xffffffff", Settings_Node);
XTU.Add_Attribute ("numFiles", "0xffffffff", Settings_Node);
XTU.Add_Attribute ("numDrivers", "0xffffffff", Settings_Node);
XTU.Add_Attribute ("numLogMsgs", "0xffffffff", Settings_Node);
XTU.Add_Attribute ("maxGlobalFDs", "10", Settings_Node);
XTU.Add_Attribute ("fpExcEnable", "1", Settings_Node);
XTU.Add_Attribute ("maxEventQStallDuration", "INFINITE_TIME",
Settings_Node);
Shared_Library_Region_Node := Make_XML_Node ("SharedLibraryRegion");
XTU.Add_Attribute ("NamedRef", "vxSysLib", Shared_Library_Region_Node);
Append_Node_To_List (Shared_Library_Region_Node,
XTN.Subitems (Partition_Description_Node));
Application_Node := Make_XML_Node ("Application");
Append_Node_To_List (Application_Node,
XTN.Subitems (Partition_Description_Node));
XTU.Add_Attribute ("NameRef",
Get_Name_String
(AIN.Name
(Identifier
(Parent_Subcomponent
(Runtime)))) & ".exe", Partition_Node);
XTU.Add_Attribute ("MainProcessStackSizeInPages", "1", Partition_Node);
XTU.Add_Attribute ("BreakAtStartup", "no", Partition_Node);
XTU.Add_Attribute ("InDebugSet", "no", Partition_Node);
XTU.Add_Attribute ("MapConfigurationFileTo", "RAM", Partition_Node);
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),
Partition_Node);
XTU.Add_Attribute ("BlackboardQuota",
Trim (Unsigned_Long_Long'Image
(Nb_Blackboards), Left),
Partition_Node);
(Runtime)))),
Partition_Node);
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);
XTU.Add_Attribute ("SemaphoreQuota", "0", Partition_Node);
XTU.Add_Attribute ("EventQuota", "1", Partition_Node);
XTU.Add_Attribute ("MaximumPartitionLockLevel", "16", Partition_Node);
XTU.Add_Attribute ("MinimumProcessPriority", "1", Partition_Node);
XTU.Add_Attribute ("MaximumProcessPriority", "239", Partition_Node);
XTU.Add_Attribute ("LoggingFunction", "", Partition_Node);
XTU.Add_Attribute ("Vxworks653KernelAttributeAccess",
"no", Partition_Node);
XTU.Add_Attribute ("ProcessStackGapSizeInDwords",
"0", Partition_Node);
XTU.Add_Attribute ("ProcessStackTagIntervalInDwords",
"0", Partition_Node);
XTU.Add_Attribute ("SourcePortSharedMemoryType",
"Vxworks653SharedMemory", 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);
XTU.Add_Attribute ("EventLoggingEnabled", "yes", Partition_Node);
return Partition_Node;
end Map_Partition;
......
-- with Ada.Strings; use Ada.Strings;
-- with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Text_IO;
with Ada.Integer_Text_IO;
with Ocarina.Backends.Messages;
with Ocarina.ME_AADL;
with Ocarina.ME_AADL.AADL_Instances.Nodes;
......@@ -16,8 +14,6 @@ with Ocarina.Backends.Vxworks653_Conf.Mapping;
package body Ocarina.Backends.Vxworks653_Conf.Partitions is
use Ada.Text_IO;
use Ada.Integer_Text_IO;
use Ocarina.ME_AADL;
use Ocarina.Backends.Utils;
......@@ -31,11 +27,9 @@ package body Ocarina.Backends.Vxworks653_Conf.Partitions is
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;
Process_Nb_Threads : Unsigned_Long_Long := 0;
Process_Nb_Buffers : Unsigned_Long_Long := 0;
......@@ -56,86 +50,6 @@ package body Ocarina.Backends.Vxworks653_Conf.Partitions is
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;
function Make_Default_Memory_Region return Node_Id;
function Make_Memory_Region (Segment : Node_Id) return Node_Id;
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
Temp_Str : String (1 .. Num_Of_Digits + 5) := (others => '0');
New_Str : String (1 .. Num_Of_Digits) := (others => '0');
First_Digit : Positive;
begin
Put (To => Temp_Str, Item => Num, Base => 16);
for I in 1 .. Num_Of_Digits + 4 loop
if Temp_Str (I) = '#' then
First_Digit := I + 1;
exit;
end if;
end loop;
New_Str (First_Digit - 4 .. Num_Of_Digits) :=
Temp_Str (First_Digit .. Num_Of_Digits + 4);
return New_Str;
end Hex_Print;
--------------------------------
-- Make_Default_Memory_Region --
--------------------------------
function Make_Default_Memory_Region return Node_Id is
N : Node_Id;
begin
N := Make_XML_Node ("MemoryRegion");
XTU.Add_Attribute ("Name", "Initial RAM Pool", N);
XTU.Add_Attribute ("Type", "Initial RAM Pool", N);
XTU.Add_Attribute ("Address", "0x0", N);
XTU.Add_Attribute ("Size", "0x19000", N);
XTU.Add_Attribute ("AccessRights", "READ_WRITE", N);
XTU.Add_Attribute ("PlatformMemoryPool", "0", N);
return N;
end Make_Default_Memory_Region;
------------------------
-- Make_Memory_Region --
------------------------
function Make_Memory_Region (Segment : Node_Id)
return Node_Id is
N : Node_Id;
begin
N := Make_XML_Node ("MemoryRegion");
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),
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),
N);
XTU.Add_Attribute ("AccessRights", "READ_WRITE", N);
XTU.Add_Attribute ("PlatformMemoryPool", "0", N);
return N;
end Make_Memory_Region;
-----------------------------
-- Find_Associated_Process --
......@@ -170,40 +84,6 @@ package body Ocarina.Backends.Vxworks653_Conf.Partitions is
return No_Node;
end Find_Associated_Process;
------------------------------------
-- Find_Associated_Memory_Segment --
------------------------------------
function Find_Associated_Memory_Segment
(Process : 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_Memory and then
Get_Bound_Memory (Process) = Current_Node
then
return Current_Node;
end if;
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));
if T /= No_Node then
return T;
end if;
S := Next_Node (S);
end loop;
end if;
return No_Node;
end Find_Associated_Memory_Segment;
-----------
-- Visit --
-----------
......@@ -406,12 +286,8 @@ package body Ocarina.Backends.Vxworks653_Conf.Partitions is
procedure Visit_Virtual_Processor_Instance (E : Node_Id) is
S : Node_Id;
F : Node_Id;
Corresponding_Process : Node_Id := No_Node;
Memory_Segment : Node_Id := No_Node;
Partition_Node : Node_Id;
Sampling_Ports : Node_Id := No_Node;
Queuing_Ports : Node_Id := No_Node;
begin
Corresponding_Process := Find_Associated_Process (E);
......@@ -444,81 +320,6 @@ package body Ocarina.Backends.Vxworks653_Conf.Partitions is
(Partition_Node,
XTN.Subitems (Partitions_Node));
--
-- Then, we associate the partition with memory region
--
Memory_Regions := Make_XML_Node ("MemoryRegions");
Memory_Segment := Find_Associated_Memory_Segment
(Corresponding_Process);
if Memory_Segment = No_Node then
Append_Node_To_List
(Make_Default_Memory_Region,
XTN.Subitems (Memory_Regions));
else
Append_Node_To_List
(Make_Memory_Region (Memory_Segment),
XTN.Subitems (Memory_Regions));
end if;
Append_Node_To_List
(Memory_Regions,
XTN.Subitems (Partition_Node));
--
-- Then, we configure the inter-partitions communication
-- ports (sampling/queueing).
--
if not AINU.Is_Empty (Features (Corresponding_Process)) then
Sampling_Ports := Make_XML_Node ("SamplingPorts");
Queuing_Ports := Make_XML_Node ("QueuingPorts");
F := First_Node (Features (Corresponding_Process));
while Present (F) loop
if Kind (F) = K_Port_Spec_Instance
and then Get_Connection_Pattern (F) = Inter_Process
then
if Is_Data (F) and then not Is_Event (F)
and then not (Is_In (F) and then Is_Out (F))
then
Append_Node_To_List
(Map_Sampling_Port (F),
XTN.Subitems (Sampling_Ports));
end if;
if Is_Data (F) and then Is_Event (F)
and then not (Is_In (F) and then Is_Out (F))
then
Append_Node_To_List
(Map_Queuing_Port (F),
XTN.Subitems (Queuing_Ports));
end if;
end if;
F := Next_Node (F);
end loop;
end if;
if Sampling_Ports /= No_Node and then
XTN.Subitems (Sampling_Ports) /= No_List
then
Append_Node_To_List
(Sampling_Ports,
XTN.Subitems (Partition_Node));
end if;
if Queuing_Ports /= No_Node and then
XTN.Subitems (Queuing_Ports) /= No_List
then
Append_Node_To_List
(Queuing_Ports,
XTN.Subitems (Partition_Node));
end if;
Partition_Identifier := Partition_Identifier + 1;
end if;
......
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