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