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