Sophie

Sophie

distrib > CentOS > 6 > i386 > by-pkgid > 2c51d8eb79f8810ada971ee8c30ce1e5 > files > 3742

kernel-doc-2.6.32-71.14.1.el6.noarch.rpm

<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>Adding an interrupt handler</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="The Userspace I/O HOWTO" /><link rel="up" href="custom_kernel_module.html" title="Chapter&#160;3.&#160;Writing your own kernel module" /><link rel="prev" href="custom_kernel_module.html" title="Chapter&#160;3.&#160;Writing your own kernel module" /><link rel="next" href="ch03s03.html" title="Using uio_pdrv for platform devices" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Adding an interrupt handler</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="custom_kernel_module.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;3.&#160;Writing your own kernel module</th><td width="20%" align="right">&#160;<a accesskey="n" href="ch03s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" title="Adding an interrupt handler"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="adding_irq_handler"></a>Adding an interrupt handler</h2></div></div></div><p>
	What you need to do in your interrupt handler depends on your
	hardware and on how you want to	handle it. You should try to
	keep the amount of code in your kernel interrupt handler low.
	If your hardware requires no action that you
	<span class="emphasis"><em>have</em></span> to perform after each interrupt,
	then your handler can be empty.</p><p>If, on the other
	hand, your hardware <span class="emphasis"><em>needs</em></span> some action to
	be performed after each interrupt, then you
	<span class="emphasis"><em>must</em></span> do it in your kernel module. Note
	that you cannot rely on the userspace part of your driver. Your
	userspace program can terminate at any time, possibly leaving
	your hardware in a state where proper interrupt handling is
	still required.
	</p><p>
	There might also be applications where you want to read data
	from your hardware at each interrupt and buffer it in a piece
	of kernel memory you've allocated for that purpose.  With this
	technique you could avoid loss of data if your userspace
	program misses an interrupt.
	</p><p>
	A note on shared interrupts: Your driver should support
	interrupt sharing whenever this is possible. It is possible if
	and only if your driver can detect whether your hardware has
	triggered the interrupt or not. This is usually done by looking
	at an interrupt status register. If your driver sees that the
	IRQ bit is actually set, it will perform its actions, and the
	handler returns IRQ_HANDLED. If the driver detects that it was
	not your hardware that caused the interrupt, it will do nothing
	and return IRQ_NONE, allowing the kernel to call the next
	possible interrupt handler.
	</p><p>
	If you decide not to support shared interrupts, your card
	won't work in computers with no free interrupts. As this
	frequently happens on the PC platform, you can save yourself a
	lot of trouble by supporting interrupt sharing.
	</p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="custom_kernel_module.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="custom_kernel_module.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="ch03s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&#160;3.&#160;Writing your own kernel module&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Using uio_pdrv for platform devices</td></tr></table></div></body></html>