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的所有寄存器中 ...
随机推荐
- Arrays.asList () 不可添加或删除元素的原因
Java中奖数组转换为List<T>容器有一个很方便的方法 Arrays.asList(T ... a),我通过此方法给容器进行了赋值操作,接着对其进行 添加元素,却发现会抛出一个(jav ...
- Table样式设置
<table class="listTable"> <tr><th width="40px">序号</th>&l ...
- win10 uwp json
本文讲的是关于在uwp使用json的简单使用,json应用很多,因为我只是写简单使用,说的东西可能不对或者不符合每个人的预期.如果觉得我有讲的不对的,就多多包含,或者直接关掉这篇文章,但是请勿生气或者 ...
- Python学习笔记(七)
Python学习笔记(七): 深浅拷贝 Set-集合 函数 1. 深浅拷贝 1. 浅拷贝-多层嵌套只拷贝第一层 a = [[1,2],3,4] b = a.copy() print(b) # 结果:[ ...
- HTML5之window.applicationCache对象
不知道离线缓存技术的可以参照上一篇文章: HTML5之appcache语法理解/HTML5应用程序缓存/manifest缓存文件官方用法翻译 参考文章 window.applicationCache ...
- 61、web框架
每个编程语言都有它自己的框架,它是我们做项目总重要的一部分.python最重要的框架为django,到底什么是框架,今天先来了解了解 一.http协议 1.HTTP简介 HTTP协议是Hyper Te ...
- Java并发之CountDownLatch、CyclicBarrier和Semaphore
CountDownLatch 是能使一组线程等另一组线程都跑完了再继续跑:CyclicBarrier 能够使一组线程在一个时间点上达到同步,可以是一起开始执行全部任务或者一部分任务. CountDow ...
- Java基础总结--面向对象2
1.存在相关的多个方法就封装在一个类中,方法没调用到特有数据,需要静态化2.假如一个类所有方法都是静态方法,为了保证不被其他创建对象,可以将该类的构造方法私有化3.文档注释javadoc-按照规定注释 ...
- MYSQL 子查询返回多列显示
因工作需要,目前研究出一种mysql 技能,与大家分享一下. 需求:关联查询另一个大表数据的某些(一个以上)字段 方案:因关联查询的表数据太大.多表查询影响效率,单个子查询又有些多余.所以采用多列拼接 ...
- KICKSTART无人值守安装
1.1 环境说明 [root@test ~]# cat /etc/redhat-release CentOS release 6.9 (Final) [root@test ~]# uname -r - ...