File : a-extiin-bb.adb


   1 ------------------------------------------------------------------------------
   2 --                                                                          --
   3 --                         GNAT RUN-TIME COMPONENTS                         --
   4 --                                                                          --
   5 --         A D A . E X E C U T I O N _ T I M E . I N T E R R U P T S        --
   6 --                                                                          --
   7 --                                 B o d y                                  --
   8 --                                                                          --
   9 --            Copyright (C) 2011, Free Software Foundation, Inc.            --
  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 -- GNAT was originally developed  by the GNAT team at  New York University. --
  28 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
  29 --                                                                          --
  30 ------------------------------------------------------------------------------
  31 
  32 --  This is the Bare Board version of this package
  33 
  34 with Ada.Unchecked_Conversion;
  35 
  36 with System.BB.Execution_Time;
  37 with System.BB.Interrupts;
  38 with System.BB.Time;
  39 
  40 package body Ada.Execution_Time.Interrupts with
  41   SPARK_Mode => Off
  42 is
  43 
  44    package SBET renames System.BB.Execution_Time;
  45    package SBI  renames System.BB.Interrupts;
  46 
  47    function To_CPU_Time is new Ada.Unchecked_Conversion
  48      (System.BB.Time.Time, CPU_Time);
  49    --  Function to change the view from System.BB.Time.Time (unsigned 64-bit)
  50    --  to CPU_Time (unsigned 64-bit).
  51    --
  52    --  CPU_Time is derived from Ada.Real_Time.Time which is derived from
  53    --  System.BB.Time.Time. So CPU_Time and System.BB.Time.Time are the same
  54    --  type, but Ada.Real_Time.Time is private so we don't have visibility.
  55 
  56    function Clock (Interrupt : Ada.Interrupts.Interrupt_ID) return CPU_Time is
  57       Execution_Time : constant System.BB.Time.Time :=
  58         SBET.Interrupt_Clock (SBI.Interrupt_ID (Interrupt));
  59    begin
  60       return To_CPU_Time (Execution_Time);
  61    end Clock;
  62 
  63    function Supported
  64      (Interrupt : Ada.Interrupts.Interrupt_ID) return Boolean is
  65       pragma Unreferenced (Interrupt);
  66    begin
  67       return True;
  68    end Supported;
  69 
  70 end Ada.Execution_Time.Interrupts;