static void __irq Key_ISR(void)//中断处理函数
{
U8 key;
U32 r;
EnterCritical(&r);
if(rINTPND==BIT_EINT1)
{
//Uart_Printf("eint1\n");
ClearPending(BIT_EINT1);
}
if(rINTPND==BIT_EINT4_7)
{
ClearPending(BIT_EINT4_7);
if(rEINTPEND&(1<<4))
{
//Uart_Printf("eint4\n");
rEINTPEND |= 1<< 4;
}
}
if(rINTPND==BIT_EINT0)
{
//Uart_Printf("eint0\n");
ClearPending(BIT_EINT0);
}
if(rINTPND==BIT_EINT2)
{
//Uart_Printf("eint2\n");
ClearPending(BIT_EINT2);
}
key=Key_Scan();
if( key == 0xff )
Uart_Printf( "Interrupt occur... Key is released!\n") ;
else
Uart_Printf( "Interrupt occur... K%d is pressed!\n", key) ;
ExitCritical(&r);
}
附:
EnterCritical
mrs r1, cpsr
str r1, [r0]
orr r1, r1, #NOINT
msr cpsr_cxsf, r1
MOV_PC_LR
;restore cpsr, r0 = address to restore cpsr
EXPORT ExitCritical
ExitCritical
ldr r1, [r0]
msr cpsr_cxsf, r1
MOV_PC_LR
看不懂 EnterCritical 和ExitCritical是什么意思 有什么作用 麻烦哪位大哥 帮忙解释一下 感激不尽啊
另外就是这上面的_irq是什么作用? |