Skip to content

Lab 2: PIT And Timer IRQs

Generated folder: labs/timer/

Lab 2 introduces periodic hardware events. Instead of asking a high-level OS clock for time, you configure a timer-like device and react to interrupts.

Device Model

PartRole
Timer 0periodic interrupt source
Control wordselects timer, access mode, operating mode, BCD/binary
Divisorconverts base clock frequency into requested rate
IRQ lineevent path from device to program
Interrupt handlerrecords that a tick happened

Plan

  1. Validate timer number and requested frequency.
  2. Compute the PIT divisor.
  3. Write low byte and high byte in order.
  4. Subscribe to timer interrupts.
  5. Keep the interrupt handler small.

Next: implementation tasks.

Course/docs licensed CC BY 4.0. Code licensed MIT.