polyorb_hi-hybrid_task_driver.ads 4.94 KB
Newer Older
1 2 3 4 5 6 7 8
------------------------------------------------------------------------------
--                                                                          --
--                          PolyORB HI COMPONENTS                           --
--                                                                          --
--        P O L Y O R B _ H I . H Y B R I D _ T A S K _ D R I V E R         --
--                                                                          --
--                                 S p e c                                  --
--                                                                          --
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
--    Copyright (C) 2007-2009 Telecom ParisTech, 2010-2015 ESA & ISAE.      --
--                                                                          --
-- PolyORB-HI is free software; you can redistribute it and/or modify under --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
-- sion. PolyORB-HI is distributed in the hope that it will be useful, but  --
-- WITHOUT ANY WARRANTY; without even the implied warranty of               --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     --
--                                                                          --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception,   --
-- version 3.1, as published by the Free Software Foundation.               --
--                                                                          --
-- You should have received a copy of the GNU General Public License and    --
-- a copy of the GCC Runtime Library Exception along with this program;     --
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
-- <http://www.gnu.org/licenses/>.                                          --
26
--                                                                          --
jhugues's avatar
jhugues committed
27 28
--              PolyORB-HI/Ada is maintained by the TASTE project           --
--                      (taste-users@lists.tuxfamily.org)                   --
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
--                                                                          --
------------------------------------------------------------------------------

--  This package contains the archetype for the High-Priority task
--  that will trigger periodically all the Hybrid threads in the
--  current node.

with System;
with PolyORB_HI.Streams;
with Ada.Real_Time;
with Ada.Synchronous_Task_Control;

with PolyORB_HI_Generated.Deployment;

package PolyORB_HI.Hybrid_Task_Driver is

   --  Some type definitions that are useful for implementing AADL
   --  Hybrid threads.

   type Hybrid_Task_Info is record
      The_Task               : PolyORB_HI_Generated.Deployment.Entity_Type;
      --  The task entity

      Period_Event           : PolyORB_HI_Generated.Deployment.Port_Type;
      --  Denotes the fake event port added to the task to receive
      --  period-events.

      Period                 : Ada.Real_Time.Time_Span;
      --  The hybrid task period

      Next_Periodic_Dispatch : Ada.Real_Time.Time;
      --  The value (in absolute real time) of the next dispatch of
      --  the hybrid task.

      Eligible               : Boolean;
      --  True if this task must be awakened during the driver's next
      --  dispatch.
   end record;

   type Hybrid_Task_Info_Array is array (Positive range <>)
     of Hybrid_Task_Info;
   --  Used to store the set of Hybrid thread info of the current node

   Driver_Suspender : Ada.Synchronous_Task_Control.Suspension_Object;
   --  Suspends the driver until all the system is initialized

   --  The task below needs to be encapsulated in a generic package
   --  because the elements we give to it cannot be set as type
   --  discriminants and cannot be directly visible since they would
   --  lead to a cyclic package dependancy.

   generic
      Hybrid_Task_Set : in out Hybrid_Task_Info_Array;
      --  The set of Hybrid thread information. We assume that the
      --  initial value of this array is sorted increasingly
      --  (depending on the period). If the user wants all hybrid task
      --  to be triggered at instant zero, the Eligible flag of the
      --  initial value of the Hybrid_Task_Set element must be set to
      --  True.

      Task_Priority  : in System.Any_Priority;
      --  Task priority: equal to 1 plus the maximum Hybrid thread
      --  priority.

      Task_Stack_Size : in Natural;
      --  Driver stack size

      with procedure Deliver
        (Entity  : PolyORB_HI_Generated.Deployment.Entity_Type;
         Message : PolyORB_HI.Streams.Stream_Element_Array);
      --  The local delivery procedure of the current node.
   package Driver is

      task The_Driver is
         pragma Priority (Task_Priority);
         pragma Storage_Size (Task_Stack_Size);
      end The_Driver;

   end Driver;

end PolyORB_HI.Hybrid_Task_Driver;