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 | * Network driver configuration |
---|
49 | */ |
---|
50 | struct rtems_bsdnet_ifconfig; |
---|
51 | extern int rtems_sonic_driver_attach (struct rtems_bsdnet_ifconfig *config); |
---|
52 | #define RTEMS_BSP_NETWORK_DRIVER_NAME "sonic1" |
---|
53 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_sonic_driver_attach |
---|
54 | |
---|
55 | |
---|
56 | /* |
---|
57 | * The following macro calculates the Baud constant. For the Z8530 chip. |
---|
58 | */ |
---|
59 | #define Z8530_Baud( _frequency, _clock_by, _baud_rate ) \ |
---|
60 | ( (_frequency /( _clock_by * 2 * _baud_rate)) - 2) |
---|
61 | |
---|
62 | |
---|
63 | /* |
---|
64 | * Define the time limits for RTEMS Test Suite test durations. |
---|
65 | * Long test and short test duration limits are provided. These |
---|
66 | * values are in seconds and need to be converted to ticks for the |
---|
67 | * application. |
---|
68 | * |
---|
69 | */ |
---|
70 | |
---|
71 | #define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */ |
---|
72 | #define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */ |
---|
73 | |
---|
74 | |
---|
75 | /* |
---|
76 | * Stuff for Time Test 27 |
---|
77 | */ |
---|
78 | |
---|
79 | #define MUST_WAIT_FOR_INTERRUPT 1 |
---|
80 | |
---|
81 | #define Install_tm27_vector( _handler ) \ |
---|
82 | set_vector( (_handler), PPC_IRQ_DECREMENTER, 1 ) |
---|
83 | |
---|
84 | #define Cause_tm27_intr() \ |
---|
85 | do { \ |
---|
86 | unsigned32 _clicks = 1; \ |
---|
87 | asm volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \ |
---|
88 | } while (0) |
---|
89 | |
---|
90 | #define Clear_tm27_intr() \ |
---|
91 | do { \ |
---|
92 | unsigned32 _clicks = 0xffffffff; \ |
---|
93 | unsigned32 _msr = 0; \ |
---|
94 | _ISR_Set_level( 0 ); \ |
---|
95 | asm volatile( "mfmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \ |
---|
96 | _msr &= ~0x8000; \ |
---|
97 | asm volatile( "mtmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \ |
---|
98 | asm volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \ |
---|
99 | } while (0) |
---|
100 | |
---|
101 | #define Lower_tm27_intr() \ |
---|
102 | do { \ |
---|
103 | unsigned32 _msr = 0; \ |
---|
104 | _ISR_Set_level( 0 ); \ |
---|
105 | asm volatile( "mfmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \ |
---|
106 | _msr |= 0x8002; \ |
---|
107 | asm volatile( "mtmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \ |
---|
108 | } while (0) |
---|
109 | |
---|
110 | /* Constants */ |
---|
111 | |
---|
112 | /* |
---|
113 | * Device Driver Table Entries |
---|
114 | */ |
---|
115 | |
---|
116 | /* |
---|
117 | * NOTE: Use the standard Console driver entry |
---|
118 | */ |
---|
119 | |
---|
120 | /* |
---|
121 | * NOTE: Use the standard Clock driver entry |
---|
122 | */ |
---|
123 | |
---|
124 | |
---|
125 | /* |
---|
126 | * Information placed in the linkcmds file. |
---|
127 | */ |
---|
128 | |
---|
129 | extern int RAM_START; |
---|
130 | extern int RAM_END; |
---|
131 | extern int RAM_SIZE; |
---|
132 | |
---|
133 | extern int PROM_START; |
---|
134 | extern int PROM_END; |
---|
135 | extern int PROM_SIZE; |
---|
136 | |
---|
137 | extern int CLOCK_SPEED; |
---|
138 | |
---|
139 | extern int end; /* last address in the program */ |
---|
140 | |
---|
141 | /* |
---|
142 | * How many libio files we want |
---|
143 | */ |
---|
144 | |
---|
145 | #define BSP_LIBIO_MAX_FDS 20 |
---|
146 | |
---|
147 | /* functions */ |
---|
148 | |
---|
149 | /* |
---|
150 | * genvec.c |
---|
151 | */ |
---|
152 | rtems_isr_entry set_EE_vector( |
---|
153 | rtems_isr_entry handler, /* isr routine */ |
---|
154 | rtems_vector_number vector /* vector number */ |
---|
155 | ); |
---|
156 | void initialize_external_exception_vector (); |
---|
157 | |
---|
158 | /* |
---|
159 | * console.c |
---|
160 | */ |
---|
161 | void DEBUG_puts( char *string ); |
---|
162 | |
---|
163 | void BSP_fatal_return( void ); |
---|
164 | |
---|
165 | |
---|
166 | |
---|
167 | void bsp_start( void ); |
---|
168 | |
---|
169 | void bsp_cleanup( void ); |
---|
170 | |
---|
171 | rtems_isr_entry set_vector( /* returns old vector */ |
---|
172 | rtems_isr_entry handler, /* isr routine */ |
---|
173 | rtems_vector_number vector, /* vector number */ |
---|
174 | int type /* RTEMS or RAW intr */ |
---|
175 | ); |
---|
176 | |
---|
177 | void BSP_fatal_return( void ); |
---|
178 | |
---|
179 | void bsp_spurious_initialize( void ); |
---|
180 | |
---|
181 | extern rtems_configuration_table BSP_Configuration; /* owned by BSP */ |
---|
182 | |
---|
183 | extern rtems_cpu_table Cpu_table; /* owned by BSP */ |
---|
184 | |
---|
185 | extern rtems_unsigned32 bsp_isr_level; |
---|
186 | |
---|
187 | extern int CPU_PPC_CLICKS_PER_MS; |
---|
188 | |
---|
189 | #endif /* ASM */ |
---|
190 | |
---|
191 | #ifdef __cplusplus |
---|
192 | } |
---|
193 | #endif |
---|
194 | |
---|
195 | #endif |
---|
196 | /* end of include file */ |
---|