RTEMS  5.0.0
bsp.h
Go to the documentation of this file.
1 
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 LIBBSP_SPARC_LEON3_BSP_H
29 #define LIBBSP_SPARC_LEON3_BSP_H
30 
31 #include <bspopts.h>
33 
34 #include <rtems.h>
35 #include <leon.h>
36 #include <rtems/irq-extension.h>
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
52 /* SPARC CPU variant: LEON3 */
53 #define LEON3 1
54 
55 /*
56  * BSP provides its own Idle thread body
57  */
58 void *bsp_idle_thread( uintptr_t ignored );
59 #define BSP_IDLE_TASK_BODY bsp_idle_thread
60 
61 /* Maximum supported APBUARTs by BSP */
62 #define BSP_NUMBER_OF_TERMIOS_PORTS 8
63 
64 /* Make sure maximum number of consoles fit in filesystem */
65 #define BSP_MAXIMUM_DEVICES 8
66 
67 /*
68  * Network driver configuration
69  */
70 struct rtems_bsdnet_ifconfig;
71 extern int rtems_leon_open_eth_driver_attach(
72  struct rtems_bsdnet_ifconfig *config,
73  int attach
74 );
75 extern int rtems_smc91111_driver_attach_leon3(
76  struct rtems_bsdnet_ifconfig *config,
77  int attach
78 );
79 extern int rtems_leon_greth_driver_attach(
80  struct rtems_bsdnet_ifconfig *config,
81  int attach
82 );
83 
84 #define RTEMS_BSP_NETWORK_DRIVER_NAME_OPENETH "open_eth1"
85 #define RTEMS_BSP_NETWORK_DRIVER_ATTACH_OPENETH \
86  rtems_leon_open_eth_driver_attach
87 #define RTEMS_BSP_NETWORK_DRIVER_NAME_SMC91111 "smc_eth1"
88 #define RTEMS_BSP_NETWORK_DRIVER_ATTACH_SMC91111 \
89  rtems_smc91111_driver_attach_leon3
90 #define RTEMS_BSP_NETWORK_DRIVER_NAME_GRETH "gr_eth1"
91 #define RTEMS_BSP_NETWORK_DRIVER_ATTACH_GRETH \
92  rtems_leon_greth_driver_attach
93 
94 #ifndef RTEMS_BSP_NETWORK_DRIVER_NAME
95 #define RTEMS_BSP_NETWORK_DRIVER_NAME RTEMS_BSP_NETWORK_DRIVER_NAME_GRETH
96 #define RTEMS_BSP_NETWORK_DRIVER_ATTACH RTEMS_BSP_NETWORK_DRIVER_ATTACH_GRETH
97 #endif
98 
99 #define HAS_SMC91111
100 
101 /* Configure GRETH driver */
102 #define GRETH_SUPPORTED
103 #define GRETH_MEM_LOAD(addr) leon_r32_no_cache((uintptr_t)addr)
104 
105 extern int CPU_SPARC_HAS_SNOOPING;
106 
107 /* Constants */
108 
109 /*
110  * Information placed in the linkcmds file.
111  */
112 
113 extern int RAM_START;
114 extern int RAM_END;
115 extern int RAM_SIZE;
116 
117 extern int PROM_START;
118 extern int PROM_END;
119 extern int PROM_SIZE;
120 
121 extern int CLOCK_SPEED;
122 
123 extern int end; /* last address in the program */
124 
125 /* miscellaneous stuff assumed to exist */
126 
127 rtems_isr_entry set_vector( /* returns old vector */
128  rtems_isr_entry handler, /* isr routine */
129  rtems_vector_number vector, /* vector number */
130  int type /* RTEMS or RAW intr */
131 );
132 
133 void BSP_fatal_exit(uint32_t error);
134 
135 void bsp_spurious_initialize( void );
136 
137 /*
138  * Delay for the specified number of microseconds.
139  */
140 void rtems_bsp_delay(int usecs);
141 
142 /* Interrupt Service Routine (ISR) pointer */
143 typedef void (*bsp_shared_isr)(void *arg);
144 
145 /* Initializes the Shared System Interrupt service */
146 extern void BSP_shared_interrupt_init(void);
147 
148 /* Called directly from IRQ trap handler TRAP[0x10..0x1F] = IRQ[0..15] */
149 void bsp_isr_handler(rtems_vector_number vector);
150 
151 /* Registers a shared IRQ handler, and enable it at IRQ controller. Multiple
152  * interrupt handlers may use the same IRQ number, all ISRs will be called
153  * when an interrupt on that line is fired.
154  *
155  * Arguments
156  * irq System IRQ number
157  * info Optional Name of IRQ source
158  * isr Function pointer to the ISR
159  * arg Second argument to function isr
160  */
161 static __inline__ int BSP_shared_interrupt_register
162  (
163  int irq,
164  const char *info,
165  bsp_shared_isr isr,
166  void *arg
167  )
168 {
169  return rtems_interrupt_handler_install(irq, info,
170  RTEMS_INTERRUPT_SHARED, isr, arg);
171 }
172 
173 /* Unregister previously registered shared IRQ handler.
174  *
175  * Arguments
176  * irq System IRQ number
177  * isr Function pointer to the ISR
178  * arg Second argument to function isr
179  */
180 static __inline__ int BSP_shared_interrupt_unregister
181  (
182  int irq,
183  bsp_shared_isr isr,
184  void *arg
185  )
186 {
187  return rtems_interrupt_handler_remove(irq, isr, arg);
188 }
189 
190 /* Clear interrupt pending on IRQ controller, this is typically done on a
191  * level triggered interrupt source such as PCI to avoid taking double IRQs.
192  * In such a case the interrupt source must be cleared first on LEON, before
193  * acknowledging the IRQ with this function.
194  *
195  * Arguments
196  * irq System IRQ number
197  */
198 extern void BSP_shared_interrupt_clear(int irq);
199 
200 /* Enable Interrupt. This function will unmask the IRQ at the interrupt
201  * controller. This is normally done by _register(). Note that this will
202  * affect all ISRs on this IRQ.
203  *
204  * Arguments
205  * irq System IRQ number
206  */
207 extern void BSP_shared_interrupt_unmask(int irq);
208 
209 /* Disable Interrupt. This function will mask one IRQ at the interrupt
210  * controller. This is normally done by _unregister(). Note that this will
211  * affect all ISRs on this IRQ.
212  *
213  * Arguments
214  * irq System IRQ number
215  */
216 extern void BSP_shared_interrupt_mask(int irq);
217 
218 #if defined(RTEMS_SMP) || defined(RTEMS_MULTIPROCESSING)
219 /* Irq used by the shared memory driver and for inter-processor interrupts.
220  * The variable is weakly linked. Redefine the variable in your application
221  * to override the BSP default.
222  */
223 extern const unsigned char LEON3_mp_irq;
224 #endif
225 
226 #ifdef RTEMS_SMP
227 /* Weak table used to implement static interrupt CPU affinity in a SMP
228  * configuration. The array index is the interrupt to be looked up, and
229  * the array[INTERRUPT] content is the CPU number relative to boot CPU
230  * index that will be servicing the interrupts from the IRQ source. The
231  * default is to let the first CPU (the boot cpu) to handle all
232  * interrupts (all zeros).
233  */
234 extern const unsigned char LEON3_irq_to_cpu[32];
235 #endif
236 
237 /* Common driver build-time configurations. On small systems undefine
238  * [DRIVER]_INFO_AVAIL to avoid info routines get dragged in. It is good
239  * for debugging and printing information about the system, but makes the
240  * image bigger.
241  */
242 #define AMBAPPBUS_INFO_AVAIL /* AMBAPP Bus driver */
243 #define APBUART_INFO_AVAIL /* APBUART Console driver */
244 #define GPTIMER_INFO_AVAIL /* GPTIMER Timer driver */
245 #define GRETH_INFO_AVAIL /* GRETH Ethernet driver */
246 
247 #ifdef __cplusplus
248 }
249 #endif
250 
253 #endif
Definition: deflate.c:115
rtems_isr_entry set_vector(rtems_isr_entry handler, rtems_vector_number vector, int type)
Install an interrupt handler.
Definition: setvec.c:28
#define RTEMS_INTERRUPT_SHARED
Allows that this interrupt handler may share a common interrupt vector with other handler...
Definition: irq-extension.h:56
rtems_status_code rtems_interrupt_handler_remove(rtems_vector_number vector, rtems_interrupt_handler handler, void *arg)
Removes the interrupt handler routine handler with argument arg for the interrupt vector with number ...
Definition: irq.c:175
rtems_status_code rtems_interrupt_handler_install(rtems_vector_number vector, const char *info, rtems_option options, rtems_interrupt_handler handler, void *arg)
Installs the interrupt handler routine handler for the interrupt vector with number vector...
Definition: irq.c:127
DEFAULT_INITIAL_EXTENSION Support.
ISR_Vector_number rtems_vector_number
Control block type used to manage the vectors.
Definition: intr.h:47
Header file for the Interrupt Manager Extension.
void * bsp_idle_thread(uintptr_t ignored)
Optimized idle task.
Definition: bspidle.c:26
LEON3 BSP data types and macros.