📄 eb40a_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 : eb40a_execute.s
;- Object : Execution code to allows consumption measurement
;-
;- Exported Resources : ExecuteTest
;- Imported Resources : None
;-
;- 1.0 99/01/08 JCZ : Creation
;- 1.0 28/03/00 JCZ : Clean up
;------------------------------------------------------------------------------
AREA TEST, CODE, READONLY, INTERWORK
;-------------------------- List of Included Files ---------------------------
INCLUDE targets/eb40a/eb40a.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, PtPIOBase
mov r1, #BP_SW2
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 :
;- Input Parameters : None
;- Output Parameters : None
;- Registers lost : None
;- Called Functions : None
;- Called Macros : None
;------------------------------------------------------------------------------
EXPORT ExecuteArmTest
ExecuteArmTest
ldr r0, PtPIOBase
ldr r2, [r0, #PIO_PDSR]
mov r1, #BP_SW2
ands r3, r2, r1
bne EndArmExecute
b ExecuteArmTest
EndArmExecute
bx lr
;------------------------------------------------------------------------------
;- Function : ExecuteThumbTest
;- Treatments : AT91 Thumb execution function
;- Input Parameters : None
;- Output Parameters : None
;- Registers lost : None
;- Called Functions : None
;- Called Macros : None
;------------------------------------------------------------------------------
CODE16
EXPORT ExecuteThumbTest
ExecuteThumbTest
ldr r0, PtPIOBase
ldr r2, [r0, #PIO_PDSR]
mov r3, r2
ldr r1, MaskSW2
and r2, r1
bne EndThumbExecute
b ExecuteThumbTest
EndThumbExecute
bx lr
CODE32
ALIGN
PtPIOBase
DCD PIO_BASE
MaskSW2
DCD BP_SW2
Execute_end
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -