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