S3C2440中断与异常定义与基本知识
扫描二维码
随时随地手机看文章
1.S3C2440中断初始化:
#define BIT_ALLMSK(0xffffffff)
void Isr_Init(void)
{
pISR_UNDEF=(unsigned)HaltUndef;
pISR_SWI =(unsigned)HaltSwi;
pISR_PABORT=(unsigned)HaltPabort;
pISR_DABORT=(unsigned)HaltDabort;
rINTMOD=0x0; //All=IRQ mode Address:0x4A000004 =1FIQ mode; =0 IRQ mode
rINTMSK=BIT_ALLMSK;// All interrupt is masked. Address:0x4A000008 0 = Interrupt service is available.
//1 = Interrupt service is masked.
}
void HaltUndef(void)
{
Uart_Printf("Undefined instruction exception!!!n");
while(1);
}
void HaltSwi(void)
{
Uart_Printf("SWI exception!!!n");
while(1);
}
void HaltPabort(void)
{
Uart_Printf("Pabort exception!!!n");
while(1);
}
void HaltDabort(void)
{
Uart_Printf("Dabort exception!!!n");
while(1);
}
2. 7个中断地址:
#define _ISR_STARTADDRESS 0x33ffff00
#define pISR_RESET(*(unsigned *)(_ISR_STARTADDRESS+0x0))
#define pISR_UNDEF(*(unsigned *)(_ISR_STARTADDRESS+0x4))
#define pISR_SWI(*(unsigned *)(_ISR_STARTADDRESS+0x8))
#define pISR_PABORT(*(unsigned *)(_ISR_STARTADDRESS+0xc))
#define pISR_DABORT(*(unsigned *)(_ISR_STARTADDRESS+0x10))
#define pISR_RESERVED(*(unsigned *)(_ISR_STARTADDRESS+0x14))
#define pISR_IRQ(*(unsigned *)(_ISR_STARTADDRESS+0x18))
#define pISR_FIQ(*(unsigned *)(_ISR_STARTADDRESS+0x1c))
(unsigned*)目的把(_ISR_STARTADDRESS+0x0)指针强转(unsigned*)类型,最前的一个*,取该(unsigned*)类型指针对应的unsigned值;
得恶补C语言的知识了