[8d830fae] | 1 | /** |
---|
| 2 | * @file |
---|
[cfeb191e] | 3 | * @ingroup sparc_bsp |
---|
| 4 | * @defgroup sparc_leon2 SPARC Leon2 |
---|
| 5 | * @ingroup sparc_leon2 |
---|
| 6 | * @brief Sparc Leon2 BSP |
---|
[8d830fae] | 7 | */ |
---|
| 8 | |
---|
[bec7ba52] | 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.com/license/LICENSE. |
---|
| 19 | * |
---|
| 20 | * Ported to ERC32 implementation of the SPARC by On-Line Applications |
---|
[44b06ca] | 21 | * Research Corporation (OAR) under contract to the European Space |
---|
[bec7ba52] | 22 | * Agency (ESA). |
---|
| 23 | * |
---|
[44b06ca] | 24 | * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995. |
---|
[bec7ba52] | 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> |
---|
[bec7ba52] | 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> |
---|
[2aaff51] | 43 | |
---|
| 44 | /* SPARC CPU variant: LEON2 */ |
---|
| 45 | #define LEON2 1 |
---|
[44b06ca] | 46 | |
---|
[bec7ba52] | 47 | /* |
---|
[b181c30] | 48 | * BSP provides its own Idle thread body |
---|
[bec7ba52] | 49 | */ |
---|
[b181c30] | 50 | void *bsp_idle_thread( uintptr_t ignored ); |
---|
| 51 | #define BSP_IDLE_TASK_BODY bsp_idle_thread |
---|
[bec7ba52] | 52 | |
---|
| 53 | /* |
---|
| 54 | * Network driver configuration |
---|
| 55 | */ |
---|
| 56 | struct rtems_bsdnet_ifconfig; |
---|
[b181c30] | 57 | extern int rtems_leon_open_eth_driver_attach( |
---|
| 58 | struct rtems_bsdnet_ifconfig *config |
---|
| 59 | ); |
---|
| 60 | extern int rtems_smc91111_driver_attach_leon2( |
---|
| 61 | struct rtems_bsdnet_ifconfig *config |
---|
| 62 | ); |
---|
[bec7ba52] | 63 | #define RTEMS_BSP_NETWORK_DRIVER_NAME "open_eth1" |
---|
[b181c30] | 64 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH_OPENETH \ |
---|
| 65 | rtems_leon_open_eth_driver_attach |
---|
| 66 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH_SMC91111 \ |
---|
| 67 | rtems_smc91111_driver_attach_leon2 |
---|
[bec7ba52] | 68 | |
---|
[67b1ce4] | 69 | #define HAS_SMC91111 |
---|
| 70 | |
---|
[39671330] | 71 | /* Configure GRETH driver */ |
---|
| 72 | #define GRETH_SUPPORTED |
---|
| 73 | #define GRETH_MEM_LOAD(addr) leon_r32_no_cache(addr) |
---|
| 74 | |
---|
[bec7ba52] | 75 | /* |
---|
| 76 | * The synchronous trap is an arbitrarily chosen software trap. |
---|
| 77 | */ |
---|
| 78 | |
---|
[b181c30] | 79 | extern int CPU_SPARC_HAS_SNOOPING; |
---|
[bec7ba52] | 80 | |
---|
| 81 | /* Constants */ |
---|
| 82 | |
---|
| 83 | /* |
---|
| 84 | * Information placed in the linkcmds file. |
---|
| 85 | */ |
---|
| 86 | |
---|
| 87 | extern int RAM_START; |
---|
| 88 | extern int RAM_END; |
---|
| 89 | extern int RAM_SIZE; |
---|
[44b06ca] | 90 | |
---|
[bec7ba52] | 91 | extern int PROM_START; |
---|
| 92 | extern int PROM_END; |
---|
| 93 | extern int PROM_SIZE; |
---|
| 94 | |
---|
| 95 | extern int CLOCK_SPEED; |
---|
[44b06ca] | 96 | |
---|
[bec7ba52] | 97 | extern int end; /* last address in the program */ |
---|
| 98 | |
---|
| 99 | /* miscellaneous stuff assumed to exist */ |
---|
| 100 | |
---|
| 101 | rtems_isr_entry set_vector( /* returns old vector */ |
---|
| 102 | rtems_isr_entry handler, /* isr routine */ |
---|
| 103 | rtems_vector_number vector, /* vector number */ |
---|
| 104 | int type /* RTEMS or RAW intr */ |
---|
| 105 | ); |
---|
| 106 | |
---|
| 107 | void BSP_fatal_return( void ); |
---|
| 108 | |
---|
| 109 | void bsp_spurious_initialize( void ); |
---|
| 110 | |
---|
[0729e2a7] | 111 | /* Allocate 8-byte aligned non-freeable pre-malloc() memory. The function |
---|
| 112 | * can be called at any time. The work-area will shrink when called before |
---|
[47a3cd8] | 113 | * bsp_work_area_initialize(). malloc() is called to get memory when this function |
---|
| 114 | * is called after bsp_work_area_initialize(). |
---|
[0729e2a7] | 115 | */ |
---|
| 116 | void *bsp_early_malloc(int size); |
---|
| 117 | |
---|
[95518e59] | 118 | /* Interrupt Service Routine (ISR) pointer */ |
---|
| 119 | typedef void (*bsp_shared_isr)(void *arg); |
---|
| 120 | |
---|
| 121 | /* Initializes the Shared System Interrupt service */ |
---|
[dd8df59] | 122 | extern void BSP_shared_interrupt_init(void); |
---|
[95518e59] | 123 | |
---|
| 124 | /* Registers a shared IRQ handler, and enable it at IRQ controller. Multiple |
---|
| 125 | * interrupt handlers may use the same IRQ number, all ISRs will be called |
---|
| 126 | * when an interrupt on that line is fired. |
---|
| 127 | * |
---|
| 128 | * Arguments |
---|
| 129 | * irq System IRQ number |
---|
| 130 | * info Optional Name of IRQ source |
---|
| 131 | * isr Function pointer to the ISR |
---|
| 132 | * arg Second argument to function isr |
---|
| 133 | */ |
---|
| 134 | static __inline__ int BSP_shared_interrupt_register |
---|
| 135 | ( |
---|
| 136 | int irq, |
---|
| 137 | const char *info, |
---|
| 138 | bsp_shared_isr isr, |
---|
| 139 | void *arg |
---|
| 140 | ) |
---|
| 141 | { |
---|
| 142 | return rtems_interrupt_handler_install(irq, info, |
---|
| 143 | RTEMS_INTERRUPT_SHARED, isr, arg); |
---|
| 144 | } |
---|
| 145 | |
---|
| 146 | /* Unregister previously registered shared IRQ handler. |
---|
| 147 | * |
---|
| 148 | * Arguments |
---|
| 149 | * irq System IRQ number |
---|
| 150 | * isr Function pointer to the ISR |
---|
| 151 | * arg Second argument to function isr |
---|
| 152 | */ |
---|
| 153 | static __inline__ int BSP_shared_interrupt_unregister |
---|
| 154 | ( |
---|
| 155 | int irq, |
---|
| 156 | bsp_shared_isr isr, |
---|
| 157 | void *arg |
---|
| 158 | ) |
---|
| 159 | { |
---|
| 160 | return rtems_interrupt_handler_remove(irq, isr, arg); |
---|
| 161 | } |
---|
| 162 | |
---|
| 163 | /* Clear interrupt pending on IRQ controller, this is typically done on a |
---|
| 164 | * level triggered interrupt source such as PCI to avoid taking double IRQs. |
---|
| 165 | * In such a case the interrupt source must be cleared first on LEON, before |
---|
| 166 | * acknowledging the IRQ with this function. |
---|
| 167 | * |
---|
| 168 | * Arguments |
---|
| 169 | * irq System IRQ number |
---|
| 170 | */ |
---|
| 171 | extern void BSP_shared_interrupt_clear(int irq); |
---|
| 172 | |
---|
| 173 | /* Enable Interrupt. This function will unmask the IRQ at the interrupt |
---|
| 174 | * controller. This is normally done by _register(). Note that this will |
---|
| 175 | * affect all ISRs on this IRQ. |
---|
| 176 | * |
---|
| 177 | * Arguments |
---|
| 178 | * irq System IRQ number |
---|
| 179 | */ |
---|
| 180 | extern void BSP_shared_interrupt_unmask(int irq); |
---|
| 181 | |
---|
| 182 | /* Disable Interrupt. This function will mask one IRQ at the interrupt |
---|
| 183 | * controller. This is normally done by _unregister(). Note that this will |
---|
| 184 | * affect all ISRs on this IRQ. |
---|
| 185 | * |
---|
| 186 | * Arguments |
---|
| 187 | * irq System IRQ number |
---|
| 188 | */ |
---|
| 189 | extern void BSP_shared_interrupt_mask(int irq); |
---|
| 190 | |
---|
[bec7ba52] | 191 | #ifdef __cplusplus |
---|
| 192 | } |
---|
| 193 | #endif |
---|
| 194 | |
---|
| 195 | #endif |
---|