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