How the CPU and I/O read and write

 

 There are four main ways of data transmission between CPU and IO device:

  1. Query control mode:

    The CPU actively reads the status register through the program to understand the interface situation and completes the corresponding data operation. Query operations need to be repeated at intervals with a small number of clock cycles, which is CPU inefficient.

  2. Interrupt control method:

    When the program is running normally, if there is an external event with a higher priority, it will notify the CPU through an interrupt request, and the CPU will then read the status register to determine the type of event, so as to execute different branch processing. This method is CPU efficient and has good real-time performance.

  3. DMA (Direct Memory Access) control mode:

    As the name implies, the specific process of direct memory access, that is, data transfer, is directly completed by hardware (DMA controller) between memory and IO. The CPU only temporarily transfers control to DMA at the beginning until the end of data transfer. The transfer speed in this way is faster than through the CPU, especially when the batch transfer is very efficient.

  4. Channel control mode:

    The basic method is the same as the above-mentioned DMA control method, except that the DMA is completed by the DMA controller, and the channel control method is completed by a dedicated channel bus for communication transmission. More efficient than DMA.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327105961&siteId=291194637