Conceptual
Login

Making the Card Compute a Factorial by Polling

This is the first time you ask the hardware to do work rather than just identify itself: you write a number into the card's compute register, watch a status bit until the card says it has finished, then read the answer back out of the same place. Wiring that to the device file from the earlier stage means a person at a shell can send a number in and get the factorial out, with the arithmetic done by the emulated card. After it you understand the basic shape of every device transaction — hand over a request, wait for a done signal, collect the result.

Questions this Concept answers

  • Why does the driver re-read the status register in a loop instead of waiting a fixed interval judged long enough?