=========================================================
IRQ程序 注意:INTMSK的设置必须为32位,否则会出现异常 =========================================================
.equ SRCPND,0X4A000000
.equ INTMOD,0X4A000004
.equ INTMSK,0X4A000008
.equ INTPND,0x4A000010
.equ SUBPND,0X4A000018
.equ SUBMSK,0x4A00001C
.equ INTPND,0X4A000010
.equ SRCPND,0X4A000000
.equ WTCON ,0X53000000
.equ WTDAT ,0X53000004
.equ WTCNT ,0X53000008
begin:
stmfd sp!,{r0-r4,lr}
ldr r0,=INTMSK
.equ INTMSK_DATA,0xfffffdff
ldr r1,=INTMSK_DATA
ldr r2,[r0]
and r1,r1,r2
str r1,[r0]
ldr r0,=SUBMSK
.equ SUBMSK_DATA,0x0000
ldr r1,=SUBMSK_DATA
str r1,[r0]
ldr r0,=WTCNT
.equ WTCNT_DATA,0x8000
ldr r1,=WTCNT_DATA
str r1,[r0]
irq:
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}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
VECTOR.S 中断向量 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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, (0<<8)
.equ GPB5_DATA_T, (1<<5)
.equ GPB6_DATA_T, (0<<6)
.equ GPB7_DATA_T, (0<<7)
.equ GPB8_DATA_T, (1<<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:
nop
nop
nop
undef:
nop
nop
nop
soft:
nop
nop
nop
resstop:
nop
nop
nop
datstop:
nop
nop
nop
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]
and r0,r0,#0x00000001
cmp r0,#1
beq led_style_two
blt led_style_one
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}^
fiq:
nop nop nop |
watchdog汇编程序
最新推荐文章于 2022-06-30 14:41:09 发布