OS device controller
Controller points:
- Status Register: Inform the CPU of the status of the current device, such as: working, completed
- Command Register: CPU sends commands to devices
- Data Register (Data Register): CPU transfers data to IO
I/O device points:
- Block Device: store data in fixed blocks, each block has its own address, such as: hard disk, USB
- Character Device (Character Device): Send or receive character streams in units of characters, character devices are not addressable, such as: mouse
Block device: data is large, generally has a data buffer
- CPU writes data to the controller: put a batch of data in the buffer and send it to the device
- The CPU reads data from the controller: a batch of data is stored in the buffer, and then copied to the memory
- Purpose: Reduce frequent transmission of equipment
Communication method between CPU and register/data buffer:
- Port I/O: Assign I/O ports to control registers, and operate these registers through instructions
- Memory-mapped I/O: Map control registers into memory space, read and write data buffers