|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
源程序如下:
#include "def.h"
#include "option.h"
#include "2440addr.h"
#include "2440lib.h"
static void __irq Eint0_ISR(void)
{
ClearPending(BIT_EINT0);
Uart_Printf("EINT0 is occurred.\n");
}
static void __irq Eint2_ISR(void)
{
ClearPending(BIT_EINT2);
Uart_Printf("EINT2 is occurred.\n");
}
static void __irq Eint11_19_ISR(void)
{
if(rEINTPEND & (1<<11))
{
Uart_Printf("EINT11 is occurred.\n");
rEINTPEND=(1<<11);
ClearPending(BIT_EINT8_23);
}
else if(rEINTPEND & (1<<19))
{
Uart_Printf("EINT19 is occurred.\n");
rEINTPEND=(1<<19);
ClearPending(BIT_EINT8_23);
}
else
{
Uart_Printf("others ENTs are occurred\n");
rEINTPEND=0xffffff;
ClearPending(BIT_EINT8_23);
}
}
void xmain(void)
{
ChangeClockDivider(3,1);
ChangeMPllValue(127,2,1); //405MHZ
Isr_Init();
Uart_Init(0, 115200);
Uart_Select(0);
Uart_Printf("the main is running\n");
rGPFCON = (rGPFCON & ~((3<<4)|(3)))|(1<<5)|(1<<1); //GPF0/2 = EINT0/2
rGPGCON = (rGPGCON & ~((3<<22)|(3<<6)))|(1<<23)|(1<<7); //GPG3/11 = EINT11/19
rEXTINT0 = (rEXTINT0 & ~(7<<8))|(2<<8); //EINT0/2=falling edge triggered
rEXTINT0 = (rEXTINT0 & ~(7<<0))|(2<<0);
rEXTINT1 = (rEXTINT1 & ~(7<<12))|(0x2<<12); //EINT11=falling edge triggered
rEXTINT2 = (rEXTINT2 & ~(7<<12))|(0x2<<12); //EINT19=falling edge triggered
pISR_EINT0=(U32)Eint0_ISR;
pISR_EINT2=(U32)Eint2_ISR;
pISR_EINT8_23=(U32)Eint11_19_ISR;
rEINTPEND = 0xffffff;
rSRCPND |= BIT_EINT0|BIT_EINT2|BIT_EINT8_23; //to clear the previous pending states
rINTPND |= BIT_EINT0|BIT_EINT2|BIT_EINT8_23;
rEINTMASK=~( (1<<11)|(1<<19) );
rINTMSK=~(BIT_EINT0|BIT_EINT2|BIT_EINT8_23);
while(1)
{
Uart_Printf("the main is running\n");
Delay(100000);
}
}
出现错误如下:
runDummy_isr error, interrupt number: 0, INTMSK = 0xffffffda
我分析了错误原因可能是可能就是CPSR程序状态寄存器的ISQ中断位没开,但是我的库函数文件里没有开启那个位的函数。我不会改,谁能帮我改一下,或者谁有好用的带中断的程序给我一个,我是S3C2440的芯片开发板不胜感激!!!! |
|