Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between DMA Controller and I/O processor

Tags:

io

hardware

dma

Given the starting memory address & word count DMA controller transfers data while the CPU works on some other process. The Input Output processor too handles I/O processes given the starting address & word count.. (correct me if I'm in error)

So what's the difference in functionality between IOP & DMA controller?

like image 666
Sach Avatar asked Apr 24 '13 19:04

Sach


2 Answers

In case of memory specific I/O operations (Simple example instructions like lw $r1,$r2,16 in case of MIPS processor), CPU needs to get the data from memory,to facilitate I/O operations. And so CPU has to pause any other operation and monitor the memory READ/WRITE operation till it is not completed. In other words CPU is totally occupied as long as read/write operation is in progress without DMA .If the processor was free during this time,then processor could have executed some other instructions .

Direct Memory Access(DMA):

DMA provides this capability to carry out memory specific operations with minimal CPU intervention. When any I/O device needs a memory access. It sends a DMA request(in form of interrupt) to CPU. CPU initiates the the transfer by providing appropriate grant signals to the data bus. And passes the control to the DMA controller which controls the rest of the data transfer and transfers the data directly to I/O device. During this time, CPU continues with other instructions. Once the Read/Write operation in completed (or any exception is occurred )the DMA controller initiates an interrupt and notifies the processor about the status of read/write operation.

In this way the read/write operation is also carried out and CPU also executes some other instruction during that time. However, initialization of DMA still requires CPU intervention. And so the overall performance is maximized.

I/O processor

You can think I/O processor along the lines of DMA approach. The I/O processor, generally used in large computer systems, is a coprocessor which is capable of executing the instructions in addition to transfer of data. By the way, the coprocessor instruction system is different from the central processing unit.

CPU can execute the I/O specific program by initializing the basic operations like enabling the data path and setting up the I/O devices participating in operation. And then it transfers the task to I/O processor,which then carry out rest of the tasks and upon completion notifies the processor. The processor meanwhile executes other important instructions.

The I/O processor is essentially a small DMA dedicated processor that can execute limited input and output instructions and can be shared by multiple peripherals.

The I/O processor solves two problems:

  • The job of input and output is assumed by the CPU. Although DMA does not require CPU for data exchange between peripherals and memory, it only reduces the burden of CPU. Because in DMA, the initialization of input and output is still done by CPU.
  • The problem of sharing DMA interface of high speed equipment in large computer system. A large computer system peripherals so much that it had to share the DMA interface Limited (small computer systems such as PC in each device is assigned a DMA high speed interface).
like image 156
axiqia Avatar answered Nov 15 '22 10:11

axiqia


DMA is a hardware module able to transfer data between a peripheral and memory (UART, SPI, DAC, ADCs) or two differents memory addresses without consuming CPU processing time. Generally, configuirng DMA modules involves setting up a memory destination address and a source address, also users are able to configure options such as: buffer data size, automatic address increment and circular buffer. Moreover, these kind of module emits a IRQ signal at the end of the data transfer.

There is a DMA configuration example below for the microcontroller STM32F373. The example shows a DMA configuration between sigma-delta ADC and a memory buffer.

DMA_InitTypeDef  DMA_InitStructure;
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA2, ENABLE);
DMA_DeInit(DMA2_Channel3);

/* DISABLE the DMA SDADC1 channel */
DMA_Cmd(DMA2_Channel3, DISABLE);
/* DMA channel SDADC1 Configuration */
DMA_InitStructure.DMA_BufferSize = bufferSize;

DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)&SDADC1->JDATAR;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;

DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)memoryAddress;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc;
DMA_InitStructure.DMA_MemoryDataSize =  DMA_MemoryDataSize_HalfWord;

DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
DMA_InitStructure.DMA_Priority = DMA_Priority_High;
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;

DMA_Init(DMA2_Channel3, &DMA_InitStructure);

/* Avoid interrupt on DMA ENABLE */
DMA_ClearITPendingBit(DMA2_FLAG_TC3);

// Enable DMA2 Channel Transfer Complete interrupt
DMA_ITConfig(DMA2_Channel3, DMA_IT_TC, ENABLE);

/* Enable the DMA channel */
DMA_Cmd(DMA2_Channel3, ENABLE);

Regarding to I/O processor, I didn't understand it all what did you you mean. But I can say that GPIO hardware modules are able to map general digital input/output to a memory address, i.e: The I/O I/o has a memory address, but read and write operations in fact are done in a peripheral register.

like image 40
Filipe Calasans Avatar answered Nov 15 '22 10:11

Filipe Calasans