Commit 7d85a19c authored by yoogx's avatar yoogx

* Added support for ISR tasks

parent 9899b809
......@@ -23,7 +23,7 @@ property set AADL_Project is
Spin_Lock,
Semaphore);
Supported_Dispatch_Protocols: type enumeration (Periodic, Sporadic, Aperiodic, Timed, Hybrid, Background);
Supported_Dispatch_Protocols: type enumeration (Periodic, Sporadic, Aperiodic, Timed, Hybrid, Background, Interrupt);
Supported_Queue_Processing_Protocols: type enumeration (Fifo);
......
......@@ -77,7 +77,7 @@ property set Deployment is
Driver_Name : aadlstring applies to (device);
Configuration : aadlstring applies to (device);
Configuration : aadlstring applies to (device, thread);
Config : aadlstring applies to (device);
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2013 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -228,6 +228,7 @@ package Ocarina.Backends.Ada_Tree.Nutils is
P_Init,
P_Initialize_Entrypoint,
P_Index,
P_Interrupt_Identifier,
P_Item,
P_Job,
P_Key,
......
......@@ -397,6 +397,9 @@ package body Ocarina.Backends.PO_HI_Ada.Activity is
function Background_Task_Instantiation (E : Node_Id) return Node_Id;
-- Build a package instantiation for a background task
function ISR_Task_Instantiation (E : Node_Id) return Node_Id;
-- Build a package instantiation for a background task
function Task_Job_Spec (E : Node_Id) return Node_Id;
-- Creates the parameterless subprogram specification that does
-- the thread's job.
......@@ -434,6 +437,7 @@ package body Ocarina.Backends.PO_HI_Ada.Activity is
if Get_Thread_Dispatch_Protocol (E) = Thread_Periodic
or else Get_Thread_Dispatch_Protocol (E) = Thread_Sporadic
or else Get_Thread_Dispatch_Protocol (E) = Thread_Hybrid
or else Get_Thread_Dispatch_Protocol (E) = Thread_ISR
then
-- The task period of minimal interarrival time
......@@ -722,6 +726,48 @@ package body Ocarina.Backends.PO_HI_Ada.Activity is
return N;
end Background_Task_Instantiation;
----------------------------
-- ISR_Task_Instantiation --
----------------------------
function ISR_Task_Instantiation (E : Node_Id) return Node_Id is
N : Node_Id;
Parameter_List : constant List_Id := New_List (ADN.K_List_Id);
Configuration : Name_Id;
begin
Configuration := Get_Configuration (E);
if Configuration = No_Name then
Display_Located_Error
(Loc (E),
"No interrupt configured",
Fatal => True);
end if;
N := Make_Withed_Package (RU (RU_Ada_Interrupts_Names));
Append_Node_To_List (N, ADN.Withed_Packages (Current_Package));
N := Make_Used_Package (RU (RU_Ada_Interrupts_Names));
Append_Node_To_List (N, ADN.Visible_Part (Current_Package));
N := Make_Parameter_Association
(Selector_Name => Make_Defining_Identifier
(PN (P_Interrupt_Identifier)),
Actual_Parameter => Make_Defining_Identifier
(Get_Configuration (E)));
Append_Node_To_List (N, Parameter_List);
-- Append the common parameters
Cyclic_Task_Instantiation_Formals (E, Parameter_List);
-- Build the package instantiation
N := Make_Package_Instantiation
(Defining_Identifier => Map_Task_Identifier (E),
Generic_Package => RU (RU_PolyORB_HI_ISR_Task),
Parameter_List => Parameter_List);
return N;
end ISR_Task_Instantiation;
-------------------------------
-- Hybrid_Task_Instantiation --
-------------------------------
......@@ -1180,6 +1226,12 @@ package body Ocarina.Backends.PO_HI_Ada.Activity is
& Get_Name_String (Display_Name (Identifier (S))));
Append_Node_To_List (N, ADN.Visible_Part (Current_Package));
when Thread_ISR =>
N := Message_Comment
("ISR task : "
& Get_Name_String (Display_Name (Identifier (S))));
Append_Node_To_List (N, ADN.Visible_Part (Current_Package));
when others =>
Display_Located_Error
(AIN.Loc (E),
......@@ -1227,6 +1279,12 @@ package body Ocarina.Backends.PO_HI_Ada.Activity is
N := Background_Task_Instantiation (E);
Append_Node_To_List (N, ADN.Visible_Part (Current_Package));
when Thread_ISR =>
-- Instantiate the ISR task
N := ISR_Task_Instantiation (E);
Append_Node_To_List (N, ADN.Visible_Part (Current_Package));
when others =>
raise Program_Error;
end case;
......@@ -4124,6 +4182,12 @@ package body Ocarina.Backends.PO_HI_Ada.Activity is
& Get_Name_String (Display_Name (Identifier (S))));
Append_Node_To_List (N, ADN.Statements (Current_Package));
when Thread_ISR =>
N := Message_Comment
("ISR task : "
& Get_Name_String (Display_Name (Identifier (S))));
Append_Node_To_List (N, ADN.Statements (Current_Package));
when Thread_Hybrid =>
N := Message_Comment
("Hybrid task : "
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2013 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -351,7 +351,8 @@ package body Ocarina.Backends.PO_HI_Ada.Main is
| Thread_Sporadic
| Thread_Hybrid
| Thread_Aperiodic
| Thread_Background =>
| Thread_Background
| Thread_ISR =>
Add_With_Package
(E =>
RU (RU_PolyORB_HI_Generated_Activity, False),
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2013 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -268,6 +268,7 @@ package body Ocarina.Backends.PO_HI_Ada.Runtime is
(RUD (RU_Ada_Strings_Wide_Bounded_Generic_Bounded_Length));
Declare_Subunit (RUD (RU_Ada_Strings_Bounded_Generic_Bounded_Length));
Declare_Subunit (RUD (RU_PolyORB_HI_Hybrid_Task_Driver_Driver));
Declare_Subunit (RUD (RU_Ada_Interrupts_Names));
-- Package Standard is not a subunit but it has to be handled
-- in a specific way as well as subunit.
......
......@@ -39,6 +39,8 @@ package Ocarina.Backends.PO_HI_Ada.Runtime is
(RU_Null,
RU_Ada,
RU_Ada_Exceptions,
RU_Ada_Interrupts,
RU_Ada_Interrupts_Names,
RU_Ada_Real_Time,
RU_Ada_Strings,
RU_Ada_Strings_Bounded,
......@@ -64,6 +66,7 @@ package Ocarina.Backends.PO_HI_Ada.Runtime is
RU_PolyORB_HI_Periodic_Task,
RU_PolyORB_HI_Sporadic_Task,
RU_PolyORB_HI_Hybrid_Task,
RU_PolyORB_HI_ISR_Task,
RU_PolyORB_HI_Port_Kinds,
RU_PolyORB_HI_Marshallers_G,
RU_PolyORB_HI_Port_Type_Marshallers,
......
......@@ -290,6 +290,7 @@ package body Ocarina.Backends.Properties is
Thread_Sporadic_Name : Name_Id;
Thread_Hybrid_Name : Name_Id;
Thread_Timed_Name : Name_Id;
Thread_Interrupt_Name : Name_Id;
Thread_Background_Name : Name_Id;
Time_Ps_Name : Name_Id;
......@@ -1821,6 +1822,9 @@ package body Ocarina.Backends.Properties is
elsif P_Name = Thread_Aperiodic_Name then
return Thread_Aperiodic;
elsif P_Name = Thread_Interrupt_Name then
return Thread_ISR;
elsif P_Name = Thread_Sporadic_Name then
if not Is_Defined_Integer_Property (T, Thread_Period) then
Display_Located_Error
......@@ -1993,7 +1997,10 @@ package body Ocarina.Backends.Properties is
pragma Assert (Is_Thread (T));
case Get_Thread_Dispatch_Protocol (T) is
when Thread_Periodic | Thread_Sporadic | Thread_Hybrid =>
when Thread_Periodic
| Thread_Sporadic
| Thread_Hybrid
| Thread_ISR =>
-- We are sure the thread has a period
The_Period := Get_Time_Property_Value (T, Thread_Period);
......@@ -2046,7 +2053,10 @@ package body Ocarina.Backends.Properties is
pragma Assert (Is_Thread (T));
case Get_Thread_Dispatch_Protocol (T) is
when Thread_Periodic | Thread_Sporadic | Thread_Hybrid =>
when Thread_Periodic
| Thread_Sporadic
| Thread_Hybrid
| Thread_ISR =>
if Is_Defined_Property (T, Thread_Deadline) then
return Get_Time_Property_Value (T, Thread_Deadline);
else
......@@ -3245,7 +3255,8 @@ package body Ocarina.Backends.Properties is
Thread_Aperiodic_Name := Get_String_Name ("aperiodic");
Thread_Sporadic_Name := Get_String_Name ("sporadic");
Thread_Hybrid_Name := Get_String_Name ("hybrid");
Thread_Timed_Name := Get_String_Name ("timed");
Thread_Timed_Name := Get_String_Name ("timed");
Thread_Interrupt_Name := Get_String_Name ("interrupt");
Thread_Background_Name := Get_String_Name ("background");
Time_Ps_Name := Get_String_Name ("ps");
......@@ -4455,6 +4466,21 @@ package body Ocarina.Backends.Properties is
return No_Name;
end Get_Driver_Name;
-----------------------
-- Get_Configuration --
-----------------------
function Get_Configuration (Device : Node_Id) return Name_Id is
begin
if Is_Defined_String_Property
(Device, Get_String_Name ("deployment::configuration")) then
return Get_String_Property
(Device, Get_String_Name ("deployment::configuration"));
end if;
return No_Name;
end Get_Configuration;
----------------------------
-- Get_Send_Function_Name --
----------------------------
......
......@@ -370,6 +370,7 @@ package Ocarina.Backends.Properties is
Thread_Hybrid,
Thread_Timed,
Thread_Background,
Thread_ISR,
Thread_None);
type Time_Units is
......@@ -823,6 +824,13 @@ package Ocarina.Backends.Properties is
return ARINC653_Memory_Kind;
-- Returns the memory_kind property value of a memory component.
-----------------------
-- Device properties --
-----------------------
function Get_Configuration (Device : Node_Id) return Name_Id;
-- Returns the configuraton string attached to a device
function Get_Driver_Name (Device : Node_Id) return Name_Id;
-- Returns the name of the driver.
......
......@@ -151,22 +151,22 @@ Evaluating theorem set_declaration_is_passing_through
* Iterate for variable: rma.erc32_node_a_task_1
Content of set accessor_flows (test_real_exec_02.aadl:251:21) is
anonymous end to end flow :3790 end to end flow spec
anonymous end to end flow :3791 end to end flow spec
=> Result: TRUE
* Iterate for variable: rma.erc32_node_a_task_2
Content of set accessor_flows (test_real_exec_02.aadl:251:21) is
anonymous end to end flow :3790 end to end flow spec
anonymous end to end flow :3791 end to end flow spec
=> Result: TRUE
* Iterate for variable: rma.erc32_node_a_task_12
Content of set accessor_flows (test_real_exec_02.aadl:251:21) is
anonymous end to end flow :3791 end to end flow spec
anonymous end to end flow :3792 end to end flow spec
=> Result: TRUE
* Iterate for variable: rma.erc32_node_a_task_22
Content of set accessor_flows (test_real_exec_02.aadl:251:21) is
anonymous end to end flow :3791 end to end flow spec
anonymous end to end flow :3792 end to end flow spec
=> Result: TRUE
theorem set_declaration_is_passing_through is: TRUE
......
......@@ -55,7 +55,7 @@ property set Deployment is
applies to (device);
Configuration : aadlstring
applies to (device);
applies to (device, thread);
Config : aadlstring
applies to (device);
......
......@@ -55,7 +55,7 @@ property set Deployment is
applies to (device);
Configuration : aadlstring
applies to (device);
applies to (device, thread);
Config : aadlstring
applies to (device);
......
......@@ -55,7 +55,7 @@ property set Deployment is
applies to (device);
Configuration : aadlstring
applies to (device);
applies to (device, thread);
Config : aadlstring
applies to (device);
......
......@@ -55,7 +55,7 @@ property set Deployment is
applies to (device);
Configuration : aadlstring
applies to (device);
applies to (device, thread);
Config : aadlstring
applies to (device);
......
......@@ -55,7 +55,7 @@ property set Deployment is
applies to (device);
Configuration : aadlstring
applies to (device);
applies to (device, thread);
Config : aadlstring
applies to (device);
......
This diff is collapsed.
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