Commit 0ca21888 authored by yoogx's avatar yoogx
Browse files

* Remove deactivated code

        For openaadl/ocarina#160
parent 964a1a8e
......@@ -33,79 +33,20 @@ with Ocarina.Namet; use Ocarina.Namet;
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.XML_Common.Mapping;
with Ocarina.Backends.XML_Values;
with Ocarina.Backends.XML_Tree.Nodes;
with Ocarina.Backends.XML_Tree.Nutils;
package body Ocarina.Backends.AIR_Conf.Mapping is
use Ocarina.ME_AADL;
use Ocarina.ME_AADL.AADL_Instances.Nodes;
use Ocarina.ME_AADL.AADL_Instances.Entities;
use Ocarina.Backends.Utils;
use Ocarina.Backends.XML_Common.Mapping;
use Ocarina.Backends.XML_Tree.Nodes;
use Ocarina.Backends.XML_Tree.Nutils;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package XV renames Ocarina.Backends.XML_Values;
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
-------------------
-- Map_Scheduler --
-------------------
procedure Map_Scheduler (E : Node_Id; N : Node_Id) is
Scheduler : Supported_POK_Scheduler;
R : Node_Id;
Q : Node_Id;
begin
Scheduler := Get_POK_Scheduler (E);
Set_Str_To_Name_Buffer ("scheduler");
R := Make_Defining_Identifier (Name_Find);
if Scheduler = RMS then
Set_Str_To_Name_Buffer ("rms");
elsif Scheduler = EDF then
Set_Str_To_Name_Buffer ("edf");
elsif Scheduler = Static then
Set_Str_To_Name_Buffer ("static");
else
Set_Str_To_Name_Buffer ("unknown");
end if;
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (R, Q), XTN.Items (N));
end Map_Scheduler;
---------------------------------
-- Map_Distributed_Application --
---------------------------------
function Map_Distributed_Application (E : Node_Id) return Node_Id is
D : constant Node_Id := New_Node (XTN.K_HI_Distributed_Application);
begin
pragma Assert (AINU.Is_System (E) or else AINU.Is_Processor (E));
-- Update the global variable to be able to fetch the root of
-- the distributed application and generate the source files.
XML_Root := D;
XTN.Set_Name (D, To_XML_Name (AIN.Name (AIN.Identifier (E))));
XTN.Set_Units (D, New_List (XTN.K_List_Id));
XTN.Set_HI_Nodes (D, New_List (XTN.K_List_Id));
return D;
end Map_Distributed_Application;
-----------------
-- Map_HI_Node --
-----------------
......@@ -196,719 +137,4 @@ package body Ocarina.Backends.AIR_Conf.Mapping is
return U;
end Map_HI_Unit;
-------------------------
-- Map_Port_Connection --
-------------------------
function Map_Port_Connection (E : Node_Id) return Node_Id is
N : Node_Id;
R : Node_Id;
Q : Node_Id;
Src : Node_Id;
Dst : Node_Id;
begin
N := Make_XML_Node ("Connection");
Set_Str_To_Name_Buffer ("type");
R := Make_Defining_Identifier (Name_Find);
if Get_Category_Of_Connection (E) = CT_Data then
if Get_Category_Of_Connection (E) = CT_Event then
Set_Str_To_Name_Buffer ("eventdata");
else
Set_Str_To_Name_Buffer ("data");
end if;
elsif Get_Category_Of_Connection (E) = CT_Event then
Set_Str_To_Name_Buffer ("event");
end if;
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (R, Q), XTN.Items (N));
Src := Item (AIN.First_Node (Path (Source (E))));
Dst := Item (AIN.First_Node (Path (Destination (E))));
R :=
Make_Defining_Identifier
(To_XML_Name (Display_Name (Identifier (Src))));
Set_Str_To_Name_Buffer ("src");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (Q, R), XTN.Items (N));
R :=
Make_Defining_Identifier
(To_XML_Name (Display_Name (Identifier (Dst))));
Set_Str_To_Name_Buffer ("dst");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (Q, R), XTN.Items (N));
return N;
end Map_Port_Connection;
--------------------
-- Map_Bus_Access --
--------------------
function Map_Bus_Access (E : Node_Id) return Node_Id is
N : Node_Id;
R : Node_Id;
Q : Node_Id;
Src : Node_Id;
Dst : Node_Id;
begin
N := Make_XML_Node ("access");
Set_Str_To_Name_Buffer ("type");
R := Make_Defining_Identifier (Name_Find);
Set_Str_To_Name_Buffer ("bus");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (R, Q), XTN.Items (N));
Src := Item (AIN.First_Node (Path (Source (E))));
Dst := Item (AIN.First_Node (Path (Destination (E))));
R :=
Make_Defining_Identifier
(To_XML_Name (Display_Name (Identifier (Src))));
Set_Str_To_Name_Buffer ("src");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (Q, R), XTN.Items (N));
R :=
Make_Defining_Identifier
(To_XML_Name (Display_Name (Identifier (Dst))));
Set_Str_To_Name_Buffer ("dst");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (Q, R), XTN.Items (N));
return N;
end Map_Bus_Access;
---------------------
-- Map_Data_Access --
---------------------
function Map_Data_Access (E : Node_Id) return Node_Id is
N : Node_Id;
R : Node_Id;
Q : Node_Id;
Src : Node_Id;
Dst : Node_Id;
begin
N := Make_XML_Node ("access");
Set_Str_To_Name_Buffer ("type");
R := Make_Defining_Identifier (Name_Find);
Set_Str_To_Name_Buffer ("data");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (R, Q), XTN.Items (N));
Src := Item (AIN.First_Node (Path (Source (E))));
Dst := Item (AIN.First_Node (Path (Destination (E))));
R :=
Make_Defining_Identifier
(To_XML_Name (Display_Name (Identifier (Src))));
Set_Str_To_Name_Buffer ("src");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (Q, R), XTN.Items (N));
R :=
Make_Defining_Identifier
(To_XML_Name (Display_Name (Identifier (Dst))));
Set_Str_To_Name_Buffer ("dst");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (Q, R), XTN.Items (N));
return N;
end Map_Data_Access;
----------------
-- Map_System --
----------------
function Map_System (E : Node_Id) return Node_Id is
N : Node_Id;
Q : Node_Id;
P : Node_Id;
begin
N := Make_XML_Node ("ARINC653_Module");
-- Set the name of the system
P := Make_Defining_Identifier (To_XML_Name (AIN.Name (Identifier (E))));
Set_Str_To_Name_Buffer ("ModuleName");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N));
return N;
end Map_System;
-----------------
-- Map_Process --
-----------------
function Map_Process
(E : Node_Id;
Partition_Identifier : Unsigned_Long_Long) return Node_Id
is
N : Node_Id;
P : Node_Id;
Q : Node_Id;
begin
N := Make_XML_Node ("Partition");
P :=
Make_Defining_Identifier
(To_XML_Name (Display_Name (Identifier (Parent_Subcomponent (E)))));
Set_Str_To_Name_Buffer ("PartitionName");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N));
P := Make_Literal (XV.New_Numeric_Value (Partition_Identifier, 1, 10));
Set_Str_To_Name_Buffer ("PartitionIdentifier");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N));
AIN.Set_Backend_Node (Identifier (E), Copy_Node (P));
Set_Str_To_Name_Buffer ("main");
P := Make_Defining_Identifier (Name_Find);
Set_Str_To_Name_Buffer ("EntryPoint");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N));
Set_Str_To_Name_Buffer ("true");
P := Make_Defining_Identifier (Name_Find);
Set_Str_To_Name_Buffer ("SystemPartition");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N));
return N;
end Map_Process;
-------------------
-- Map_Processor --
-------------------
function Map_Processor (E : Node_Id) return Node_Id is
N : Node_Id;
P : Node_Id;
Q : Node_Id;
begin
N := Make_XML_Node ("processor");
P :=
Make_Defining_Identifier
(To_XML_Name (Display_Name (Identifier (Parent_Subcomponent (E)))));
Set_Str_To_Name_Buffer ("name");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N));
Map_Scheduler (E, N);
return N;
end Map_Processor;
-------------
-- Map_Bus --
-------------
function Map_Bus (E : Node_Id) return Node_Id is
N : Node_Id;
P : Node_Id;
Q : Node_Id;
begin
N := Make_XML_Node ("bus");
P :=
Make_Defining_Identifier
(To_XML_Name (Display_Name (Identifier (Parent_Subcomponent (E)))));
Set_Str_To_Name_Buffer ("name");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N));
return N;
end Map_Bus;
---------------------------
-- Map_Virtual_Processor --
---------------------------
function Map_Virtual_Processor (E : Node_Id) return Node_Id is
N : Node_Id;
P : Node_Id;
Q : Node_Id;
begin
N := Make_XML_Node ("virtual_processor");
P :=
Make_Defining_Identifier
(To_XML_Name (Display_Name (Identifier (Parent_Subcomponent (E)))));
Set_Str_To_Name_Buffer ("name");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N));
Map_Scheduler (E, N);
return N;
end Map_Virtual_Processor;
--------------
-- Map_Data --
--------------
function Map_Data (E : Node_Id) return Node_Id is
N : Node_Id;
P : Node_Id;
Q : Node_Id;
begin
N := Make_XML_Node ("data");
P :=
Make_Defining_Identifier
(To_XML_Name (Display_Name (Identifier (Parent_Subcomponent (E)))));
Set_Str_To_Name_Buffer ("name");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (Q, P), XTN.Items (N));
return N;
end Map_Data;
--------------------
-- Map_Connection --
--------------------
function Map_Connection
(Connection : Node_Id;
Channel_Identifier : Unsigned_Long_Long) return Node_Id
is
Channel_Node : Node_Id;
Source_Node : Node_Id;
Destination_Node : Node_Id;
P : Node_Id;
N : Node_Id;
Q : Node_Id;
Source_Port_Name : Name_Id;
Destination_Port_Name : Name_Id;
Source_Component_Name : Name_Id;
Destination_Component_Name : Name_Id;
Partition_Source : Node_Id;
Partition_Destination : Node_Id;
begin
Channel_Node := Make_XML_Node ("Channel");
Source_Node := Make_XML_Node ("Source");
Destination_Node := Make_XML_Node ("Destination");
Set_Str_To_Name_Buffer ("ChannelIdentifier");
P := Make_Defining_Identifier (Name_Find);
Q := Make_Literal (XV.New_Numeric_Value (Channel_Identifier, 1, 10));
Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (Channel_Node));
N := Make_XML_Node ("Standard_Partition");
Partition_Source :=
AIN.Corresponding_Instance
(AIN.Item (AIN.First_Node (AIN.Path (AIN.Source (Connection)))));
Partition_Destination :=
AIN.Corresponding_Instance
(AIN.Item
(AIN.First_Node (AIN.Path (AIN.Destination (Connection)))));
Source_Component_Name :=
AIN.Name
(AIN.Identifier
(AIN.Item (AIN.First_Node (AIN.Path (AIN.Source (Connection))))));
Source_Port_Name :=
AIN.Name
(AIN.Identifier
(AIN.Item
(AIN.Next_Node
(AIN.First_Node (AIN.Path (AIN.Source (Connection)))))));
Set_Str_To_Name_Buffer ("PortName");
P := Make_Defining_Identifier (Name_Find);
Q := Make_Defining_Identifier (To_XML_Name (Source_Port_Name));
Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N));
Set_Str_To_Name_Buffer ("PartitionName");
P := Make_Defining_Identifier (Name_Find);
Q := Make_Defining_Identifier (To_XML_Name (Source_Component_Name));
Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N));
if Present (Backend_Node (Identifier (Partition_Source))) then
Set_Str_To_Name_Buffer ("PartitionIdentifier");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List
(Make_Assignement
(Q,
Copy_Node (Backend_Node (Identifier (Partition_Source)))),
XTN.Items (N));
end if;
Append_Node_To_List (N, XTN.Subitems (Source_Node));
Destination_Component_Name :=
AIN.Name
(AIN.Identifier
(AIN.Item
(AIN.First_Node (AIN.Path (AIN.Destination (Connection))))));
Destination_Port_Name :=
AIN.Name
(AIN.Identifier
(AIN.Item
(AIN.Next_Node
(AIN.First_Node
(AIN.Path (AIN.Destination (Connection)))))));
N := Make_XML_Node ("Standard_Partition");
Set_Str_To_Name_Buffer ("PortName");
P := Make_Defining_Identifier (Name_Find);
Q := Make_Defining_Identifier (To_XML_Name (Destination_Port_Name));
Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N));
Set_Str_To_Name_Buffer ("PartitionName");
P := Make_Defining_Identifier (Name_Find);
Q := Make_Defining_Identifier (To_XML_Name (Destination_Component_Name));
Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N));
if Present (Backend_Node (Identifier (Partition_Destination))) then
Set_Str_To_Name_Buffer ("PartitionIdentifier");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List
(Make_Assignement
(Q,
Copy_Node (Backend_Node (Identifier (Partition_Destination)))),
XTN.Items (N));
end if;
Append_Node_To_List (N, XTN.Subitems (Destination_Node));
Append_Node_To_List (Source_Node, XTN.Subitems (Channel_Node));
Append_Node_To_List (Destination_Node, XTN.Subitems (Channel_Node));
return Channel_Node;
end Map_Connection;
------------------------
-- Map_Process_Memory --
------------------------
function Map_Process_Memory (Process : Node_Id) return Node_Id is
N : Node_Id;
M : Node_Id;
P : Node_Id;
Q : Node_Id;
Memory : Node_Id;
begin
N := Make_XML_Node ("Partition_Memory");
Set_Str_To_Name_Buffer ("PartitionName");
P := Make_Defining_Identifier (Name_Find);
Q :=
Make_Defining_Identifier
(To_XML_Name
(Display_Name (Identifier (Parent_Subcomponent (Process)))));
Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N));
if Present (Backend_Node (Identifier (Process))) then
Set_Str_To_Name_Buffer ("PartitionIdentifier");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List
(Make_Assignement
(Q,
Copy_Node (Backend_Node (Identifier (Process)))),
XTN.Items (N));
end if;
if Get_Data_Size (Process) /= Null_Size then
M := Make_XML_Node ("Memory_Requirements");
Set_Str_To_Name_Buffer ("SizeBytes");
P := Make_Defining_Identifier (Name_Find);
Q :=
Make_Literal
(XV.New_Numeric_Value
(To_Bytes (Get_Data_Size (Process)),
1,
10));
Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (M));
Set_Str_To_Name_Buffer ("Type");
P := Make_Defining_Identifier (Name_Find);
Set_Str_To_Name_Buffer ("DATA");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (M));
Set_Str_To_Name_Buffer ("Access");
P := Make_Defining_Identifier (Name_Find);
Set_Str_To_Name_Buffer ("READ-WRITE");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (M));
Append_Node_To_List (M, XTN.Subitems (N));
end if;
if Get_Code_Size (Process) /= Null_Size then
M := Make_XML_Node ("Memory_Requirements");
Set_Str_To_Name_Buffer ("SizeBytes");
P := Make_Defining_Identifier (Name_Find);
Q :=
Make_Literal
(XV.New_Numeric_Value
(To_Bytes (Get_Code_Size (Process)),
1,
10));
Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (M));
Set_Str_To_Name_Buffer ("Type");
P := Make_Defining_Identifier (Name_Find);
Set_Str_To_Name_Buffer ("CODE");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (M));
Set_Str_To_Name_Buffer ("Access");
P := Make_Defining_Identifier (Name_Find);
Set_Str_To_Name_Buffer ("READ-WRITE");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (M));
Append_Node_To_List (M, XTN.Subitems (N));
end if;
if Get_Bound_Memory (Process) /= No_Node then
Memory := Get_Bound_Memory (Process);
declare
Byte_Count : Unsigned_Long_Long := 1;
Word_Size : Unsigned_Long_Long := 1;
begin
if Get_Byte_Count (Get_Bound_Memory (Process)) /= 0 then
Byte_Count := Get_Byte_Count (Get_Bound_Memory (Process));