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

* backends/ocarina-backends-properties.adb

   backends/ocarina-backends-properties.ads
     - Handle Activate_Entrypoint property

 * backends/ocarina-backends-po_hi_c-activity.adb
   - Now handle the Activate_Entrypoint property
     correctly.

 * backends/ocarina-backends-po_hi_c-main.adb
   - Fix Initialize_Entrypoint semantics according
     to the AADL standard.


git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@2081 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 075bc8df
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2008-2010, GET-Telecom Paris. --
-- Copyright (C) 2008-2011, European Space Agency (ESA). --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -429,16 +429,16 @@ package body Ocarina.Backends.PO_HI_C.Activity is
procedure Make_Fetch_In_Ports;
procedure Make_Thread_Compute_Entrypoint;
procedure Make_Ports_Compute_Entrypoint;
procedure Make_Initialize_Entrypoint;
procedure Make_Activate_Entrypoint;
function Make_Get_Valid_Value (F : Node_Id) return Node_Id;
--------------------------------
-- Make_Initialize_Entrypoint --
--------------------------------
------------------------------
-- Make_Activate_Entrypoint --
------------------------------
procedure Make_Initialize_Entrypoint is
procedure Make_Activate_Entrypoint is
Entrypoint : constant Node_Id
:= Get_Thread_Initialize_Entrypoint (E);
:= Get_Thread_Activate_Entrypoint (E);
begin
if Entrypoint /= No_Node then
Append_Node_To_List
......@@ -446,7 +446,7 @@ package body Ocarina.Backends.PO_HI_C.Activity is
(Map_C_Subprogram_Identifier (Entrypoint)),
Statements);
end if;
end Make_Initialize_Entrypoint;
end Make_Activate_Entrypoint;
--------------------------
-- Make_Get_Valid_Value --
......@@ -1188,7 +1188,7 @@ package body Ocarina.Backends.PO_HI_C.Activity is
null;
end case;
Make_Initialize_Entrypoint;
Make_Activate_Entrypoint;
Check_Thread_Consistency (E);
......@@ -1365,7 +1365,7 @@ package body Ocarina.Backends.PO_HI_C.Activity is
declare
Init_Entrypoint : constant Name_Id :=
Get_Thread_Initialize_Entrypoint (E);
Get_Thread_Activate_Entrypoint (E);
Parameter_List : constant List_Id :=
New_List (CTN.K_List_Id);
begin
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2008-2010, GET-Telecom Paris. --
-- Copyright (C) 2008-2011, European Space Agency (ESA). --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -287,6 +287,51 @@ package body Ocarina.Backends.PO_HI_C.Main is
Append_Node_To_List (N, CTN.Statements (Main_Function));
end if;
-- Visit all threads and see if there is an initialize entrypoint.
-- In that case, call the initialize entrypoint.
-- There is two ways to deal with initialize entrypoint. The
-- entrypoint can point a subprogram classifier (a node)
-- or just reference text. We have to handle both cases.
if not AAU.Is_Empty (Subcomponents (E)) then
C := First_Node (Subcomponents (E));
while Present (C) loop
-- First, handle the case when the initialize_entrypoint
-- is a subprogram classifier reference.
if AAU.Is_Thread (Corresponding_Instance (C)) and then
Get_Thread_Initialize_Entrypoint
(Corresponding_Instance (C)) /= No_Node
then
Append_Node_To_List
(Make_Call_Profile
(Map_C_Subprogram_Identifier
(Get_Thread_Initialize_Entrypoint
(Corresponding_Instance (C))), No_List),
CTN.Statements (Main_Function));
end if;
-- Then, handle the case when the initialize entrypoint
-- is just a string.
if AAU.Is_Thread (Corresponding_Instance (C)) and then
Get_Thread_Initialize_Entrypoint
(Corresponding_Instance (C)) /= No_Name
then
Append_Node_To_List
(Make_Call_Profile
(Make_Defining_Identifier
(Get_Thread_Initialize_Entrypoint
(Corresponding_Instance (C))), No_List),
CTN.Statements (Main_Function));
end if;
C := Next_Node (C);
end loop;
end if;
-- Visit all devices attached to the parent system that
-- share the same processor as process E.
-- This is done to initialize all devices before system starts.
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2008-2010, European Space Agency (ESA). --
-- Copyright (C) 2008-2011, European Space Agency (ESA). --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -132,6 +132,8 @@ package body Ocarina.Backends.Properties is
Thread_Dispatch_Protocol : Name_Id;
Thread_Cheddar_Priority : Name_Id;
Thread_Stack_Size : Name_Id;
Activate_Entrypoint : Name_Id;
Activate_Entrypoint_Source_Text : Name_Id;
Initialize_Entrypoint : Name_Id;
Initialize_Entrypoint_Source_Text : Name_Id;
Recover_Entrypoint : Name_Id;
......@@ -2293,6 +2295,38 @@ package body Ocarina.Backends.Properties is
end if;
end Get_Thread_Initialize_Entrypoint;
------------------------------------
-- Get_Thread_Activate_Entrypoint --
------------------------------------
function Get_Thread_Activate_Entrypoint (T : Node_Id) return Name_Id is
begin
if Is_Defined_String_Property (T, Activate_Entrypoint) then
return Get_String_Property (T, Activate_Entrypoint);
elsif Is_Defined_String_Property
(T, Activate_Entrypoint_Source_Text)
then
return Get_String_Property
(T, Activate_Entrypoint_Source_Text);
else
return No_Name;
end if;
end Get_Thread_Activate_Entrypoint;
------------------------------------
-- Get_Thread_Activate_Entrypoint --
------------------------------------
function Get_Thread_Activate_Entrypoint (T : Node_Id) return Node_Id is
begin
if Is_Defined_Property (T, Activate_Entrypoint) then
return Get_Classifier_Property (T, Activate_Entrypoint);
else
return No_Node;
end if;
end Get_Thread_Activate_Entrypoint;
-----------------------------------
-- Get_Thread_Recover_Entrypoint --
-----------------------------------
......@@ -3308,6 +3342,10 @@ package body Ocarina.Backends.Properties is
Initialize_Entrypoint := Get_String_Name ("initialize_entrypoint");
Initialize_Entrypoint_Source_Text := Get_String_Name
("initialize_entrypoint_source_text");
Activate_Entrypoint := Get_String_Name ("activate_entrypoint");
Activate_Entrypoint_Source_Text := Get_String_Name
("activate_entrypoint_source_text");
Recover_Entrypoint := Get_String_Name ("recover_entrypoint");
Recover_Entrypoint_Source_Text := Get_String_Name
("recover_entrypoint_source_text");
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2008-2010, European Space Agency (ESA). --
-- Copyright (C) 2008-2011, European Space Agency (ESA). --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -462,6 +462,14 @@ package Ocarina.Backends.Properties is
-- Return the abstract component implementation attached to a
-- component through the Implemented_As property.
function Get_Thread_Activate_Entrypoint (T : Node_Id) return Name_Id;
-- Return the activate entry point of the given thread. Return
-- No_Name in case the property is not defined for the thread.
function Get_Thread_Activate_Entrypoint (T : Node_Id) return Node_Id;
-- Same as before but returns the classifier associated with the
-- property (used in AADLv2).
function Get_Thread_Initialize_Entrypoint (T : Node_Id) return Name_Id;
-- Return the initialize entry point of the given thread. Return
-- No_Name in case the property is not defined for the thread.
......
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