当前位置:网站首页>Just learning embedded, I want to ask what is interrupt and what is the concept of interrupt

Just learning embedded, I want to ask what is interrupt and what is the concept of interrupt

2022-06-09 20:31:00 Dafang teacher talks about SCM

A simple life scene : The child sleeps in the bedroom , Mother is reading in the living room , that , How does a mother know her child is awake ?

fbe35e2eca92b66f6e536c7e2647a764.png

·  Always check in the room : A query

·  Go into the room and sleep with the children , When a child wakes up, it will wake her up : Sleep - Wake up the

·  Mom has a lot of work to do , But you can set an alarm clock to sleep with your child :poll The way

·  Mother works in the room , The child wakes up by himself , Go out of the room and tell mom : Asynchronous notification

Back 3 Both ways require children to interrupt their mothers : Interrupt her sleep 、 Her job .

3f05fa6d8dcb68aca90677fc432f8178.png16c759d1a06da8ec15f5bf3d9df3be28.png

In fact, it can “ interrupt ” Mom has a lot to do

·  Distant cat calls : Ignore

·  Doorbell , The child cries : Corresponding to different treatments

·  Under the weather : Get some rest

·  A spider fell down : Run away

Mother is reading . The interrupted process :

·  I'm reading a book

·  All kinds of sounds occur : Interrupt source

o  Distant cat calls

o  The child cries

o  Doorbell ...

How to deal with

·  Put a bookmark in the book first , close the book : Save the scene

·  To deal with : Interrupt service routine

·  Come back and continue reading : Return processing

Interrupt in embedded system

c4990f34d3690aa1931db44f42bd4025.pngbed49846d303153f7ebe7ed6bd21dc91.png

CPU In the process of operation, it will be affected by various “ abnormal ” interrupt :

·  Undefined

·  Instructions 、 There's a problem with the data

· SWI: Soft interrupt

·  Break it up

·  interrupt

An interrupt is also an exception . There are many things that cause interruptions :

·  Key

·  Timer

· ADC convert network

· UART After sending data 、 Receive the data

·  wait

These interrupt sources , To the interrupt controller , The interrupt controller selects the highest interrupt and notifies CPU

Interrupt processing flow

·  initialization :

o  Set interrupt source : What kind of interruption

o  Set interrupt controller ( Mask an interrupt , Interrupt priority )

o  Set up CPU Main switch : To interrupt

·  Perform normal procedures :

·  The interrupt : For example, press the button -> Interrupt controller -> CPU

· CPU If a command is not executed, it will be checked for interruption / The generation of anomalies

· CPU There was an interruption / abnormal , Start to deal with :

o  For different exceptions , Jump to a different address to execute the program

o  On this address , It's just a jump command , Jump to execute a function , This is the exception vector .

after 3 All the steps are done by hardware . The software does :

·  Save the scene ( Various registers )

·  Handling exceptions and interrupts

·  Restore the scene


原网站

版权声明
本文为[Dafang teacher talks about SCM]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206092025111327.html