3 * Purpose: Generic high-level routines for generic ColdFire processors
7 * License: All software covered by license agreement in -
8 * docs/Freescale_Software_License.pdf
13 /********************************************************************/
15 #define EXCEPTFMT "%s -- PC = %#08X\n"
17 /********************************************************************/
19 * This is the exception handler for all defined exceptions. Most
20 * exceptions do nothing, but some of the more important ones are
21 * handled to some extent.
23 * Called by asm_exception_handler
26 mcf5xxx_exception_handler (void *framep)
28 switch (MCF5XXX_RD_SF_FORMAT(framep))
36 printf(EXCEPTFMT,"Illegal stack type", MCF5XXX_SF_PC(framep));
40 switch (MCF5XXX_RD_SF_VECTOR(framep))
43 printf(EXCEPTFMT, "Access Error", MCF5XXX_SF_PC(framep));
44 switch (MCF5XXX_RD_SF_FS(framep))
47 printf("Error on instruction fetch\n");
50 printf("Error on operand write\n");
53 printf("Attempted write to write-protected space\n");
56 printf("Error on operand read\n");
59 printf("Reserved Fault Status Encoding\n");
64 printf(EXCEPTFMT, "Address Error", MCF5XXX_SF_PC(framep));
65 switch (MCF5XXX_RD_SF_FS(framep))
68 printf("Error on instruction fetch\n");
71 printf("Error on operand write\n");
74 printf("Attempted write to write-protected space\n");
77 printf("Error on operand read\n");
80 printf("Reserved Fault Status Encoding\n");
85 printf(EXCEPTFMT, "Illegal instruction", MCF5XXX_SF_PC(framep));
88 printf(EXCEPTFMT, "Privilege violation", MCF5XXX_SF_PC(framep));
91 printf(EXCEPTFMT, "Trace Exception", MCF5XXX_SF_PC(framep));
94 printf(EXCEPTFMT, "Unimplemented A-Line Instruction", \
95 MCF5XXX_SF_PC(framep));
98 printf(EXCEPTFMT, "Unimplemented F-Line Instruction", \
99 MCF5XXX_SF_PC(framep));
102 printf(EXCEPTFMT, "Debug Interrupt", MCF5XXX_SF_PC(framep));
105 printf(EXCEPTFMT, "Format Error", MCF5XXX_SF_PC(framep));
108 printf(EXCEPTFMT, "Unitialized Interrupt", MCF5XXX_SF_PC(framep));
111 printf(EXCEPTFMT, "Spurious Interrupt", MCF5XXX_SF_PC(framep));
120 printf("Autovector interrupt level %d\n",
121 MCF5XXX_RD_SF_VECTOR(framep) - 24);
139 printf("TRAP #%d\n", MCF5XXX_RD_SF_VECTOR(framep) - 32);
169 printf("Reserved: #%d\n", MCF5XXX_RD_SF_VECTOR(framep));
172 cpu_handle_interrupt(MCF5XXX_RD_SF_VECTOR(framep));
177 /********************************************************************/
179 * Interpret the reset values of D0 and D1
182 * d0 - the reset value of data register zero
183 * d1 - the reset value of data register one
186 mcf5xxx_interpret_d0d1(int d0, int d1)
189 printf("\nColdFire Core Configuration:\n");
190 printf("----------------------------\n");
191 printf("Processor Family %#02x\n",MCF5XXX_D0_PF(d0));
192 printf("ColdFire Core Version: %d\n",MCF5XXX_D0_VER(d0));
193 printf("Processor Revision: %d\n",MCF5XXX_D0_REV(d1));
194 printf("Bus Width: ");
195 switch (MCF5XXX_D1_BUSW(d1))
201 printf("Reserved\n");
203 printf("ISA Version: ");
204 switch (MCF5XXX_D0_ISA(d0))
219 printf("Reserved\n");
221 printf("Debug Version: ");
222 switch (MCF5XXX_D0_DEBUG(d0))
243 printf("Reserved\n");
245 printf("MAC: %s\n", MCF5XXX_D0_MAC(d0) ? "Yes" : "No");
246 printf("DIV: %s\n", MCF5XXX_D0_DIV(d0) ? "Yes" : "No");
247 printf("EMAC: %s\n", MCF5XXX_D0_EMAC(d0) ? "Yes" : "No");
248 printf("FPU: %s\n", MCF5XXX_D0_FPU(d0) ? "Yes" : "No");
249 printf("MMU: %s\n", MCF5XXX_D0_MMU(d0) ? "Yes" : "No");
250 printf("RAM Bank 0 Size: ");
251 switch (MCF5XXX_D1_RAM0SIZ(d1))
284 printf("Reserved\n");
286 printf("RAM Bank 1 Size: ");
287 switch (MCF5XXX_D1_RAM1SIZ(d1))
320 printf("Reserved\n");
322 printf("ROM Bank 0 Size: ");
323 switch (MCF5XXX_D1_ROM0SIZ(d1))
349 printf("Reserved\n");
351 printf("ROM Bank 1 Size: ");
352 switch (MCF5XXX_D1_ROM1SIZ(d1))
378 printf("Reserved\n");
380 printf("Cache Line Size: ");
381 switch (MCF5XXX_D1_CL(d1))
387 printf("Reserved\n");
389 printf("I-Cache Associativity: ");
390 switch (MCF5XXX_D1_ICA(d1))
393 printf("Four-way\n");
396 printf("Direct mapped\n");
399 printf("Reserved\n");
401 printf("D-Cache Associativity: ");
402 switch (MCF5XXX_D1_DCA(d1))
405 printf("Four-way\n");
408 printf("Direct mapped\n");
411 printf("Reserved\n");
413 printf("I-Cache Size: ");
414 switch (MCF5XXX_D1_ICSIZ(d1))
444 printf("Reserved\n");
446 printf("D-Cache Size: ");
447 switch (MCF5XXX_D1_DCSIZ(d1))
477 printf("Reserved\n");
481 /* Remove compiler warnings. */
487 /********************************************************************/
489 mcf5xxx_irq_enable (void)
493 /********************************************************************/
495 mcf5xxx_irq_disable (void)
499 /********************************************************************/
501 * Write new interrupt vector handler into the vector table
502 * Return previous handler address
506 mcf5xxx_set_handler (int vector, ADDRESS new_handler)
509 extern uint32 __VECTOR_RAM[];
511 old_handler = (ADDRESS) __VECTOR_RAM[vector];
512 __VECTOR_RAM[vector] = (uint32)new_handler;
516 /********************************************************************/