|
各位哥些,我在学习S3C2440定时器中断的时候碰到了一个问题,希望大家不吝赐教一下。。。下面是我写的c程序:
#define _ISR_STARTADDRESS 0x33ffff00
#define U32 unsigned int
#define pISR_TIMER4 (*(unsigned *)(_ISR_STARTADDRESS+0x58))
#define SRCPND (*(volatile unsigned *)0x4a000000)
#define INTMASK (*(volatile unsigned *)0x4a000008)
#define INTPND (*(volatile unsigned *)0x4a000010)
#define GPBCON (*(volatile unsigned *)0x56000010)
#define GPBDAT (*(volatile unsigned *)0x56000014)
#define GPBUP (*(volatile unsigned *)0x56000018)
#define MPLLCON (*(volatile unsigned *)0x4c000004)
#define CLKDIVN (*(volatile unsigned *)0x4c000014)
#define TCFG0 (*(volatile unsigned *)0x51000000)
#define TCFG1 (*(volatile unsigned *)0x51000004)
#define TCON (*(volatile unsigned *)0x51000008)
#define TCNTB4 (*(volatile unsigned *)0x5100003c)
#define TCNTO4 (*(volatile unsigned *)0x51000040)
void __irq Timer4_ISR(void);
void Main(void)
{
GPBCON =(1<<0)|(1<<10)|(1<<12)|(1<<14)|(1<<16);
GPBDAT = 0x1e0;
GPBUP = 0x7ff;
MPLLCON=0x7f021;
CLKDIVN=0x05;
SRCPND = SRCPND|(0x1<<14);
INTPND = INTPND|(0x1<<14);
INTMASK =~(1<<14);
TCFG0 = 0xf900;
TCFG1 = 0x2000;
TCNTB4 = 25000;
TCON = 0x700000;
pISR_TIMER4=(U32)Timer4_ISR;
while(1);
}
void __irq Timer4_ISR(void)
{
static int count;
count=0;
count++;
SRCPND = SRCPND|(1<<14);
INTPND = INTPND|(1<<14);
if(count%4==0)
GPBDAT=~0x1e0;
else if(count%4==1)
GPBDAT=0x1e0;
}
启动代码如下:
IMPORT Main
AREA Init,CODE,READONLY
ENTRY
ldr r0,=0x53000000;看门狗定时器控制寄存器
ldr r1,=0x0
str r1,[r0]
ldr r0,=0x4a000008;中断屏蔽寄存器
ldr r1,=0xffffffff;屏蔽所有中断
str r1,[r0]
ldr r0,=0x4a00001c;子中断屏蔽寄存器
ldr r1,=0x7ff ;屏蔽所有子中断
str r1,[r0]
ldr r0,=0x4c000000;锁相环锁定时间计数器
ldr r1,=0xffffff
str r1,[r0]
b Main
END
编译通过后用Hjtag调试的时候,光标一直指到中断服务程序,根本就进不到主程序中,希望大家帮我看一下,跪求。。。万分感谢。。。
|
|