File : s-bbcaco.ads


   1 ------------------------------------------------------------------------------
   2 --                                                                          --
   3 --                 GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                 --
   4 --                                                                          --
   5 --               S Y S T E M . B B . C A C H E _ C O N T R O L              --
   6 --                                                                          --
   7 --                                  S p e c                                 --
   8 --                                                                          --
   9 --                         Copyright (C) 2010, 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 ------------------------------------------------------------------------------
  28 
  29 --  This package defines basic primitives to control the behavior of the cache
  30 
  31 pragma Restrictions (No_Elaboration_Code);
  32 
  33 package System.BB.Cache_Control is
  34 
  35    type Cache_Type is (Instruction, Data);
  36    --  The granularity of the operations can be on either the instruction or
  37    --  the data cache.
  38 
  39    type Cache_State is (Disabled, Enabled, Frozen);
  40    --  The three different states for the cache
  41 
  42    Invalid_Cache_Control : exception;
  43    --  Exception indicating that the operation on the cache is not supported
  44 
  45    procedure Set_Cache_State
  46      (Cache          : Cache_Type;
  47       State          : Cache_State;
  48       Partition_Wide : Boolean := False);
  49    --  Change the state of the indicated cache memory for the task that
  50    --  performs the call. If Partition_Wide is set to True the cache state is
  51    --  changed for the whole partition (all the tasks in the system).
  52    --
  53    --  Invalid_Cache_Control is raised if the operation is not supported
  54 
  55    function Get_Cache_State (Cache : Cache_Type) return Cache_State;
  56    --  Returns the cache state for the calling task
  57 
  58    procedure Enable_Cache_Freeze_On_Interrupt
  59      (Cache          : Cache_Type;
  60       Partition_Wide : Boolean := False);
  61    --  The indicated cache will automatically be frozen when an asynchronous
  62    --  interrupt is taken. If Partition_Wide is set to True then freeze on
  63    --  interrupt is set for the whole partition (all the tasks in the system).
  64    --
  65    --  Invalid_Cache_Control is raised if the operation is not supported
  66 
  67    procedure Disable_Cache_Freeze_On_Interrupt
  68      (Cache          : Cache_Type;
  69       Partition_Wide : Boolean := False);
  70    --  Disable the freeze on interrupt capability for the indicated cache. If
  71    --  Partition_Wide is set to True then freeze on interrupt is set for the
  72    --  whole partition (all the tasks in the system).
  73    --
  74    --  Invalid_Cache_Control is raised if the operation is not supported
  75 
  76    procedure Cache_Flush (Cache : Cache_Type);
  77    --  Flush the indicated cache
  78    --
  79    --  Invalid_Cache_Control is raised if the operation is not supported
  80 
  81 end System.BB.Cache_Control;