#include "2440lib.h"
#include "2440addr.h"
int flag=0;
void __irq eint_handler(void)
{
//unsigned long i,j;
rSRCPND |= (1<<5); //clear eint_8_23
rINTPND |= (1<<5); //clear eint8_23
// rEINTPEND |= (1<<8); //clear eint8
//led5
if (rEINTPEND & (1<<8))
{
// rGPBCON =rGPBCON &~(0x3<<16)|(0x1<<16);
rGPBDAT |=(1<<8);
//for(i=0; i<999999; i++);
//rGPBDAT |= (1<<5);
//flag = 1;
rEINTPEND |= (1<<8);
}
// else
//
if (rEINTPEND & (1<<11))
{
// rGPBCON =rGPBCON &~(0x3<<16)|(0x1<<16);
rGPBDAT &=~(1<<8);
//for(j=0; j<999999;j++);
//rGPBDAT |= (1<<8);
rEINTPEND |= (1<<11);
}
}
int xmain(void)
{
ChangeClockDivider(3,1);//1:3:6
ChangeMPllValue(127,2,1); //405MHZ
Port_Init();
Isr_Init();
rGPBDAT = 0x7fe ; //led mie
rGPBCON =rGPBCON &~(0x3<<16)|(0x1<<16);
rGPGCON = rGPGCON &~(0x3|(0x3<<6))|((0x2)|(0x2<<6)); //enable io
rINTMSK =rINTMSK &~(1<<5); //enable EINT8_23
rEINTMASK = rEINTMASK &~((1<<8)|(1<<11)); // enable EINT8
// rEINTMASK = rEINTMASK &~(1<<8); // enable EINT8
rEXTINT1 = rEXTINT1 &~((0x7)|(0x7<<12)) |((0x2)|(0x2<<12)); //falling edge
// rEXTINT1 = rEXTINT1 &~(0x7) |(0x2); //falling edge
rSRCPND |= (1<<5); //clear eint_8_23
rINTPND |= (1<<5); //clear eint8_23
rEINTPEND |= ((1<<8)|(1<<11)); //clear eint8
// rEINTPEND |= (1<<8); //clear eint8
pISR_EINT8_23 = (U32)eint_handler;
while(1);
}
ISRP 改为0x34
阅读(1884) | 评论(0) | 转发(1) |