1 |
578 |
jeremybenn |
/*
|
2 |
|
|
* File: mcf5xxx.h
|
3 |
|
|
* Purpose: Definitions common to all ColdFire processors
|
4 |
|
|
*
|
5 |
|
|
* Notes:
|
6 |
|
|
*
|
7 |
|
|
* License: All software covered by license agreement in -
|
8 |
|
|
* docs/Freescale_Software_License.pdf
|
9 |
|
|
*/
|
10 |
|
|
|
11 |
|
|
#ifndef _CPU_MCF5XXX_H
|
12 |
|
|
#define _CPU_MCF5XXX_H
|
13 |
|
|
|
14 |
|
|
/***********************************************************************/
|
15 |
|
|
/*
|
16 |
|
|
* Misc. Defines
|
17 |
|
|
*/
|
18 |
|
|
#ifdef FALSE
|
19 |
|
|
#undef FALSE
|
20 |
|
|
#endif
|
21 |
|
|
#define FALSE (0)
|
22 |
|
|
|
23 |
|
|
#ifdef TRUE
|
24 |
|
|
#undef TRUE
|
25 |
|
|
#endif
|
26 |
|
|
#define TRUE (1)
|
27 |
|
|
|
28 |
|
|
#ifdef NULL
|
29 |
|
|
#undef NULL
|
30 |
|
|
#endif
|
31 |
|
|
#define NULL (0)
|
32 |
|
|
|
33 |
|
|
#ifdef ON
|
34 |
|
|
#undef ON
|
35 |
|
|
#endif
|
36 |
|
|
#define ON (1)
|
37 |
|
|
|
38 |
|
|
#ifdef OFF
|
39 |
|
|
#undef OFF
|
40 |
|
|
#endif
|
41 |
|
|
#define OFF (0)
|
42 |
|
|
|
43 |
|
|
/***********************************************************************/
|
44 |
|
|
/*
|
45 |
|
|
* The basic data types
|
46 |
|
|
*/
|
47 |
|
|
typedef unsigned char uint8; /* 8 bits */
|
48 |
|
|
typedef unsigned short int uint16; /* 16 bits */
|
49 |
|
|
typedef unsigned long int uint32; /* 32 bits */
|
50 |
|
|
|
51 |
|
|
typedef char int8; /* 8 bits */
|
52 |
|
|
typedef short int int16; /* 16 bits */
|
53 |
|
|
typedef int int32; /* 32 bits */
|
54 |
|
|
|
55 |
|
|
typedef volatile int8 vint8; /* 8 bits */
|
56 |
|
|
typedef volatile int16 vint16; /* 16 bits */
|
57 |
|
|
typedef volatile int32 vint32; /* 32 bits */
|
58 |
|
|
|
59 |
|
|
typedef volatile uint8 vuint8; /* 8 bits */
|
60 |
|
|
typedef volatile uint16 vuint16; /* 16 bits */
|
61 |
|
|
typedef volatile uint32 vuint32; /* 32 bits */
|
62 |
|
|
|
63 |
|
|
/***********************************************************************/
|
64 |
|
|
/*
|
65 |
|
|
* Common M68K & ColdFire definitions
|
66 |
|
|
*/
|
67 |
|
|
#define ADDRESS uint32
|
68 |
|
|
#define INSTRUCTION uint16
|
69 |
|
|
#define ILLEGAL 0x4AFC
|
70 |
|
|
#define CPU_WORD_SIZE 16
|
71 |
|
|
|
72 |
|
|
/* Status Register */
|
73 |
|
|
#define MCF5XXX_SR_T (0x8000)
|
74 |
|
|
#define MCF5XXX_SR_S (0x2000)
|
75 |
|
|
#define MCF5XXX_SR_M (0x1000)
|
76 |
|
|
#define MCF5XXX_SR_IPL (0x0700)
|
77 |
|
|
#define MCF5XXX_SR_IPL_0 (0x0000)
|
78 |
|
|
#define MCF5XXX_SR_IPL_1 (0x0100)
|
79 |
|
|
#define MCF5XXX_SR_IPL_2 (0x0200)
|
80 |
|
|
#define MCF5XXX_SR_IPL_3 (0x0300)
|
81 |
|
|
#define MCF5XXX_SR_IPL_4 (0x0400)
|
82 |
|
|
#define MCF5XXX_SR_IPL_5 (0x0500)
|
83 |
|
|
#define MCF5XXX_SR_IPL_6 (0x0600)
|
84 |
|
|
#define MCF5XXX_SR_IPL_7 (0x0700)
|
85 |
|
|
#define MCF5XXX_SR_X (0x0010)
|
86 |
|
|
#define MCF5XXX_SR_N (0x0008)
|
87 |
|
|
#define MCF5XXX_SR_Z (0x0004)
|
88 |
|
|
#define MCF5XXX_SR_V (0x0002)
|
89 |
|
|
#define MCF5XXX_SR_C (0x0001)
|
90 |
|
|
|
91 |
|
|
/* Cache Control Register */
|
92 |
|
|
#define MCF5XXX_CACR_CENB (0x80000000)
|
93 |
|
|
#define MCF5XXX_CACR_DEC (0x80000000)
|
94 |
|
|
#define MCF5XXX_CACR_DW (0x40000000)
|
95 |
|
|
#define MCF5XXX_CACR_DESB (0x20000000)
|
96 |
|
|
#define MCF5XXX_CACR_CPDI (0x10000000)
|
97 |
|
|
#define MCF5XXX_CACR_DDPI (0x10000000)
|
98 |
|
|
#define MCF5XXX_CACR_CPD (0x10000000)
|
99 |
|
|
#define MCF5XXX_CACR_CFRZ (0x08000000)
|
100 |
|
|
#define MCF5XXX_CACR_DHLCK (0x08000000)
|
101 |
|
|
#define MCF5XXX_CACR_DDCM_WT (0x00000000)
|
102 |
|
|
#define MCF5XXX_CACR_DDCM_CB (0x02000000)
|
103 |
|
|
#define MCF5XXX_CACR_DDCM_IP (0x04000000)
|
104 |
|
|
#define MCF5XXX_CACR_DDCM_II (0x06000000)
|
105 |
|
|
#define MCF5XXX_CACR_CINV (0x01000000)
|
106 |
|
|
#define MCF5XXX_CACR_DCINVA (0x01000000)
|
107 |
|
|
#define MCF5XXX_CACR_DIDI (0x00800000)
|
108 |
|
|
#define MCF5XXX_CACR_DDSP (0x00800000)
|
109 |
|
|
#define MCF5XXX_CACR_DISD (0x00400000)
|
110 |
|
|
#define MCF5XXX_CACR_INVI (0x00200000)
|
111 |
|
|
#define MCF5XXX_CACR_INVD (0x00100000)
|
112 |
|
|
#define MCF5XXX_CACR_BEC (0x00080000)
|
113 |
|
|
#define MCF5XXX_CACR_BCINVA (0x00040000)
|
114 |
|
|
#define MCF5XXX_CACR_IEC (0x00008000)
|
115 |
|
|
#define MCF5XXX_CACR_DNFB (0x00002000)
|
116 |
|
|
#define MCF5XXX_CACR_IDPI (0x00001000)
|
117 |
|
|
#define MCF5XXX_CACR_IHLCK (0x00000800)
|
118 |
|
|
#define MCF5XXX_CACR_CEIB (0x00000400)
|
119 |
|
|
#define MCF5XXX_CACR_IDCM (0x00000400)
|
120 |
|
|
#define MCF5XXX_CACR_DCM_WR (0x00000000)
|
121 |
|
|
#define MCF5XXX_CACR_DCM_CB (0x00000100)
|
122 |
|
|
#define MCF5XXX_CACR_DCM_IP (0x00000200)
|
123 |
|
|
#define MCF5XXX_CACR_DCM (0x00000200)
|
124 |
|
|
#define MCF5XXX_CACR_DCM_II (0x00000300)
|
125 |
|
|
#define MCF5XXX_CACR_DBWE (0x00000100)
|
126 |
|
|
#define MCF5XXX_CACR_ICINVA (0x00000100)
|
127 |
|
|
#define MCF5XXX_CACR_IDSP (0x00000080)
|
128 |
|
|
#define MCF5XXX_CACR_DWP (0x00000020)
|
129 |
|
|
#define MCF5XXX_CACR_EUSP (0x00000020)
|
130 |
|
|
#define MCF5XXX_CACR_EUST (0x00000020)
|
131 |
|
|
#define MCF5XXX_CACR_DF (0x00000010)
|
132 |
|
|
#define MCF5XXX_CACR_CLNF_00 (0x00000000)
|
133 |
|
|
#define MCF5XXX_CACR_CLNF_01 (0x00000002)
|
134 |
|
|
#define MCF5XXX_CACR_CLNF_10 (0x00000004)
|
135 |
|
|
#define MCF5XXX_CACR_CLNF_11 (0x00000006)
|
136 |
|
|
|
137 |
|
|
/* Access Control Register */
|
138 |
|
|
#define MCF5XXX_ACR_AB(a) ((a)&0xFF000000)
|
139 |
|
|
#define MCF5XXX_ACR_AM(a) (((a)&0xFF000000) >> 8)
|
140 |
|
|
#define MCF5XXX_ACR_AM_4G (0x00FF0000)
|
141 |
|
|
#define MCF5XXX_ACR_AM_2G (0x007F0000)
|
142 |
|
|
#define MCF5XXX_ACR_AM_1G (0x003F0000)
|
143 |
|
|
#define MCF5XXX_ACR_AM_1024M (0x003F0000)
|
144 |
|
|
#define MCF5XXX_ACR_AM_512M (0x001F0000)
|
145 |
|
|
#define MCF5XXX_ACR_AM_256M (0x000F0000)
|
146 |
|
|
#define MCF5XXX_ACR_AM_128M (0x00070000)
|
147 |
|
|
#define MCF5XXX_ACR_AM_64M (0x00030000)
|
148 |
|
|
#define MCF5XXX_ACR_AM_32M (0x00010000)
|
149 |
|
|
#define MCF5XXX_ACR_AM_16M (0x00000000)
|
150 |
|
|
#define MCF5XXX_ACR_EN (0x00008000)
|
151 |
|
|
#define MCF5XXX_ACR_SM_USER (0x00000000)
|
152 |
|
|
#define MCF5XXX_ACR_SM_SUPER (0x00002000)
|
153 |
|
|
#define MCF5XXX_ACR_SM_IGNORE (0x00006000)
|
154 |
|
|
#define MCF5XXX_ACR_ENIB (0x00000080)
|
155 |
|
|
#define MCF5XXX_ACR_CM (0x00000040)
|
156 |
|
|
#define MCF5XXX_ACR_DCM_WR (0x00000000)
|
157 |
|
|
#define MCF5XXX_ACR_DCM_CB (0x00000020)
|
158 |
|
|
#define MCF5XXX_ACR_DCM_IP (0x00000040)
|
159 |
|
|
#define MCF5XXX_ACR_DCM_II (0x00000060)
|
160 |
|
|
#define MCF5XXX_ACR_CM (0x00000040)
|
161 |
|
|
#define MCF5XXX_ACR_BWE (0x00000020)
|
162 |
|
|
#define MCF5XXX_ACR_WP (0x00000004)
|
163 |
|
|
|
164 |
|
|
/* RAM Base Address Register */
|
165 |
|
|
#define MCF5XXX_RAMBAR_BA(a) ((a)&0xFFFFC000)
|
166 |
|
|
#define MCF5XXX_RAMBAR_PRI_00 (0x00000000)
|
167 |
|
|
#define MCF5XXX_RAMBAR_PRI_01 (0x00004000)
|
168 |
|
|
#define MCF5XXX_RAMBAR_PRI_10 (0x00008000)
|
169 |
|
|
#define MCF5XXX_RAMBAR_PRI_11 (0x0000C000)
|
170 |
|
|
#define MCF5XXX_RAMBAR_WP (0x00000100)
|
171 |
|
|
#define MCF5XXX_RAMBAR_CI (0x00000020)
|
172 |
|
|
#define MCF5XXX_RAMBAR_SC (0x00000010)
|
173 |
|
|
#define MCF5XXX_RAMBAR_SD (0x00000008)
|
174 |
|
|
#define MCF5XXX_RAMBAR_UC (0x00000004)
|
175 |
|
|
#define MCF5XXX_RAMBAR_UD (0x00000002)
|
176 |
|
|
#define MCF5XXX_RAMBAR_V (0x00000001)
|
177 |
|
|
|
178 |
|
|
/* Read macros for D0/D1 reset values */
|
179 |
|
|
#define MCF5XXX_D0_PF(x) (((x)&0xFF000000)>>24)
|
180 |
|
|
#define MCF5XXX_D0_VER(x) (((x)&0x00F00000)>>20)
|
181 |
|
|
#define MCF5XXX_D0_REV(x) (((x)&0x000F0000)>>16)
|
182 |
|
|
#define MCF5XXX_D0_MAC(x) ((x)&0x00008000)
|
183 |
|
|
#define MCF5XXX_D0_DIV(x) ((x)&0x00004000)
|
184 |
|
|
#define MCF5XXX_D0_EMAC(x) ((x)&0x00002000)
|
185 |
|
|
#define MCF5XXX_D0_FPU(x) ((x)&0x00001000)
|
186 |
|
|
#define MCF5XXX_D0_MMU(x) ((x)&0x00000800)
|
187 |
|
|
#define MCF5XXX_D0_ISA(x) (((x)&0x000000F0)>>4)
|
188 |
|
|
#define MCF5XXX_D0_DEBUG(x) (((x)&0x0000000F)>>0)
|
189 |
|
|
#define MCF5XXX_D1_CL(x) (((x)&0xC0000000)>>30)
|
190 |
|
|
#define MCF5XXX_D1_ICA(x) (((x)&0x30000000)>>28)
|
191 |
|
|
#define MCF5XXX_D1_ICSIZ(x) (((x)&0x0F000000)>>24)
|
192 |
|
|
#define MCF5XXX_D1_RAM0SIZ(x) (((x)&0x00F00000)>>20)
|
193 |
|
|
#define MCF5XXX_D1_ROM0SIZ(x) (((x)&0x000F0000)>>16)
|
194 |
|
|
#define MCF5XXX_D1_BUSW(x) (((x)&0x0000C000)>>14)
|
195 |
|
|
#define MCF5XXX_D1_DCA(x) (((x)&0x00003000)>>12)
|
196 |
|
|
#define MCF5XXX_D1_DCSIZ(x) (((x)&0x00000F00)>>8)
|
197 |
|
|
#define MCF5XXX_D1_RAM1SIZ(x) (((x)&0x000000F0)>>4)
|
198 |
|
|
#define MCF5XXX_D1_ROM1SIZ(x) (((x)&0x0000000F)>>0)
|
199 |
|
|
|
200 |
|
|
/***********************************************************************/
|
201 |
|
|
/*
|
202 |
|
|
* The ColdFire family of processors has a simplified exception stack
|
203 |
|
|
* frame that looks like the following:
|
204 |
|
|
*
|
205 |
|
|
* 3322222222221111 111111
|
206 |
|
|
* 1098765432109876 5432109876543210
|
207 |
|
|
* 8 +----------------+----------------+
|
208 |
|
|
* | Program Counter |
|
209 |
|
|
* 4 +----------------+----------------+
|
210 |
|
|
* |FS/Fmt/Vector/FS| SR |
|
211 |
|
|
* SP --> 0 +----------------+----------------+
|
212 |
|
|
*
|
213 |
|
|
* The stack self-aligns to a 4-byte boundary at an exception, with
|
214 |
|
|
* the FS/Fmt/Vector/FS field indicating the size of the adjustment
|
215 |
|
|
* (SP += 0,1,2,3 bytes).
|
216 |
|
|
*/
|
217 |
|
|
#define MCF5XXX_RD_SF_FORMAT(PTR) \
|
218 |
|
|
((*((uint16 *)(PTR)) >> 12) & 0x00FF)
|
219 |
|
|
|
220 |
|
|
#define MCF5XXX_RD_SF_VECTOR(PTR) \
|
221 |
|
|
((*((uint16 *)(PTR)) >> 2) & 0x00FF)
|
222 |
|
|
|
223 |
|
|
#define MCF5XXX_RD_SF_FS(PTR) \
|
224 |
|
|
( ((*((uint16 *)(PTR)) & 0x0C00) >> 8) | (*((uint16 *)(PTR)) & 0x0003) )
|
225 |
|
|
|
226 |
|
|
#define MCF5XXX_SF_SR(PTR) *((uint16 *)(PTR)+1)
|
227 |
|
|
#define MCF5XXX_SF_PC(PTR) *((uint32 *)(PTR)+1)
|
228 |
|
|
|
229 |
|
|
/********************************************************************/
|
230 |
|
|
/*
|
231 |
|
|
* Functions provided in mcf5xxx.s
|
232 |
|
|
*/
|
233 |
|
|
int asm_set_ipl (uint32);
|
234 |
|
|
void mcf5xxx_exe_wdebug (void *);
|
235 |
|
|
void mcf5xxx_wr_sr (uint32);
|
236 |
|
|
void mcf5xxx_wr_cacr (uint32);
|
237 |
|
|
void mcf5xxx_wr_asid (uint32);
|
238 |
|
|
void mcf5xxx_wr_acr0 (uint32);
|
239 |
|
|
void mcf5xxx_wr_acr1 (uint32);
|
240 |
|
|
void mcf5xxx_wr_acr2 (uint32);
|
241 |
|
|
void mcf5xxx_wr_acr3 (uint32);
|
242 |
|
|
void mcf5xxx_wr_mmubar (uint32);
|
243 |
|
|
void mcf5xxx_wr_other_a7 (uint32);
|
244 |
|
|
void mcf5xxx_wr_other_sp (uint32);
|
245 |
|
|
void mcf5xxx_wr_vbr (uint32);
|
246 |
|
|
void mcf5xxx_wr_macsr (uint32);
|
247 |
|
|
void mcf5xxx_wr_mask (uint32);
|
248 |
|
|
void mcf5xxx_wr_acc0 (uint32);
|
249 |
|
|
void mcf5xxx_wr_accext01 (uint32);
|
250 |
|
|
void mcf5xxx_wr_accext23 (uint32);
|
251 |
|
|
void mcf5xxx_wr_acc1 (uint32);
|
252 |
|
|
void mcf5xxx_wr_acc2 (uint32);
|
253 |
|
|
void mcf5xxx_wr_acc3 (uint32);
|
254 |
|
|
void mcf5xxx_wr_pc (uint32);
|
255 |
|
|
void mcf5xxx_wr_rombar0 (uint32);
|
256 |
|
|
void mcf5xxx_wr_rombar1 (uint32);
|
257 |
|
|
void mcf5xxx_wr_rambar0 (uint32);
|
258 |
|
|
void mcf5xxx_wr_rambar1 (uint32);
|
259 |
|
|
void mcf5xxx_wr_mpcr (uint32);
|
260 |
|
|
void mcf5xxx_wr_secmbar (uint32);
|
261 |
|
|
void mcf5xxx_wr_mbar1 (uint32);
|
262 |
|
|
void mcf5xxx_wr_mbar (uint32);
|
263 |
|
|
void mcf5xxx_wr_mbar0 (uint32);
|
264 |
|
|
void mcf5xxx_move_line (ADDRESS, ADDRESS);
|
265 |
|
|
|
266 |
|
|
/*
|
267 |
|
|
* Functions provided in mcf5xxx.c
|
268 |
|
|
*/
|
269 |
|
|
void mcf5xxx_exception_handler (void *);
|
270 |
|
|
void mcf5xxx_interpret_d0d1 (int, int);
|
271 |
|
|
void mcf5xxx_irq_enable (void);
|
272 |
|
|
void mcf5xxx_irq_disable (void);
|
273 |
|
|
ADDRESS mcf5xxx_set_handler (int, ADDRESS);
|
274 |
|
|
|
275 |
|
|
/*
|
276 |
|
|
* Functions provided by processor specific C file
|
277 |
|
|
*/
|
278 |
|
|
void cpu_handle_interrupt (int);
|
279 |
|
|
|
280 |
|
|
/********************************************************************/
|
281 |
|
|
|
282 |
|
|
#endif /* _CPU_MCF5XXX_H */
|
283 |
|
|
|