// ********************** sdma.h *************************************** // Arm-Dsp runtime library // // SDMA module provides interface to sdma channels handling. It provides functions // for selecting sdma channel, configuring it and coping data via selected channel. // define __DMA_TIME_COUNTING__ if you want to use time count of SDMA // // (c) multicore.ru // // ******************************************************************* #ifndef _SDMA_H_ #define _SDMA_H_ #include "erlcommon.h" #ifdef __cplusplus extern "C" { #endif #define SDMA_BASE 0x37220000 #define ISALIGNED64(x) ((((unsigned int)(x))&0x7)==0) typedef struct { volatile unsigned csr; volatile unsigned cpc; } Chan_CTRL; typedef struct { volatile unsigned sar; volatile unsigned dar; volatile unsigned ccr; volatile unsigned lc0; volatile unsigned lc1; volatile unsigned char RES[12]; } Chan; typedef struct { volatile unsigned dsr; volatile unsigned dpc; volatile unsigned reserved1[6]; volatile unsigned inten; volatile unsigned int_event_ris; volatile unsigned intmis; volatile unsigned intclr; volatile unsigned fsrd; volatile unsigned fsrc; volatile unsigned ftrd; volatile unsigned reserved2; volatile unsigned ftr[8]; volatile unsigned reserved3[40]; volatile Chan_CTRL chCtrl[8]; volatile unsigned reserved4[176]; volatile Chan ch[8]; volatile unsigned reseved13[512]; volatile unsigned dbgstatus; volatile unsigned dbgcmd; volatile unsigned dbginst0; volatile unsigned dbginst1; volatile unsigned reserved14[60]; volatile unsigned cr0; volatile unsigned cr1; volatile unsigned cr2; volatile unsigned cr3; volatile unsigned cr4; volatile unsigned crd; volatile unsigned reserved15[26]; volatile unsigned wd; volatile unsigned reserved16[87]; volatile unsigned periph_id_n[4]; volatile unsigned pcell_id_n[4]; } SDMA_CB; typedef SDMA_CB* PSDMA_CB; unsigned run_channel(unsigned int channel, unsigned int inst0, unsigned int pc); // Function: sdma_copy // // Blocking copy of buffer via sdma memory channel. The execution thread is blocked until the dma channel stops its work. // // Parameters: // dma_id - number of requested memory dma channel // dst - physical or virtual address of destination buffer // src - physical or virtual address of source buffer // size - size of transmitted buffer in bytes // // Return: // ERL_NO_ERROR - configuration procedure is successful // ERL_SYSTEM_ERROR - dma channel id wrong // ERL_PROGRAM_ERROR - size or line number is wrong // enum ERL_ERROR sdma_copy(int dma_id, unsigned int *dst, unsigned int *src, int size); // Function: sdma_copy2d // // Blocking copy of 2d array via dma memory channel. The execution thread is blocked until the sdma channel stops its work. // // Parameters: // dma_id - number of requested memory dma channel // dst - physical or virtual address of destination buffer // stride_dst - destination stride in bytes // src - physical or virtual address of source buffer // stride_src - source stride in bytes // width - size of line in bytes // height - number of lines // // Return: // ERL_NO_ERROR - configuration procedure is successful // ERL_SYSTEM_ERROR - dma channel id wrong // ERL_PROGRAM_ERROR - size or line number is wrong // enum ERL_ERROR sdma_copy2d(int dma_id, unsigned int *dst, unsigned int stride_dst, unsigned int *src, unsigned int stride_src, int width, int height); // Function: sdma_copy_sampling // // Blocking copy of buffer via dma memory channel. The execution thread is blocked until the dma channel stops its work. // Has interface to OR registers // // Parameters: // dma_id - number of requested memory dma channel // dst - physical or virtual address of destination buffer // dst_or - destination buffer step in data words // src - physical or virtual address of source buffer // src_or - source buffer step in data words // size - size of transmitted buffer in bytes // en64 - length of transmitted word 0 - 32 bit, 1 - 64 bit // // Return: // ERL_NO_ERROR - configuration procedure is successful // ERL_SYSTEM_ERROR - dma channel id wrong // ERL_PROGRAM_ERROR - size or line number is wrong // enum ERL_ERROR sdma_copy_sampling(unsigned int dma_id,unsigned int* dst, int dst_or,unsigned int* src, int src_or,unsigned int size, int en64); #ifdef __cplusplus } #endif #endif