1 | /* bsp.h |
---|
2 | * |
---|
3 | * This include file contains all SPARC simulator definitions. |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 1989-1998. |
---|
6 | * On-Line Applications Research Corporation (OAR). |
---|
7 | * |
---|
8 | * The license and distribution terms for this file may be |
---|
9 | * found in the file LICENSE in this distribution or at |
---|
10 | * http://www.rtems.com/license/LICENSE. |
---|
11 | * |
---|
12 | * Ported to ERC32 implementation of the SPARC by On-Line Applications |
---|
13 | * Research Corporation (OAR) under contract to the European Space |
---|
14 | * Agency (ESA). |
---|
15 | * |
---|
16 | * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995. |
---|
17 | * European Space Agency. |
---|
18 | */ |
---|
19 | |
---|
20 | #ifndef _BSP_H |
---|
21 | #define _BSP_H |
---|
22 | |
---|
23 | #ifdef __cplusplus |
---|
24 | extern "C" { |
---|
25 | #endif |
---|
26 | |
---|
27 | #include <bspopts.h> |
---|
28 | |
---|
29 | #include <rtems.h> |
---|
30 | #include <leon.h> |
---|
31 | #include <rtems/clockdrv.h> |
---|
32 | #include <rtems/console.h> |
---|
33 | #include <rtems/irq-extension.h> |
---|
34 | |
---|
35 | /* SPARC CPU variant: LEON3 */ |
---|
36 | #define LEON3 1 |
---|
37 | |
---|
38 | /* |
---|
39 | * BSP provides its own Idle thread body |
---|
40 | */ |
---|
41 | void *bsp_idle_thread( uintptr_t ignored ); |
---|
42 | #define BSP_IDLE_TASK_BODY bsp_idle_thread |
---|
43 | |
---|
44 | /* Maximum supported APBUARTs by BSP */ |
---|
45 | #define BSP_NUMBER_OF_TERMIOS_PORTS 8 |
---|
46 | |
---|
47 | /* |
---|
48 | * Network driver configuration |
---|
49 | */ |
---|
50 | struct rtems_bsdnet_ifconfig; |
---|
51 | extern int rtems_leon_open_eth_driver_attach( |
---|
52 | struct rtems_bsdnet_ifconfig *config, |
---|
53 | int attach |
---|
54 | ); |
---|
55 | extern int rtems_smc91111_driver_attach_leon3( |
---|
56 | struct rtems_bsdnet_ifconfig *config, |
---|
57 | int attach |
---|
58 | ); |
---|
59 | extern int rtems_leon_greth_driver_attach( |
---|
60 | struct rtems_bsdnet_ifconfig *config, |
---|
61 | int attach |
---|
62 | ); |
---|
63 | |
---|
64 | #define RTEMS_BSP_NETWORK_DRIVER_NAME_OPENETH "open_eth1" |
---|
65 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH_OPENETH rtems_leon_open_eth_driver_attach |
---|
66 | #define RTEMS_BSP_NETWORK_DRIVER_NAME_SMC91111 "smc_eth1" |
---|
67 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH_SMC91111 rtems_smc91111_driver_attach_leon3 |
---|
68 | #define RTEMS_BSP_NETWORK_DRIVER_NAME_GRETH "gr_eth1" |
---|
69 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH_GRETH rtems_leon_greth_driver_attach |
---|
70 | |
---|
71 | #ifndef RTEMS_BSP_NETWORK_DRIVER_NAME |
---|
72 | #define RTEMS_BSP_NETWORK_DRIVER_NAME RTEMS_BSP_NETWORK_DRIVER_NAME_GRETH |
---|
73 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH RTEMS_BSP_NETWORK_DRIVER_ATTACH_GRETH |
---|
74 | #endif |
---|
75 | |
---|
76 | #define HAS_SMC91111 |
---|
77 | |
---|
78 | /* Configure GRETH driver */ |
---|
79 | #define GRETH_SUPPORTED |
---|
80 | #define GRETH_MEM_LOAD(addr) leon_r32_no_cache(addr) |
---|
81 | |
---|
82 | extern int CPU_SPARC_HAS_SNOOPING; |
---|
83 | |
---|
84 | |
---|
85 | /* Constants */ |
---|
86 | |
---|
87 | /* |
---|
88 | * Information placed in the linkcmds file. |
---|
89 | */ |
---|
90 | |
---|
91 | extern int RAM_START; |
---|
92 | extern int RAM_END; |
---|
93 | extern int RAM_SIZE; |
---|
94 | |
---|
95 | extern int PROM_START; |
---|
96 | extern int PROM_END; |
---|
97 | extern int PROM_SIZE; |
---|
98 | |
---|
99 | extern int CLOCK_SPEED; |
---|
100 | |
---|
101 | extern int end; /* last address in the program */ |
---|
102 | |
---|
103 | /* miscellaneous stuff assumed to exist */ |
---|
104 | |
---|
105 | rtems_isr_entry set_vector( /* returns old vector */ |
---|
106 | rtems_isr_entry handler, /* isr routine */ |
---|
107 | rtems_vector_number vector, /* vector number */ |
---|
108 | int type /* RTEMS or RAW intr */ |
---|
109 | ); |
---|
110 | |
---|
111 | void BSP_fatal_return( void ); |
---|
112 | |
---|
113 | void bsp_spurious_initialize( void ); |
---|
114 | |
---|
115 | /* Allocate 8-byte aligned non-freeable pre-malloc() memory. The function |
---|
116 | * can be called at any time. The work-area will shrink when called before |
---|
117 | * bsp_work_area_initialize(). malloc() is called to get memory when this function |
---|
118 | * is called after bsp_work_area_initialize(). |
---|
119 | */ |
---|
120 | void *bsp_early_malloc(int size); |
---|
121 | |
---|
122 | /* Interrupt Service Routine (ISR) pointer */ |
---|
123 | typedef void (*bsp_shared_isr)(void *arg); |
---|
124 | |
---|
125 | /* Initializes the Shared System Interrupt service */ |
---|
126 | extern int BSP_shared_interrupt_init(void); |
---|
127 | |
---|
128 | /* Registers a shared IRQ handler, and enable it at IRQ controller. Multiple |
---|
129 | * interrupt handlers may use the same IRQ number, all ISRs will be called |
---|
130 | * when an interrupt on that line is fired. |
---|
131 | * |
---|
132 | * Arguments |
---|
133 | * irq System IRQ number |
---|
134 | * info Optional Name of IRQ source |
---|
135 | * isr Function pointer to the ISR |
---|
136 | * arg Second argument to function isr |
---|
137 | */ |
---|
138 | static __inline__ int BSP_shared_interrupt_register |
---|
139 | ( |
---|
140 | int irq, |
---|
141 | const char *info, |
---|
142 | bsp_shared_isr isr, |
---|
143 | void *arg |
---|
144 | ) |
---|
145 | { |
---|
146 | return rtems_interrupt_handler_install(irq, info, |
---|
147 | RTEMS_INTERRUPT_SHARED, isr, arg); |
---|
148 | } |
---|
149 | |
---|
150 | /* Unregister previously registered shared IRQ handler. |
---|
151 | * |
---|
152 | * Arguments |
---|
153 | * irq System IRQ number |
---|
154 | * isr Function pointer to the ISR |
---|
155 | * arg Second argument to function isr |
---|
156 | */ |
---|
157 | static __inline__ int BSP_shared_interrupt_unregister |
---|
158 | ( |
---|
159 | int irq, |
---|
160 | bsp_shared_isr isr, |
---|
161 | void *arg |
---|
162 | ) |
---|
163 | { |
---|
164 | return rtems_interrupt_handler_remove(irq, isr, arg); |
---|
165 | } |
---|
166 | |
---|
167 | /* Clear interrupt pending on IRQ controller, this is typically done on a |
---|
168 | * level triggered interrupt source such as PCI to avoid taking double IRQs. |
---|
169 | * In such a case the interrupt source must be cleared first on LEON, before |
---|
170 | * acknowledging the IRQ with this function. |
---|
171 | * |
---|
172 | * Arguments |
---|
173 | * irq System IRQ number |
---|
174 | */ |
---|
175 | extern void BSP_shared_interrupt_clear(int irq); |
---|
176 | |
---|
177 | /* Enable Interrupt. This function will unmask the IRQ at the interrupt |
---|
178 | * controller. This is normally done by _register(). Note that this will |
---|
179 | * affect all ISRs on this IRQ. |
---|
180 | * |
---|
181 | * Arguments |
---|
182 | * irq System IRQ number |
---|
183 | */ |
---|
184 | extern void BSP_shared_interrupt_unmask(int irq); |
---|
185 | |
---|
186 | /* Disable Interrupt. This function will mask one IRQ at the interrupt |
---|
187 | * controller. This is normally done by _unregister(). Note that this will |
---|
188 | * affect all ISRs on this IRQ. |
---|
189 | * |
---|
190 | * Arguments |
---|
191 | * irq System IRQ number |
---|
192 | */ |
---|
193 | extern void BSP_shared_interrupt_mask(int irq); |
---|
194 | |
---|
195 | #ifdef __cplusplus |
---|
196 | } |
---|
197 | #endif |
---|
198 | |
---|
199 | #endif |
---|
200 | |
---|
201 | |
---|