📄 init.tmp
字号:
#line 1 "<stdin>"
; $Id:
;
#line 1 "C:\Triscend\SDK_3.0\Triscend\a7hal\include\hal_conf.h"
#line 11 "<stdin>"
Mode_USR EQU 0x10
Mode_IRQ EQU 0x12
Mode_SVC EQU 0x13
Mode_ABT EQU 0x17
Mode_FIQ EQU 0x11
I_Bit EQU 0x80
F_Bit EQU 0x40
REMAP_ALIAS_ENABLE_REG EQU 0xd1010440
MSS_SDR_CTRL_REG EQU 0xd101000c
SYS_POWER_CTRL_REG EQU 0xd1010110
SYS_CLOCK_CTRL_REG EQU 0xd1010100
SYS_PLL_STATUS_REG EQU 0xd1010104
SYS_PLL_STATUS_CLEAR_REG EQU 0xd1010108
SYS_PLL_CONTROL_REG EQU 0xd1010114
RMAP_PAUSE_REG EQU 0xd1010400
IMPORT |Image$$.text$$Limit| ; End of ROM code (=start of ROM data)
IMPORT |Image$$RW$$Base| ; Base of RAM to initialise
IMPORT |Image$$RW$$ZI$$Base| ; Base and limit of area
IMPORT |Image$$RW$$ZI$$Limit| ; to zero initialise
IMPORT __use_no_semihosting_swi
IMPORT a7hal_icu_IRQExit
IMPORT a7hal_icu_IRQEnter
IMPORT __IMAGE_DEST_ADDRESS
IMPORT __PHYSICAL_EXEC_ADDRESS
IMPORT __ALIAS_SETTING
IMPORT __STACK_TOP
IMPORT __STACK_SIZE
AREA vectors, CODE
EXPORT __begin
EXPORT _main
EXPORT __vectorend
EXPORT Hardware_Vector0
ENTRY
_main
__begin
LDR PC,Start_Addr
Udef
B Udef
SWI
LDR PC, SWI_Wrapper_Addr
Prefetch
B Prefetch
Abort
LDR PC, Abort_Wrapper_Addr
Res
NOP
IRQ
LDR PC, IRQ_Wrapper_Addr
FIQ
LDR PC, FIQ_Wrapper_Addr
;
Hardware_Vector0
DCD 0
Hardware_Vector1
DCD 0
Hardware_Vector2
DCD 0
Hardware_Vector3
DCD 0
Hardware_Vector4
DCD 0
Hardware_Vector5
DCD 0
Hardware_Vector6
DCD 0
Hardware_Vector7
DCD 0
SWI_Wrapper_Addr
DCD SWI_Wrapper
Abort_Wrapper_Addr
DCD Abort_Wrapper
IRQ_Wrapper_Addr
DCD IRQ_Wrapper
FIQ_Wrapper_Addr
DCD FIQ_Wrapper
Start_Addr
DCD Start
;
; Registers used by this function:
; v1 = interrupt status
; v2 = SDRAM_CTRL_REG
; v3 = CLOCK_CTRL_REG
; v4 = PLL_CONTROL_REG
;
EXPORT _a7hal_power_lowPower
_a7hal_power_lowPower
STMDB SP!,{v1-v4} ; Save the registers we need to use
;
; Save the current interrupt status
;
MRS v1,CPSR
;
; Disable interurpts, if this is not done, when we get the
; wakeup interrupt we will jump off to the IRQ vector instead of
; powering up the device.
;
ORR R0,v1,#I_Bit | F_Bit
MSR CPSR_c,R0
;
; Save the value of the SDRAM control register. Then check
; to see if the SDRAM controller is enabled, if it is not
; enabled, there is no need to put the SDRAM into self-refresh.
;
LDR R0,SDRAM_CTRL_REG
LDR v2,[R0,#0]
TST v2,#0x07
BEQ noSDRAMPowerDown
;
; Put the SDRAM into self refresh
; mode.
;
BIC R1,v2,#0x07
ORR R1,R1,#0x00000004
STR R1,[R0,#0]
noSDRAMPowerDown
;
; Save the value of the clock
; control register.
;
LDR R0,CLOCK_CTRL_REG
LDR v3,[R0,#0]
;
; Switch the clock to the
; internal ring oscillator
;
MOV R1,#0
STR R1,[R0,#0]
; Power down
LDR R0,POWER_DOWN_CTRL_REG
MOV R1,#0x2f
STR R1,[R0,#0]
ORR R1,R1,#0x10
STR R1,[R0,#0]
;
; The CPU will continue from this
; point after it wakes up
;
; Check to see if we need to use the PLL
; if not branch over the PLL init code.
;
TST v3,#0x01
BEQ noPLL
;
; Clear the PLL status register
;
LDR R0,PLL_STATUS_CLEAR_REG
MOV R1,#0x03
STR R1,[R0,#0]
;
; Restore the clock control reg.
; but do not use the PLL yet
;
LDR R0,CLOCK_CTRL_REG
BIC R1,v3,#0x01
STR R1,[R0,#0]
;
; Wait for the PLL Locked bit
;
LDR R0,PLL_STATUS_REG
locked
LDR R1,[R0,#0]
ANDS R1,R1,#0x02
BEQ locked
noPLL
;
; Restore the clock control reg.
;
LDR R0,CLOCK_CTRL_REG
STR v3,[R0,#0]
;
; Restore the SDRAM control reg.
;
TST v2,#0x07
BEQ noSDRAMDelay
LDR R0,SDRAM_CTRL_REG
STR v2,[R0,#0]
;
; Give the SDRAM time to enter normal mode
; before we change to the ring oscillator.
;
LDR R1,SDRAM_DELAY
sdram_delay_loop
SUBS R1,R1,#1
BNE sdram_delay_loop
noSDRAMDelay
;
; Restore the interrupt status
;
MSR CPSR_c,v1
LDMIA SP!,{v1-v4} ; restore the registers
MOV PC,LR
;
; The addresses of the A7 registers are stored here
; to prevent the linker from putting them into SDRAM
; which we put into self refresh.
;
SDRAM_DELAY
DCD 500000
SDRAM_CTRL_REG
DCD MSS_SDR_CTRL_REG
POWER_DOWN_CTRL_REG
DCD SYS_POWER_CTRL_REG
CLOCK_CTRL_REG
DCD SYS_CLOCK_CTRL_REG
PAUSE_REG
DCD RMAP_PAUSE_REG
PLL_STATUS_REG
DCD SYS_PLL_STATUS_REG
PLL_STATUS_CLEAR_REG
DCD SYS_PLL_STATUS_CLEAR_REG
__vectorend
AREA |.text|, CODE, READONLY
DCB "Copyright (C) 2001-2004, Triscend Corporation. All Rights Reserved."
;
; Abort Wrapper saves all of the registers and
; branches to the 'C' routine to handle the
; abort passing the address of the instruction
; that cause the abort in R0.
;
CODE32
IMPORT a7hal_icu_abortMain
Abort_Wrapper
SUB LR,LR,#4
STMDB SP!,{R0-IP,LR} ; Store all of the registers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -