File : s-bbpara-leon.ads
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
4 -- --
5 -- S Y S T E M . B B . P A R A M E T E R S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1999-2002 Universidad Politecnica de Madrid --
10 -- Copyright (C) 2003-2005 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 basic parameters used by the low level tasking system
38
39 -- This is the ERC32/LEON/LEON3 version of this package
40
41 pragma Restrictions (No_Elaboration_Code);
42
43 with System.BB.Board_Parameters;
44
45 package System.BB.Parameters is
46 pragma Pure;
47
48 --------------------
49 -- Hardware clock --
50 --------------------
51
52 Clock_Frequency : constant := System.BB.Board_Parameters.Clock_Frequency;
53 -- Frequency of the system clock
54
55 Ticks_Per_Second : constant :=
56 Clock_Frequency / (Board_Parameters.Prescaler_Min + 1);
57 -- The prescaler is clocked by the system clock. When it underflows, it
58 -- is reloaded from the prescaler reload register and a timer tick is
59 -- generated. The effective division rate is therefore equal to the
60 -- prescaler reload register value plus 1.
61
62 ----------------
63 -- Interrupts --
64 ----------------
65
66 -- The following are ERC32/LEON/LEON3 definitions and they cannot be
67 -- modified.
68
69 -- These definitions are in this package in order to isolate target
70 -- dependencies.
71
72 Number_Of_Interrupt_ID : constant := 15;
73 -- Number of interrupts in the SPARC architecture
74
75 Trap_Vectors : constant := 256;
76 -- The SPARC arquitecture supports 256 vectors
77
78 ------------------------
79 -- Context Management --
80 ------------------------
81
82 -- The SPARC processor needs to save:
83 --
84 -- * 18 integer registers of 32 bits (7 global, 8 output, PSR, Y, and WIM)
85 -- for normal processing
86 --
87 -- * 33 floating point registers of 32 bits
88 --
89 -- * the number of register windows saved to the stack
90 -- (the input and local registers are saved to the stack).
91 --
92 -- * interrupt nesting level corresponding to the task
93 --
94 -- * for LEON, to slots for the Cache Control Register
95 --
96 -- This would be 55 slots for LEON/LEON3 and 53 otherwise, but
97 -- this need to be rounded up to an even number to allow more
98 -- efficient access.
99 --
100 -- For LEON, we store the Cache Control Register to be able to keep the
101 -- cache status per task. We keep the base Cache Control Register (which
102 -- is not affected by automatic changes related to the freeze-on-interrupt
103 -- capability) and the actual Cache Control Register (the one directly
104 -- extracted from the hardware).
105
106 Base_CCR_Context_Index : constant := 53;
107 CCR_Context_Index : constant := 54;
108
109 Context_Buffer_Capacity : constant := 56;
110
111 ------------
112 -- Stacks --
113 ------------
114
115 Interrupt_Stack_Size : constant := 8 * 1024; -- bytes
116 -- Size of each of the interrupt stacks
117
118 ----------
119 -- CPUS --
120 ----------
121
122 Max_Number_Of_CPUs : constant := Board_Parameters.Max_Number_Of_CPUs;
123 -- Maximum number of CPUs
124
125 Multiprocessor : constant Boolean := Max_Number_Of_CPUs /= 1;
126 -- Are we on a multiprocessor board?
127
128 end System.BB.Parameters;