Commit f535edb6 authored by julien.delange's avatar julien.delange

* Declare maccro for driver inclusion

 * Get appropriate device when parsing a connection
 * Add Driver_Name property for macro generation



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@518 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 49675f2e
......@@ -45,4 +45,6 @@ property set Deployment is
Priority : Deployment::Priority_Type applies to (data, thread);
-- Thread and data component priority
Driver_Name : aadlstring applies to (device);
end Deployment;
......@@ -32,6 +32,7 @@
------------------------------------------------------------------------------
with Namet;
with Utils; use Utils;
with Ocarina.ME_AADL;
with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nutils;
......@@ -356,6 +357,8 @@ package body Ocarina.Backends.PO_HI_C.Naming is
C_End : Node_Id;
End_List : List_Id;
Parent : Node_Id;
Accessing_Device : Node_Id;
Driver_Name : Name_Id;
Root_Sys : constant Node_Id
:= Parent_Component (Parent_Subcomponent (E));
Transport_API : Supported_Transport_APIs := Transport_None;
......@@ -472,6 +475,23 @@ package body Ocarina.Backends.PO_HI_C.Naming is
-- nodes involved with the current one and append it
-- to the naming list.
Set_Deployment_Header;
Append_Node_To_List
(Make_Define_Statement
(Defining_Identifier =>
(RE (RE_Need_Driver_Sockets)),
Value =>
(Make_Literal
(CV.New_Int_Value (1, 1, 10)))),
CTN.Declarations (Current_File));
Set_Naming_Source;
-- Here, by default, we activate the socket
-- transport layer. This is the default behavior
-- if no device is specified for transport concerns.
S := First_Node (Subcomponents (Root_Sys));
while Present (S) loop
......@@ -490,6 +510,57 @@ package body Ocarina.Backends.PO_HI_C.Naming is
N := Message_Comment ("Naming Table");
Append_Node_To_List (N, CTN.Declarations (Current_File));
when Transport_User =>
if AAU.Is_Bus (B) then
Accessing_Device := Get_Device_Of_Process (B, E);
elsif AAU.Is_Virtual_Bus (B) then
Accessing_Device := Get_Device_Of_Process
(Parent_Component (Parent_Subcomponent (B)), E);
else
Display_Located_Error
(Loc (B),
"Unknown bus kind !",
Fatal => True);
end if;
if Accessing_Device = No_Node then
Display_Located_Error
(Loc (B),
"No device is accessing this bus !",
Fatal => True);
end if;
Driver_Name := Get_Driver_Name
(Corresponding_Instance (Accessing_Device));
if Driver_Name = No_Name then
Display_Located_Error
(Loc (B),
"Driver must have a name" &
"(see Deployment::Driver_Name) !",
Fatal => True);
end if;
Set_Deployment_Header;
Set_Str_To_Name_Buffer ("__PO_HI_NEED_");
Get_Name_String_And_Append (Driver_Name);
Driver_Name := Name_Find;
Driver_Name := To_Upper (Driver_Name);
Append_Node_To_List
(Make_Define_Statement
(Defining_Identifier =>
(Make_Defining_Identifier
(Driver_Name,
C_Conversion => False)),
Value =>
(Make_Literal
(CV.New_Int_Value (1, 1, 10)))),
CTN.Declarations (Current_File));
Set_Naming_Source;
when others =>
-- If we did not fetch a meaningful transport layer,
-- this means the application does not use the
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2008-2009, GET-Telecom Paris. --
-- Copyright (C) 2008-2010, GET-Telecom Paris. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -154,6 +154,7 @@ package Ocarina.Backends.PO_HI_C.Runtime is
RE_Simulink_Init_Func, -- __PO_HI_SIMULINK_INIT
RE_Simulink_Model_Type, -- __PO_HI_SIMULINK_MODEL
RE_Nb_Tasks, -- __PO_HI_NB_TASKS
RE_Need_Driver_Sockets, -- __PO_HI_NEED_DRIVER_SOCKETS
RE_SUCCESS, -- __PO_HI_SUCCESS
RE_Task_Id, -- __po_hi_task_id
......@@ -315,6 +316,7 @@ package Ocarina.Backends.PO_HI_C.Runtime is
RE_Noaddr => RH_PO_HI_Protocols,
RE_Noport => RH_PO_HI_Protocols,
RE_Nb_Tasks => RH_Deployment,
RE_Need_Driver_Sockets => RH_Deployment,
RE_SUCCESS => RH_PO_HI_Returns,
-- Variables associations
......
......@@ -3952,4 +3952,20 @@ package body Ocarina.Backends.Properties is
return ARINC653_Empty_Actions;
end Get_ARINC653_HM_Actions;
---------------------
-- Get_Driver_Name --
---------------------
function Get_Driver_Name (Device : Node_Id) return Name_Id is
begin
if Is_Defined_String_Property
(Device, Get_String_Name ("deployment::driver_name")) then
return Get_String_Property
(Device, Get_String_Name ("deployment::driver_name"));
end if;
return No_Name;
end Get_Driver_Name;
end Ocarina.Backends.Properties;
......@@ -763,6 +763,9 @@ package Ocarina.Backends.Properties is
return ARINC653_Memory_Kind;
-- Returns the memory_kind property value of a memory component.
function Get_Driver_Name (Device : Node_Id) return Name_Id;
-- Returns the name of the driver.
private
Empty_Name_Array : constant Name_Array (1 .. 0) := (others => No_Name);
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2005-2009, GET-Telecom Paris. --
-- Copyright (C) 2005-2010, GET-Telecom Paris. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -3594,5 +3594,4 @@ package body Ocarina.Backends.Utils is
return No_Node;
end Get_Corresponding_Port_In_Component;
end Ocarina.Backends.Utils;
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2005-2009, GET-Telecom Paris. --
-- Copyright (C) 2005-2010, GET-Telecom Paris. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -476,5 +476,4 @@ package Ocarina.Backends.Utils is
return Node_Id;
-- Return the port connected the port given in parameter
-- inside the component.
end Ocarina.Backends.Utils;
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