1 |
30 |
unneback |
/*
|
2 |
|
|
*-------------------------------------------------------------------
|
3 |
|
|
*
|
4 |
|
|
* SIM -- System Integration Module
|
5 |
|
|
*
|
6 |
|
|
* The system integration module (SIM) is used on many Motorola 16-
|
7 |
|
|
* and 32-bit MCUs for the following functions:
|
8 |
|
|
*
|
9 |
|
|
* () System configuration and protection. Bus and software watchdog
|
10 |
|
|
* monitors are provided in addition to periodic interrupt generators.
|
11 |
|
|
*
|
12 |
|
|
* () Clock signal generation for other intermodule bus (IMB) members
|
13 |
|
|
* and external devices.
|
14 |
|
|
*
|
15 |
|
|
* () The generation of chip-select signals that simplify external
|
16 |
|
|
* circuitry interface.
|
17 |
|
|
*
|
18 |
|
|
* () Data ports that are available for general purpose input and
|
19 |
|
|
* output.
|
20 |
|
|
*
|
21 |
|
|
* () A system test block that is intended only for factory tests.
|
22 |
|
|
*
|
23 |
|
|
* For more information, refer to Motorola's "Modular Microcontroller
|
24 |
|
|
* Family System Integration Module Reference Manual" (Motorola document
|
25 |
|
|
* SIMRM/AD).
|
26 |
|
|
*
|
27 |
|
|
* This file has been created by John S. Gwynne for support of
|
28 |
|
|
* Motorola's 68332 MCU in the efi332 project.
|
29 |
|
|
*
|
30 |
|
|
* Redistribution and use in source and binary forms are permitted
|
31 |
|
|
* provided that the following conditions are met:
|
32 |
|
|
* 1. Redistribution of source code and documentation must retain
|
33 |
|
|
* the above authorship, this list of conditions and the
|
34 |
|
|
* following disclaimer.
|
35 |
|
|
* 2. The name of the author may not be used to endorse or promote
|
36 |
|
|
* products derived from this software without specific prior
|
37 |
|
|
* written permission.
|
38 |
|
|
*
|
39 |
|
|
* This software is provided "AS IS" without warranty of any kind,
|
40 |
|
|
* either expressed or implied, including, but not limited to, the
|
41 |
|
|
* implied warranties of merchantability, title and fitness for a
|
42 |
|
|
* particular purpose.
|
43 |
|
|
*
|
44 |
|
|
*------------------------------------------------------------------
|
45 |
|
|
*
|
46 |
|
|
* $Id: sim.h,v 1.2 2001-09-27 11:59:28 chris Exp $
|
47 |
|
|
*/
|
48 |
|
|
|
49 |
|
|
#ifndef _SIM_H_
|
50 |
|
|
#define _SIM_H_
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
/* SAM-- shift and mask */
|
54 |
|
|
#undef SAM
|
55 |
|
|
#define SAM(a,b,c) ((a << b) & c)
|
56 |
|
|
|
57 |
|
|
/*
|
58 |
|
|
* These macros make this file usable from assembly.
|
59 |
|
|
*/
|
60 |
|
|
|
61 |
|
|
#ifdef ASM
|
62 |
|
|
#define SIM_VOLATILE_USHORT_POINTER
|
63 |
|
|
#define SIM_VOLATILE_UCHAR_POINTER
|
64 |
|
|
#else
|
65 |
|
|
#define SIM_VOLATILE_USHORT_POINTER (volatile unsigned short int * const)
|
66 |
|
|
#define SIM_VOLATILE_UCHAR_POINTER (volatile unsigned char * const)
|
67 |
|
|
#endif
|
68 |
|
|
|
69 |
|
|
/* SIM_CRB (SIM Control Register Block) base address of the SIM
|
70 |
|
|
control registers */
|
71 |
|
|
/* not included in ram_init.h */
|
72 |
|
|
#if SIM_MM == 0
|
73 |
|
|
#define SIM_CRB 0x7ffa00
|
74 |
|
|
#else
|
75 |
|
|
#undef SIM_MM
|
76 |
|
|
#define SIM_MM 1
|
77 |
|
|
#define SIM_CRB 0xfffa00
|
78 |
|
|
#endif
|
79 |
|
|
/* end not included in ram_init.h */
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
#define SIMCR SIM_VOLATILE_USHORT_POINTER(0x00 + SIM_CRB)
|
84 |
|
|
/* Module Configuration Register */
|
85 |
|
|
#define EXOFF 0x8000 /* External Clock Off */
|
86 |
|
|
#define FRZSW 0x4000 /* Freeze Software Enable */
|
87 |
|
|
#define FRZBM 0x2000 /* Freeze Bus Monitor Enable */
|
88 |
|
|
#define SLVEN 0x0800 /* Factory Test Model Enabled (ro)*/
|
89 |
|
|
#define SHEN 0x0300 /* Show Cycle Enable */
|
90 |
|
|
#define SUPV 0x0080 /* Supervisor/Unrestricted Data Space */
|
91 |
|
|
#define MM 0x0040 /* Module Mapping */
|
92 |
|
|
#define IARB 0x000f /* Interrupt Arbitration Field */
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
#define SIMTR SIM_VOLATILE_USHORT_POINTER(0x02 + SIM_CRB)
|
97 |
|
|
/* SIM Test Register */
|
98 |
|
|
/* Used only for factor testing */
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
#define SYNCR SIM_VOLATILE_USHORT_POINTER(0x04 + SIM_CRB)
|
103 |
|
|
/* Clock Synthesizer Control Register */
|
104 |
|
|
#define VCO 0x8000 /* Frequency Control (VCO) */
|
105 |
|
|
#define PRESCALE 0x4000 /* Frequency Control Bit (Prescale) */
|
106 |
|
|
#define COUNTER 0x3f00 /* Frequency Control Counter */
|
107 |
|
|
#define EDIV 0x0080 /* ECLK Divide Rate */
|
108 |
|
|
#define SLIMP 0x0010 /* Limp Mode Status */
|
109 |
|
|
#define SLOCK 0x0008 /* Synthesizer Lock */
|
110 |
|
|
#define RSTEN 0x0004 /* Reset Enable */
|
111 |
|
|
#define STSIM 0x0002 /* Stop Mode SIM Clock */
|
112 |
|
|
#define STEXT 0x0001 /* Stop Mode External Clock */
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
#define RSR SIM_VOLATILE_UCHAR_POINTER(0x07 + SIM_CRB)
|
117 |
|
|
/* Reset Status Register */
|
118 |
|
|
#define EXT 0x0080 /* External Reset */
|
119 |
|
|
#define POW 0x0040 /* Power-On Reset */
|
120 |
|
|
#define SW 0x0020 /* Software Watchdog Reset */
|
121 |
|
|
#define DBF 0x0010 /* Double Bus Fault Reset */
|
122 |
|
|
#define LOC 0x0004 /* Loss of Clock Reset */
|
123 |
|
|
#define SYS 0x0002 /* System Reset */
|
124 |
|
|
#define TST 0x0001 /* Test Submodule Reset */
|
125 |
|
|
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
#define SIMTRE SIM_VOLATILE_USHORT_POINTER(0x08 + SIM_CRB)
|
129 |
|
|
/* System Integration Test Register */
|
130 |
|
|
/* Used only for factor testing */
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
#define PORTE0 SIM_VOLATILE_UCHAR_POINTER(0x11 + SIM_CRB)
|
135 |
|
|
#define PORTE1 SIM_VOLATILE_UCHAR_POINTER(0x13 + SIM_CRB)
|
136 |
|
|
/* Port E Data Register */
|
137 |
|
|
#define DDRE SIM_VOLATILE_UCHAR_POINTER(0x15 + SIM_CRB)
|
138 |
|
|
/* Port E Data Direction Register */
|
139 |
|
|
#define PEPAR SIM_VOLATILE_UCHAR_POINTER(0x17 + SIM_CRB)
|
140 |
|
|
/* Port E Pin Assignment Register */
|
141 |
|
|
/* Any bit cleared (zero) defines the corresponding pin to be an I/O
|
142 |
|
|
pin. Any bit set defines the corresponding pin to be a bus control
|
143 |
|
|
signal. */
|
144 |
|
|
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
#define PORTF0 SIM_VOLATILE_UCHAR_POINTER(0x19 + SIM_CRB)
|
148 |
|
|
#define PORTF1 SIM_VOLATILE_UCHAR_POINTER(0x1b + SIM_CRB)
|
149 |
|
|
/* Port F Data Register */
|
150 |
|
|
#define DDRF SIM_VOLATILE_UCHAR_POINTER(0x1d + SIM_CRB)
|
151 |
|
|
/* Port E Data Direction Register */
|
152 |
|
|
#define PFPAR SIM_VOLATILE_UCHAR_POINTER(0x1f + SIM_CRB)
|
153 |
|
|
/* Any bit cleared (zero) defines the corresponding pin to be an I/O
|
154 |
|
|
pin. Any bit set defines the corresponding pin to be a bus control
|
155 |
|
|
signal. */
|
156 |
|
|
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
#define SYPCR SIM_VOLATILE_UCHAR_POINTER(0x21 + SIM_CRB)
|
160 |
|
|
/* !!! can write to only once after reset !!! */
|
161 |
|
|
/* System Protection Control Register */
|
162 |
|
|
#define SWE 0x80 /* Software Watch Enable */
|
163 |
|
|
#define SWP 0x40 /* Software Watchdog Prescale */
|
164 |
|
|
#define SWT 0x30 /* Software Watchdog Timing */
|
165 |
|
|
#define HME 0x08 /* Halt Monitor Enable */
|
166 |
|
|
#define BME 0x04 /* Bus Monitor External Enable */
|
167 |
|
|
#define BMT 0x03 /* Bus Monitor Timing */
|
168 |
|
|
|
169 |
|
|
|
170 |
|
|
|
171 |
|
|
#define PICR SIM_VOLATILE_USHORT_POINTER(0x22 + SIM_CRB)
|
172 |
|
|
/* Periodic Interrupt Control Reg. */
|
173 |
|
|
#define PIRQL 0x0700 /* Periodic Interrupt Request Level */
|
174 |
|
|
#define PIV 0x00ff /* Periodic Interrupt Level */
|
175 |
|
|
|
176 |
|
|
|
177 |
|
|
|
178 |
|
|
#define PITR SIM_VOLATILE_USHORT_POINTER(0x24 + SIM_CRB)
|
179 |
|
|
/* Periodic Interrupt Timer Register */
|
180 |
|
|
#define PTP 0x0100 /* Periodic Timer Prescaler Control */
|
181 |
|
|
#define PITM 0x00ff /* Periodic Interrupt Timing Modulus */
|
182 |
|
|
|
183 |
|
|
|
184 |
|
|
|
185 |
|
|
#define SWSR SIM_VOLATILE_UCHAR_POINTER(0x27 + SIM_CRB)
|
186 |
|
|
/* Software Service Register */
|
187 |
|
|
/* write 0x55 then 0xaa to service the software watchdog */
|
188 |
|
|
|
189 |
|
|
|
190 |
|
|
|
191 |
|
|
#define TSTMSRA SIM_VOLATILE_USHORT_POINTER(0x30 + SIM_CRB)
|
192 |
|
|
/* Test Module Master Shift A */
|
193 |
|
|
#define TSTMSRB SIM_VOLATILE_USHORT_POINTER(0x32 + SIM_CRB)
|
194 |
|
|
/* Test Module Master Shift A */
|
195 |
|
|
#define TSTSC SIM_VOLATILE_USHORT_POINTER(0x34 + SIM_CRB)
|
196 |
|
|
/* Test Module Shift Count */
|
197 |
|
|
#define TSTRC SIM_VOLATILE_USHORT_POINTER(0x36 + SIM_CRB)
|
198 |
|
|
/* Test Module Repetition Counter */
|
199 |
|
|
#define CREG SIM_VOLATILE_USHORT_POINTER(0x38 + SIM_CRB)
|
200 |
|
|
/* Test Module Control */
|
201 |
|
|
#define DREG SIM_VOLATILE_USHORT_POINTER(0x3a + SIM_CRB)
|
202 |
|
|
/* Test Module Distributed */
|
203 |
|
|
/* Used only for factor testing */
|
204 |
|
|
|
205 |
|
|
|
206 |
|
|
|
207 |
|
|
#define PORTC SIM_VOLATILE_UCHAR_POINTER(0x41 + SIM_CRB)
|
208 |
|
|
/* Port C Data */
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
|
212 |
|
|
#define CSPAR0 SIM_VOLATILE_USHORT_POINTER(0x44 + SIM_CRB)
|
213 |
|
|
/* Chip Select Pin Assignment
|
214 |
|
|
Resgister 0 */
|
215 |
|
|
/* CSPAR0 contains seven two-bit fields that determine the functions
|
216 |
|
|
of corresponding chip-select pins. CSPAR0[15:14] are not
|
217 |
|
|
used. These bits always read zero; write have no effect. CSPAR0 bit
|
218 |
|
|
1 always reads one; writes to CSPAR0 bit 1 have no effect. */
|
219 |
|
|
#define CSPAR1 SIM_VOLATILE_USHORT_POINTER(0x46 + SIM_CRB)
|
220 |
|
|
/* Chip Select Pin Assignment
|
221 |
|
|
Register 1 */
|
222 |
|
|
/* CSPAR1 contains five two-bit fields that determine the finctions of
|
223 |
|
|
corresponding chip-select pins. CSPAR1[15:10] are not used. These
|
224 |
|
|
bits always read zero; writes have no effect. */
|
225 |
|
|
/*
|
226 |
|
|
*
|
227 |
|
|
* Bit Field | Description
|
228 |
|
|
* ------------+---------------
|
229 |
|
|
* 00 | Discrete Output
|
230 |
|
|
* 01 | Alternate Function
|
231 |
|
|
* 10 | Chip Select (8-bit port)
|
232 |
|
|
* 11 | Chip Select (16-bit port)
|
233 |
|
|
*/
|
234 |
|
|
#define DisOut 0x0
|
235 |
|
|
#define AltFun 0x1
|
236 |
|
|
#define CS8bit 0x2
|
237 |
|
|
#define CS16bit 0x3
|
238 |
|
|
/*
|
239 |
|
|
*
|
240 |
|
|
* CSPARx Field |Chip Select Signal | Alternate Signal | Discrete Output
|
241 |
|
|
*-----------------+--------------------+--------------------+---------------*/
|
242 |
|
|
#define CS_5 12 /* !CS5 | FC2 | PC2 */
|
243 |
|
|
#define CS_4 10 /* !CS4 | FC1 | PC1 */
|
244 |
|
|
#define CS_3 8 /* !CS3 | FC0 | PC0 */
|
245 |
|
|
#define CS_2 6 /* !CS2 | !BGACK | */
|
246 |
|
|
#define CS_1 4 /* !CS1 | !BG | */
|
247 |
|
|
#define CS_0 2 /* !CS0 | !BR | */
|
248 |
|
|
#define CSBOOT 0 /* !CSBOOT | | */
|
249 |
|
|
/* | | | */
|
250 |
|
|
#define CS_10 8 /* !CS10 | ADDR23 | ECLK */
|
251 |
|
|
#define CS_9 6 /* !CS9 | ADDR22 | PC6 */
|
252 |
|
|
#define CS_8 4 /* !CS8 | ADDR21 | PC5 */
|
253 |
|
|
#define CS_7 2 /* !CS7 | ADDR20 | PC4 */
|
254 |
|
|
#define CS_6 0 /* !CS6 | ADDR19 | PC3 */
|
255 |
|
|
|
256 |
|
|
#define BS_2K 0x0
|
257 |
|
|
#define BS_8K 0x1
|
258 |
|
|
#define BS_16K 0x2
|
259 |
|
|
#define BS_64K 0x3
|
260 |
|
|
#define BS_128K 0x4
|
261 |
|
|
#define BS_256K 0x5
|
262 |
|
|
#define BS_512K 0x6
|
263 |
|
|
#define BS_1M 0x7
|
264 |
|
|
|
265 |
|
|
#define CSBARBT SIM_VOLATILE_USHORT_POINTER(0x48 + SIM_CRB)
|
266 |
|
|
#define CSBAR0 SIM_VOLATILE_USHORT_POINTER(0x4c + SIM_CRB)
|
267 |
|
|
#define CSBAR1 SIM_VOLATILE_USHORT_POINTER(0x50 + SIM_CRB)
|
268 |
|
|
#define CSBAR2 SIM_VOLATILE_USHORT_POINTER(0x54 + SIM_CRB)
|
269 |
|
|
#define CSBAR3 SIM_VOLATILE_USHORT_POINTER(0x58 + SIM_CRB)
|
270 |
|
|
#define CSBAR4 SIM_VOLATILE_USHORT_POINTER(0x5c + SIM_CRB)
|
271 |
|
|
#define CSBAR5 SIM_VOLATILE_USHORT_POINTER(0x60 + SIM_CRB)
|
272 |
|
|
#define CSBAR6 SIM_VOLATILE_USHORT_POINTER(0x64 + SIM_CRB)
|
273 |
|
|
#define CSBAR7 SIM_VOLATILE_USHORT_POINTER(0x68 + SIM_CRB)
|
274 |
|
|
#define CSBAR8 SIM_VOLATILE_USHORT_POINTER(0x6c + SIM_CRB)
|
275 |
|
|
#define CSBAR9 SIM_VOLATILE_USHORT_POINTER(0x70 + SIM_CRB)
|
276 |
|
|
#define CSBAR10 SIM_VOLATILE_USHORT_POINTER(0x74 + SIM_CRB)
|
277 |
|
|
|
278 |
|
|
#define MODE 0x8000
|
279 |
|
|
#define Disable 0
|
280 |
|
|
#define LowerByte 0x2000
|
281 |
|
|
#define UpperByte 0x4000
|
282 |
|
|
#define BothBytes 0x6000
|
283 |
|
|
#define ReadOnly 0x0800
|
284 |
|
|
#define WriteOnly 0x1000
|
285 |
|
|
#define ReadWrite 0x1800
|
286 |
|
|
#define SyncAS 0x0
|
287 |
|
|
#define SyncDS 0x0400
|
288 |
|
|
|
289 |
|
|
#define WaitStates_0 (0x0 << 6)
|
290 |
|
|
#define WaitStates_1 (0x1 << 6)
|
291 |
|
|
#define WaitStates_2 (0x2 << 6)
|
292 |
|
|
#define WaitStates_3 (0x3 << 6)
|
293 |
|
|
#define WaitStates_4 (0x4 << 6)
|
294 |
|
|
#define WaitStates_5 (0x5 << 6)
|
295 |
|
|
#define WaitStates_6 (0x6 << 6)
|
296 |
|
|
#define WaitStates_7 (0x7 << 6)
|
297 |
|
|
#define WaitStates_8 (0x8 << 6)
|
298 |
|
|
#define WaitStates_9 (0x9 << 6)
|
299 |
|
|
#define WaitStates_10 (0xa << 6)
|
300 |
|
|
#define WaitStates_11 (0xb << 6)
|
301 |
|
|
#define WaitStates_12 (0xc << 6)
|
302 |
|
|
#define WaitStates_13 (0xd << 6)
|
303 |
|
|
#define FastTerm (0xe << 6)
|
304 |
|
|
#define External (0xf << 6)
|
305 |
|
|
|
306 |
|
|
#define CPUSpace (0x0 << 4)
|
307 |
|
|
#define UserSpace (0x1 << 4)
|
308 |
|
|
#define SupSpace (0x2 << 4)
|
309 |
|
|
#define UserSupSpace (0x3 << 4)
|
310 |
|
|
|
311 |
|
|
#define IPLevel_any 0x0
|
312 |
|
|
#define IPLevel_1 0x2
|
313 |
|
|
#define IPLevel_2 0x4
|
314 |
|
|
#define IPLevel_3 0x6
|
315 |
|
|
#define IPLevel_4 0x8
|
316 |
|
|
#define IPLevel_5 0xa
|
317 |
|
|
#define IPLevel_6 0xc
|
318 |
|
|
#define IPLevel_7 0xe
|
319 |
|
|
|
320 |
|
|
#define AVEC 1
|
321 |
|
|
|
322 |
|
|
#define CSORBT SIM_VOLATILE_USHORT_POINTER(0x4a + SIM_CRB)
|
323 |
|
|
#define CSOR0 SIM_VOLATILE_USHORT_POINTER(0x4e + SIM_CRB)
|
324 |
|
|
#define CSOR1 SIM_VOLATILE_USHORT_POINTER(0x52 + SIM_CRB)
|
325 |
|
|
#define CSOR2 SIM_VOLATILE_USHORT_POINTER(0x56 + SIM_CRB)
|
326 |
|
|
#define CSOR3 SIM_VOLATILE_USHORT_POINTER(0x5a + SIM_CRB)
|
327 |
|
|
#define CSOR4 SIM_VOLATILE_USHORT_POINTER(0x5e + SIM_CRB)
|
328 |
|
|
#define CSOR5 SIM_VOLATILE_USHORT_POINTER(0x62 + SIM_CRB)
|
329 |
|
|
#define CSOR6 SIM_VOLATILE_USHORT_POINTER(0x66 + SIM_CRB)
|
330 |
|
|
#define CSOR7 SIM_VOLATILE_USHORT_POINTER(0x6a + SIM_CRB)
|
331 |
|
|
#define CSOR8 SIM_VOLATILE_USHORT_POINTER(0x6e + SIM_CRB)
|
332 |
|
|
#define CSOR9 SIM_VOLATILE_USHORT_POINTER(0x72 + SIM_CRB)
|
333 |
|
|
#define CSOR10 SIM_VOLATILE_USHORT_POINTER(0x76 + SIM_CRB)
|
334 |
|
|
|
335 |
|
|
#endif /* _SIM_h_ */
|