Input and output subsystem, query, interrupt, DMA mode

 table of Contents

IO structure function: 

Query, interrupt, DMA mode.

inquiry mode

Interrupt mode

DMA method


The IO interface realizes the exchange of information between the host and peripherals.

IO structure function: 

  • Equipment location
  • Send command
  • Transfer data
  • Feedback IO status 

Query, interrupt, DMA mode.

inquiry mode

Interrupt mode

Interrupts should make us more concerned (whether it is a bare-metal interrupt or an interrupt in the system (OS)).

The difference between bare metal interrupt and OS interrupt:

In the bare metal interrupt, when an interrupt occurs at a certain moment, the interrupt service program is executed, and after the interrupt service program is executed, it returns to the place where the interrupt occurred to continue executing other programs. (Protect the scene).

In the OS, when an interrupt occurs at a certain moment, the interrupt service program is executed. After the interrupt service program is executed, it does not return to the place where the interrupt occurred , but to query the program execution with high interrupt priority (ie, interrupt arbitration).

Interruption effect:

  1. Realize the parallel work of CPU and I/O device.
  2. Deal with hardware failures and software errors.
  3. To achieve human-computer interaction, users intervene in the machine.
  4. Realize multi-program, time-sharing operation, multi-program switching.
  5. Realize real-time processing.
  6. Information exchange and task switching between processors in a multiprocessing system.

Interrupt exception:

I won't talk about interruption. "Exception" is a commendatory word here, which can refer to task switching. That is, the interruption occurs and the interrupt service routine is executed.

 Interrupt nesting realization: It is the realization of interrupt shielding technology. Interrupt nesting realizes two conditions:

  1. Open the interrupt in the interrupt service routine.
  2. High priority interrupts have the right to interrupt low priority interrupts.

Interrupt shielding technology is implemented at the hardware layer, there are interrupt shielding registers, generally do not need to be concerned, for example, in the development of STM32, we only need to set the priority.

Interrupt handling process:

  • Interrupt request.
  • Interrupt response.
  • Interrupt processing.

It can be seen that the interrupt service routine is not directly executed when the interrupt request occurs. 

DMA method

In the DMA mode, when the I/O device needs to transfer data, the DMA controller puts forward a DMA transfer request to the CPU. After the CPU responds, it will give up the system bus, and the DMA controller will take over the bus for data transfer. (Intercept program execution cycle)

Comparison of interrupt mode and DMA mode: 

Guess you like

Origin blog.csdn.net/weixin_41865104/article/details/107853742