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的所有寄存器中 ...
随机推荐
- 吐槽CSDN--想赚钱想疯了--强行升级皮肤--增加广告位
一直对CSDN很有好感,和博客园同是技术分享的好平台,但是界面更清爽,用户间互动也较多.在学生时代就一直在用,平时抄个作业,竞赛搜个题,论文需要凑字数等等.当年为了下载一份源代码,或者为了下载某本买不 ...
- C# 格式化字符串
C#字符串使用{}来格式化 {引索,宽度:格式} 格式后面加数字保留位数 格式 C人民币 {0,10:C10} <script type="text/javascript"& ...
- UVa12563- Jin Ge Jin Qu hao
思路一定要清晰! /* * Author: Bingo * Created Time: 2014/12/25 3:45:35 * File Name: uva12563.cpp */ #include ...
- LINUX 笔记-netstat命令
netstat命令用于显示与IP.TCP.UDP和ICMP协议相关的统计数据,一般用于检验本机各端口的网络连接情况.netstat是在内核中访问网络及相关信息的程序,它能提供TCP连接,TCP和UDP ...
- 限定textbox中只能输入数字的小方法
在textbox中加入onkeyup="this.value=this.value.replace(/\D/g,' ')"即可实现这一功能 验证数字的正则表达式:^[0-9]*$或 ...
- javascript方法的方法名慎用close
通常我们在定义了与window同名的方法时,会自动覆盖掉window同名的方法.close()方法也不例外.示例: <!DOCTYPE html PUBLIC "-//W3C//DTD ...
- C#方法中参数ref和out的解析
一.C#方法中参数类型 有4种参数类型,有时候很难记住它们的不同特征,下图对它们做一个总结,使之更容易比较和对照. 二.C#方法中的参数 1.值参数 使用值参数,通过复制实参的值到形参的方式把数据传递 ...
- 关于VRTK的使用(一)—— VR开发环境搭建
首先在Hierarchy窗口中添加GameEmpty,并重命名为VRTK.然后给VRTK添加一个子容器命名为SteamVR.从Asset Store导入SteamVR Plugin: 然后分别选中预制 ...
- Setup and Configure the vsftpd server in CentOS 7 operation system
############################################################################## 1. close the firewall ...
- Python - 单步调试
Python 有一个单步调试器模块,能实现基本的调试效果!详情请看Python标准文档说明:https://docs.python.org/2/library/pdb.html 调试例子: >& ...