[42b6dd2a] | 1 | /* bsp.h |
---|
| 2 | * |
---|
[9c448e1] | 3 | * This include file contains all board IO definitions. |
---|
| 4 | * |
---|
[42b6dd2a] | 5 | * COPYRIGHT (c) 1989-2009. |
---|
[9c448e1] | 6 | * On-Line Applications Research Corporation (OAR). |
---|
| 7 | * |
---|
[42b6dd2a] | 8 | * The license and distribution terms for this file may be |
---|
| 9 | * found in the file LICENSE in this distribution or at |
---|
[b14e2f2] | 10 | * http://www.rtems.com/license/LICENSE. |
---|
[9c448e1] | 11 | * |
---|
| 12 | * $Id$ |
---|
| 13 | */ |
---|
| 14 | |
---|
[34c4852] | 15 | #ifndef _BSP_H |
---|
| 16 | #define _BSP_H |
---|
[9c448e1] | 17 | |
---|
| 18 | #ifdef __cplusplus |
---|
| 19 | extern "C" { |
---|
| 20 | #endif |
---|
| 21 | |
---|
[42b6dd2a] | 22 | #define BSP_ZERO_WORKSPACE_AUTOMATICALLY TRUE |
---|
| 23 | |
---|
[d4f9cef5] | 24 | #include <bspopts.h> |
---|
[bb41881e] | 25 | #include <rtems.h> |
---|
| 26 | #include <rtems/console.h> |
---|
| 27 | #include <libcpu/io.h> |
---|
| 28 | #include <rtems/clockdrv.h> |
---|
| 29 | #include <bsp/vectors.h> |
---|
[d4f9cef5] | 30 | |
---|
[9c448e1] | 31 | #ifdef ASM |
---|
| 32 | /* Definition of where to store registers in alignment handler */ |
---|
| 33 | #define ALIGN_REGS 0x0140 |
---|
| 34 | |
---|
| 35 | #else |
---|
| 36 | #include <rtems.h> |
---|
[1c54724] | 37 | #include <rtems/console.h> |
---|
| 38 | #include <rtems/clockdrv.h> |
---|
| 39 | #include <rtems/iosupp.h> |
---|
[9c448e1] | 40 | |
---|
[f5e7b4c3] | 41 | /* |
---|
| 42 | * We no longer support the first generation board. |
---|
| 43 | */ |
---|
[9c448e1] | 44 | |
---|
| 45 | #include <gen2.h> |
---|
[42b6dd2a] | 46 | #include <bsp/irq.h> |
---|
[9c448e1] | 47 | |
---|
| 48 | /* |
---|
| 49 | * The following macro calculates the Baud constant. For the Z8530 chip. |
---|
| 50 | * |
---|
| 51 | * Note: baud constant = ((clock frequency / Clock_X) / (2 * Baud Rate)) - 2 |
---|
| 52 | * for the Score603e ((10,000,000 / 16) / (2 * Baud Rate)) - 2 |
---|
| 53 | */ |
---|
| 54 | #define _Score603e_Z8530_Baud( _frequency, _clock_by, _baud_rate ) \ |
---|
| 55 | ( (_frequency /( _clock_by * 2 * _baud_rate)) - 2) |
---|
| 56 | |
---|
| 57 | #define Score603e_Z8530_Chip1_Baud( _value ) \ |
---|
| 58 | _Score603e_Z8530_Baud( SCORE603E_85C30_1_CLOCK, \ |
---|
[6128a4a] | 59 | SCORE603E_85C30_1_CLOCK_X, _value ) |
---|
[9c448e1] | 60 | |
---|
| 61 | #define Score603e_Z8530_Chip0_Baud( _value ) \ |
---|
| 62 | _Score603e_Z8530_Baud( SCORE603E_85C30_0_CLOCK, \ |
---|
[6128a4a] | 63 | SCORE603E_85C30_0_CLOCK_X, _value ) |
---|
[9c448e1] | 64 | |
---|
| 65 | #define Initialize_Board_ctrl_register() \ |
---|
| 66 | *SCORE603E_BOARD_CTRL_REG = (*SCORE603E_BOARD_CTRL_REG | \ |
---|
[f309cda] | 67 | SCORE603E_BRD_FLASH_DISABLE_MASK) |
---|
| 68 | |
---|
| 69 | #define Processor_Synchronize() \ |
---|
[3d50574] | 70 | asm volatile(" eieio ") |
---|
[f309cda] | 71 | |
---|
[9c448e1] | 72 | |
---|
[42b6dd2a] | 73 | /* Constants */ |
---|
| 74 | |
---|
| 75 | /* |
---|
| 76 | * Device Driver Table Entries |
---|
| 77 | */ |
---|
| 78 | |
---|
| 79 | /* |
---|
| 80 | * NOTE: Use the standard Console driver entry |
---|
| 81 | */ |
---|
| 82 | |
---|
| 83 | /* |
---|
| 84 | * NOTE: Use the standard Clock driver entry |
---|
| 85 | */ |
---|
| 86 | |
---|
[9c448e1] | 87 | /* |
---|
| 88 | * Information placed in the linkcmds file. |
---|
| 89 | */ |
---|
| 90 | |
---|
[42b6dd2a] | 91 | extern int RAM_START; |
---|
| 92 | extern int RAM_END; |
---|
| 93 | extern int RAM_SIZE; |
---|
| 94 | |
---|
| 95 | extern int PROM_START; |
---|
| 96 | extern int PROM_END; |
---|
| 97 | extern int PROM_SIZE; |
---|
[9c448e1] | 98 | |
---|
| 99 | extern int CLOCK_SPEED; |
---|
| 100 | extern int CPU_PPC_CLICKS_PER_MS; |
---|
| 101 | |
---|
[42b6dd2a] | 102 | extern int end; /* last address in the program */ |
---|
| 103 | |
---|
[387a69a] | 104 | /* |
---|
| 105 | * Total RAM available |
---|
| 106 | */ |
---|
[42b6dd2a] | 107 | extern int end; /* last address in the program */ |
---|
| 108 | extern int RAM_END; |
---|
| 109 | extern uint32_t BSP_mem_size; |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | /* |
---|
| 113 | * How many libio files we want |
---|
| 114 | */ |
---|
| 115 | |
---|
| 116 | #define BSP_LIBIO_MAX_FDS 20 |
---|
[387a69a] | 117 | |
---|
[9c448e1] | 118 | /* functions */ |
---|
| 119 | |
---|
[6128a4a] | 120 | /* |
---|
[42b6dd2a] | 121 | * |
---|
[9c448e1] | 122 | */ |
---|
| 123 | rtems_isr_entry set_EE_vector( |
---|
| 124 | rtems_isr_entry handler, /* isr routine */ |
---|
| 125 | rtems_vector_number vector /* vector number */ |
---|
| 126 | ); |
---|
| 127 | void initialize_external_exception_vector (); |
---|
| 128 | |
---|
| 129 | /* |
---|
| 130 | * console.c |
---|
| 131 | */ |
---|
| 132 | void BSP_fatal_return( void ); |
---|
| 133 | |
---|
| 134 | /* |
---|
| 135 | * Hwr_init.c |
---|
| 136 | */ |
---|
| 137 | void init_PCI(); |
---|
| 138 | void instruction_cache_enable (); |
---|
| 139 | void data_cache_enable (); |
---|
| 140 | |
---|
| 141 | void initialize_PCI_bridge (); |
---|
[dac4208] | 142 | uint16_t read_and_clear_irq (); |
---|
[9c448e1] | 143 | void set_irq_mask( |
---|
[dac4208] | 144 | uint16_t value |
---|
[9c448e1] | 145 | ); |
---|
[dac4208] | 146 | uint16_t get_irq_mask(); |
---|
[9c448e1] | 147 | |
---|
| 148 | /* |
---|
| 149 | * universe.c |
---|
| 150 | */ |
---|
| 151 | void initialize_universe(); |
---|
| 152 | |
---|
| 153 | void set_irq_mask( |
---|
[dac4208] | 154 | uint16_t value |
---|
[9c448e1] | 155 | ); |
---|
| 156 | |
---|
[dac4208] | 157 | uint16_t get_irq_mask(); |
---|
[9c448e1] | 158 | |
---|
[6128a4a] | 159 | void unmask_irq( |
---|
[dac4208] | 160 | uint16_t irq_idx |
---|
[9c448e1] | 161 | ); |
---|
| 162 | |
---|
[42b6dd2a] | 163 | void mask_irq( |
---|
| 164 | uint16_t irq_idx |
---|
| 165 | ); |
---|
| 166 | |
---|
[9c448e1] | 167 | void init_irq_data_register(); |
---|
| 168 | |
---|
[dac4208] | 169 | uint16_t read_and_clear_PMC_irq( |
---|
| 170 | uint16_t irq |
---|
[9c448e1] | 171 | ); |
---|
| 172 | |
---|
[40e7ae2] | 173 | bool Is_PMC_IRQ( |
---|
[dac4208] | 174 | uint32_t pmc_irq, |
---|
| 175 | uint16_t status_word |
---|
[9c448e1] | 176 | ); |
---|
| 177 | |
---|
[dac4208] | 178 | uint16_t read_and_clear_irq(); |
---|
[9c448e1] | 179 | |
---|
| 180 | /* |
---|
| 181 | * FPGA.c |
---|
| 182 | */ |
---|
| 183 | void initialize_PCI_bridge (); |
---|
| 184 | |
---|
| 185 | /* flash.c */ |
---|
| 186 | |
---|
| 187 | unsigned int SCORE603e_FLASH_Disable( |
---|
[dac4208] | 188 | uint32_t unused |
---|
[9c448e1] | 189 | ); |
---|
| 190 | unsigned int SCORE603e_FLASH_verify_enable(); |
---|
| 191 | unsigned int SCORE603e_FLASH_Enable_writes( |
---|
[dac4208] | 192 | uint32_t area /* Unused */ |
---|
[9c448e1] | 193 | ); |
---|
| 194 | |
---|
[f309cda] | 195 | #define BSP_FLASH_ENABLE_WRITES( _area) SCORE603e_FLASH_Enable_writes( _area ) |
---|
| 196 | #define BSP_FLASH_DISABLE_WRITES(_area) SCORE603e_FLASH_Disable( _area ) |
---|
| 197 | |
---|
[9c448e1] | 198 | #define Convert_Endian_32( _data ) \ |
---|
| 199 | ( ((_data&0x000000ff)<<24) | ((_data&0x0000ff00)<<8) | \ |
---|
| 200 | ((_data&0x00ff0000)>>8) | ((_data&0xff000000)>>24) ) |
---|
| 201 | |
---|
| 202 | #define Convert_Endian_16( _data ) \ |
---|
| 203 | ( ((_data&0x00ff)<<8) | ((_data&0xff00)>>8) ) |
---|
| 204 | |
---|
| 205 | #endif /* ASM */ |
---|
| 206 | |
---|
| 207 | #ifdef __cplusplus |
---|
| 208 | } |
---|
| 209 | #endif |
---|
| 210 | |
---|
| 211 | #endif |
---|