RTEMS 7.0-rc1
Loading...
Searching...
No Matches
sim.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
30/*
31 * Copyright (c) 1995 John Gwynne <john.gwynne@matrixresearch.com>
32 *
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 *
42 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
43 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
45 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
46 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
47 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
48 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
49 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
50 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
51 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
52 * POSSIBILITY OF SUCH DAMAGE.
53 */
54
55#ifndef _RTEMS_M68K_SIM_H
56#define _RTEMS_M68K_SIM_H
57
58
59/* SAM-- shift and mask */
60#undef SAM
61#define SAM(a,b,c) ((a << b) & c)
62
63/*
64 * These macros make this file usable from assembly.
65 */
66
67#ifdef ASM
68#define SIM_VOLATILE_USHORT_POINTER
69#define SIM_VOLATILE_UCHAR_POINTER
70#else
71#define SIM_VOLATILE_USHORT_POINTER (volatile unsigned short int * const)
72#define SIM_VOLATILE_UCHAR_POINTER (volatile unsigned char * const)
73#endif
74
75/* SIM_CRB (SIM Control Register Block) base address of the SIM
76 control registers */
77#ifndef SIM_CRB
78#if SIM_MM == 0
79#define SIM_CRB 0x7ffa00
80#else /* SIM_MM */
81#undef SIM_MM
82#define SIM_MM 1
83#define SIM_CRB 0xfffa00
84#endif /* SIM_MM */
85#endif /* SIM_CRB */
86
87
88#define SIMCR SIM_VOLATILE_USHORT_POINTER(0x00 + SIM_CRB)
89 /* Module Configuration Register */
90#define EXOFF 0x8000 /* External Clock Off */
91#define FRZSW 0x4000 /* Freeze Software Enable */
92#define FRZBM 0x2000 /* Freeze Bus Monitor Enable */
93#define SLVEN 0x0800 /* Factory Test Model Enabled (ro)*/
94#define SHEN 0x0300 /* Show Cycle Enable */
95#define SUPV 0x0080 /* Supervisor/Unrestricted Data Space */
96#define MM 0x0040 /* Module Mapping */
97#define IARB 0x000f /* Interrupt Arbitration Field */
98
99
100
101#define SIMTR SIM_VOLATILE_USHORT_POINTER(0x02 + SIM_CRB)
102 /* SIM Test Register */
103/* Used only for factor testing */
104
105
106
107#define SYNCR SIM_VOLATILE_USHORT_POINTER(0x04 + SIM_CRB)
108 /* Clock Synthesizer Control Register */
109#define VCO 0x8000 /* Frequency Control (VCO) */
110#define PRESCALE 0x4000 /* Frequency Control Bit (Prescale) */
111#define COUNTER 0x3f00 /* Frequency Control Counter */
112#define EDIV 0x0080 /* ECLK Divide Rate */
113#define SLIMP 0x0010 /* Limp Mode Status */
114#define SLOCK 0x0008 /* Synthesizer Lock */
115#define RSTEN 0x0004 /* Reset Enable */
116#define STSIM 0x0002 /* Stop Mode SIM Clock */
117#define STEXT 0x0001 /* Stop Mode External Clock */
118
119
120
121#define RSR SIM_VOLATILE_UCHAR_POINTER(0x07 + SIM_CRB)
122 /* Reset Status Register */
123#define EXT 0x0080 /* External Reset */
124#define POW 0x0040 /* Power-On Reset */
125#define SW 0x0020 /* Software Watchdog Reset */
126#define DBF 0x0010 /* Double Bus Fault Reset */
127#define LOC 0x0004 /* Loss of Clock Reset */
128#define SYS 0x0002 /* System Reset */
129#define TST 0x0001 /* Test Submodule Reset */
130
131
132
133#define SIMTRE SIM_VOLATILE_USHORT_POINTER(0x08 + SIM_CRB)
134 /* System Integration Test Register */
135/* Used only for factor testing */
136
137
138
139#define PORTE0 SIM_VOLATILE_UCHAR_POINTER(0x11 + SIM_CRB)
140#define PORTE1 SIM_VOLATILE_UCHAR_POINTER(0x13 + SIM_CRB)
141 /* Port E Data Register */
142#define DDRE SIM_VOLATILE_UCHAR_POINTER(0x15 + SIM_CRB)
143 /* Port E Data Direction Register */
144#define PEPAR SIM_VOLATILE_UCHAR_POINTER(0x17 + SIM_CRB)
145 /* Port E Pin Assignment Register */
146/* Any bit cleared (zero) defines the corresponding pin to be an I/O
147 pin. Any bit set defines the corresponding pin to be a bus control
148 signal. */
149
150
151
152#define PORTF0 SIM_VOLATILE_UCHAR_POINTER(0x19 + SIM_CRB)
153#define PORTF1 SIM_VOLATILE_UCHAR_POINTER(0x1b + SIM_CRB)
154 /* Port F Data Register */
155#define DDRF SIM_VOLATILE_UCHAR_POINTER(0x1d + SIM_CRB)
156 /* Port E Data Direction Register */
157#define PFPAR SIM_VOLATILE_UCHAR_POINTER(0x1f + SIM_CRB)
158/* Any bit cleared (zero) defines the corresponding pin to be an I/O
159 pin. Any bit set defines the corresponding pin to be a bus control
160 signal. */
161
162
163
164#define SYPCR SIM_VOLATILE_UCHAR_POINTER(0x21 + SIM_CRB)
165/* !!! can write to only once after reset !!! */
166 /* System Protection Control Register */
167#define SWE 0x80 /* Software Watch Enable */
168#define SWP 0x40 /* Software Watchdog Prescale */
169#define SWT 0x30 /* Software Watchdog Timing */
170#define HME 0x08 /* Halt Monitor Enable */
171#define BME 0x04 /* Bus Monitor External Enable */
172#define BMT 0x03 /* Bus Monitor Timing */
173
174
175
176#define PICR SIM_VOLATILE_USHORT_POINTER(0x22 + SIM_CRB)
177 /* Periodic Interrupt Control Reg. */
178#define PIRQL 0x0700 /* Periodic Interrupt Request Level */
179#define PIV 0x00ff /* Periodic Interrupt Level */
180
181
182
183#define PITR SIM_VOLATILE_USHORT_POINTER(0x24 + SIM_CRB)
184 /* Periodic Interrupt Timer Register */
185#define PTP 0x0100 /* Periodic Timer Prescaler Control */
186#define PITM 0x00ff /* Periodic Interrupt Timing Modulus */
187
188
189
190#define SWSR SIM_VOLATILE_UCHAR_POINTER(0x27 + SIM_CRB)
191 /* Software Service Register */
192/* write 0x55 then 0xaa to service the software watchdog */
193
194
195
196#define TSTMSRA SIM_VOLATILE_USHORT_POINTER(0x30 + SIM_CRB)
197 /* Test Module Master Shift A */
198#define TSTMSRB SIM_VOLATILE_USHORT_POINTER(0x32 + SIM_CRB)
199 /* Test Module Master Shift A */
200#define TSTSC SIM_VOLATILE_USHORT_POINTER(0x34 + SIM_CRB)
201 /* Test Module Shift Count */
202#define TSTRC SIM_VOLATILE_USHORT_POINTER(0x36 + SIM_CRB)
203 /* Test Module Repetition Counter */
204#define CREG SIM_VOLATILE_USHORT_POINTER(0x38 + SIM_CRB)
205 /* Test Module Control */
206#define DREG SIM_VOLATILE_USHORT_POINTER(0x3a + SIM_CRB)
207 /* Test Module Distributed */
208/* Used only for factor testing */
209
210
211
212#define PORTC SIM_VOLATILE_UCHAR_POINTER(0x41 + SIM_CRB)
213 /* Port C Data */
214
215
216
217#define CSPAR0 SIM_VOLATILE_USHORT_POINTER(0x44 + SIM_CRB)
218 /* Chip Select Pin Assignment
219 Resgister 0 */
220/* CSPAR0 contains seven two-bit fields that determine the functions
221 of corresponding chip-select pins. CSPAR0[15:14] are not
222 used. These bits always read zero; write have no effect. CSPAR0 bit
223 1 always reads one; writes to CSPAR0 bit 1 have no effect. */
224#define CSPAR1 SIM_VOLATILE_USHORT_POINTER(0x46 + SIM_CRB)
225 /* Chip Select Pin Assignment
226 Register 1 */
227/* CSPAR1 contains five two-bit fields that determine the finctions of
228 corresponding chip-select pins. CSPAR1[15:10] are not used. These
229 bits always read zero; writes have no effect. */
230/*
231 *
232 * Bit Field | Description
233 * ------------+---------------
234 * 00 | Discrete Output
235 * 01 | Alternate Function
236 * 10 | Chip Select (8-bit port)
237 * 11 | Chip Select (16-bit port)
238 */
239#define DisOut 0x0
240#define AltFun 0x1
241#define CS8bit 0x2
242#define CS16bit 0x3
243/*
244 *
245 * CSPARx Field |Chip Select Signal | Alternate Signal | Discrete Output
246 *-----------------+--------------------+--------------------+---------------*/
247#define CS_5 12 /* !CS5 | FC2 | PC2 */
248#define CS_4 10 /* !CS4 | FC1 | PC1 */
249#define CS_3 8 /* !CS3 | FC0 | PC0 */
250#define CS_2 6 /* !CS2 | !BGACK | */
251#define CS_1 4 /* !CS1 | !BG | */
252#define CS_0 2 /* !CS0 | !BR | */
253#define CSBOOT 0 /* !CSBOOT | | */
254/* | | | */
255#define CS_10 8 /* !CS10 | ADDR23 | ECLK */
256#define CS_9 6 /* !CS9 | ADDR22 | PC6 */
257#define CS_8 4 /* !CS8 | ADDR21 | PC5 */
258#define CS_7 2 /* !CS7 | ADDR20 | PC4 */
259#define CS_6 0 /* !CS6 | ADDR19 | PC3 */
260
261#define BS_2K 0x0
262#define BS_8K 0x1
263#define BS_16K 0x2
264#define BS_64K 0x3
265#define BS_128K 0x4
266#define BS_256K 0x5
267#define BS_512K 0x6
268#define BS_1M 0x7
269
270#define CSBARBT SIM_VOLATILE_USHORT_POINTER(0x48 + SIM_CRB)
271#define CSBAR0 SIM_VOLATILE_USHORT_POINTER(0x4c + SIM_CRB)
272#define CSBAR1 SIM_VOLATILE_USHORT_POINTER(0x50 + SIM_CRB)
273#define CSBAR2 SIM_VOLATILE_USHORT_POINTER(0x54 + SIM_CRB)
274#define CSBAR3 SIM_VOLATILE_USHORT_POINTER(0x58 + SIM_CRB)
275#define CSBAR4 SIM_VOLATILE_USHORT_POINTER(0x5c + SIM_CRB)
276#define CSBAR5 SIM_VOLATILE_USHORT_POINTER(0x60 + SIM_CRB)
277#define CSBAR6 SIM_VOLATILE_USHORT_POINTER(0x64 + SIM_CRB)
278#define CSBAR7 SIM_VOLATILE_USHORT_POINTER(0x68 + SIM_CRB)
279#define CSBAR8 SIM_VOLATILE_USHORT_POINTER(0x6c + SIM_CRB)
280#define CSBAR9 SIM_VOLATILE_USHORT_POINTER(0x70 + SIM_CRB)
281#define CSBAR10 SIM_VOLATILE_USHORT_POINTER(0x74 + SIM_CRB)
282
283#define MODE 0x8000
284#define Disable 0
285#define LowerByte 0x2000
286#define UpperByte 0x4000
287#define BothBytes 0x6000
288#define ReadOnly 0x0800
289#define WriteOnly 0x1000
290#define ReadWrite 0x1800
291#define SyncAS 0x0
292#define SyncDS 0x0400
293
294#define WaitStates_0 (0x0 << 6)
295#define WaitStates_1 (0x1 << 6)
296#define WaitStates_2 (0x2 << 6)
297#define WaitStates_3 (0x3 << 6)
298#define WaitStates_4 (0x4 << 6)
299#define WaitStates_5 (0x5 << 6)
300#define WaitStates_6 (0x6 << 6)
301#define WaitStates_7 (0x7 << 6)
302#define WaitStates_8 (0x8 << 6)
303#define WaitStates_9 (0x9 << 6)
304#define WaitStates_10 (0xa << 6)
305#define WaitStates_11 (0xb << 6)
306#define WaitStates_12 (0xc << 6)
307#define WaitStates_13 (0xd << 6)
308#define FastTerm (0xe << 6)
309#define External (0xf << 6)
310
311#define CPUSpace (0x0 << 4)
312#define UserSpace (0x1 << 4)
313#define SupSpace (0x2 << 4)
314#define UserSupSpace (0x3 << 4)
315
316#define IPLevel_any 0x0
317#define IPLevel_1 0x2
318#define IPLevel_2 0x4
319#define IPLevel_3 0x6
320#define IPLevel_4 0x8
321#define IPLevel_5 0xa
322#define IPLevel_6 0xc
323#define IPLevel_7 0xe
324
325#define AVEC 1
326
327#define CSORBT SIM_VOLATILE_USHORT_POINTER(0x4a + SIM_CRB)
328#define CSOR0 SIM_VOLATILE_USHORT_POINTER(0x4e + SIM_CRB)
329#define CSOR1 SIM_VOLATILE_USHORT_POINTER(0x52 + SIM_CRB)
330#define CSOR2 SIM_VOLATILE_USHORT_POINTER(0x56 + SIM_CRB)
331#define CSOR3 SIM_VOLATILE_USHORT_POINTER(0x5a + SIM_CRB)
332#define CSOR4 SIM_VOLATILE_USHORT_POINTER(0x5e + SIM_CRB)
333#define CSOR5 SIM_VOLATILE_USHORT_POINTER(0x62 + SIM_CRB)
334#define CSOR6 SIM_VOLATILE_USHORT_POINTER(0x66 + SIM_CRB)
335#define CSOR7 SIM_VOLATILE_USHORT_POINTER(0x6a + SIM_CRB)
336#define CSOR8 SIM_VOLATILE_USHORT_POINTER(0x6e + SIM_CRB)
337#define CSOR9 SIM_VOLATILE_USHORT_POINTER(0x72 + SIM_CRB)
338#define CSOR10 SIM_VOLATILE_USHORT_POINTER(0x76 + SIM_CRB)
339
340#endif /* _RTEMS_M68K_SIM_H */