中断进不去 求看看怎么回事,EINT8按键中断 ,程序如下:
#include "def.h"
#include "option.h"
#include "2440addr.h"
#include "2440lib.h"
#include "2440slib.h"
//================================
void delay(U32 tt)
{
U32 i;
for(;tt>0;tt--)
{
for(i=0;i<10000;i++){}
}
}
void clk_config()
{
rMPLLCON = (92<<12)|(1<<4)|(1<<1); //400MHZ
rCLKDIVN = 0x05; // 1:4:8
}
void led_config()
{
rGPBCON |= ((1<<16)|(1<<14)|(1<<12)|(1<<10));
rGPBUP |= 0x1e0;
}
//void key_config()
//{
// rGPGUP |= 0x05;
//}
static void __irq Key_ISR()
{
rSRCPND |=(1<<5);
rINTPND |=(1<<5);
rGPBDAT |= 0x1e0;
if(rEINTPEND&(1<<8))
{
if((rGPBDAT&0x1e0)==0)
{
rGPBDAT |= 0x1e0;
}
else
{
rGPBDAT &= 0xe1f;
}
rEINTPEND |= (1<<8);
}
}
void keyint_config()
{
rGPGCON |=(1<<1);
rGPGUP |= 1 ;
rSRCPND |=(1<<5); //源挂起位 写1清零
// rINTMOD &=~(1<<5); //中断模式 fiq或irq
rINTMSK &=~(1<<5); //中断屏蔽
rINTPND |=(1<<5); //中断挂起 写1清零
rEINTMASK &= ~(1<<8); //中断屏蔽位
rEINTPEND |= (1<<8); //中断挂起位 使能中断 写1清零
rEXTINT1 &= ~0x7; //中断模式
pISR_EINT8_23 = (U32)Key_ISR;
}
int main(int argc, char **argv)
{
// U8 flag=0;
clk_config();
led_config();
keyint_config();
while(1)
{
}
// rGPBDAT &= 0xe1f;
// delay(100);
// rGPBDAT |= 0x1e0;
// delay(100);
}
|