Wednesday, July 08, 2009

Double-buffering

A double buffer has to be used to handle the DMA transfer and DSP, so that DSP and DMA do not access the same data at the same time. In following figure, DSP processes in1 buffer and stores the result in out1 buffer. DMA is filling in0 and transmitting the data from out0. out0 was processed by DSP in last step. It is also called “ping-pong” buffer.

ping-pong_buffer

[asked in sep. 06] In video systems, we need double buffer in both input and output parts. For the output part (display), one buffer is showing the original data, if you want to do some operations, e.g, drawing a line, you have to use another buffer. The hardware-design does not allow to draw in the first buffer. If the output just display the input video, we can just put the output buffer point the input buffer (so do not need to copy). Similar thing to input buffer. In practice,  three or more buffers are applied in the system. The buffer can be tagged with ‘ready’, etc. Multiple buffers provide more margin for synchronization, and reduce the frequency of interrupts.

No comments:

Post a Comment