File : s-bbbosu-ppc.ads
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
4 -- --
5 -- S Y S T E M . B B . B O A R D _ S U P P O R T --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1999-2002 Universidad Politecnica de Madrid --
10 -- Copyright (C) 2003-2006 The European Space Agency --
11 -- Copyright (C) 2003-2016, AdaCore --
12 -- --
13 -- GNARL is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 3, or (at your option) any later ver- --
16 -- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. --
19 -- --
20 -- --
21 -- --
22 -- --
23 -- --
24 -- You should have received a copy of the GNU General Public License and --
25 -- a copy of the GCC Runtime Library Exception along with this program; --
26 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
27 -- <http://www.gnu.org/licenses/>. --
28 -- --
29 -- GNARL was developed by the GNARL team at Florida State University. --
30 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
31 -- --
32 -- The port of GNARL to bare board targets was initially developed by the --
33 -- Real-Time Systems Group at the Technical University of Madrid. --
34 -- --
35 ------------------------------------------------------------------------------
36
37 -- This package defines an interface used for handling the peripherals
38 -- available in the target board that are needed by the target-independent
39 -- part of the run time.
40
41 pragma Restrictions (No_Elaboration_Code);
42
43 with System.BB.Interrupts;
44 with System.BB.CPU_Specific;
45
46 package System.BB.Board_Support is
47 pragma Preelaborate;
48
49 -----------------------------
50 -- Hardware Initialization --
51 -----------------------------
52
53 procedure Initialize_Board;
54 -- Procedure that performs the hardware initialization of the board. Should
55 -- be called before any other operations in this package.
56
57 ------------------------------------------------
58 -- Clock and Timer Definitions and Primitives --
59 ------------------------------------------------
60
61 procedure Clear_Alarm_Interrupt;
62 pragma Inline (Clear_Alarm_Interrupt);
63 -- Acknowledge the alarm interrupt
64
65 ----------------
66 -- Interrupts --
67 ----------------
68
69 procedure Clear_Interrupt_Request
70 (Interrupt : System.BB.Interrupts.Interrupt_ID);
71 pragma Inline (Clear_Interrupt_Request);
72 -- Acknowledge the end of the interrupt
73
74 function Get_Interrupt_Request
75 (Vector : CPU_Specific.Vector_Id)
76 return System.BB.Interrupts.Interrupt_ID;
77 pragma Inline (Get_Interrupt_Request);
78 -- Function to be called from the trap handler to determine the external
79 -- interrupt to handle for the given trap vector. If the trap does not
80 -- correspond to an external interrupt (that is, if it is a synchronous
81 -- trap) then interrupt level 0 (no interrupt) is returned. If the
82 -- system shares a single trap handler for multiple external interrupts,
83 -- this would typically query the interrupt controller for determining
84 -- the interrupt to handle.
85
86 function Priority_Of_Interrupt
87 (Interrupt : System.BB.Interrupts.Interrupt_ID)
88 return System.Any_Priority;
89 pragma Inline (Priority_Of_Interrupt);
90 -- Function to obtain the priority associated with an interrupt. It returns
91 -- System.Any_Priority'First if Interrupt is equal to zero (no interrupt).
92
93 procedure Install_Interrupt_Handler
94 (Handler : Address;
95 Interrupt : Interrupts.Interrupt_ID;
96 Prio : Interrupt_Priority);
97 -- Determine the trap vector that will be called for handling the given
98 -- external interrupt on the current CPU, and install the given handler
99 -- there. It is an error to try to install two different handlers for the
100 -- vector, though this procedure may be called for multiple interrupts that
101 -- share the same vector, as long as they use the same Handler. The handler
102 -- expects a single argument indicating the vector called. This routine may
103 -- need to set up the interrupt controller to enable the given interrupt
104 -- source, so it will actually cause a trap on the CPU. Note, this
105 -- should not actually enable interrupts, as this is only done through
106 -- CPU_Primitives.Enable_Interrupts, which typically uses a processor
107 -- status register. Prio is the priority for the interrupt, and the
108 -- hardware can be programmed to use that priority.
109
110 procedure Set_Current_Priority (Priority : Integer);
111 pragma Inline (Set_Current_Priority);
112 -- Only allow interrupts higher than the specified priority. This routine
113 -- differes from the Enable_Interrupts/Disable_Interrupts procedures
114 -- in CPU_Primitives in that it disables interrupts at the board level,
115 -- rather than the CPU. Typically if board-specific support of an interrupt
116 -- controller is needed to block interrupts of insufficient priority, this
117 -- routine will be needed. On other systems, where the processor has this
118 -- control, or where only a single interrupt priority is supported, this
119 -- may be a null procedure.
120
121 procedure Power_Down;
122 pragma Inline (Power_Down);
123 -- Power-down the current CPU. This procedure is called only by the idle
124 -- task, with interrupt enabled.
125
126 end System.BB.Board_Support;