www.pudn.com > at91rm9200_test.rar > main.c


#include "main.h" 
 
typedef	unsigned int U32; 
typedef	unsigned short U16; 
typedef	unsigned char U8; 
 
#define	_ISR_STARTADDRESS	0x21ffff00 
#define	pISR_RESET     *(U32 *)(_ISR_STARTADDRESS+0x0) 
#define	pISR_UNDEF     *(U32 *)(_ISR_STARTADDRESS+0x4) 
#define	pISR_SWI       *(U32 *)(_ISR_STARTADDRESS+0x8) 
#define	pISR_PABORT    *(U32 *)(_ISR_STARTADDRESS+0xc) 
#define	pISR_DABORT    *(U32 *)(_ISR_STARTADDRESS+0x10) 
#define	pISR_RESERVED  *(U32 *)(_ISR_STARTADDRESS+0x14) 
#define	pISR_IRQ       *(U32 *)(_ISR_STARTADDRESS+0x18) 
#define	pISR_FIQ       *(U32 *)(_ISR_STARTADDRESS+0x1c) 
 
 
void HaltUndef(void) 
{ 
    printf("Undefined instruction exception!!!\n"); 
    while(1); 
} 
 
void HaltSwi(void) 
{ 
    printf("SWI exception!!!\n"); 
    while(1); 
} 
 
void HaltPabort(void) 
{ 
    printf("Pabort exception!!!\n"); 
    while(1); 
} 
 
void HaltDabort(void) 
{ 
    printf("Dabort exception!!!\n"); 
    while(1); 
} 
 
void HaltIrq(void) 
{ 
	printf("Irq happen!!!\n"); 
	while(1); 
} 
 
void HaltFiq(void) 
{ 
	printf("Fiq happen!!!\n"); 
	while(1); 
} 
 
 
void Isr_Init(void) 
{ 
    pISR_UNDEF  = (U32)HaltUndef; 
    pISR_SWI    = (U32)HaltSwi; 
    pISR_PABORT = (U32)HaltPabort; 
    pISR_DABORT = (U32)HaltDabort; 
    pISR_IRQ = (U32)HaltIrq; 
    pISR_FIQ = (U32)HaltFiq; 
} 
 
 
int main(void) 
{ 
	Isr_Init(); 
	puts(__DATE__); 
	while(1) { 
		putch('a'); 
	} 
}