当前位置:首页 > 单片机 > 单片机
[导读]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;rINT

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语言的知识了


本站声明: 本文章由作者或相关机构授权发布,目的在于传递更多信息,并不代表本站赞同其观点,本站亦不保证或承诺内容真实性等。需要转载请联系该专栏作者,如若文章内容侵犯您的权益,请及时联系本站删除( 邮箱:macysun@21ic.com )。
换一批
延伸阅读
关闭