管理提醒: 本帖被 qq2440 从 micro2440技术交流专区 移动到本区(2013-11-18)
比较郁闷搞了大概一星期了,就是进不了中断。RTC,WDT,EINT,都进不去啊,有谁遇见过类似情况啊,网上说是因为mmu未初始化。从mmu.c拷贝个MMU_Init()就ok了,但考了,还是进不去中断啊。用axd+jtag调试,intpend可以挂起,但就进不去ISR中断0X0000 0018...比如我做RTC时钟中断。INTPND相应位都置位了,但就是进不了中断程序啊。论坛了诸位高手可否指点下、
#include "2440addr.h"
#include "2440lib.h"
#include "2440slib.h"
#include "mmu.h"
int i;
void __irq Watchdog_ISR(void);
void watchdog_timer(void);
void MMU_Init(void);
//void ChangeRomCacheStatus(int attr);
//void MMU_SetMTT(int vaddrStart,int vaddrEnd,int paddrStart,int attr);
int count=0;
void xmain(void)
{
ChangeClockDivider(3,1);
ChangeMPllValue(127,2,1);
//MMU_DisableICache();
// MMU_DisableDCache();
MMU_Init();
Port_Init();
Uart_Init(0,115200);
Uart_Select(0);
for(i=0;i<10000;i++);
Isr_Init();
Uart_Printf(" Main is running\n");
watchdog_timer();
}
void watchdog_timer(void)
{
//清WatchDog中断寄存器
rSRCPND|=BIT_WDT_AC97;
rINTPND|=BIT_WDT_AC97;
rSUBSRCPND|=BIT_SUB_WDT;
pISR_WDT_AC97=(unsigned)Watchdog_ISR;
//WDT初始化
rWTCON=(100<<8)|(3<<3);
rWTCON&=(~(0x1));//Reset disable
rWTCON|=(1<<5);
rWTCON|=(1<<2);//Enable or disable bit of the interrupt.
//0 = Disable //1 = Enable
rWTDAT=20000;
rWTCNT=20000;
//开中断
rINTMSK&=~(BIT_WDT_AC97);
rINTSUBMSK&=~(BIT_SUB_WDT);
while(count<11)
{
Uart_Printf("WTCNT::%d",rWTCNT);
Uart_Printf("count::%d\n",count);
}
}
void __irq Watchdog_ISR(void)
{
Uart_Printf("@@ wdt interrupt occer!!@@");
if(rSUBSRCPND&BIT_SUB_WDT)
{
Uart_Printf("@@ wdt interrupt occer rSUBSRCPND&BIT_SUB_WDT\n!!@@");
//ClearPending(BIT_WDT_AC97);
rSRCPND|=BIT_WDT_AC97;
rINTPND|=BIT_WDT_AC97;
rSUBSRCPND|=BIT_SUB_WDT;
count++;
Uart_Printf("count:%d",count);
if(count<11);
else
{
rINTSUBMSK|=BIT_SUB_WDT;
rINTMSK|=BIT_WDT_AC97;
}
}
if((rSUBSRCPND&(BIT_SUB_AC97)))
{
rSUBSRCPND|=BIT_SUB_AC97;
rSRCPND|=BIT_WDT_AC97;
rINTPND|=BIT_WDT_AC97;
}
}