Letting the Card Interrupt You When the Answer Is Ready
Polling a status bit burns a processor doing nothing useful, so real drivers ask the device to raise an interrupt when it is finished. In this stage you turn on the card's interrupt-enable bit, register a handler, and rework the factorial path so the code that asked for the answer sleeps until the handler wakes it, reads which event happened, tells the card the signal has been received, and hands the result back. After it you can write a driver that gives the processor back while hardware works, which is the difference between a toy and something you would ship.
Questions this Concept answers
- Why must the interrupt handler hand the result back through a sleeping thread rather than finishing the request itself?
Interrupt Management | maxerenberg/qemu-edu-driver
Instead of spinning in a loop waiting for a device to finish, a driver can ask the hardware to tap it on the shoulder. This walks through registering a handler for the card's interrupt, checking insi…