source: rtems/cpukit/score/cpu/m68k/sim.h @ 6c68186

4.104.114.84.95
Last change on this file since 6c68186 was 6c68186, checked in by Joel Sherrill <joel.sherrill@…>, on 10/12/00 at 12:50:43

2000-10-12 John S Gwynne <jgwynne@…>

  • sim.h: These changes enable RTEMS to automatically generate the ram_init file used by gdb with the BDM patches. The 332 has on-board chip select lines (for RAM and FLASH) that must be configured before use of these peripherals. These patches parse data from start.c where the chip select lines are configured in the runtime executable and automatically generates the gdb initialization file using the same settings. A great time saver. A similar file, ram_init_FW (flash writable), is also generated that the flash programming tool uses.
  • BSP/start/start.c: Must be modified to support above.
  • BSP/start/ram_init.ld, BSP/start/ram_init.sed: New files.
  • Property mode set to 100644
File size: 11.8 KB
Line 
1/*
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$
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#ifndef SIM_CRB
72#if SIM_MM == 0
73#define SIM_CRB 0x7ffa00
74#else /* SIM_MM */
75#undef SIM_MM
76#define SIM_MM 1
77#define SIM_CRB 0xfffa00
78#endif /* SIM_MM */
79#endif /* SIM_CRB */
80
81
82#define SIMCR SIM_VOLATILE_USHORT_POINTER(0x00 + SIM_CRB)
83                                /* Module Configuration Register */
84#define    EXOFF 0x8000         /*    External Clock Off */
85#define    FRZSW 0x4000         /*    Freeze Software Enable */
86#define    FRZBM 0x2000         /*    Freeze Bus Monitor Enable */
87#define    SLVEN 0x0800         /*    Factory Test Model Enabled (ro)*/
88#define    SHEN  0x0300         /*    Show Cycle Enable */
89#define    SUPV  0x0080         /*    Supervisor/Unrestricted Data Space */
90#define    MM    0x0040         /*    Module Mapping */
91#define    IARB  0x000f         /*    Interrupt Arbitration Field */
92
93
94
95#define SIMTR SIM_VOLATILE_USHORT_POINTER(0x02 + SIM_CRB)
96                                /* SIM Test Register */
97/* Used only for factor testing */
98
99
100
101#define SYNCR SIM_VOLATILE_USHORT_POINTER(0x04 + SIM_CRB)
102                                /* Clock Synthesizer Control Register */
103#define    VCO      0x8000      /*    Frequency Control (VCO) */
104#define    PRESCALE 0x4000      /*    Frequency Control Bit (Prescale) */
105#define    COUNTER  0x3f00      /*    Frequency Control Counter */
106#define    EDIV     0x0080      /*    ECLK Divide Rate */
107#define    SLIMP    0x0010      /*    Limp Mode Status */
108#define    SLOCK    0x0008      /*    Synthesizer Lock */
109#define    RSTEN    0x0004      /*    Reset Enable */
110#define    STSIM    0x0002      /*    Stop Mode SIM Clock */
111#define    STEXT    0x0001      /*    Stop Mode External Clock */
112
113
114
115#define RSR SIM_VOLATILE_UCHAR_POINTER(0x07 + SIM_CRB)
116                                /* Reset Status Register */
117#define    EXT   0x0080         /*    External Reset */
118#define    POW   0x0040         /*    Power-On Reset */
119#define    SW    0x0020         /*    Software Watchdog Reset */
120#define    DBF   0x0010         /*    Double Bus Fault Reset */
121#define    LOC   0x0004         /*    Loss of Clock Reset */
122#define    SYS   0x0002         /*    System Reset */
123#define    TST   0x0001         /*    Test Submodule Reset */
124
125
126
127#define SIMTRE SIM_VOLATILE_USHORT_POINTER(0x08 + SIM_CRB)
128                                /* System Integration Test Register */
129/* Used only for factor testing */
130
131
132
133#define PORTE0 SIM_VOLATILE_UCHAR_POINTER(0x11 + SIM_CRB)
134#define PORTE1 SIM_VOLATILE_UCHAR_POINTER(0x13 + SIM_CRB)
135                                /* Port E Data Register */
136#define DDRE SIM_VOLATILE_UCHAR_POINTER(0x15 + SIM_CRB)
137                                /* Port E Data Direction Register */
138#define PEPAR SIM_VOLATILE_UCHAR_POINTER(0x17 + SIM_CRB)
139                                /* Port E Pin Assignment Register */
140/* Any bit cleared (zero) defines the corresponding pin to be an I/O
141   pin. Any bit set defines the corresponding pin to be a bus control
142   signal. */
143
144
145
146#define PORTF0 SIM_VOLATILE_UCHAR_POINTER(0x19 + SIM_CRB)
147#define PORTF1 SIM_VOLATILE_UCHAR_POINTER(0x1b + SIM_CRB)
148                                /* Port F Data Register */
149#define DDRF SIM_VOLATILE_UCHAR_POINTER(0x1d + SIM_CRB)
150                                /* Port E Data Direction Register */
151#define PFPAR SIM_VOLATILE_UCHAR_POINTER(0x1f + SIM_CRB)
152/* Any bit cleared (zero) defines the corresponding pin to be an I/O
153   pin. Any bit set defines the corresponding pin to be a bus control
154   signal. */
155
156
157
158#define SYPCR SIM_VOLATILE_UCHAR_POINTER(0x21 + SIM_CRB)
159/* !!! can write to only once after reset !!! */
160                                /* System Protection Control Register */
161#define    SWE   0x80           /*    Software Watch Enable */
162#define    SWP   0x40           /*    Software Watchdog Prescale */
163#define    SWT   0x30           /*    Software Watchdog Timing */
164#define    HME   0x08           /*    Halt Monitor Enable */
165#define    BME   0x04           /*    Bus Monitor External Enable */
166#define    BMT   0x03           /*    Bus Monitor Timing */
167
168
169
170#define PICR SIM_VOLATILE_USHORT_POINTER(0x22 + SIM_CRB)
171                                /* Periodic Interrupt Control Reg. */
172#define    PIRQL 0x0700         /*    Periodic Interrupt Request Level */
173#define    PIV   0x00ff         /*    Periodic Interrupt Level */
174
175
176
177#define PITR SIM_VOLATILE_USHORT_POINTER(0x24 + SIM_CRB)
178                                /* Periodic Interrupt Timer Register */
179#define    PTP   0x0100         /*    Periodic Timer Prescaler Control */
180#define    PITM  0x00ff         /*    Periodic Interrupt Timing Modulus */
181
182
183
184#define SWSR SIM_VOLATILE_UCHAR_POINTER(0x27 + SIM_CRB)
185                                /* Software Service Register */
186/* write 0x55 then 0xaa to service the software watchdog */
187
188
189
190#define TSTMSRA SIM_VOLATILE_USHORT_POINTER(0x30 + SIM_CRB)
191                                /* Test Module Master Shift A */
192#define TSTMSRB SIM_VOLATILE_USHORT_POINTER(0x32 + SIM_CRB)
193                                /* Test Module Master Shift A */
194#define TSTSC SIM_VOLATILE_USHORT_POINTER(0x34 + SIM_CRB)
195                                /* Test Module Shift Count */
196#define TSTRC SIM_VOLATILE_USHORT_POINTER(0x36 + SIM_CRB)
197                                /* Test Module Repetition Counter */
198#define CREG SIM_VOLATILE_USHORT_POINTER(0x38 + SIM_CRB)
199                                /* Test Module Control */
200#define DREG SIM_VOLATILE_USHORT_POINTER(0x3a + SIM_CRB)
201                                /* Test Module Distributed */
202/* Used only for factor testing */
203
204
205
206#define PORTC SIM_VOLATILE_UCHAR_POINTER(0x41 + SIM_CRB)
207                                /* Port C Data */
208
209
210
211#define CSPAR0 SIM_VOLATILE_USHORT_POINTER(0x44 + SIM_CRB)
212                                /* Chip Select Pin Assignment
213                                   Resgister 0 */
214/* CSPAR0 contains seven two-bit fields that determine the functions
215   of corresponding chip-select pins. CSPAR0[15:14] are not
216   used. These bits always read zero; write have no effect. CSPAR0 bit
217   1 always reads one; writes to CSPAR0 bit 1 have no effect. */
218#define CSPAR1 SIM_VOLATILE_USHORT_POINTER(0x46 + SIM_CRB)
219                                /* Chip Select Pin Assignment
220                                   Register 1 */
221/* CSPAR1 contains five two-bit fields that determine the finctions of
222   corresponding chip-select pins. CSPAR1[15:10] are not used. These
223   bits always read zero; writes have no effect. */
224/*
225 *
226 *                      Bit Field  |  Description
227 *                     ------------+---------------
228 *                         00      | Discrete Output
229 *                         01      | Alternate Function
230 *                         10      | Chip Select (8-bit port)
231 *                         11      | Chip Select (16-bit port)
232 */
233#define DisOut 0x0
234#define AltFun 0x1
235#define CS8bit 0x2
236#define CS16bit 0x3
237/*
238 *
239 * CSPARx Field    |Chip Select Signal  |  Alternate Signal  |  Discrete Output
240 *-----------------+--------------------+--------------------+---------------*/
241#define CS_5    12 /*     !CS5          |         FC2        |       PC2     */
242#define CS_4    10 /*     !CS4          |         FC1        |       PC1     */
243#define CS_3     8 /*     !CS3          |         FC0        |       PC0     */
244#define CS_2     6 /*     !CS2          |       !BGACK       |               */
245#define CS_1     4 /*     !CS1          |         !BG        |               */
246#define CS_0     2 /*     !CS0          |         !BR        |               */
247#define CSBOOT   0 /*     !CSBOOT       |                    |               */
248/*                 |                    |                    |               */
249#define CS_10    8 /*     !CS10         |       ADDR23       |      ECLK     */
250#define CS_9     6 /*     !CS9          |       ADDR22       |       PC6     */
251#define CS_8     4 /*     !CS8          |       ADDR21       |       PC5     */
252#define CS_7     2 /*     !CS7          |       ADDR20       |       PC4     */
253#define CS_6     0 /*     !CS6          |       ADDR19       |       PC3     */
254
255#define BS_2K 0x0
256#define BS_8K 0x1
257#define BS_16K 0x2
258#define BS_64K 0x3
259#define BS_128K 0x4
260#define BS_256K 0x5
261#define BS_512K 0x6
262#define BS_1M 0x7
263
264#define CSBARBT SIM_VOLATILE_USHORT_POINTER(0x48 + SIM_CRB)
265#define CSBAR0 SIM_VOLATILE_USHORT_POINTER(0x4c + SIM_CRB)
266#define CSBAR1 SIM_VOLATILE_USHORT_POINTER(0x50 + SIM_CRB)
267#define CSBAR2 SIM_VOLATILE_USHORT_POINTER(0x54 + SIM_CRB)
268#define CSBAR3 SIM_VOLATILE_USHORT_POINTER(0x58 + SIM_CRB)
269#define CSBAR4 SIM_VOLATILE_USHORT_POINTER(0x5c + SIM_CRB)
270#define CSBAR5 SIM_VOLATILE_USHORT_POINTER(0x60 + SIM_CRB)
271#define CSBAR6 SIM_VOLATILE_USHORT_POINTER(0x64 + SIM_CRB)
272#define CSBAR7 SIM_VOLATILE_USHORT_POINTER(0x68 + SIM_CRB)
273#define CSBAR8 SIM_VOLATILE_USHORT_POINTER(0x6c + SIM_CRB)
274#define CSBAR9 SIM_VOLATILE_USHORT_POINTER(0x70 + SIM_CRB)
275#define CSBAR10 SIM_VOLATILE_USHORT_POINTER(0x74 + SIM_CRB)
276
277#define MODE 0x8000
278#define Disable 0
279#define LowerByte 0x2000
280#define UpperByte 0x4000
281#define BothBytes 0x6000
282#define ReadOnly 0x0800
283#define WriteOnly 0x1000
284#define ReadWrite 0x1800
285#define SyncAS 0x0
286#define SyncDS 0x0400
287
288#define WaitStates_0 (0x0 << 6)
289#define WaitStates_1 (0x1 << 6)
290#define WaitStates_2 (0x2 << 6)
291#define WaitStates_3 (0x3 << 6)
292#define WaitStates_4 (0x4 << 6)
293#define WaitStates_5 (0x5 << 6)
294#define WaitStates_6 (0x6 << 6)
295#define WaitStates_7 (0x7 << 6)
296#define WaitStates_8 (0x8 << 6)
297#define WaitStates_9 (0x9 << 6)
298#define WaitStates_10 (0xa << 6)
299#define WaitStates_11 (0xb << 6)
300#define WaitStates_12 (0xc << 6)
301#define WaitStates_13 (0xd << 6)
302#define FastTerm (0xe << 6)
303#define External (0xf << 6)
304
305#define CPUSpace (0x0 << 4)
306#define UserSpace (0x1 << 4)
307#define SupSpace (0x2 << 4)
308#define UserSupSpace (0x3 << 4)
309
310#define IPLevel_any 0x0
311#define IPLevel_1 0x2
312#define IPLevel_2 0x4
313#define IPLevel_3 0x6
314#define IPLevel_4 0x8
315#define IPLevel_5 0xa
316#define IPLevel_6 0xc
317#define IPLevel_7 0xe
318
319#define AVEC 1
320
321#define CSORBT SIM_VOLATILE_USHORT_POINTER(0x4a + SIM_CRB)
322#define CSOR0 SIM_VOLATILE_USHORT_POINTER(0x4e + SIM_CRB)
323#define CSOR1 SIM_VOLATILE_USHORT_POINTER(0x52 + SIM_CRB)
324#define CSOR2 SIM_VOLATILE_USHORT_POINTER(0x56 + SIM_CRB)
325#define CSOR3 SIM_VOLATILE_USHORT_POINTER(0x5a + SIM_CRB)
326#define CSOR4 SIM_VOLATILE_USHORT_POINTER(0x5e + SIM_CRB)
327#define CSOR5 SIM_VOLATILE_USHORT_POINTER(0x62 + SIM_CRB)
328#define CSOR6 SIM_VOLATILE_USHORT_POINTER(0x66 + SIM_CRB)
329#define CSOR7 SIM_VOLATILE_USHORT_POINTER(0x6a + SIM_CRB)
330#define CSOR8 SIM_VOLATILE_USHORT_POINTER(0x6e + SIM_CRB)
331#define CSOR9 SIM_VOLATILE_USHORT_POINTER(0x72 + SIM_CRB)
332#define CSOR10 SIM_VOLATILE_USHORT_POINTER(0x76 + SIM_CRB)
333
334#endif /* _SIM_h_ */
Note: See TracBrowser for help on using the repository browser.