[25026906] | 1 | /** |
---|
| 2 | * @file |
---|
[296c74e6] | 3 | * |
---|
[cfeb191e] | 4 | * @ingroup sparc_erc32 |
---|
[296c74e6] | 5 | * |
---|
| 6 | * @brief Global BSP Definitions. |
---|
[25026906] | 7 | */ |
---|
| 8 | |
---|
[7f96eef] | 9 | /* bsp.h |
---|
| 10 | * |
---|
| 11 | * This include file contains all SPARC simulator definitions. |
---|
| 12 | * |
---|
[bf5ef93] | 13 | * COPYRIGHT (c) 1989-2007. |
---|
[7f96eef] | 14 | * On-Line Applications Research Corporation (OAR). |
---|
| 15 | * |
---|
[98e4ebf5] | 16 | * The license and distribution terms for this file may be |
---|
| 17 | * found in the file LICENSE in this distribution or at |
---|
[7d2a0641] | 18 | * http://www.rtems.com/license/LICENSE. |
---|
[7f96eef] | 19 | * |
---|
| 20 | * Ported to ERC32 implementation of the SPARC by On-Line Applications |
---|
[6128a4a] | 21 | * Research Corporation (OAR) under contract to the European Space |
---|
[7f96eef] | 22 | * Agency (ESA). |
---|
| 23 | * |
---|
[6128a4a] | 24 | * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995. |
---|
[7f96eef] | 25 | * European Space Agency. |
---|
| 26 | */ |
---|
| 27 | |
---|
[34c4852] | 28 | #ifndef _BSP_H |
---|
| 29 | #define _BSP_H |
---|
[7f96eef] | 30 | |
---|
| 31 | #ifdef __cplusplus |
---|
| 32 | extern "C" { |
---|
| 33 | #endif |
---|
| 34 | |
---|
[ac43f07] | 35 | #include <bspopts.h> |
---|
[a052181] | 36 | #include <bsp/default-initial-extension.h> |
---|
[ac43f07] | 37 | |
---|
[7f96eef] | 38 | #include <rtems.h> |
---|
[206e590] | 39 | #include <rtems/iosupp.h> |
---|
[5354ab0] | 40 | #include <erc32.h> |
---|
[206e590] | 41 | #include <rtems/clockdrv.h> |
---|
| 42 | #include <rtems/console.h> |
---|
[95518e59] | 43 | #include <rtems/irq-extension.h> |
---|
[df49c60] | 44 | |
---|
[296c74e6] | 45 | /** |
---|
| 46 | * @defgroup sparc_erc32 ERC32 Support |
---|
| 47 | * |
---|
| 48 | * @ingroup bsp_sparc |
---|
| 49 | * |
---|
| 50 | * @brief ERC32 Support Package |
---|
| 51 | */ |
---|
| 52 | |
---|
[df49c60] | 53 | /* |
---|
[0fed29a] | 54 | * BSP provides its own Idle thread body |
---|
[df49c60] | 55 | */ |
---|
[0fed29a] | 56 | void *bsp_idle_thread( uintptr_t ignored ); |
---|
| 57 | #define BSP_IDLE_TASK_BODY bsp_idle_thread |
---|
[7f96eef] | 58 | |
---|
[2700423] | 59 | /* |
---|
| 60 | * Network driver configuration |
---|
| 61 | */ |
---|
| 62 | struct rtems_bsdnet_ifconfig; |
---|
[0fed29a] | 63 | extern int rtems_erc32_sonic_driver_attach( |
---|
| 64 | struct rtems_bsdnet_ifconfig *config |
---|
| 65 | ); |
---|
[2700423] | 66 | #define RTEMS_BSP_NETWORK_DRIVER_NAME "sonic1" |
---|
| 67 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_erc32_sonic_driver_attach |
---|
| 68 | |
---|
[7f96eef] | 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; |
---|
[6128a4a] | 78 | |
---|
[7f96eef] | 79 | extern int PROM_START; |
---|
| 80 | extern int PROM_END; |
---|
| 81 | extern int PROM_SIZE; |
---|
| 82 | |
---|
| 83 | extern int CLOCK_SPEED; |
---|
[6128a4a] | 84 | |
---|
[7f96eef] | 85 | extern int end; /* last address in the program */ |
---|
| 86 | |
---|
[ccceaf3] | 87 | /* functions */ |
---|
[7f96eef] | 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 | |
---|
[0729e2a7] | 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 |
---|
[47a3cd8] | 101 | * bsp_work_area_initialize(). malloc() is called to get memory when this function |
---|
| 102 | * is called after bsp_work_area_initialize(). |
---|
[0729e2a7] | 103 | */ |
---|
| 104 | void *bsp_early_malloc(int size); |
---|
| 105 | |
---|
[95518e59] | 106 | /* Interrupt Service Routine (ISR) pointer */ |
---|
| 107 | typedef void (*bsp_shared_isr)(void *arg); |
---|
| 108 | |
---|
| 109 | /* Initializes the Shared System Interrupt service */ |
---|
[dd8df59] | 110 | extern void BSP_shared_interrupt_init(void); |
---|
[95518e59] | 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 | |
---|
[7f96eef] | 179 | #ifdef __cplusplus |
---|
| 180 | } |
---|
| 181 | #endif |
---|
| 182 | |
---|
| 183 | #endif |
---|