Commit 9d256c1c authored by julien.delange's avatar julien.delange

* handle connection between processes and device, prototype

   of the pci_minio card now works


git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@974 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent e0cadca1
......@@ -2,6 +2,8 @@ package ocarina_drivers_ni_6071e
public
with Base_Types;
subprogram spg_init
properties
Source_Language => C;
......@@ -10,6 +12,8 @@ end spg_init;
subprogram spg_poller
features
data1 : out parameter Base_Types::Integer;
properties
Source_Language => C;
Source_Name => "__po_hi_c_driver_ni_pcimio_poller";
......@@ -17,6 +21,8 @@ end spg_poller;
thread thr_poller
features
data1 : out data port Base_Types::Integer;
end thr_poller;
thread implementation thr_poller.i
......@@ -24,6 +30,8 @@ calls
mycall : {
pspg : subprogram spg_poller;
};
connections
parameter pspg.data1 -> data1;
properties
Period => 100 ms;
Dispatch_Protocol => Periodic;
......@@ -31,11 +39,15 @@ end thr_poller.i;
abstract driver
features
data1 : out data port Base_Types::Integer;
end driver;
abstract implementation driver.i
subcomponents
poller : thread thr_poller.i;
connections
port poller.data1 -> data1;
end driver.i;
end ocarina_drivers_ni_6071e;
......@@ -1019,10 +1019,6 @@ package body Ocarina.Backends.C_Common.Mapping is
-- For threads, the enumerator name is mapped from the
-- containing process name and the thread subcomponent name.
-- Verifiy that the thread is a subcomponent of a process
pragma Assert (AINU.Is_Process (Parent_Component (E)));
C_Name :=
Display_Name
(Identifier
......
......@@ -51,8 +51,6 @@ with Ocarina.Backends.C_Common.Mapping;
with Ocarina.Backends.PO_HI_C.Runtime;
with Ocarina.Backends.POK_C.Runtime;
with Ocarina.Instances.Queries;
package body Ocarina.Backends.C_Common.Types is
use Ocarina.ME_AADL;
......@@ -67,8 +65,6 @@ package body Ocarina.Backends.C_Common.Types is
use Ocarina.Backends.POK_C;
use Ocarina.Backends.POK_C.Runtime;
use Ocarina.Instances.Queries;
package ATN renames Ocarina.ME_AADL.AADL_Tree.Nodes;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
......@@ -212,27 +208,31 @@ package body Ocarina.Backends.C_Common.Types is
Implementation : Node_Id;
S : Node_Id;
begin
if Get_Current_Backend_Kind /= PolyORB_Kernel_C then
return;
end if;
U := CTN.Distributed_Application_Unit
(CTN.Naming_Node (Backend_Node (Identifier (E))));
if Get_Current_Backend_Kind = PolyORB_Kernel_C then
U := CTN.Distributed_Application_Unit
(CTN.Naming_Node (Backend_Node (Identifier (E))));
P := CTN.Entity (U);
P := CTN.Entity (U);
Push_Entity (P);
Push_Entity (U);
Push_Entity (P);
Push_Entity (U);
end if;
Implementation := Get_Classifier_Property (E, "implemented_as");
Implementation := Get_Implementation (E);
if Implementation /= No_Node then
if not AINU.Is_Empty (AIN.Subcomponents (Implementation)) then
S := First_Node (Subcomponents (Implementation));
while Present (S) loop
if Get_Category_Of_Component (S) = CC_Process then
Visit_Process_Instance
(Corresponding_Instance (S), False);
if Get_Current_Backend_Kind = PolyORB_Kernel_C then
if Get_Category_Of_Component (S) = CC_Process then
Visit_Process_Instance
(Corresponding_Instance (S), False);
end if;
else
Visit
(Corresponding_Instance (S));
end if;
S := Next_Node (S);
......@@ -241,8 +241,10 @@ package body Ocarina.Backends.C_Common.Types is
end if;
Pop_Entity; -- U
Pop_Entity; -- P
if Get_Current_Backend_Kind = PolyORB_Kernel_C then
Pop_Entity; -- U
Pop_Entity; -- P
end if;
end Visit_Device_Instance;
------------------------------
......@@ -739,6 +741,8 @@ package body Ocarina.Backends.C_Common.Types is
U : Node_Id;
P : Node_Id;
Declaration : Node_Id;
The_System : constant Node_Id := Parent_Component
(Parent_Subcomponent (E));
begin
if Real_Process then
U := CTN.Distributed_Application_Unit
......@@ -810,6 +814,26 @@ package body Ocarina.Backends.C_Common.Types is
end loop;
end if;
-- Visit all devices attached to the parent system that
-- share the same processor as process E.
if Get_Current_Backend_Kind = PolyORB_HI_C and then
not AINU.Is_Empty (Subcomponents (The_System)) then
C := First_Node (Subcomponents (The_System));
while Present (C) loop
if AINU.Is_Device (Corresponding_Instance (C))
and then
Get_Bound_Processor (Corresponding_Instance (C))
= Get_Bound_Processor (E)
then
-- Build the enumerator corresponding to the device
-- Note: we reuse the process name XXX
Visit_Device_Instance (Corresponding_Instance (C));
end if;
C := Next_Node (C);
end loop;
end if;
-- We visit all the data of connected components, because
-- we may need them in case of a distributed system.
......@@ -935,7 +959,10 @@ package body Ocarina.Backends.C_Common.Types is
then
null;
else
Visit (Corresponding_Instance (S));
if Get_Category_Of_Component
(Corresponding_Instance (S)) /= CC_Device then
Visit (Corresponding_Instance (S));
end if;
end if;
S := Next_Node (S);
end loop;
......
......@@ -689,7 +689,7 @@ package body Ocarina.Backends.PO_HI_C.Activity is
Call_Parameters := New_List (CTN.K_Parameter_List);
N := Make_Defining_Identifier
(Map_C_Enumerator_Name (S));
(Map_C_Enumerator_Name (S, Current_Device));
Append_Node_To_List (N, Call_Parameters);
N := Make_Defining_Identifier
......@@ -807,7 +807,7 @@ package body Ocarina.Backends.PO_HI_C.Activity is
-- Then, call the send_output in the main loop.
Call_Parameters := New_List (CTN.K_Parameter_List);
N := Make_Defining_Identifier
(Map_C_Enumerator_Name (S));
(Map_C_Enumerator_Name (S, Current_Device));
Append_Node_To_List (N, Call_Parameters);
N := Make_Defining_Identifier
......@@ -1168,7 +1168,7 @@ package body Ocarina.Backends.PO_HI_C.Activity is
Append_Node_To_List
(Make_Defining_Identifier
(Map_C_Enumerator_Name (S)),
(Map_C_Enumerator_Name (S, Current_Device)),
Call_Parameters);
Append_Node_To_List
......@@ -1517,6 +1517,24 @@ package body Ocarina.Backends.PO_HI_C.Activity is
end loop;
end if;
-- Visit all devices attached to the parent system that
-- share the same processor as process E.
if not AAU.Is_Empty (Subcomponents (The_System)) then
S := First_Node (Subcomponents (The_System));
while Present (S) loop
if AAU.Is_Device (Corresponding_Instance (S))
and then
Get_Bound_Processor (Corresponding_Instance (S))
= Get_Bound_Processor (E)
then
Visit_Device_Instance
(Corresponding_Instance (S));
end if;
S := Next_Node (S);
end loop;
end if;
if Present (Backend_Node (Identifier (Parent_Subcomponent
(E)))) and then
Present (CTN.Job_Node (Backend_Node (Identifier
......@@ -1568,6 +1586,10 @@ package body Ocarina.Backends.PO_HI_C.Activity is
Append_Node_To_List (N, CTN.Declarations (Current_File));
end if;
-- If some threads are connected to other nodes, we declare
-- a send_output function that is responsible to send
-- data over the network using device drivers functions.
if Has_Send_Output_Declared then
Append_Node_To_List
(Make_Switch_Alternative
......@@ -1599,27 +1621,6 @@ package body Ocarina.Backends.PO_HI_C.Activity is
Append_Node_To_List (N, CTN.Declarations (Current_File));
end if;
-- If some threads are connected to other nodes, we declare
-- a send_output function that is responsible to send
-- data over the network using device drivers functions.
-- Visit all devices attached to the parent system that
-- share the same processor as process E.
if not AAU.Is_Empty (Subcomponents (The_System)) then
S := First_Node (Subcomponents (The_System));
while Present (S) loop
if AAU.Is_Device (Corresponding_Instance (S))
and then
Get_Bound_Processor (Corresponding_Instance (S))
= Get_Bound_Processor (E)
then
Visit_Device_Instance
(Corresponding_Instance (S));
end if;
S := Next_Node (S);
end loop;
end if;
Pop_Entity; -- U
Pop_Entity; -- P
......@@ -1715,7 +1716,7 @@ package body Ocarina.Backends.PO_HI_C.Activity is
if Kind (F) = K_Port_Spec_Instance then
if Is_Out (F) then
Destinations := Get_Destination_Ports (F);
Destinations := Get_Destination_Ports (F, Current_Device);
Local_Dest_Values := Make_Array_Values;
if AAU.Is_Empty (Destinations) then
......
......@@ -114,7 +114,7 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
Global_Port_Model_Names : Node_Id;
Local_Port_List : List_Id;
Current_Process_Instance : Node_Id := No_Node;
Current_Process_Instance : Node_Id := No_Node;
Global_Port_To_Entity : Node_Id;
Global_Port_To_Local : Node_Id;
......@@ -277,7 +277,6 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
---------------------------
procedure Visit_Device_Instance (E : Node_Id) is
Implementation : constant Node_Id := Get_Implementation (E);
N : Node_Id;
Conf_Str : Name_Id := No_Name;
Tmp_Name : Name_Id;
......@@ -358,16 +357,6 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
end if;
if Implementation /= No_Node then
if not AAU.Is_Empty (AAN.Subcomponents (Implementation)) then
N := First_Node (Subcomponents (Implementation));
while Present (N) loop
Visit_Component_Instance (Corresponding_Instance (N));
N := Next_Node (N);
end loop;
end if;
end if;
Current_Device := No_Node;
end Visit_Device_Instance;
......@@ -394,6 +383,7 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
Parent : Node_Id;
The_System : constant Node_Id := Parent_Component
(Parent_Subcomponent (E));
Device_Implementation : Node_Id;
begin
pragma Assert (AAU.Is_System (Root_Sys));
......@@ -436,6 +426,27 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
-- Note: we reuse the process name XXX
Visit_Device_Instance (Corresponding_Instance (C));
Current_Device := Corresponding_Instance (C);
Device_Implementation :=
Get_Implementation (Corresponding_Instance (C));
if Device_Implementation /= No_Node then
if not AAU.Is_Empty
(AAN.Subcomponents (Device_Implementation)) then
N := First_Node (Subcomponents
(Device_Implementation));
while Present (N) loop
Visit_Component_Instance
(Corresponding_Instance (N));
N := Next_Node (N);
end loop;
end if;
end if;
Current_Device := No_Node;
end if;
C := Next_Node (C);
end loop;
......@@ -1044,7 +1055,10 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
(N, CTN.Values (Global_Port_To_Local));
N := Make_Defining_Identifier
(Map_C_Enumerator_Name (S, Entity => True));
(Map_C_Enumerator_Name
(S,
Entity => True,
Custom_Parent => Current_Device));
Append_Node_To_List
(N, CTN.Values (Global_Port_To_Entity));
......@@ -1083,7 +1097,11 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
end loop;
if Parent_Component (Parent_Subcomponent (E))
= Current_Process_Instance then
= Current_Process_Instance or else
(Current_Device /= No_Node and then
Get_Bound_Processor
(Current_Device) =
Get_Bound_Processor (Current_Process_Instance)) then
N := Make_Define_Statement
(Defining_Identifier =>
Make_Defining_Identifier
......
......@@ -43,6 +43,8 @@ with Ocarina.Backends.C_Tree.Nutils;
with Ocarina.Backends.C_Tree.Nodes;
with Ocarina.Backends.C_Values;
with Ocarina.Backends.Properties;
package body Ocarina.Backends.PO_HI_C.Request is
use Ocarina.ME_AADL;
use Ocarina.ME_AADL.AADL_Instances.Nodes;
......@@ -51,6 +53,7 @@ package body Ocarina.Backends.PO_HI_C.Request is
use Ocarina.Backends.C_Common.Mapping;
use Ocarina.Backends.PO_HI_C.Runtime;
use Ocarina.Backends.C_Tree.Nutils;
use Ocarina.Backends.Properties;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
......@@ -145,6 +148,9 @@ package body Ocarina.Backends.PO_HI_C.Request is
F : Node_Id;
J : Node_Id;
I : Node_Id;
The_System : constant Node_Id := Parent_Component
(Parent_Subcomponent (E));
Device_Implementation : Node_Id;
begin
Push_Entity (P);
Push_Entity (U);
......@@ -160,6 +166,34 @@ package body Ocarina.Backends.PO_HI_C.Request is
Operation_Identifier := 0;
Request_Declared := False;
if not AINU.Is_Empty (Subcomponents (The_System)) then
C := First_Node (Subcomponents (The_System));
while Present (C) loop
if AINU.Is_Device (Corresponding_Instance (C))
and then
Get_Bound_Processor (Corresponding_Instance (C))
= Get_Bound_Processor (E)
then
Device_Implementation :=
Get_Implementation (Corresponding_Instance (C));
if Device_Implementation /= No_Node then
if not AINU.Is_Empty
(AIN.Subcomponents (Device_Implementation)) then
N := First_Node (Subcomponents
(Device_Implementation));
while Present (N) loop
Visit_Component_Instance
(Corresponding_Instance (N));
N := Next_Node (N);
end loop;
end if;
end if;
end if;
C := Next_Node (C);
end loop;
end if;
if not AINU.Is_Empty (Features (E)) then
C := First_Node (Features (E));
......
......@@ -1478,7 +1478,7 @@ package body Ocarina.Backends.Properties is
-- and a null source name and a null source text is a
-- wrong built subprogram.
return Subprogram_Unknown;
return Subprogram_Opaque_C;
end if;
when Language_RTSJ =>
......
......@@ -722,11 +722,14 @@ package body Ocarina.Backends.Utils is
-- Get_Destination_Ports --
---------------------------
function Get_Destination_Ports (P : Node_Id) return List_Id is
function Get_Destination_Ports
(P : Node_Id;
Custom_Parent : Node_Id := No_Node) return List_Id is
function Rec_Get_Destination_Ports
(P : Node_Id;
B : Node_Id := No_Node)
B : Node_Id := No_Node;
Custom_Parent : Node_Id := No_Node)
return List_Id;
-- Recursive internal routine
......@@ -735,8 +738,9 @@ package body Ocarina.Backends.Utils is
-------------------------------
function Rec_Get_Destination_Ports
(P : Node_Id;
B : Node_Id := No_Node)
(P : Node_Id;
B : Node_Id := No_Node;
Custom_Parent : Node_Id := No_Node)
return List_Id
is
Result : constant List_Id := New_List (K_List_Id, No_Location);
......@@ -802,7 +806,17 @@ package body Ocarina.Backends.Utils is
AAU.Append_Node_To_List
(Make_Node_Container (Item (D), B), Result);
elsif Custom_Parent /= No_Node and then
Is_Device (Custom_Parent) and then
Get_Port_By_Name (P, Custom_Parent) /= No_Node then
AAU.Append_Node_To_List
(First_Node
(Rec_Get_Destination_Ports
(Get_Port_By_Name (P, Custom_Parent),
B,
No_Node)),
Result);
else
Display_Located_Error
(Loc (P),
......@@ -816,7 +830,7 @@ package body Ocarina.Backends.Utils is
return Result;
end Rec_Get_Destination_Ports;
begin
return Rec_Get_Destination_Ports (P, No_Node);
return Rec_Get_Destination_Ports (P, No_Node, Custom_Parent);
end Get_Destination_Ports;
----------------------
......
......@@ -131,7 +131,9 @@ package Ocarina.Backends.Utils is
-- Extra_Item of the node container corresponding to the
-- destination.
function Get_Destination_Ports (P : Node_Id) return List_Id;
function Get_Destination_Ports
(P : Node_Id;
Custom_Parent : Node_Id := No_Node) return List_Id;
-- Return a node container list of all the THREAD IN ports that
-- are endpoint sources of the OUT port P. If the connection path
-- between P and one of its destinations involves a connection
......
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