SRCPND EQU 0X4A000000
INTMSK EQU 0X4A000008
INTPND EQU 0X4A000010
EINTMASK EQU 0X560000A4
EINTPEND EQU 0X560000A8
EXTINT1 EQU 0X5600008C
EXTINT2 EQU 0X56000090
INTMOD EQU 0X4A000004
AREA INT_KEY,CODE,READONLY
ENTRY
CODE32
ResetEntry
b Reset
; //0x04: vector address of undefined instruction abort mode
HandleUndef
b HandleUndef
; //0x08: vector address of management mode, enter this mode through SWI instruction
HandleSWI
b HandleSWI
; //0x0c: vector address of exception caused by instruction prefetch termination
HandlePrefetchAbort
b HandlePrefetchAbort
; //0x10: vector address of exception caused by data access termination
HandleDataAbort
b HandleDataAbort
; //0x14: reserved
HandleNotUsed
b HandleNotUsed
; //0x18: vector address of interrupt mode
b HandleIRQ
; //0x1c: vector address of fast interrupt mode
HandleFIQ
b HandleFIQ
Reset
BL Disable_Watch_Dog
msr cpsr_c, #0xd2 ;// Enter interrupt mode
ldr sp, =3072 ;// Set interrupt mode stack pointer
msr cpsr_c, #0xdf ;// Enter system mode
;// Set system mode stack pointer,
;// Actually, after reset, the CPU is in system mode,
msr cpsr_c, #0x5f ;// Set I-bit=0, open IRQ interrupt
BL Main
halt_loop
B halt_loop
Disable_Watch_Dog ;// Disable watchdog, otherwise it will restart all the time
LDR R0,=0x53000000
MOV R1,#0x0
STR R1,[R0]
MOV PC, lr ;// Return to
Main
BL LED_Init
BL KEY_Init
BL INT_Init
B MAIN_LOOP
MOV PC,LR
MAIN_LOOP
B MAIN_LOOP
LED_Init
LDR R0,=0x56000010
MOV R1,#0x00015400
STR R1,[R0]
LDR R0,=0x56000014
MOV R1,#0x000001E0
STR R1,[R0]
MOV PC,LR
KEY_Init
LDR R0,=0x56000060
LDR R1,=0x80A882 ;//Set GPG0 as extended function
STR R1,[R0]
MOV PC,LR
INT_Init
MOV r1,#0x20
LDR r0,=SRCPND
STR r1,[r0]
LDR R1,=INTMSK
LDR R0,=0XFFC0
STR R0,[R1]
LDR R1,=EXTINT1
LDR R0,=0X22202002
STR R0,[R1]
LDR R1,=EXTINT2
LDR R0,=0X2000
STR R0,[R1]
LDR R1,=EINTMASK;//11110111000101101111111
LDR R0,=0XF716FF
STR R0,[R1]
LDR R1,=INTMOD
LDR R0,=0X0
STR R0,[R1]
MOV PC,LR
HandleIRQ
SUB LR,LR,#4 ;//Calculate the return address
STMDB SP!,{R0-R12,LR} ;//Save the used registers. At this time, sp is the sp of interrupt mode. Push it on the stack
LDR LR,=INT_RETURN ;//ISR return address
LDR PC,=EINT_HANDLE ;//Call interrupt service function
INT_RETURN
LDMIA SP!,{R0-R12,PC}^ ;//Interrupt return, ^ means copy the value of spsr to cpsr, pop the stack
EINT_HANDLE
NOP
LOOP
LDR R1,=EINTPEND
LDR R2,[R1]
LDR R3,=0XFFFFF;//Clear interrupt
STR R3,[R1]
LDR R1,=SRCPND
LDR R3,=0X3F
STR R3,[R1]
LDR R1,=INTPND
LDR R3,=0X3F
STR R3,[R1]
SWITCH
LDR R0,=0x56000014
CASE_8
TST R2,#0X100
BEQ CASE_11
LDR R1,=0X1C0
STR R1,[R0]
B SWITCH_END
CASE_11
TST R2,#0X800
BEQ CASE_13
LDR R1,=0X1A0
STR R1,[R0]
B
SWITCH_END CASE_13 TST R2,
#0X2000
BEQ
CASE_14
LDR R1,=0X160
STR R1,[R0]
B
SWITCH_END
CASE_14
TST R2,#0X4000
BEQ CASE_15
LDR R1,=0X0E0
STR R1,[R0]
B SWITCH_END
CASE_15
TST R2,#0X8000
BEQ
CASE_19
LDR R1,=0X000
STR R1,[R0]
B SWITCH_END
CASE_19
TST R2,#0X80000
BEQ DEFAULT
LDR R1,=0X1E0
STR R1,[R0]
B SWITCH_END
DEFAULT
LDR R1,=0X1E0
STR R1,[R0]
SWITCH_END
NOP
MOV PC,LR
END
Previous article:S3C2440 UART2 is configured as CTS problem solved
Next article:Linxu S3C2440 LCD driver test program
Recommended ReadingLatest update time:2024-11-16 09:57
- Popular Resources
- Popular amplifiers
- 2024 DigiKey Ideas Contest Code
- A review of learning-based camera and lidar simulation methods for autonomous driving systems
- Mission-oriented wireless communications for cooperative sensing in intelligent unmanned systems
- Evaluating Roadside Perception for Autonomous Vehicles: Insights from Field Testing
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Application of TI current detection device INA series in TWS battery box
- Now we need to produce a batch of calibration cards (EEPROM 24C128 + pull-up resistors for SCL and SDA signals, a total of three components...
- CAN (Controller Area Network) bus batch data transmission based on SAEJ1939 wireless communication data transmission protocol
- Power supply output power problem
- STM32MP157A-DK1 Evaluation (4) UART and SPI Device Access
- WLAN radio frequency and channels
- What kind of IoT card is reliable?
- [RVB2601 Creative Application Development] Initially implement the perpetual calendar function of NTP clock synchronization
- Overcoming the Design Challenges of Low Quiescent Current in Small Battery-Powered Devices
- Implementation of high-precision division in fixed-point DSP