#include "pdma.h" pdma_mem_channel* get_pdma_dev(int dma_id) { if(dma_id < 0 || dma_id > 7) { return 0; } return &(_MemCh[dma_id]); } int pdma_configure(int dma_id, void * dst, const void * src, int size) { if(size <= 0) return 0; if (dma_id <0 || dma_id >7) return 0; pdma_mem_channel* dma_ch = get_pdma_dev(dma_id); if (dma_ch == 0) return 0; if (ChEnReg & (1<SAR = (unsigned)src; dma_ch->DAR = (unsigned)dst; unsigned long long size_shifted = size>>2; size_shifted = size_shifted<<32; dma_ch->CTL = size_shifted | 0x4824; DmaCfgReg = 1; return 1; } int pdma_run(int dma_id) { ChEnReg |= (1<>2; n_blocks = size_w/PDMA_MAX_BLOCK_SIZE; unsigned int src_t, dst_t; for (i=0;iDAR = (unsigned int)dst; link->SAR = (unsigned int)src; link->LLP = (unsigned int)(link+1); unsigned long long size_shifted = size>>2; size_shifted = size_shifted<<32; link->CTL = size_shifted | 0x4824; if (llp_en == 1) link->CTL |= 0x18000000; } int pdma_start_chain(int dma_id, pdma_mem_chain *link) { pdma_mem_channel* dma_ch = get_pdma_dev(dma_id); if (dma_ch == 0) return 0; if (ChEnReg & (1<DAR = link->DAR; dma_ch->SAR = link->SAR; dma_ch->CTL = link->CTL; DmaCfgReg = 1; pdma_run(dma_id); }