1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup sparc_erc32 |
---|
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-2007. |
---|
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.com/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 | #ifdef __cplusplus |
---|
32 | extern "C" { |
---|
33 | #endif |
---|
34 | |
---|
35 | #include <bspopts.h> |
---|
36 | #include <bsp/default-initial-extension.h> |
---|
37 | |
---|
38 | #include <rtems.h> |
---|
39 | #include <rtems/iosupp.h> |
---|
40 | #include <erc32.h> |
---|
41 | #include <rtems/clockdrv.h> |
---|
42 | #include <rtems/console.h> |
---|
43 | #include <rtems/irq-extension.h> |
---|
44 | |
---|
45 | /** |
---|
46 | * @defgroup sparc_erc32 ERC32 Support |
---|
47 | * |
---|
48 | * @ingroup bsp_sparc |
---|
49 | * |
---|
50 | * @brief ERC32 Support Package |
---|
51 | */ |
---|
52 | |
---|
53 | /* |
---|
54 | * BSP provides its own Idle thread body |
---|
55 | */ |
---|
56 | void *bsp_idle_thread( uintptr_t ignored ); |
---|
57 | #define BSP_IDLE_TASK_BODY bsp_idle_thread |
---|
58 | |
---|
59 | /* |
---|
60 | * Network driver configuration |
---|
61 | */ |
---|
62 | struct rtems_bsdnet_ifconfig; |
---|
63 | extern int rtems_erc32_sonic_driver_attach( |
---|
64 | struct rtems_bsdnet_ifconfig *config |
---|
65 | ); |
---|
66 | #define RTEMS_BSP_NETWORK_DRIVER_NAME "sonic1" |
---|
67 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_erc32_sonic_driver_attach |
---|
68 | |
---|
69 | /* Constants */ |
---|
70 | |
---|
71 | /* |
---|
72 | * Information placed in the linkcmds file. |
---|
73 | */ |
---|
74 | |
---|
75 | extern int RAM_START; |
---|
76 | extern int RAM_END; |
---|
77 | extern int RAM_SIZE; |
---|
78 | |
---|
79 | extern int PROM_START; |
---|
80 | extern int PROM_END; |
---|
81 | extern int PROM_SIZE; |
---|
82 | |
---|
83 | extern int CLOCK_SPEED; |
---|
84 | |
---|
85 | extern int end; /* last address in the program */ |
---|
86 | |
---|
87 | /* functions */ |
---|
88 | |
---|
89 | rtems_isr_entry set_vector( /* returns old vector */ |
---|
90 | rtems_isr_entry handler, /* isr routine */ |
---|
91 | rtems_vector_number vector, /* vector number */ |
---|
92 | int type /* RTEMS or RAW intr */ |
---|
93 | ); |
---|
94 | |
---|
95 | void BSP_fatal_return( void ); |
---|
96 | |
---|
97 | void bsp_spurious_initialize( void ); |
---|
98 | |
---|
99 | /* Allocate 8-byte aligned non-freeable pre-malloc() memory. The function |
---|
100 | * can be called at any time. The work-area will shrink when called before |
---|
101 | * bsp_work_area_initialize(). malloc() is called to get memory when this function |
---|
102 | * is called after bsp_work_area_initialize(). |
---|
103 | */ |
---|
104 | void *bsp_early_malloc(int size); |
---|
105 | |
---|
106 | /* Interrupt Service Routine (ISR) pointer */ |
---|
107 | typedef void (*bsp_shared_isr)(void *arg); |
---|
108 | |
---|
109 | /* Initializes the Shared System Interrupt service */ |
---|
110 | extern void BSP_shared_interrupt_init(void); |
---|
111 | |
---|
112 | /* Registers a shared IRQ handler, and enable it at IRQ controller. Multiple |
---|
113 | * interrupt handlers may use the same IRQ number, all ISRs will be called |
---|
114 | * when an interrupt on that line is fired. |
---|
115 | * |
---|
116 | * Arguments |
---|
117 | * irq System IRQ number |
---|
118 | * info Optional Name of IRQ source |
---|
119 | * isr Function pointer to the ISR |
---|
120 | * arg Second argument to function isr |
---|
121 | */ |
---|
122 | static __inline__ int BSP_shared_interrupt_register |
---|
123 | ( |
---|
124 | int irq, |
---|
125 | const char *info, |
---|
126 | bsp_shared_isr isr, |
---|
127 | void *arg |
---|
128 | ) |
---|
129 | { |
---|
130 | return rtems_interrupt_handler_install(irq, info, |
---|
131 | RTEMS_INTERRUPT_SHARED, isr, arg); |
---|
132 | } |
---|
133 | |
---|
134 | /* Unregister previously registered shared IRQ handler. |
---|
135 | * |
---|
136 | * Arguments |
---|
137 | * irq System IRQ number |
---|
138 | * isr Function pointer to the ISR |
---|
139 | * arg Second argument to function isr |
---|
140 | */ |
---|
141 | static __inline__ int BSP_shared_interrupt_unregister |
---|
142 | ( |
---|
143 | int irq, |
---|
144 | bsp_shared_isr isr, |
---|
145 | void *arg |
---|
146 | ) |
---|
147 | { |
---|
148 | return rtems_interrupt_handler_remove(irq, isr, arg); |
---|
149 | } |
---|
150 | |
---|
151 | /* Clear interrupt pending on IRQ controller, this is typically done on a |
---|
152 | * level triggered interrupt source such as PCI to avoid taking double IRQs. |
---|
153 | * In such a case the interrupt source must be cleared first on LEON, before |
---|
154 | * acknowledging the IRQ with this function. |
---|
155 | * |
---|
156 | * Arguments |
---|
157 | * irq System IRQ number |
---|
158 | */ |
---|
159 | extern void BSP_shared_interrupt_clear(int irq); |
---|
160 | |
---|
161 | /* Enable Interrupt. This function will unmask the IRQ at the interrupt |
---|
162 | * controller. This is normally done by _register(). Note that this will |
---|
163 | * affect all ISRs on this IRQ. |
---|
164 | * |
---|
165 | * Arguments |
---|
166 | * irq System IRQ number |
---|
167 | */ |
---|
168 | extern void BSP_shared_interrupt_unmask(int irq); |
---|
169 | |
---|
170 | /* Disable Interrupt. This function will mask one IRQ at the interrupt |
---|
171 | * controller. This is normally done by _unregister(). Note that this will |
---|
172 | * affect all ISRs on this IRQ. |
---|
173 | * |
---|
174 | * Arguments |
---|
175 | * irq System IRQ number |
---|
176 | */ |
---|
177 | extern void BSP_shared_interrupt_mask(int irq); |
---|
178 | |
---|
179 | #ifdef __cplusplus |
---|
180 | } |
---|
181 | #endif |
---|
182 | |
---|
183 | #endif |
---|