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