Linux Kernel Development.pdf

(220 KB) Pobierz
Linux Kernel Development
- Robert Love
설지훈
1
Contents
Interrupts and interrupt handlers
Bottom halves and deferring work
2
Introduction
Interrupts
Interrupts are
special electrical signals
sent from
hardware devices to the processor
The operating system can service each interrupt with a
unique handler
These interrupt values are often called interrupt
request (IRQ) lines
Example, zero is timer, one is keyboard.
3
Interrupts and interrupt handlers
Interrupt handlers
The function the kernel runs in response to a specific
interrupt is called an
interrupt handler
or
interrupt
service routine
(ISR)
The interrupt handler for a device is part of the
devices’s
driver
The interrupt handler execute in as short a period as
possible
4
Registering an interrupt handler
int request_irq (unsigned int irq,
irqreturn_t (*handler)(int, void *, struct pt_regs *),
unsigned long irqflags, const char * devname, void *dev_id)
Parameters
irq
handler
irqflags
Specifies the interrupt number to allocate
A pointer to the actual interrupt handler that services this interrupt
SA_INTERRUPT, SA_SAMPLE_RANDOM, SA_SHIRQ
An ASCII text representation of the device associated with the interrupt
Used primarily for shared interrupt lines
devname
dev_id
Note request_irq() might sleep and, therefore, cannot be called from interrupt
context or other situations where code cannot block
5
Zgłoś jeśli naruszono regulamin