LKD: Chapter 7 Interrupts and Interrupt Handlers
Recently I realized my English is still far from good. So in order to improve my English, I must not only read in English, but also think and write in English. I know I'm gonna make a lot of mistake in using English, but everything has a process so I just need to keep practiing my English.
I use 2.6.34 instead of 2.6.32 as the book describes.
There're two similar concepts:
Exceptions: synchronous interrupts generated by the processor.
Interrupts: asynchronous interrupts generated by hardware.
In this chapter, we focus on the interrupts.
Interrupt handlers are running in interrupt context, which cannot block.
The processing of interrupts is split into two parts, or halves:
Top Half(interrupt handler): time-critical
Bottom Half: deferred work.
Resgitering an Interrupt Handler(P116):
/* <linux/interrupt.h> */
int request_irq ( unsigned int irq, /* interrupt number */
irq_handler_t handler, /* function pointer to the actual interrupt handler */
unsigned long flags, /* can be either zero or a bit mask */
const char *name, /* an ASCII text representation of the device */
void *dev) /* used for shared interrupt lines */
The third parameter, flags: IRQF_DISABLED, IRQF_SAMPLE_RANDOM, IRQF_TIMER, IRQF_SHARED.
Freeing an Interrupt Handler:
void free_irq (unsigned int irq, void *dev)
A call to free_irq() must be made from process context.
Writing an Interrupt Handler:
The following is a declaration of an interrupt handler:
static irqreturn_t intr_handler ( int irq, void *dev)
An interrupt handler return two special value:
IRQ_NONE: when the interrupt handler detects an interrupt for which its device was not the originator.
IRQ_HANDLED: the interrupt handler was correctly invoked, and its device did indeed cause the interrupt.
LKD: Chapter 7 Interrupts and Interrupt Handlers的更多相关文章
- LKD: Chapter 8 Bottom Halves and Deferring Work
In 2.6.x, there are 3 mechanisms for implementing a bottom half: softirqs, tasklets and work queues. ...
- LKD: Chapter 9 An Introduction to Kernel Synchronization
This chapter introduces some conception about kernel synchronization generally. Critical Regions: Co ...
- LKD: Chapter 5 System Call
在Linux中,处理器所作的事可以归纳为3种情况: 1.In user-space, executing user code in a process; 2.In kernel-space, in p ...
- LKD: Chapter 6 Kernel Data Structures
这一章我们研究四种主要的数据结构: linked lists, queues, maps, binary trees. Linked Lists:(<linux/list.h>) 在lin ...
- Linux 网络性能tuning向导
本文的目的不完全在于提供调优信息,而是在于告诉读者了解Linux kernel如何处理数据包,从而能够在 自己的实践中发挥Linux 内核协议栈最大的性能 The NIC ring buffer 接收 ...
- 《CS:APP》 chapter 8 Exceptional Control Flow 注意事项
Exceptional Control Flow The program counter assumes a sequence of values ...
- STM32F4 External interrupts
STM32F4 External interrupts Each STM32F4 device has 23 external interrupt or event sources. They are ...
- Linux Context , Interrupts 和 Context Switching 说明
一. 进程Context 定义 当一个进程在执行时, CPU的所有寄存器中的值.进程的状态以及堆栈中的内容,比如各个变量和数据,包括所有的寄存器变量.进程打开的文件.内存信息等.这些信息被称为该进程的 ...
- Linux Context , Interrupts 和 Context Switching 说明【转】
转自:http://blog.csdn.net/tianlesoftware/article/details/6461207 一. 进程Context 定义 当一个进程在执行时, CPU的所有寄存器中 ...
随机推荐
- Prometheus 架构 - 每天5分钟玩转 Docker 容器技术(83)
Prometheus 是一个非常优秀的监控工具.准确的说,应该是监控方案.Prometheus 提供了监控数据搜集.存储.处理.可视化和告警一套完整的解决方案. 让我们先来看看 Prometheus ...
- win10 uwp 自定义控件初始化
我遇到一个问题,我在 xaml 用了我的自定义控件,但是我给他设置了一个值,但是什么时候我才可以获得这个值? 本文告诉大家,从构造函数.loaded.Initialized 的调用过程. 用最简单的方 ...
- nodejs里的module.exports和exports
引 在node.js中我们可以使用module.exports和exports导出模块,设置导出函数.数组.变量等等 为什么可以用这两个模块? 或者直接问,node.js的模块功能是怎么实现的. 这样 ...
- ubuntu 下修改文件访问权限chmod 777 -R *血的教训!没事别乱开权限!用谁开谁的就行。。。最后不要用这个命令,文件操作全部改用终端
本文转自: 个人建议 Ubuntu下修改目录权限命令如下:chmod 600 name (只有所有者有读和写的权限)chmod 644 name (所有者有读和写的权限,组用户只有读的权限)chmod ...
- Oracle学习笔记之游标详解
游标 游标存在意义:解决"select *"返回空.多行记录问题,但凡select,就可能多行结果集,也就需要用游标. 游标分4步走:cursor.open.fetch.close ...
- 【转】CPU与内存的那些事
下面是网上看到的一些关于内存和CPU方面的一些很不错的文章. 整理如下: 转: CPU的等待有多久? 原文标题:What Your Computer Does While You Wait 原文地址: ...
- Mysql存在则更新,没有则新增
insert ignore 当插入数据时,如出现错误时,如重复数据,将不返回错误,只以警告形式返回. insert ignore into table(col1,col2) values ('val1 ...
- HandlerThread学习
之前基本讲过Handler的一些知识了,我们今天学习下Google封装的一个实现线程通信的一个类HandlerThread 一.HandlerThread使用 @Override protected ...
- Leetcode题解(31)
103. Binary Tree Zigzag Level Order Traversal 题目 分析: 广度优先遍历的应用.重点是掌握vector的reverse函数,一开始我忘记有这个函数了,琢磨 ...
- 暑假练习赛 007 A - Time
A - Time Description standard input/outputStatements A plane can go from city X to city Y in 1 hour ...