如下两个代码,第一个是中断向量,第二个是中断设置,关于watchdog的中断
设置watchdog工作方式未定时器,然后间断的产生一个请求,之后再中断函数中清除
SUBSRCPND,SRCPND和INTPND,之后让LED亮,每一次中断,0x31000000地址的数据+1,然后判断它的最低有效位是否为0,如果是,选择style_1的方式亮,如果不为0,选择style_2的方式亮
现在我的问题是,我将程序加载到内存中后,uboot go 对应的地址后,发现中断处理程序无法正常返回到uboot的输入命令行,就卡再那里了,请问我的代码有错误吗
_____________________________向量_________________________________
b reset
b undef
b soft
b resstop
b datstop
.word 0x00
.equ SUBSRCPND,0x4a000018
.equ SRCPND, 0x4a000000
.equ INTPND, 0x4a000010
.equ GPBCON,0x56000010
.equ GPBDAT, 0x56000014
.equ GPB5, (1<<(5*2))
.equ GPB6, (1<<(6*2))
.equ GPB7, (1<<(7*2))
.equ GPB8, (1<<(8*2))
.equ GPBVALUE, (GPB5|GPB6|GPB7|GPB8)
.equ GPB5_DATA, (0<<5)
.equ GPB6_DATA, (1<<6)
.equ GPB7_DATA, (1<<7)
.equ GPB8_DATA, (1<<8)
.equ GPB5_DATA_T, (1<<5)
.equ GPB6_DATA_T, (1<<6)
.equ GPB7_DATA_T, (1<<7)
.equ GPB8_DATA_T, (0<<8)
.equ GPB_DATA, (GPB5_DATA|GPB6_DATA|GPB7_DATA|GPB8_DATA)
.equ GPB_DATA_T, (GPB5_DATA_T|GPB6_DATA_T|GPB7_DATA_T|GPB8_DATA_T)
b irq
b firq
reset:
undef:
soft:
resstop:
datstop:
irq:
clear_bit:
ldr sp,=0x32000000
sub lr,lr,#4
stmfd sp!,{r0-r12,r14}
ldr r0,=SUBSRCPND
ldr r1,[r0]
str r1,[r0]
ldr r0,=INTPND
ldr r1,=SRCPND
ldr r2,[r0]
str r2,[r1]
str r2,[r0]
feed_dog:
led:
ldr r0,=GPBCON
ldr r1,=GPBVALUE
str r1,[r0]
ldr r4,=0x31000000
ldr r0,[r4]
add r0,r0,#1
str r0,[r4]
bic r0,r0,#0xfe
cmp r0,#1
blt led_style_one
beq led_style_two
led_style_one:
ldr r0,=GPBDAT
ldr r1,=GPB_DATA
str r1,[r0]
b recover
led_style_two:
ldr r0,=GPBDAT
ldr r1,=GPB_DATA_T
str r1,[r0]
b recover
recover:
ldmfd sp!,{r0-r12,pc}^
firq:
_______________________________________________________________________________
++++++++++++++++++++++++++++++++++中断设置+++++++++++++++++++++++++++++++++++++
.equ SRCPND,0X4A000000
.equ INTMOD,0X4A000004
.equ INTMSK,0X4A000008
.equ INTPND,0x4A000010
.equ SUBPND,0X4A000018
.equ SUBMSK,0x4A00001C
.equ WTCON ,0X53000000
.equ WTDAT ,0X53000004
.equ WTCNT ,0X53000008
begin:
stmfd sp!,{r0-r4,lr}
ldr r0,=INTMSK
mov r1,#0
str r1,[r0]
ldr r0,=SUBMSK
mov r1,#0
str r1,[r0]
ldr r0,=WTCNT
.equ WTCNT_DATA,0x8000
ldr r1,=WTCNT_DATA
str r1,[r0]
.equ fenpin,((0x80)<<8)
.equ wtg_en,((1)<<5)
.equ
time_select,((0)<<3)
.equ irq_en,((1)<<2)
.equ reset_en,0
.equ WTCON_DATA, (fenpin|wtg_en|time_select|irq_en|reset_en)
ldr r0,=WTCON
ldr r1,=WTCON_DATA
str r1,[r0]
ldmfd sp!,{r0-r4,pc}
0
|