1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup sparc_leon2 |
---|
5 | * |
---|
6 | * @brief Global BSP Definitions. |
---|
7 | */ |
---|
8 | |
---|
9 | /* bsp.h |
---|
10 | * |
---|
11 | * This include file contains all SPARC simulator definitions. |
---|
12 | * |
---|
13 | * COPYRIGHT (c) 1989-1998. |
---|
14 | * On-Line Applications Research Corporation (OAR). |
---|
15 | * |
---|
16 | * The license and distribution terms for this file may be |
---|
17 | * found in the file LICENSE in this distribution or at |
---|
18 | * http://www.rtems.org/license/LICENSE. |
---|
19 | * |
---|
20 | * Ported to ERC32 implementation of the SPARC by On-Line Applications |
---|
21 | * Research Corporation (OAR) under contract to the European Space |
---|
22 | * Agency (ESA). |
---|
23 | * |
---|
24 | * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995. |
---|
25 | * European Space Agency. |
---|
26 | */ |
---|
27 | |
---|
28 | #ifndef _BSP_H |
---|
29 | #define _BSP_H |
---|
30 | |
---|
31 | #include <bspopts.h> |
---|
32 | #include <bsp/default-initial-extension.h> |
---|
33 | |
---|
34 | #include <rtems.h> |
---|
35 | #include <leon.h> |
---|
36 | #include <rtems/clockdrv.h> |
---|
37 | #include <rtems/console.h> |
---|
38 | #include <rtems/irq-extension.h> |
---|
39 | |
---|
40 | #ifdef __cplusplus |
---|
41 | extern "C" { |
---|
42 | #endif |
---|
43 | |
---|
44 | /** |
---|
45 | * @defgroup sparc_leon2 LEON2 Support |
---|
46 | * |
---|
47 | * @ingroup bsp_sparc |
---|
48 | * |
---|
49 | * @brief LEON2 Support Package |
---|
50 | * |
---|
51 | */ |
---|
52 | |
---|
53 | /* SPARC CPU variant: LEON2 */ |
---|
54 | #define LEON2 1 |
---|
55 | |
---|
56 | /* |
---|
57 | * BSP provides its own Idle thread body |
---|
58 | */ |
---|
59 | void *bsp_idle_thread( uintptr_t ignored ); |
---|
60 | #define BSP_IDLE_TASK_BODY bsp_idle_thread |
---|
61 | |
---|
62 | /* |
---|
63 | * Network driver configuration |
---|
64 | */ |
---|
65 | struct rtems_bsdnet_ifconfig; |
---|
66 | extern int rtems_leon_open_eth_driver_attach( |
---|
67 | struct rtems_bsdnet_ifconfig *config |
---|
68 | ); |
---|
69 | extern int rtems_smc91111_driver_attach_leon2( |
---|
70 | struct rtems_bsdnet_ifconfig *config |
---|
71 | ); |
---|
72 | #define RTEMS_BSP_NETWORK_DRIVER_NAME "open_eth1" |
---|
73 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH_OPENETH \ |
---|
74 | rtems_leon_open_eth_driver_attach |
---|
75 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH_SMC91111 \ |
---|
76 | rtems_smc91111_driver_attach_leon2 |
---|
77 | |
---|
78 | #define HAS_SMC91111 |
---|
79 | |
---|
80 | /* Configure GRETH driver */ |
---|
81 | #define GRETH_SUPPORTED |
---|
82 | #define GRETH_MEM_LOAD(addr) leon_r32_no_cache((uintptr_t) addr) |
---|
83 | |
---|
84 | /* |
---|
85 | * The synchronous trap is an arbitrarily chosen software trap. |
---|
86 | */ |
---|
87 | |
---|
88 | extern int CPU_SPARC_HAS_SNOOPING; |
---|
89 | |
---|
90 | /* Constants */ |
---|
91 | |
---|
92 | /* |
---|
93 | * Information placed in the linkcmds file. |
---|
94 | */ |
---|
95 | |
---|
96 | extern int RAM_START; |
---|
97 | extern int RAM_END; |
---|
98 | extern int RAM_SIZE; |
---|
99 | |
---|
100 | extern int PROM_START; |
---|
101 | extern int PROM_END; |
---|
102 | extern int PROM_SIZE; |
---|
103 | |
---|
104 | extern int CLOCK_SPEED; |
---|
105 | |
---|
106 | extern int end; /* last address in the program */ |
---|
107 | |
---|
108 | /* miscellaneous stuff assumed to exist */ |
---|
109 | |
---|
110 | rtems_isr_entry set_vector( /* returns old vector */ |
---|
111 | rtems_isr_entry handler, /* isr routine */ |
---|
112 | rtems_vector_number vector, /* vector number */ |
---|
113 | int type /* RTEMS or RAW intr */ |
---|
114 | ); |
---|
115 | |
---|
116 | void BSP_fatal_exit(uint32_t error); |
---|
117 | |
---|
118 | void bsp_spurious_initialize( void ); |
---|
119 | |
---|
120 | /* Allocate 8-byte aligned non-freeable pre-malloc() memory. The function |
---|
121 | * can be called at any time. The work-area will shrink when called before |
---|
122 | * bsp_work_area_initialize(). malloc() is called to get memory when this |
---|
123 | * function is called after bsp_work_area_initialize(). |
---|
124 | */ |
---|
125 | void *bsp_early_malloc(int size); |
---|
126 | |
---|
127 | /* Interrupt Service Routine (ISR) pointer */ |
---|
128 | typedef void (*bsp_shared_isr)(void *arg); |
---|
129 | |
---|
130 | /* Initializes the Shared System Interrupt service */ |
---|
131 | extern void BSP_shared_interrupt_init(void); |
---|
132 | |
---|
133 | /* Called directly from IRQ trap handler TRAP[0x10..0x1F] = IRQ[0..15] */ |
---|
134 | void bsp_isr_handler(rtems_vector_number vector); |
---|
135 | |
---|
136 | /* Registers a shared IRQ handler, and enable it at IRQ controller. Multiple |
---|
137 | * interrupt handlers may use the same IRQ number, all ISRs will be called |
---|
138 | * when an interrupt on that line is fired. |
---|
139 | * |
---|
140 | * Arguments |
---|
141 | * irq System IRQ number |
---|
142 | * info Optional Name of IRQ source |
---|
143 | * isr Function pointer to the ISR |
---|
144 | * arg Second argument to function isr |
---|
145 | */ |
---|
146 | static __inline__ int BSP_shared_interrupt_register |
---|
147 | ( |
---|
148 | int irq, |
---|
149 | const char *info, |
---|
150 | bsp_shared_isr isr, |
---|
151 | void *arg |
---|
152 | ) |
---|
153 | { |
---|
154 | return rtems_interrupt_handler_install(irq, info, |
---|
155 | RTEMS_INTERRUPT_SHARED, isr, arg); |
---|
156 | } |
---|
157 | |
---|
158 | /* Unregister previously registered shared IRQ handler. |
---|
159 | * |
---|
160 | * Arguments |
---|
161 | * irq System IRQ number |
---|
162 | * isr Function pointer to the ISR |
---|
163 | * arg Second argument to function isr |
---|
164 | */ |
---|
165 | static __inline__ int BSP_shared_interrupt_unregister |
---|
166 | ( |
---|
167 | int irq, |
---|
168 | bsp_shared_isr isr, |
---|
169 | void *arg |
---|
170 | ) |
---|
171 | { |
---|
172 | return rtems_interrupt_handler_remove(irq, isr, arg); |
---|
173 | } |
---|
174 | |
---|
175 | /* Clear interrupt pending on IRQ controller, this is typically done on a |
---|
176 | * level triggered interrupt source such as PCI to avoid taking double IRQs. |
---|
177 | * In such a case the interrupt source must be cleared first on LEON, before |
---|
178 | * acknowledging the IRQ with this function. |
---|
179 | * |
---|
180 | * Arguments |
---|
181 | * irq System IRQ number |
---|
182 | */ |
---|
183 | extern void BSP_shared_interrupt_clear(int irq); |
---|
184 | |
---|
185 | /* Enable Interrupt. This function will unmask the IRQ at the interrupt |
---|
186 | * controller. This is normally done by _register(). Note that this will |
---|
187 | * affect all ISRs on this IRQ. |
---|
188 | * |
---|
189 | * Arguments |
---|
190 | * irq System IRQ number |
---|
191 | */ |
---|
192 | extern void BSP_shared_interrupt_unmask(int irq); |
---|
193 | |
---|
194 | /* Disable Interrupt. This function will mask one IRQ at the interrupt |
---|
195 | * controller. This is normally done by _unregister(). Note that this will |
---|
196 | * affect all ISRs on this IRQ. |
---|
197 | * |
---|
198 | * Arguments |
---|
199 | * irq System IRQ number |
---|
200 | */ |
---|
201 | extern void BSP_shared_interrupt_mask(int irq); |
---|
202 | |
---|
203 | /* |
---|
204 | * Delay method |
---|
205 | */ |
---|
206 | void rtems_bsp_delay(int usecs); |
---|
207 | |
---|
208 | /* |
---|
209 | * Prototypes for BSP methods that are used across file boundaries |
---|
210 | */ |
---|
211 | int cchip1_register(void); |
---|
212 | |
---|
213 | /* BSP PCI Interrupt support */ |
---|
214 | #define BSP_PCI_shared_interrupt_register BSP_shared_interrupt_register |
---|
215 | #define BSP_PCI_shared_interrupt_unregister BSP_shared_interrupt_unregister |
---|
216 | #define BSP_PCI_shared_interrupt_unmask BSP_shared_interrupt_unmask |
---|
217 | #define BSP_PCI_shared_interrupt_mask BSP_shared_interrupt_mask |
---|
218 | #define BSP_PCI_shared_interrupt_clear BSP_shared_interrupt_clear |
---|
219 | |
---|
220 | /* AT697 has PCI defined as big endian */ |
---|
221 | #define BSP_PCI_BIG_ENDIAN |
---|
222 | |
---|
223 | /* Common driver build-time configurations. On small systems undefine |
---|
224 | * [DRIVER]_INFO_AVAIL to avoid info routines get dragged in. It is good |
---|
225 | * for debugging and printing information about the system, but makes the |
---|
226 | * image bigger. |
---|
227 | */ |
---|
228 | #define AMBAPPBUS_INFO_AVAIL /* AMBAPP Bus driver */ |
---|
229 | #define GPTIMER_INFO_AVAIL /* GPTIMER Timer driver */ |
---|
230 | #define GRETH_INFO_AVAIL /* GRETH Ethernet driver */ |
---|
231 | |
---|
232 | #ifdef __cplusplus |
---|
233 | } |
---|
234 | #endif |
---|
235 | |
---|
236 | #endif |
---|