URL
https://opencores.org/ocsvn/aemb/aemb/trunk
[/] [aemb/] [trunk/] [sw/] [cc/] [corefunc.hh] - Diff between revs 206 and 209
Show entire file |
Details |
Blame |
View Log
Rev 206 |
Rev 209 |
Line 35... |
Line 35... |
|
|
#define MAGIC 0xAE63AE63 // magic number
|
#define MAGIC 0xAE63AE63 // magic number
|
|
|
volatile int exce = 0;
|
volatile int exce = 0;
|
|
|
void exceptionHandler()
|
volatile void _hw_exception_handler()
|
{
|
{
|
exce++; // flag the exception service routine
|
int resr;
|
}
|
asm volatile ("mfs %0, resr" : "=r"(resr));
|
|
|
|
|
volatile void _hw_exception_handler()
|
switch (resr)
|
{
|
{
|
//exceptionHandler();
|
case 1: // unaligned
|
exce++;
|
--exce;
|
asm volatile (//"lwi r15,r1,0\n"
|
break;
|
"rted r17, 0\n"
|
case 2: // illegal
|
|
++exce;
|
|
break;
|
|
default:
|
|
exce = 0;
|
|
break;
|
|
}
|
|
|
|
asm volatile ("rted r17, 0\n"
|
"nop\n");
|
"nop\n");
|
//"addik r1,r1,28\n");
|
|
}
|
}
|
|
|
/**
|
/**
|
EXCEPTION TEST ROUTINE
|
EXCEPTION TEST ROUTINE
|
*/
|
*/
|
|
|
int exceptionTest(int timeout)
|
int exceptionTest(int timeout)
|
{
|
{
|
volatile int *toggle = (int *)0xFFFFFFE2;
|
volatile int *toggle = (int *)0xFFFFFFE2;
|
|
|
// enable exceptions
|
// enable exceptions
|
asm volatile (".long 0xDEADC0DE"); // define illegal instruction (1 error)
|
asm volatile (".long 0xDEADC0DE"); // define illegal instruction (1 error)
|
|
|
*toggle = *toggle; // test unaligned memory access (2 errors)
|
*toggle = *toggle; // test unaligned memory access (2 errors)
|
// disable exceptions
|
// disable exceptions
|
return (exce != 3) ? EXIT_FAILURE : EXIT_SUCCESS;
|
|
|
return (exce != -1) ? EXIT_FAILURE : EXIT_SUCCESS;
|
}
|
}
|
|
|
volatile int intr = 0;
|
volatile int intr = 0;
|
|
|
void __attribute__ ((interrupt_handler)) interruptHandler()
|
void __attribute__ ((interrupt_handler)) interruptHandler()
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.