I⧸O and Devices

Pasted image 20231210224228.png

A CPU accesses physical memory over a Bus

A bridge connects two different buses

The I⧸O Advanced Programmable Interrupt Controller handles interrupts from devices

What is memory?

Communicating with a device

Memory-mapped device registers

Device memory

Direct Memory Access (DMA)

Example

Parallel Port

  • Every bit corresponds to a pin

There are three primary types of device registers

  • Status
    • Tells something about device current state
    • Read
  • Command
    • Issue a command to the device
    • Write
  • Data
    • Used to transfer data to and from device

Using Physical Addresses

volatile int32_t *device_control = (int32_t *) 0xc00c0100;
*device_control = 0x80; /* give command */
int32_t status = *device_control; /* get back status */

OS must map device addresses to virtual addresses and ensure they are non-cacheable

Device Drivers

Anatomy of a Disk

Flash memory