1 | /* bsp.h |
---|
2 | * |
---|
3 | * This include file contains all DY-4 DMV170 board IO definitions. |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 1989-1997. |
---|
6 | * On-Line Applications Research Corporation (OAR). |
---|
7 | * All rights assigned to U.S. Government, 1994. |
---|
8 | * |
---|
9 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
10 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
11 | * notice must appear in all copies of this file and its derivatives. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef __DMV170_BSP_h |
---|
17 | #define __DMV170_BSP_h |
---|
18 | |
---|
19 | #ifdef __cplusplus |
---|
20 | extern "C" { |
---|
21 | #endif |
---|
22 | |
---|
23 | #ifdef ASM |
---|
24 | /* Definition of where to store registers in alignment handler */ |
---|
25 | #define ALIGN_REGS 0x0140 |
---|
26 | |
---|
27 | #else |
---|
28 | #include <rtems.h> |
---|
29 | #include <console.h> |
---|
30 | #include <clockdrv.h> |
---|
31 | #include <console.h> |
---|
32 | #include <iosupp.h> |
---|
33 | |
---|
34 | #include <dmv170.h> |
---|
35 | |
---|
36 | #if 0 |
---|
37 | #define Enable_Debug() \ |
---|
38 | DMV170_WRITE( 0xffffbd0c, 0 ) |
---|
39 | |
---|
40 | #define Debug_Entry( num ) \ |
---|
41 | DMV170_WRITE( 0xffffbd06, num ) |
---|
42 | #else |
---|
43 | #define Enable_Debug() |
---|
44 | #define Debug_Entry( num ) |
---|
45 | #endif |
---|
46 | |
---|
47 | /* |
---|
48 | * The following macro calculates the Baud constant. For the Z8530 chip. |
---|
49 | */ |
---|
50 | #define Z8530_Baud( _frequency, _clock_by, _baud_rate ) \ |
---|
51 | ( (_frequency /( _clock_by * 2 * _baud_rate)) - 2) |
---|
52 | |
---|
53 | |
---|
54 | /* |
---|
55 | * Define the time limits for RTEMS Test Suite test durations. |
---|
56 | * Long test and short test duration limits are provided. These |
---|
57 | * values are in seconds and need to be converted to ticks for the |
---|
58 | * application. |
---|
59 | * |
---|
60 | */ |
---|
61 | |
---|
62 | #define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */ |
---|
63 | #define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */ |
---|
64 | |
---|
65 | |
---|
66 | /* |
---|
67 | * Stuff for Time Test 27 |
---|
68 | */ |
---|
69 | |
---|
70 | #define MUST_WAIT_FOR_INTERRUPT 1 |
---|
71 | |
---|
72 | #define Install_tm27_vector( _handler ) \ |
---|
73 | set_vector( (_handler), PPC_IRQ_DECREMENTER, 1 ) |
---|
74 | |
---|
75 | #define Cause_tm27_intr() \ |
---|
76 | do { \ |
---|
77 | unsigned32 _clicks = 1; \ |
---|
78 | asm volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \ |
---|
79 | } while (0) |
---|
80 | |
---|
81 | #define Clear_tm27_intr() \ |
---|
82 | do { \ |
---|
83 | unsigned32 _clicks = 0xffffffff; \ |
---|
84 | unsigned32 _msr = 0; \ |
---|
85 | _ISR_Set_level( 0 ); \ |
---|
86 | asm volatile( "mfmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \ |
---|
87 | _msr &= ~0x8000; \ |
---|
88 | asm volatile( "mtmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \ |
---|
89 | asm volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \ |
---|
90 | } while (0) |
---|
91 | |
---|
92 | #define Lower_tm27_intr() \ |
---|
93 | do { \ |
---|
94 | unsigned32 _msr = 0; \ |
---|
95 | _ISR_Set_level( 0 ); \ |
---|
96 | asm volatile( "mfmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \ |
---|
97 | _msr |= 0x8002; \ |
---|
98 | asm volatile( "mtmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \ |
---|
99 | } while (0) |
---|
100 | |
---|
101 | /* Constants */ |
---|
102 | |
---|
103 | /* |
---|
104 | * Device Driver Table Entries |
---|
105 | */ |
---|
106 | |
---|
107 | /* |
---|
108 | * NOTE: Use the standard Console driver entry |
---|
109 | */ |
---|
110 | |
---|
111 | /* |
---|
112 | * NOTE: Use the standard Clock driver entry |
---|
113 | */ |
---|
114 | |
---|
115 | |
---|
116 | /* |
---|
117 | * Information placed in the linkcmds file. |
---|
118 | */ |
---|
119 | |
---|
120 | extern int RAM_START; |
---|
121 | extern int RAM_END; |
---|
122 | extern int RAM_SIZE; |
---|
123 | |
---|
124 | extern int PROM_START; |
---|
125 | extern int PROM_END; |
---|
126 | extern int PROM_SIZE; |
---|
127 | |
---|
128 | extern int CLOCK_SPEED; |
---|
129 | |
---|
130 | extern int end; /* last address in the program */ |
---|
131 | |
---|
132 | /* |
---|
133 | * How many libio files we want |
---|
134 | */ |
---|
135 | |
---|
136 | #define BSP_LIBIO_MAX_FDS 20 |
---|
137 | |
---|
138 | /* functions */ |
---|
139 | |
---|
140 | /* |
---|
141 | * genvec.c |
---|
142 | */ |
---|
143 | rtems_isr_entry set_EE_vector( |
---|
144 | rtems_isr_entry handler, /* isr routine */ |
---|
145 | rtems_vector_number vector /* vector number */ |
---|
146 | ); |
---|
147 | void initialize_external_exception_vector (); |
---|
148 | |
---|
149 | /* |
---|
150 | * console.c |
---|
151 | */ |
---|
152 | void DEBUG_puts( char *string ); |
---|
153 | |
---|
154 | void BSP_fatal_return( void ); |
---|
155 | |
---|
156 | |
---|
157 | |
---|
158 | void bsp_start( void ); |
---|
159 | |
---|
160 | void bsp_cleanup( void ); |
---|
161 | |
---|
162 | rtems_isr_entry set_vector( /* returns old vector */ |
---|
163 | rtems_isr_entry handler, /* isr routine */ |
---|
164 | rtems_vector_number vector, /* vector number */ |
---|
165 | int type /* RTEMS or RAW intr */ |
---|
166 | ); |
---|
167 | |
---|
168 | void BSP_fatal_return( void ); |
---|
169 | |
---|
170 | void bsp_spurious_initialize( void ); |
---|
171 | |
---|
172 | extern rtems_configuration_table BSP_Configuration; /* owned by BSP */ |
---|
173 | |
---|
174 | extern rtems_cpu_table Cpu_table; /* owned by BSP */ |
---|
175 | |
---|
176 | extern rtems_unsigned32 bsp_isr_level; |
---|
177 | |
---|
178 | extern int CPU_PPC_CLICKS_PER_MS; |
---|
179 | |
---|
180 | #endif /* ASM */ |
---|
181 | |
---|
182 | #ifdef __cplusplus |
---|
183 | } |
---|
184 | #endif |
---|
185 | |
---|
186 | #endif |
---|
187 | /* end of include file */ |
---|