Chapter9-3.Interrupt handling schemes 《ARM system developer's guide》

来源:互联网 发布:黑马程序员小马哥 编辑:程序博客网 时间:2024/06/10 22:49

Interrupt Handling Schemes

1.Nonnested Interrupt Handling

这里写图片描述

2.Nested Interrupt Handler

这里写图片描述

进行一次context转换需要清空IRQ栈(因为handler无法在IRQ栈有数据的时候执行context switch),所有保存在IRQ栈中的寄存器都需要被转移到任务的栈中,典型的是是在SVC stack。剩余的寄存器必须要被转移到任务栈中一段内存地址中,该段被称为a stack frame

其余还有一些需要被转移到stack frame的寄存器,具体的取决于被使用的操作系统或者应用程序。例如:
r13_sur, r14_usr, 需要在支持user、SVC模式的操作系统中被保存
Floating-point register需要在系统使用hardware floating-point的时候被保存

summary

  1. 在没有优先级分配的情况下处理多个中断
  2. 中到高的中断延时
  3. 优势:在单个中断服务完成前enable interrupts能减少interrupt latency
  4. 劣势:不能处理优先级中断,所以低优先级中断会block高优先级中断

3.Reentrant Interrupt Handler

这是一种能处理多重中断的方法,这些中断按照优先级过滤-高优先级有着低中断延时,但是常规的nested interrupt handler达不到这种效果。

3和2类handler的区别在于,reentrant的reenable interrupt要更早一些,这样可以降低中断延迟。


所有的在reentrant interrupt handler的中断必须是SVC,system,undefined instruction,or abort mode 之一。

  • 如果中断在中断模式的时候reenable并且执行了BL调用了子函数,子函数的返回地址会保存到r14_irq中,如果再发生中断会覆盖r14_irq,为了避免覆盖,所以所有的中断需要进入SVC或者system模式。BL指令可以使用r14_svc去保存子流程的返回地址。在reenable中断之前必须要通过cpsr屏蔽掉中断。

  • 自从中断在SVC模式服务的时候,中断栈就没有用了,相替代的使用了IRQ的r13去指向一个12-byte的结构。该结构用于在中断进入的时候临时保存一些寄存器的值。

1.流程图

Reentrant Interrupt Handler

2.summary

1.Handles multiple interrupts that can be prioritized
2. Low Interrupt latency
3. Advantages: handles interrupts with differing prorities
4. Disadvantages: tends to be more complex

4.Prioritized Simple Interrupt Handler

这里写图片描述

summary

  1. Handles prioritized interrupts
  2. Low interrupt latency
  3. Advantages: deterministic interrupt latency since the priority level is identified first and then the service is called after the lower-priority interrupts are masked
  4. Disadvantage: the time taken to get to a low-priority service routine is the same as for a high-priority routine.

5.Prioritized Standard Interrupt handler

Prioritized Standard Interrupt handler

summary

  1. Handles higher-priority interrupts in a shorter time than low-priority interrupts.
  2. Low interrupts latancy
  3. Advantages: Higher-priority interrupts treated with greater urgency with no duplication of code to set external interrupt masks
  4. Disadvantages: there is a time penalty since this handler requires two jumps, resulting in the pipeline being flushed each time a jump occurs.

6. Prioritized Direct interrupt handler

优先级直接中断和优先级标准中断不同之处在两方面:
第一:handler中一些处理的代码被移到了ISR中。这些代码就是mask out 这些lower-priority interrupts的。
第二:优先级直接中断的handler会直接调转到合适的ISR中。

summary

  1. Handles higher-priority interrupts in a shorter time,Goes directly to the specific ISR
  2. Low Interrupt latancy
  3. Advantages: uses a single jump and saves valuable cycles to go to th ISR
  4. Disadvantages: each ISR has a mechanism to set the external interrupt mask to stop lower-priority interrupts from halting the current ISR, which adds extra code to each ISR

7.Prioritized Grouped Interrupt Handler

summary

  1. Mechanism for handling interrupts that are grouped into different priority levels
  2. Low Interrupt latancy
  3. Advantages: useful when the embeded system has to handle a large number of interrupts, and also reduces the response time since the determining of the priority level is shorter
  4. Disadvantages: determing how the interrupts are grouped together

8.VIC PL 190 Based Interrupt Service Routine

VIC-vector interrupt controller
VIC是一个典型的hardware interrupt handler

9.Summary

  1. 异常会改变通常指令执行的序列。一共有7种异常:Data abort, Prefecth abort, Fast Interrupt Request, Interrupt Request, Undefined Intsruction, Software Interrupt, Reset.每一种异常都有相应的ARM处理器模式。当一个异常产生的时候,处理器会跳转到特殊的模式,并且branch到Vector table上相应的entry中。每一种异常都有优先级。
  2. 中断是一种由外设引发的特殊异常。IRQ异常用于通用的操作系统活动,FIQ通常用于某一种中断源。中断延时是从一个外部中断请求信号发出到ISR第一个指令被取出的间隔。
  3. 我们涉及到了8中interrupt scheme。从简单的无嵌套中断,到高级的优先级分组中断。
0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 王者荣耀累计扣分12分怎么办 去医院看病没带身份证怎么办 ps4星战2鬼服怎么办 冒险岛英雄五转怎么办 6儿童视力低常怎么办 腰干活累的酸痛怎么办 狗狗体力很差怎么办啊 脉差总是五十多怎么办 吃过敏药嗜睡乏力怎么办 写字紧张心跳的快手抖怎么办 怀孕食欲差没精神怎么办 爬个三楼就喘了怎么办 头被篮球砸了怎么办 打球手指肿了很久怎么办 客人吃饭跑单了怎么办 脑子总是记不住东西怎么办 穿的鞋有味道怎么办 生完孩子血糖高怎么办 生了孩子子宫大怎么办 生完孩子阴吹怎么办 怀孕初期感冒嗓子发炎怎么办 脑子转不过来弯怎么办 他说我道行不深怎么办 鞋子内测磨破了怎么办 老公拉肚子拉的很厉害怎么办 老公拉肚子拉得很厉害怎么办 和老公吵架很厉害怎么办 新鞋鞋底吱吱响怎么办 新鞋鞋底滑了怎么办 工作中同事不配合怎么办 做体力活一身疼怎么办 大脑左则中动脉血管狭窄?怎么办 儿童体质差免疫力差怎么办 nba篮球大师体力不够怎么办 一千米差10秒怎么办 四十岁以后体力和耐力差怎么办 打篮球一打比赛就紧张怎么办 耐克空军鞋鞋底边胶掉了怎么办 鞋底踩到老鼠胶怎么办 头蒙怎么办最快最有效 备孕老公压力大怎么办