Direct Memory Access Function Documentation
Sys_DMA_ChannelConfig
void Sys_DMA_ChannelConfig(DMA_Type * dma, uint32_t cfg, uint32_t transferLength, uint32_t counterInt, uint32_t srcAddr, uint32_t destAddr)
Location: dma.h:62
Parameters
Direction | Name | Description |
---|---|---|
in |
dma |
Pointer to the DMA instance |
in |
cfg |
Configuration of the DMA transfer behavior; use DMA_[LITTLE | BIG]_ENDIAN, [DEST | SRC]_TRANS_LENGTH_SEL, DMA_PRIORITY_[0 | 1 | 2 | 3], DMA_SRC_* DMA_DEST_* WORD_SIZE_*, DMA_SRC_ADDR_*, DMA_DEST_ADDR_*, DMA_SRC_ADDR_LSB_TOGGLE_[DISABLE | ENABLE], DMA_CNT_INT_[DISABLE | ENABLE], DMA_COMPLETE_INT_[DISABLE | ENABLE] |
in |
transferLength |
Configuration of the DMA transfer length |
in |
counterInt |
Configuration of when the counter interrupt will occur during the transfer |
in |
srcAddr |
Base source address for the DMA transfer |
in |
destAddr |
Base destination address for the DMA transfer |
Example Code for Sys_DMA_ChannelConfig |
// Configure the DMA1 channels for data transfer using a transfer length of 4 // and interrupting at the beginning of the transfer uint32_t srcAddr = (uint32_t)0x2001ffc8; uint32_t destAddr = (uint32_t)0x2001ffb8; Sys_DMA_ChannelConfig(DMA1, DMA_BIG_ENDIAN | DEST_TRANS_LENGTH_SEL | DMA_PRIORITY_1 | DMA_CNT_INT_ENABLE, 4, 0, srcAddr, destAddr); |
Sys_DMA_Mode_Enable
void Sys_DMA_Mode_Enable(DMA_Type * dma, uint32_t mode)
Location: dma.h:107
Parameters
Direction | Name | Description |
---|---|---|
in |
dma |
Pointer to the DMA instance |
in |
mode |
Enable mode of operation of the DMA Channel; use DMA_[DISABLE | ENABLE | DMA_ENABLE_WRAP | DMA_ENABLE_WRAP_RESTART | DMA_TRIGGER DMA_TRIGGER_WRAP | DMA_TRIGGER_WRAP_RESTART] |
Example Code for Sys_DMA_Mode_Enable |
// Enable DMA1 Sys_DMA_Mode_Enable(DMA1, DMA_ENABLE); |
Sys_DMA_Get_Status
uint32_t Sys_DMA_Get_Status(DMA_Type * dma)
Location: dma.h:120
Parameters
Direction | Name | Description |
---|---|---|
in |
dma |
Pointer to the DMA instance |
Return
Example Code for Sys_DMA_Get_Status |
// Get the current status of DMA channel 1 result = Sys_DMA_Get_Status(DMA1); |
Sys_DMA_Clear_Status
void Sys_DMA_Clear_Status(DMA_Type * dma, uint32_t ctrl)
Location: dma.h:133
Parameters
Direction | Name | Description |
---|---|---|
in |
dma |
Pointer to the DMA instance |
in |
ctrl |
Data to be written to the DMA_SATUS register |
Example Code for Sys_DMA_Clear_Status |
// Clear the status register of DMA channel 1 result = Sys_DMA_Clear_Status(DMA1, DMA_COMPLETE_INT_CLEAR | DMA_CNT_INT_CLEAR); |
Sys_DMA_Set_Ctrl
void Sys_DMA_Set_Ctrl(DMA_Type * dma, uint32_t ctrl)
Location: dma.h:145
Parameters
Direction | Name | Description |
---|---|---|
in |
dma |
Pointer to the DMA instance |
in |
ctrl |
Data to be written to the DMA_CTRL register |
Example Code for Sys_DMA_Set_Ctrl |
// Enables DMA channel 1 which will disable the DMA when the transfer is completed. result = Sys_DMA_Set_Ctrl(DMA1, DMA_ENABLE); |