ARM learning interrupt architecture

Publisher:JoyfulMelodyLatest update time:2018-07-21 Source: eefocusKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

This afternoon and evening, I have been studying the s3c2410 interrupt architecture. Although I have been exposed to it in the teacher's class and have taken the exam before, I have gained a lot from studying it carefully. Now I will record it as follows:

1. What is an interrupt? 
Answer: An interrupt is a mechanism used by the CPU to ensure concurrent programs. It enables the CPU to respond to abnormal situations when executing programs. 
In fact, when the CPU is running, how can it know that some unexpected things have happened to various peripherals, such as the serial port receiving data, the device being inserted into the USB interface, and the pressing of a certain button. There are two methods, one is the interrupt mentioned above, and the other is the polling method. (That is, continuous while loop query). To some extent, these two methods are actually the same. The former is to narrow the query time span to after each instruction is executed, that is, when an event occurs, the hardware will set a register; after each instruction is executed, the CPU checks this register through the hardware to "query" whether there is an event of interest.

2. What is the basic interrupt processing flow of s3c2440? 
Answer: As shown in the figure below. 
Write the picture description here

I understand it simply like this: s3c2440 has two types of interrupt sources. Sub-interrupt sources and ordinary interrupt sources. If an interrupt request occurs for sub-interrupt sources of similar types, they will be aggregated into a "large" ordinary interrupt source (I don't know if this description is appropriate). Of course, this is under the condition that the sub-interrupt source is not masked. It is still quite difficult for the interrupt request of this sub-interrupt source to succeed. It has to go through two hurdles. First, the sub-interrupt source mask register cannot mask it, and then the interrupt mask register cannot mask it either. Only then can it be "favored" by the CPU (of course, it still has to compete with a large number of other request sources that 
request ). Ordinary interrupt sources are equivalent to "concubines". As long as there is a request and the priority is high, they can be "favored" by the CPU. There is also a queen-level interrupt source, called a fast interrupt source. She is quite awesome. As long as she requests, the CPU will "visit her". (It's like a palace drama).

3. When an interrupt occurs, how do we program? 
Answer: When an exception occurs, the ARM CPU will automatically complete the following things (remember, it is automatic): 
(1) The lr register saves the address of the next instruction of the current instruction. Usually (PC+4 or PC+8) 
(2) The value of CPSR is copied to SPSR. 
(3) The working mode bit of CPSR is set to the working mode corresponding to the exception. 
(4) Switch to execute the corresponding instruction in the vector table corresponding to this exception (not just the interrupt handling function).

For us, we need to complete the following things at the address corresponding to the exception vector table: 
(1) Save the running environment. The running environment mentioned here refers to the running environment in the previous mode. Although this has entered the exception mode, since the exception mode and the normal mode share some registers, these registers in the exception mode here also save the data in the previous mode, so they must be saved to the stack. 
(2) Enter the ISP function. That is, the interrupt processing function written by yourself to handle the interrupt. 
(3) In the interrupt processing function, it is necessary to determine which interrupt source issued the request (if the interrupt source is very clear, there is no need to determine), formally process the interrupt request (receive data, send data, light up the light, etc.), and finally don’t forget to clear the interrupt source. 
(4) Return from the interrupt and restore the saved running environment.

4. What is the interrupt vector table? 
Answer: The interrupt vector table is the address of the interrupt vector entry that the CPU will find according to the interrupt vector table after an interrupt occurs, and continue to execute at this address. When I was in class before, I thought it was so mysterious. Wow, the interrupt vector table is implemented in hardware. Now I see that it is not very difficult (at least for ARM9). In short, the interrupt vector table is not a real table. It is just specified in advance. If this interrupt occurs, it will continue to execute at this address. It looks like a table is mapped, and it can be regarded as a logical table. After an interrupt occurs, the CPU will continue to execute at the specified address. Therefore, you must write your interrupt handling function at this address. If there is nothing at this address, then the program will die.


Keywords:ARM Reference address:ARM learning interrupt architecture

Previous article:ARM Learning Memory Management Unit (MMU)
Next article:Some issues about STM32 GPIO pins

Recommended ReadingLatest update time:2024-11-17 04:25

ARM cortex-M3 exception handling analysis
1. The possible states of the processor before entering the exception are: 1.handler 2. Thread, MSP 3. Thread, PSP   2. When an exception occurs: 1. There is a stack push process. When an exception occurs, PSP is used and pushed into PSP. When an exception occurs, MSP is used and pushed into MSP. 2. The value of LR wi
[Microcontroller]
Three tips for maximum efficiency design of ARM Cortex M3/M4 microcontrollers
  Most of the target applications using Cortex-M3/M4 MCUs are portable and powered by batteries or energy harvesting systems, so most of the concepts we discuss involve techniques to reduce the overall energy consumption of the system. However, in many cases, these energy-saving techniques are also powerful tools in p
[Embedded]
Three tips for maximum efficiency design of ARM Cortex M3/M4 microcontrollers
Design of digital filter system based on ARM platform
introduction As the most basic processing component in applications such as speech and image processing, pattern recognition, radar signal processing, and spectrum analysis, digital filters have become one of the most commonly used tools. They can not only meet the strict requirements of filters on amplitude and phase
[Microcontroller]
Design of digital filter system based on ARM platform
[ARM Learning Notes] Experiment 3: S3C2440A and memory SDRAM connection experiment
As mentioned above, the storage controller leads out 8 chip select signal lines, corresponding to 8 banks. The address space size of each bank is 128MB, totaling 1GB of physical address space. Among the 8 BANKs, BANK0 occupies the bus address 0x00000000~0x07FFFFFF, and the CPU will read instructions from the bus add
[Microcontroller]
Coal Gangue Sorting System Based on ARM Core and CAN Bus
introduction With the continuous development of embedded technology, the ARM microcontroller with high performance, low power consumption and low price of 32-bit RISC chip has shown a strong development trend. The combination of embedded system and fieldbus technology, combining the advantages of both, provides
[Microcontroller]
Coal Gangue Sorting System Based on ARM Core and CAN Bus
ARM port of x264 encoding
Write about the recent process of porting x264. The latest version (I used 20090715 at first) already has cross-compile support, so the porting should be smooth. But this version cannot be compiled under Windows. I searched online for the problem but could not find a solution. Later, I chose 20060805, which I f
[Microcontroller]
The composition of ARM assembly files and assembly instruction types
Composition of ARM assembly files Instruction: After compilation, it is stored in the memory unit as an instruction (machine code), and the CPU can complete the processing operation when it is executed. Pseudo-instructions: replaced with recognizable ARM instructions during compilation Pseudo operation: Know that t
[Microcontroller]
Design of asynchronous LED display screen control system based on CPLD and ARM
Large-screen displays based on LED technology have been widely used in public places such as squares, airports, stadiums and stations to display multimedia information such as text, animation, images and videos on the large screen. When displaying information, the LED large-screen control system does not need to proces
[Embedded]
Design of asynchronous LED display screen control system based on CPLD and ARM
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号