LAB7: interrupt handlers (Rubini CHAPTER NINE)

parallel port is example of device using interrupts: after enabling interrupt: pin10 (called the "ack" bit) of parallel port transition low to high causes interrupt.

(note, however, USUALLY it's low to high but sometimes reversed, e.g. optiplex versus others, ... so you may or may not need an inverter which can be built right into the parallel port connector, and powered with the device such as card reader...)

interrupt lines: only F or 10 of them (15 or 16 baseA of them) so they're a precious resource.

Example: int request_irq(unsigned int irq,
         ^^^this returns (notifies) whether interrupt already taken
         void (*handler)...
               ^^^^^^^^function that's called
         const char *device
         ^^^^^^^^^^^^^^^^^^name that shows up in proc IRQ
         void *dev_id);
         ^^^^^^^^^^^^^NULL unless using shared interrupts

flags such: are also given in the request_irq().

fast handlers guarantee atomic processing of interrupts.

fast handlers: can have several thousand interrupts per second (e.g. radar)

fast handler: interrupt enable turned off while running (prevents other interrupts from being serviced)

slow handler: kernel re enables interrupt reporting so other interrupts can be serviced while slow handler running.

slow handler typical use: frame grabbers (e.g. 60Hz or so).

for both fast and slow, kernel disables the interrupt line just reported.
therefore IRQ ISR doesn't need to be reentrant.
However, both fast and slow ISRs must be written to run quickly in order to not miss the next interrupt (e.g. radar samples 8kHz)

note that the interrupt controller doesn't buffer disabled interrupts (therefore lost forever).

ISA bus: IRQs are positive edge triggered (e.g. when ungrounding)

8259 Programmable Interrupt Controller (PIC)

bottom halves and top halves