File : s-interr-raven.ads


   1 ------------------------------------------------------------------------------
   2 --                                                                          --
   3 --                 GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                 --
   4 --                                                                          --
   5 --                     S Y S T E M . I N T E R R U P T S                    --
   6 --                                                                          --
   7 --                                  S p e c                                 --
   8 --                                                                          --
   9 --                     Copyright (C) 2001-2016, AdaCore                     --
  10 --                                                                          --
  11 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  12 -- terms of the  GNU General Public License as published  by the Free Soft- --
  13 -- ware  Foundation;  either version 3,  or (at your option) any later ver- --
  14 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  15 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  16 -- or FITNESS FOR A PARTICULAR PURPOSE.                                     --
  17 --                                                                          --
  18 --                                                                          --
  19 --                                                                          --
  20 --                                                                          --
  21 --                                                                          --
  22 -- You should have received a copy of the GNU General Public License and    --
  23 -- a copy of the GCC Runtime Library Exception along with this program;     --
  24 -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
  25 -- <http://www.gnu.org/licenses/>.                                          --
  26 --                                                                          --
  27 -- GNARL was developed by the GNARL team at Florida State University.       --
  28 -- Extensive contributions were provided by Ada Core Technologies, Inc.     --
  29 --                                                                          --
  30 ------------------------------------------------------------------------------
  31 
  32 --  This is the Ravenscar version of this package
  33 
  34 --  Note: the compiler generates direct calls to this interface, via Rtsfind.
  35 --  Any changes to this interface may require corresponding compiler changes.
  36 
  37 --  This package encapsulates the implementation of interrupt or signal
  38 --  handlers. It is logically an extension of the body of Ada.Interrupts.
  39 --  It is made a child of System to allow visibility of various
  40 --  runtime system internal data and operations.
  41 
  42 with System.Tasking.Protected_Objects.Single_Entry;
  43 
  44 with System.OS_Interface;
  45 --  used for Max_Interrupt
  46 
  47 package System.Interrupts is
  48    pragma Elaborate_Body;
  49 
  50    package ST renames System.Tasking;
  51 
  52    -------------------------
  53    -- Constants and types --
  54    -------------------------
  55 
  56    Default_Interrupt_Priority : constant System.Interrupt_Priority :=
  57                                   System.Interrupt_Priority'Last;
  58    --  Default value used when a pragma Interrupt_Handler or Attach_Handler is
  59    --  specified without an Interrupt_Priority pragma, see D.3(10).
  60 
  61    type Ada_Interrupt_ID is range 0 .. System.OS_Interface.Max_Interrupt;
  62    --  Avoid inheritance by Ada.Interrupts.Interrupt_ID of unwanted operations
  63 
  64    type Interrupt_ID is range 0 .. System.OS_Interface.Max_Interrupt;
  65 
  66    --  The following renaming is introduced so that the type is accessible
  67    --  through rtsfind, otherwise the name clashes with its homonym in
  68    --  ada.interrupts.
  69 
  70    subtype System_Interrupt_Id is Interrupt_ID;
  71 
  72    type Parameterless_Handler is access protected procedure;
  73 
  74    type Handler_Index is range 0 .. Integer'Last;
  75 
  76    type Handler_Item is record
  77       Interrupt : Interrupt_ID;
  78       Handler   : Parameterless_Handler;
  79    end record;
  80    --  Contains all the information from an Attach_Handler pragma
  81 
  82    type Handler_Array is array (Handler_Index range <>) of Handler_Item;
  83 
  84    --------------------------------
  85    -- Interrupt entries services --
  86    --------------------------------
  87 
  88    -----------------------------
  89    -- Interrupt entry service --
  90    -----------------------------
  91 
  92    procedure Install_Restricted_Handlers
  93      (Prio     : Any_Priority;
  94       Handlers : Handler_Array);
  95    --  Install the static Handlers for the given Interrupts. There is one call
  96    --  per protected object, and one element in Handlers for each handler of
  97    --  the protected object (typically only one). Prio is the priority of
  98    --  the protected object, so that interrupt controler can be set to that
  99    --  priority (if possible).
 100 
 101    procedure Install_Restricted_Handlers_Sequential;
 102    pragma Export (C, Install_Restricted_Handlers_Sequential,
 103                   "__gnat_attach_all_handlers");
 104    --  When the partition elaboration policy is sequential, attachment of
 105    --  interrupts handlers is deferred until the end of elaboration. The
 106    --  binder will call this procedure at the end of elaboration, just before
 107    --  activating the tasks (if any).
 108 end System.Interrupts;