Forum Discussion
Altera_Forum
Honored Contributor
20 years agoHello Yks,
I had to recently design a DMA LCD system. I used the HAL paradigm for the DMA, bascially using the template found in the software guide and a recursive ISR. I borrowed this code from a VGA application and changed a few things for the LCD system. Everything works fine! Here are the code snippet highlights: //open the dma channel //Set Dma mode transfers //Set DMA for streaming // queue transfers // queue the dma transfer to copy frame buffer temp = alt_dma_txchan_send ( tx_chan, (const void*)(main_frame_buffer), (( PIX_MAP_WIDTH * PIX_MAP_HEIGHT ) + PIX_MAP_WIDTH) * 2 * 2, (alt_txchan_done *)(vga_dma_done), (void*)(&my_isr_context)); // Where my_isr_context is address of block where your image resides void vga_dma_done(vga_dma_done_context *context) // VGA DMA ISR { // setup another dma to feed the frame buffer out the vga alt_dma_txchan_send ( tx_chan, (const void*)(context->frame_buffer_base), ((PIX_MAP_WIDTH * PIX_MAP_HEIGHT) + PIX_MAP_WIDTH) * 2 *2, (alt_txchan_done *)(vga_dma_done), (void*)(context)); } // Above function is called recursively. Two more notes: I used the streaming mode, this works well with the DMA. Also, When you design your LCD logic make sure latency is zero. Hope this helps a bit. -Baycool