📄 eb42_execute.s
字号:
;------------------------------------------------------------------------------
;- ATMEL Microcontroller Software Support - ROUSSET -
;------------------------------------------------------------------------------
; The software is delivered "AS IS" without warranty or condition of any
; kind, either express, implied or statutory. This includes without
; limitation any warranty or condition with respect to merchantability or
; fitness for any particular purpose, or against the infringements of
; intellectual property rights of others.
;------------------------------------------------------------------------------
;- File source : eb42_execute.s
;- Object : AT91M42800 Execution code to allow consumption
;- : measurement
;-
;- Exported Resources : ExecuteTest
;- Imported Resources : None
;-
;- 1.0 13/07/01 PF : Creation
;------------------------------------------------------------------------------
AREA TEST, CODE, READONLY, INTERWORK
;-------------------------- List of Included Files ---------------------------
INCLUDE periph/pio/pio.inc
INCLUDE targets/eb42/eb42.inc
;------------------------ List of Exported resources -------------------------
;------------------------------------------------------------------------------
;- Function : ExecuteTest
;- Treatments :
;- Input Parameters :
;- r0 = address where to run the test function from
;- r1 = 0 indicates to run the test in ARM, else in Thumb
;- Output Parameters : None
;- Registers lost : None
;- Called Functions : None
;- Called Macros : None
;------------------------------------------------------------------------------
EXPORT ExecuteTest
ExecuteTest
stmdb r13!, {r4, r14}
mov r4, r0
movs r2, r1
ldreq r2, =ExecuteArmTest
ldrne r2, =ExecuteThumbTest
bic r2, r2, #3
ldr r3, =Execute_end
CopyTest_loop
ldr r12, [r2], #4
str r12, [r0], #4
cmp r2, r3
blo CopyTest_loop
;- Test Arm or Thumb Call requested
;----------------------------------
movs r2, r1
beq ArmCall
;- Thumb Call
;------------
add r4, r4, #1
mov lr, pc
bx r4
;- Exit
;-------
b Exit
;- Arm Call
;----------
ArmCall
mov lr, pc
mov pc, r4
;- Exit
;------
Exit
ldr r0, PtPIOABase
mov r1, #BP_S2
mov r3, #0
;- Wait push button released
;----------------------------
ExitLoop
ldr r2, [r0, #PIO_PDSR]
ands r2, r2, r1
bne Exit
add r3, r3, #1
cmp r3, #0x1000
blo ExitLoop
ldmia r13!, {r4, r14}
bx r14
;------------------------------------------------------------------------------
;- Function : ExecuteArmTest
;- Treatments : AT91 Arm execution function
;------------------------------------------------------------------------------
EXPORT ExecuteArmTest
ExecuteArmTest
ldr r0, PtPIOABase
ldr r2, [r0, #PIO_PDSR]
mov r1, #BP_S2
ands r3, r2, r1
beq EndArmExecute
b ExecuteArmTest
EndArmExecute
bx lr
;------------------------------------------------------------------------------
;- Function : ExecuteThumbTest
;- Treatments : AT91 Thumb execution function
;------------------------------------------------------------------------------
CODE16
EXPORT ExecuteThumbTest
ExecuteThumbTest
ldr r0, PtPIOABase
ldr r2, [r0, #PIO_PDSR]
mov r3, r2
ldr r1, MaskS2
and r2, r1
beq EndThumbExecute
b ExecuteThumbTest
EndThumbExecute
bx lr
CODE32
ALIGN
;Constante declaration
;----------------------
PtPIOABase
DCD PIOA_BASE
PtPIOBBase
DCD PIOB_BASE
MaskS2
DCD BP_S2
Execute_end
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -