ARM汇编伪指令 宏 基于STR71X

;*******************************************************************************
;* Macro Name : EIC_INIT
;* Description : This macro Initialize the EIC as following ://这个宏初始化 EIC 如下:
; - IRQ disabled
; - FIQ disabled
; - IVR contain the load PC opcode (0xE59FFXXX)
; - Current priority level equal to 0
; - All channels are disabled
; - All channels priority equal to 0
; - All SIR registers contain offset to the related IRQ
; table entry
;* Input : None.
;* Output : None.
;*******************************************************************************
MACRO 
EIC_INIT
LDR r3, =EIC_Base_addr
MOV r0, #0
MVN r1, #0
MOV r2, #0x0c
STR r0, [r3, #ICR_off_addr]
STR r0, [r3, #IER_off_addr]
STR r1, [r3, #IPR_off_addr]
STR r2, [r3, #FIR_off_addr]
STR r0, [r3, #CIPR_off_addr]

LDR r4, =0xE59F0000

STR r4, [r3, #IVR_off_addr]; Write the LDR pc,[pc,#offset]
; instruction code in IVR[31:16]
LDR r2, =32 ; 32 Channel to initialize
LDR r0, =T0TIMI_Addr ; Read the address of the IRQs
; address table
LDR r1, =0x00000FFF
AND r0,r0,r1
LDR r5, =SIR0_off_addr ; Read SIR0 address
SUB r4,r0,#8 ; Subtract 8 for prefetch
LDR r1, =0xF7E8 ; Add the offset from IVR to 0x00000000
; address(IVR address + 7E8 = 0x00000000)
; 0xF7E8 used to complete the
; LDR pc,[pc,#offset] opcode (0xE59FFXXX)
ADD r1,r4,r1 ; Compute the jump offset from IVR to the
; IRQ table entry.
EIC_INI MOV r4, r1, LSL #16 ; Left shift the result
STR r4, [r3, r5] ; Store the result in SIRx register
ADD r1, r1, #4 ; Next IRQ address
ADD r5, r5, #4 ; Next SIR
SUBS r2, r2, #1 ; Decrement the number of SIR registers
; to initialize
BNE EIC_INI ; If more then continue
MEND

 

posted @ 2022-09-02 19:47  流水江湖  阅读(51)  评论(0编辑  收藏  举报