6 #include "../memoryManagement/cacheCoherentMemoryProvider.h" 24 #define TI_NO_WIDE_BURSTS_OFF 26 26 #define TI_NO_WIDE_BURSTS_MASK (1<<TI_NO_WIDE_BURSTS_OFF) 29 #define TI_WAITS_OFF 21 31 #define TI_WAITS_MASK (31<<TI_WAITS_OFF) 34 #define TI_PERMAP_OFF 16 36 #define TI_PERMAP_MASK (31<<TI_PERMAP_OFF) 39 #define TI_BURST_LEN_OFF 12 41 #define TI_BURST_LEN_MASK (0xf<<TI_BURST_LEN_OFF) 44 #define TI_SRC_IGNORE_OFF 11 46 #define TI_SRC_IGNORE_MASK (1<<TI_SRC_IGNORE_OFF) 49 #define TI_SRC_DREQ_OFF 10 51 #define TI_SRC_DREQ_MASK (1<<TI_SRC_DREQ_OFF) 54 #define TI_SRC_WIDTH_OFF 9 56 #define TI_SRC_WIDTH_MASK (1<<TI_SRC_WIDTH_OFF) 59 #define TI_SRC_INC_OFF 8 61 #define TI_SRC_INC_MASK (1<<TI_SRC_INC_OFF) 64 #define TI_DEST_IGNORE_OFF 7 66 #define TI_DEST_IGNORE_MASK (1<<TI_DEST_IGNORE_OFF) 69 #define TI_DEST_DREQ_OFF 6 71 #define TI_DEST_DREQ_MASK (1<<TI_DEST_DREQ_OFF) 74 #define TI_DEST_WIDTH_OFF 5 76 #define TI_DEST_WIDTH_MASK (1<<TI_DEST_WIDTH_OFF) 79 #define TI_DEST_INC_OFF 4 81 #define TI_DEST_INC_MASK (1<<TI_DEST_INC_OFF) 84 #define TI_WAIT_RESP_OFF 3 86 #define TI_WAIT_RESP_MASK (1<<TI_WAIT_RESP_OFF) 89 #define TI_2DMODE_OFF 1 91 #define TI_2DMODE_MASK (1<<TI_2DMODE_OFF) 94 #define TI_INTEN_OFF (0) 96 #define TI_INTEN_MASK (1) 100 #define DREQ_ALWAYS_ON 0 103 #define DREQ_PCM_TX 2 104 #define DREQ_PCM_RX 3 107 #define DREQ_SPI_TX 6 108 #define DREQ_SPI_RX 7 115 #define TL_Y_LEN_OFF 16 117 #define TL_Y_LEN_MASK (0x3fff<<TL_Y_LEN_OFF) 120 #define TL_X_LEN_OFF 0 122 #define TL_X_LEN_MASK (0xffff) 127 #define TL_LEN_MASK (0x3fffffff) 134 #define REG_2D_STRIDE_DST_STRIDE_OFF 16 136 #define REG_2D_STRIDE_DST_STRIDE_MASK (0xffff<<REG_2D_STRIDE_DST_STRIDE_OFF) 139 #define REG_2D_STRIDE_SRC_STRIDE_OFF 0 141 #define REG_2D_STRIDE_SRC_STRIDE_MASK (0xffff) 204 static_assert(
sizeof(
ControlBlock)==32,
"ControlBlock has wrong size");
uint32_t zero1
This must be zero.
Definition: dma.h:164
int dma_allocControlBlockPhys(uintptr_t srcAddrPhys, uintptr_t dstAddrPhys, size_t transferLength, uintptr_t nextControlBlockPhys, uint32_t transferInfo, uint32_t _2DStrideModeInfo, size_t _2DStrideTransferLenX, size_t _2DStrideTransferLenY, Ccmb_desc *area)
Builds a control block with the specified characteristics.
Definition: dma.cpp:521
uint32_t zero2
This must be zero.
Definition: dma.h:166
int dma_init()
Initializes the interface, to be called before any other function in this file.
Definition: dma.cpp:209
uint32_t dma_getUsableChannels()
Returns a bit mask indicating the usable channels with 1.
Definition: dma.cpp:557
int dma_writeControlBlock(ControlBlock *cb, uintptr_t srcAddrPhys, uintptr_t dstAddrPhys, size_t transferLength, uintptr_t nextControlBlockPhys, uint32_t transferInfo, uint32_t _2DStrideModeInfo, size_t _2DStrideTransferLenX, size_t _2DStrideTransferLenY)
Definition: dma.cpp:486
int dma_isInit()
Says if dma_init has been called with success.
Definition: dma.cpp:227
uint32_t nextControlBlockAddrPhys
The physical address of the next control block, 0 if there isn't a next control block.
Definition: dma.h:162
int dma_dumpRegisters(int channel, char *s)
For debug purposes: writes the register's contents on the provided string.
Definition: dma.cpp:267
uint32_t transferInfo
The tranfer info register: fill using the TI_* macros.
Definition: dma.h:152
int dma_printControlBlock(ControlBlock *cb)
For debug purposes: prints the control block's contents on standard output.
Definition: dma.cpp:331
int dma_controlBlockToString(ControlBlock *cb, char *s)
For debug purposes: writes the control block's contents on a string.
Definition: dma.cpp:343
Describes a Cache Coherent Memory Block allocated by ccmp_malloc()
Definition: cacheCoherentMemoryProvider.h:23
int dma_dumpRegistersDense(int channel, char *s)
For debug purposes: writes the register's contents on the provided string, in a single line...
Definition: dma.cpp:304
int dma_setChannelGlobalEnable(int channel, int value)
Set the global enable status for the specified channel.
Definition: dma.cpp:388
int dma_setControlBlockAddr(int channel, uint32_t controlBlockAddrPhys)
Sets the address of the control block to be loaded in the dma engine, to start the transfer you then ...
Definition: dma.cpp:457
uint32_t srcAddrPhys
The physical source address.
Definition: dma.h:154
uint32_t _2DStrideMode
The 2DStride register, fill using the REG_2D_* macros.
Definition: dma.h:160
volatile struct ControlBlock_struct ControlBlock
Describes a control block, contorl blocks are needed to load the registers of the DMA engine and star...
int dma_channelResetInitDefault(int channel)
Resets the channel and sets it to default values.
Definition: dma.cpp:361
uint32_t dstAddrPhys
The physical destination address.
Definition: dma.h:156
uint32_t transferLength
The transfer length register, fill using the TL_* macros.
Definition: dma.h:158
int dma_setChannelActive(int channel, int value)
Sets the channel active bit, this is automatically cleared at the end of each control block chain...
Definition: dma.cpp:411
int dma_isChannelActive(int channel)
Gets the channel active bit, this is automatically cleared at the end of each control block chain...
Definition: dma.cpp:436
Describes a control block, contorl blocks are needed to load the registers of the DMA engine and star...
Definition: dma.h:149
int dma_printRegisters(int channel)
For debug purposes: prints the registers' contents to standard output.
Definition: dma.cpp:239