S3C2440 key interrupt mode assembly code

Publisher:eta17Latest update time:2024-06-13 Source: elecfansKeywords:S3C2440 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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


Keywords:S3C2440 Reference address:S3C2440 key interrupt mode assembly code

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

Digi-Key and PI collaborate to launch a power focus event to give users higher power conversion efficiency
Digi-Key Electronics and Power Integrations partner to launch Focus on Power event, collaboration brings users higher power conversion efficiency Digi-Key Electronics, the world's broadest and fastest-stock electronic components distributor, has announced a collaboration with Power Integrations, a lea
[Power Management]
Digi-Key and PI collaborate to launch a power focus event to give users higher power conversion efficiency
Embedded driver writing simple driver Hello_word
Development Environment BootLoader: u-boot-1.1.6 kernel:linux-2.6.30.4 cpu:S3C2440 step 1. Write driver code This should be the simplest driver, which only prints information in the kernel. The code is as follows: #include linux/module.h #include linux/kernel.h MODULE_LICENSE("GPL");                 static in
[Microcontroller]
Embedded driver writing simple driver Hello_word
Digi-Key Electronics announces 2022 Back-to-School Lucky Draw
Digi-Key Electronics announces 2022 Back-to-School Lucky Draw Sweepstakes will drive student innovation and learning Digi-Key Electronics, a global distributor of the broadest selection of in-stock electronic components with fast shipping, has kicked off its highly anticipated annual back-to-school sweepstakes,
[Internet of Things]
Digi-Key Electronics announces 2022 Back-to-School Lucky Draw
S3C2440 memory initialization
It is divided into three parts:  ①2440 address space  ②Memory and chip hardware connection  ③Storage controller register S3C2440 Address Space S3C2440 provides 27 address lines to the outside. With only 27 pins on the chip, it can only access 128MB of peripheral space.  In order to expand the access range of peripher
[Microcontroller]
S3C2440 bare metal -------LCD_add division
In the s3c2440_lcd_controller.c we mentioned earlier int clkval = (float)HCLK/plcdparams- time_seq.vclk/2-1+0.5; //int clkval = 5; An error occurred during compilation. This is because we have not implemented division. The following method is generally used to solve this problem: Go to uboot to find; Go to t
[Microcontroller]
S3C2440 bare metal -------LCD_add division
s3c2440 learning series 6 (dma continued)
The advantage of DMA is that it does not require CPU intervention when transmitting data, which can greatly improve the CPU's work efficiency. DMA is very important in large-capacity data transmission, such as image data transmission, SD card data transmission, USB data transmission and so on. S3C2410 has four DMA
[Microcontroller]
1.8.2_S3C2440_Using the Palette_P
When the BPP is set to 8 bits, the color palette is used to configure the LCD. There are 256 options in 8 bits, so the color palette can set up to 256 colors (0~255). Each item in the palette stores 16-bit BPP data. When the palette is used, the LCD controller will retrieve the 16-bit data of the corresponding item
[Microcontroller]
1.8.2_S3C2440_Using the Palette_P
Use of S3C2440 timer
#include "mytimer.h" #include "lhg_def.h" #include "uart.h" #include "lhg_def.h" #include "2440addr.h" //Timer input clock Frequency = PCLK / {prescaler value+1} / {divider value} //PCLK=50Mhz //prescaler : 0~255 #define prescaler234 99 //divider : 1/2,1/4,1/8,1/16 select (0,1,2,3) #define divider4 2 //Timer is set t
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号