[d230d8e] | 1 | /** |
---|
[df217b0b] | 2 | * @file |
---|
[296c74e6] | 3 | * |
---|
[cfeb191e] | 4 | * @ingroup sparc_leon3 |
---|
[296c74e6] | 5 | * |
---|
| 6 | * @brief Global BSP Definitions. |
---|
[d230d8e] | 7 | */ |
---|
| 8 | |
---|
[41c9282] | 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 |
---|
[c499856] | 18 | * http://www.rtems.org/license/LICENSE. |
---|
[41c9282] | 19 | * |
---|
| 20 | * Ported to ERC32 implementation of the SPARC by On-Line Applications |
---|
[44b06ca] | 21 | * Research Corporation (OAR) under contract to the European Space |
---|
[41c9282] | 22 | * Agency (ESA). |
---|
| 23 | * |
---|
[44b06ca] | 24 | * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995. |
---|
[41c9282] | 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> |
---|
[a052181] | 36 | #include <bsp/default-initial-extension.h> |
---|
[41c9282] | 37 | |
---|
| 38 | #include <rtems.h> |
---|
| 39 | #include <leon.h> |
---|
| 40 | #include <rtems/clockdrv.h> |
---|
| 41 | #include <rtems/console.h> |
---|
[95518e59] | 42 | #include <rtems/irq-extension.h> |
---|
[41c9282] | 43 | |
---|
[296c74e6] | 44 | /** |
---|
| 45 | * @defgroup sparc_leon3 LEON3 Support |
---|
| 46 | * |
---|
| 47 | * @ingroup bsp_sparc |
---|
| 48 | * |
---|
| 49 | * @brief LEON3 support package |
---|
| 50 | * |
---|
| 51 | */ |
---|
| 52 | |
---|
[2aaff51] | 53 | /* SPARC CPU variant: LEON3 */ |
---|
| 54 | #define LEON3 1 |
---|
| 55 | |
---|
[41c9282] | 56 | /* |
---|
[56035ca3] | 57 | * BSP provides its own Idle thread body |
---|
[41c9282] | 58 | */ |
---|
[56035ca3] | 59 | void *bsp_idle_thread( uintptr_t ignored ); |
---|
| 60 | #define BSP_IDLE_TASK_BODY bsp_idle_thread |
---|
[41c9282] | 61 | |
---|
[ddf0d60] | 62 | /* Maximum supported APBUARTs by BSP */ |
---|
| 63 | #define BSP_NUMBER_OF_TERMIOS_PORTS 8 |
---|
| 64 | |
---|
[47cf1add] | 65 | /* Make sure maximum number of consoles fit in filesystem */ |
---|
| 66 | #define BSP_MAXIMUM_DEVICES 8 |
---|
| 67 | |
---|
[41c9282] | 68 | /* |
---|
| 69 | * Network driver configuration |
---|
| 70 | */ |
---|
| 71 | struct rtems_bsdnet_ifconfig; |
---|
| 72 | extern int rtems_leon_open_eth_driver_attach( |
---|
| 73 | struct rtems_bsdnet_ifconfig *config, |
---|
| 74 | int attach |
---|
| 75 | ); |
---|
| 76 | extern int rtems_smc91111_driver_attach_leon3( |
---|
| 77 | struct rtems_bsdnet_ifconfig *config, |
---|
| 78 | int attach |
---|
| 79 | ); |
---|
[6dd1665c] | 80 | extern int rtems_leon_greth_driver_attach( |
---|
| 81 | struct rtems_bsdnet_ifconfig *config, |
---|
| 82 | int attach |
---|
| 83 | ); |
---|
| 84 | |
---|
[9f058fb] | 85 | #define RTEMS_BSP_NETWORK_DRIVER_NAME_OPENETH "open_eth1" |
---|
| 86 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH_OPENETH \ |
---|
[363b1f7] | 87 | rtems_leon_open_eth_driver_attach |
---|
[9f058fb] | 88 | #define RTEMS_BSP_NETWORK_DRIVER_NAME_SMC91111 "smc_eth1" |
---|
[363b1f7] | 89 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH_SMC91111 \ |
---|
| 90 | rtems_smc91111_driver_attach_leon3 |
---|
[9f058fb] | 91 | #define RTEMS_BSP_NETWORK_DRIVER_NAME_GRETH "gr_eth1" |
---|
[363b1f7] | 92 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH_GRETH \ |
---|
| 93 | rtems_leon_greth_driver_attach |
---|
[6dd1665c] | 94 | |
---|
| 95 | #ifndef RTEMS_BSP_NETWORK_DRIVER_NAME |
---|
| 96 | #define RTEMS_BSP_NETWORK_DRIVER_NAME RTEMS_BSP_NETWORK_DRIVER_NAME_GRETH |
---|
| 97 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH RTEMS_BSP_NETWORK_DRIVER_ATTACH_GRETH |
---|
| 98 | #endif |
---|
[41c9282] | 99 | |
---|
[67b1ce4] | 100 | #define HAS_SMC91111 |
---|
| 101 | |
---|
[39671330] | 102 | /* Configure GRETH driver */ |
---|
| 103 | #define GRETH_SUPPORTED |
---|
| 104 | #define GRETH_MEM_LOAD(addr) leon_r32_no_cache(addr) |
---|
| 105 | |
---|
[4cb04f2] | 106 | extern int CPU_SPARC_HAS_SNOOPING; |
---|
| 107 | |
---|
[41c9282] | 108 | /* Constants */ |
---|
| 109 | |
---|
| 110 | /* |
---|
| 111 | * Information placed in the linkcmds file. |
---|
| 112 | */ |
---|
| 113 | |
---|
| 114 | extern int RAM_START; |
---|
| 115 | extern int RAM_END; |
---|
| 116 | extern int RAM_SIZE; |
---|
[44b06ca] | 117 | |
---|
[41c9282] | 118 | extern int PROM_START; |
---|
| 119 | extern int PROM_END; |
---|
| 120 | extern int PROM_SIZE; |
---|
| 121 | |
---|
| 122 | extern int CLOCK_SPEED; |
---|
[44b06ca] | 123 | |
---|
[41c9282] | 124 | extern int end; /* last address in the program */ |
---|
| 125 | |
---|
| 126 | /* miscellaneous stuff assumed to exist */ |
---|
| 127 | |
---|
| 128 | rtems_isr_entry set_vector( /* returns old vector */ |
---|
| 129 | rtems_isr_entry handler, /* isr routine */ |
---|
| 130 | rtems_vector_number vector, /* vector number */ |
---|
| 131 | int type /* RTEMS or RAW intr */ |
---|
| 132 | ); |
---|
| 133 | |
---|
| 134 | void BSP_fatal_return( void ); |
---|
| 135 | |
---|
| 136 | void bsp_spurious_initialize( void ); |
---|
| 137 | |
---|
[0729e2a7] | 138 | /* Allocate 8-byte aligned non-freeable pre-malloc() memory. The function |
---|
| 139 | * can be called at any time. The work-area will shrink when called before |
---|
[363b1f7] | 140 | * bsp_work_area_initialize(). malloc() is called to get memory when this |
---|
| 141 | * function is called after bsp_work_area_initialize(). |
---|
[0729e2a7] | 142 | */ |
---|
| 143 | void *bsp_early_malloc(int size); |
---|
| 144 | |
---|
[95518e59] | 145 | /* Interrupt Service Routine (ISR) pointer */ |
---|
| 146 | typedef void (*bsp_shared_isr)(void *arg); |
---|
| 147 | |
---|
| 148 | /* Initializes the Shared System Interrupt service */ |
---|
[dd8df59] | 149 | extern void BSP_shared_interrupt_init(void); |
---|
[95518e59] | 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 | |
---|
[41c9282] | 218 | #ifdef __cplusplus |
---|
| 219 | } |
---|
| 220 | #endif |
---|
| 221 | |
---|
| 222 | #endif |
---|
[6dd1665c] | 223 | |
---|
| 224 | |
---|