问题:关于s3c2440的键盘中断裸机程序
arm吧
全部回复
仅看楼主
level 1
apaiyao 楼主
关于s3c2440的键盘中断裸机程序,小弟初学,中断函数和键盘扫描程序看不懂,请各位大侠多多指点呀。。。。
static void __irq Key_ISR(void)
{
U8 key;
U32 r;
EnterCritical(&r);
if(rINTPND==BIT_EINT8_23) {
ClearPending(BIT_EINT8_23);
if(rEINTPEND&(1<<8)) {
//Uart_Printf("eint11\n");
rEINTPEND |= 1<< 8;
}
if(rEINTPEND&(1<<11)) {
//Uart_Printf("eint11\n");
rEINTPEND |= 1<< 11;
}
if(rEINTPEND&(1<<13)) {
//Uart_Printf("eint11\n");
rEINTPEND |= 1<< 13;
}
if(rEINTPEND&(1<<14)) {
//Uart_Printf("eint11\n");
rEINTPEND |= 1<< 14;
}
if(rEINTPEND&(1<<15)) {
//Uart_Printf("eint11\n");
rEINTPEND |= 1<< 15;
}
if(rEINTPEND&(1<<19)) {
// Uart_Printf("eint19\n");
rEINTPEND |= 1<< 19;
}
}
key=Key_Scan();
if(key != 0xff)
{
Uart_Printf("the Key is:%d\n",key);
}
ExitCritical(&r);
}
void KeyScan_Test(void)
{
Uart_Printf("\nKey Scan Test, press ESC key to exit !\n");
rGPGCON = rGPGCON & (~((3<<22)|(3<<6)|(3<<0)|(3<<10)|(3<<12)|(3<<14))) |
((2<<22)|(2<<6)|(2<<0)|(2<<10)|(2<<12)|(2<<14)) ; //GPG11,3 set EINT
rEXTINT1 &= ~(7|(7<<0));
rEXTINT1 |= (0|(0<<0)); //set eint8 falling edge int
rEXTINT1 &= ~(7<<12);
rEXTINT1 |= (0<<12); //set eint11 falling edge int
rEXTINT1 &= ~(7<<20);
rEXTINT1 |= (0<<20); //set eint13 falling edge int
rEXTINT1 &= ~(7<<24);
rEXTINT1 |= (0<<24); //set eint14 falling edge int
rEXTINT1 &= ~(7<<28);
rEXTINT1 |= (0<<28); //set eint15 falling edge int
rEXTINT2 &= ~(0xf<<12);
rEXTINT2 |= (0<<12); //set eint19 falling edge int
rEINTPEND |= (1<<8)|(1<<11)|(1<<13)|(1<<14)|(1<<15)|(1<<19); //clear eint 11,19
rEINTMASK &= ~((1<<8)|(1<<11)|(1<<13)|(1<<14)|(1<<15)|(1<<19)); //enable eint11,19
ClearPending(BIT_EINT0|BIT_EINT2|BIT_EINT8_23);
pISR_EINT0 = pISR_EINT2 = pISR_EINT8_23 = (U32)Key_ISR;
EnableIrq(BIT_EINT0|BIT_EINT2|BIT_EINT8_23);
while(1) ;
DisableIrq(BIT_EINT0|BIT_EINT2|BIT_EINT8_23);
}
2011年07月12日 08点07分 1
1