![]() |
![]() |
|
CC35xxDriverLibrary
|
|
Macros | |
| #define | DMA_NUM_CHANNELS 12 |
| Number of available DMA channels. More... | |
| #define | DMA_CH_OFFSET 0x1000 |
| DMA channel memory map offset, in bytes. More... | |
| #define | DMA_CHCTL_FIELD_WIDTH HOST_DMA_CHCTL0_CH0_W |
| DMA channel control field width, in number of bits (CHCTL register) More... | |
| #define | DMA_CHCTRL_NUMBER_OF_FIELDS (32 / DMA_CHCTL_FIELD_WIDTH) |
| Number of fields in CHCTL register. More... | |
| #define | DMA_CONFIG_SRC_PTR_WRAP HOST_DMA_CH0JCTL_BLKMODESRC |
| #define | DMA_CONFIG_DST_PTR_WRAP HOST_DMA_CH0JCTL_BLKMODEDST |
| #define | DMA_CONFIG_FORCE_REQ HOST_DMA_CH0JCTL_DMASIGBPS |
| #define | DMA_CONFIG_SRC_PTR_FIFO HOST_DMA_CH0JCTL_FIFOMODS |
| Source pointer (FIFO mode) More... | |
| #define | DMA_CONFIG_DST_PTR_FIFO HOST_DMA_CH0JCTL_FIFOMODD |
| Destination pointer (FIFO mode) More... | |
| #define | DMA_CONFIG_RX 0x00000000U |
| Link DMA channel to RX port of peripheral. More... | |
| #define | DMA_CONFIG_TX HOST_DMA_CH0JCTL_SRCDSTCFG |
| Link DMA channel to TX port of peripheral. More... | |
| #define | DMA_CONFIG_CLEAR_AT_JOB_START HOST_DMA_CH0JCTL_ENCLR |
| Enable DMA to set a rd/wr clear pulse at the beginning of a job (one cycle after run cmd) More... | |
| #define | DMA_CONFIG_ALLOWED_MASK |
| Bitmask of allowed flags passed to DMAConfigureChannel() and DMAConfigureChannelFlags(). More... | |
| #define | DMA_WORD_SIZE_1B 2 |
| Word size is 1 byte. More... | |
| #define | DMA_WORD_SIZE_2B 1 |
| Word size is 2 bytes. More... | |
| #define | DMA_WORD_SIZE_4B 0 |
| Word size is 4 bytes. More... | |
Enumerations | |
| enum | DMAPeripheral { DMA_PERIPH_UARTLIN_0 = 0, DMA_PERIPH_UARTLIN_1 = 1, DMA_PERIPH_SPI_0 = 2, DMA_PERIPH_SPI_1 = 3, DMA_PERIPH_I2C_0 = 4, DMA_PERIPH_I2C_1 = 5, DMA_PERIPH_SDMMC = 6, DMA_PERIPH_SDIO = 7, DMA_PERIPH_MCAN = 8, DMA_PERIPH_ADC = 9, DMA_PERIPH_PDM = 10, DMA_PERIPH_HIF = 11, DMA_PERIPH_UARTLIN_2 = 12, DMA_NUM_PERIPHS = 13 } |
| DMA peripheral ports enumerations for use with DMAInitChannel(). More... | |
| enum | DMAChannelStatus { DMA_HW_EVT_NO_EVENT = 0, DMA_HW_EVT_TRANS_DONE = 1, DMA_HW_EVT_ABORTED = 2, DMA_HW_EVT_EXC = 4 } |
| enum | DMACommand { DMA_CMD_RUN = 1, DMA_CMD_ABORT = 2, DMA_CMD_INIT = 4 } |
Functions | |
| void | DMAInitChannel (uint32_t channel, DMAPeripheral peripheral) |
| Initialize DMA channel by mapping it to a peripheral. More... | |
| void | DMAConfigureChannel (uint32_t channel, uint8_t blockSize, uint8_t wordSize, uint32_t config) |
| Configure job for the specified channel. More... | |
| void | DMAStartTransaction (uint32_t channel, const uint32_t *srcStartAddr, uint32_t *dstStartAddr, uint16_t transLenByte, bool remainingBytesBurst) |
| Start job for the specified channel. More... | |
| uint32_t | DMAGetChannelStatus (uint32_t channel) |
| Returns the status of the specified channel. More... | |
| uint32_t | DMAGetChannelDirection (uint32_t channel) |
| Returns the direction of the specified channel. More... | |
| __STATIC_INLINE void | DMAEnableInt (uint32_t channelMask) |
| Enables DMA interrupt sources. More... | |
| __STATIC_INLINE void | DMADisableInt (uint32_t channelMask) |
| Disables DMA channel interrupts. More... | |
| __STATIC_INLINE void | DMAClearInt (uint32_t channelMask) |
| Clears DMA interrupt sources. More... | |
| __STATIC_INLINE uint32_t | DMAIntStatus (bool masked) |
| Gets the current interrupt status. More... | |
| __STATIC_INLINE void | DMAConfigureChannelFlags (uint32_t channel, uint32_t config) |
| Clear all flags and set the specified channel flags. More... | |
| __STATIC_INLINE void | DMAEnableDestinationFifoMode (uint32_t channel) |
| Enable FIFO mode behavior for the destination pointer. More... | |
| __STATIC_INLINE void | DMADisableDestinationFifoMode (uint32_t channel) |
| Disable FIFO mode behavior for the destination pointer. More... | |
| __STATIC_INLINE uint32_t | DMAGetChannelPeripheral (uint32_t channel) |
| Get channel linked peripheral. More... | |
| #define DMA_NUM_CHANNELS 12 |
Number of available DMA channels.
Referenced by DMAConfigureChannel(), DMAConfigureChannelFlags(), DMADisableDestinationFifoMode(), DMAEnableDestinationFifoMode(), DMAGetChannelDirection(), DMAGetChannelStatus(), DMAInitChannel(), and DMAStartTransaction().
| #define DMA_CH_OFFSET 0x1000 |
DMA channel memory map offset, in bytes.
Referenced by DMAConfigureChannel(), DMAConfigureChannelFlags(), DMADisableDestinationFifoMode(), DMAEnableDestinationFifoMode(), DMAGetChannelDirection(), DMAGetChannelStatus(), and DMAStartTransaction().
| #define DMA_CHCTL_FIELD_WIDTH HOST_DMA_CHCTL0_CH0_W |
DMA channel control field width, in number of bits (CHCTL register)
Referenced by DMAGetChannelPeripheral(), and DMAInitChannel().
| #define DMA_CHCTRL_NUMBER_OF_FIELDS (32 / DMA_CHCTL_FIELD_WIDTH) |
Number of fields in CHCTL register.
Referenced by DMAGetChannelPeripheral(), and DMAInitChannel().
| #define DMA_CONFIG_SRC_PTR_WRAP HOST_DMA_CH0JCTL_BLKMODESRC |
Source pointer wraps around (block mode) (non-block mode by default - incremental)
| #define DMA_CONFIG_DST_PTR_WRAP HOST_DMA_CH0JCTL_BLKMODEDST |
Destination pointer wraps around (block mode) (non-block mode by default - incremental)
| #define DMA_CONFIG_FORCE_REQ HOST_DMA_CH0JCTL_DMASIGBPS |
Tie DMA request signal high. This indicates to DMA arbiter that both source and destination is ready for transaction. Set this bit when doing memory-to-memory transactions.
| #define DMA_CONFIG_SRC_PTR_FIFO HOST_DMA_CH0JCTL_FIFOMODS |
Source pointer (FIFO mode)
| #define DMA_CONFIG_DST_PTR_FIFO HOST_DMA_CH0JCTL_FIFOMODD |
Destination pointer (FIFO mode)
| #define DMA_CONFIG_RX 0x00000000U |
Link DMA channel to RX port of peripheral.
| #define DMA_CONFIG_TX HOST_DMA_CH0JCTL_SRCDSTCFG |
Link DMA channel to TX port of peripheral.
| #define DMA_CONFIG_CLEAR_AT_JOB_START HOST_DMA_CH0JCTL_ENCLR |
Enable DMA to set a rd/wr clear pulse at the beginning of a job (one cycle after run cmd)
| #define DMA_CONFIG_ALLOWED_MASK |
Bitmask of allowed flags passed to DMAConfigureChannel() and DMAConfigureChannelFlags().
Referenced by DMAConfigureChannel(), and DMAConfigureChannelFlags().
| #define DMA_WORD_SIZE_1B 2 |
Word size is 1 byte.
| #define DMA_WORD_SIZE_2B 1 |
Word size is 2 bytes.
| #define DMA_WORD_SIZE_4B 0 |
Word size is 4 bytes.
| enum DMAPeripheral |
DMA peripheral ports enumerations for use with DMAInitChannel().
| enum DMAChannelStatus |
| enum DMACommand |
| void DMAInitChannel | ( | uint32_t | channel, |
| DMAPeripheral | peripheral | ||
| ) |
Initialize DMA channel by mapping it to a peripheral.
| channel | is the DMA channel to configure. |
| peripheral | is the peripheral (see DMAPeripheral). |
References ASSERT, DMA_CHCTL_FIELD_WIDTH, DMA_CHCTRL_NUMBER_OF_FIELDS, DMA_NUM_CHANNELS, DMA_NUM_PERIPHS, HOST_DMA_CHCTL0_CH0_M, HOST_DMA_O_CHCTL0, HOST_DMA_TGT_BASE, and HWREG.
| void DMAConfigureChannel | ( | uint32_t | channel, |
| uint8_t | blockSize, | ||
| uint8_t | wordSize, | ||
| uint32_t | config | ||
| ) |
Configure job for the specified channel.
This function must be called after DMAInitChannel().
| channel | is the DMA channel to configure. |
| blockSize | is size of the block in words (up to 64 words). If block mode is enabled, defines the address wrap around. Since channel arbitration decisions are made every block, this also effect how much bandwidth is given to a specific channel. |
| wordSize | is the word size. The parameter can have one of these three values: |
| config | is the DMA channel configuration for the peripheral. The parameter is the bitwise OR of five values (all values set to 0 by default):
|
References ASSERT, DMA_BLOCK_SIZE_MAX, DMA_BLOCK_SIZE_MIN, DMA_CH_OFFSET, DMA_CONFIG_ALLOWED_MASK, DMA_NUM_CHANNELS, HOST_DMA_CH0JCTL_BLKSIZE_M, HOST_DMA_CH0JCTL_BLKSIZE_S, HOST_DMA_CH0JCTL_WORDSIZE_M, HOST_DMA_CH0JCTL_WORDSIZE_S, HOST_DMA_O_CH0JCTL, HOST_DMA_TGT_BASE, and HWREG.
| void DMAStartTransaction | ( | uint32_t | channel, |
| const uint32_t * | srcStartAddr, | ||
| uint32_t * | dstStartAddr, | ||
| uint16_t | transLenByte, | ||
| bool | remainingBytesBurst | ||
| ) |
Start job for the specified channel.
This function must be called after DMAConfigureChannel().
| channel | is the DMA channel to start. |
| srcStartAddr | is a pointer to the source data. |
| dstStartAddr | is a pointer to the destination data. |
| transLenByte | is the number of bytes to transfer |
| remainingBytesBurst | enables transaction optimization in specific cases. |
remainingBytesBurst can only be used with the DMA_PERIPH_HIF peripheral!When blockSize ( DMAConfigureChannel()) is not a multiple of transLenByte, the last transaction will be less than blockSize. By default, this last copy will execute word by word. When multiple DMA channels work parallel the DMA round-robin algorithm will move to other channels between every word. When setting this flag to true, the behavior will change to copy the all remaining bytes at once, BUT only after the destination peripheral asserts the request signal to the DMA. For example, UART TX will assert the request flag once the TX buffer is empty.
References ASSERT, DMA_CH_OFFSET, DMA_CMD_RUN, DMA_MAX_TRANSACTION_BYTES, DMA_NUM_CHANNELS, HOST_DMA_CH0OPTR_OPTR_M, HOST_DMA_CH0OPTR_OPTR_S, HOST_DMA_CH0TCTL2_CMD_M, HOST_DMA_CH0TCTL2_CMD_S, HOST_DMA_CH0TCTL_BURSTREQ, HOST_DMA_CH0TCTL_TRANSB_M, HOST_DMA_CH0TCTL_TRANSB_S, HOST_DMA_CH0TIPTR_IPTR_M, HOST_DMA_CH0TIPTR_IPTR_S, HOST_DMA_O_CH0OPTR, HOST_DMA_O_CH0TCTL, HOST_DMA_O_CH0TCTL2, HOST_DMA_O_CH0TIPTR, HOST_DMA_TGT_BASE, and HWREG.
| uint32_t DMAGetChannelStatus | ( | uint32_t | channel | ) |
Returns the status of the specified channel.
| channel | is the DMA channel. |
References ASSERT, DMA_CH_OFFSET, DMA_NUM_CHANNELS, HOST_DMA_CH0STA_HWEVENT_M, HOST_DMA_CH0STA_HWEVENT_S, HOST_DMA_O_CH0STA, HOST_DMA_TGT_BASE, and HWREG.
| uint32_t DMAGetChannelDirection | ( | uint32_t | channel | ) |
Returns the direction of the specified channel.
| channel | is the DMA channel. |
References ASSERT, DMA_CH_OFFSET, DMA_NUM_CHANNELS, HOST_DMA_CH0JCTL_SRCDSTCFG_M, HOST_DMA_O_CH0JCTL, HOST_DMA_TGT_BASE, and HWREG.
| __STATIC_INLINE void DMAEnableInt | ( | uint32_t | channelMask | ) |
Enables DMA interrupt sources.
This function enables the indicated DMA interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.
| channelMask | is the bit mask of the DMA channel interrupts to be enabled. Bit 0 enables channel 0, bit 1 channel 1, and so on. |
References HWREG, SOC_AAON_BASE, and SOC_AAON_O_DMASIMASK.
| __STATIC_INLINE void DMADisableInt | ( | uint32_t | channelMask | ) |
Disables DMA channel interrupts.
This function disables the indicated DMA interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.
| channelMask | is the bit mask of the DMA channel interrupts to disable. Bit 0 disables channel 0, bit 1 channel 1, and so on. |
References HWREG, SOC_AAON_BASE, and SOC_AAON_O_DMASIMASK.
| __STATIC_INLINE void DMAClearInt | ( | uint32_t | channelMask | ) |
Clears DMA interrupt sources.
The specified DMA interrupt sources are cleared, so that they no longer assert. This function must be called in the interrupt handler to keep the interrupt from being recognized again immediately upon exit.
| channelMask | is a bit mask of the channel interrupts to be cleared. |
References HWREG, SOC_AAON_BASE, and SOC_AAON_O_DMASICLR.
| __STATIC_INLINE uint32_t DMAIntStatus | ( | bool | masked | ) |
Gets the current interrupt status.
This function returns the interrupt status for the DMA. Either the raw interrupt status or the status of interrupts that are allowed to reflect to the processor can be returned.
| masked | selects either raw or masked interrupt.
|
References HWREG, SOC_AAON_BASE, SOC_AAON_O_DMASICLR, and SOC_AAON_O_DMASMIS.
| __STATIC_INLINE void DMAConfigureChannelFlags | ( | uint32_t | channel, |
| uint32_t | config | ||
| ) |
Clear all flags and set the specified channel flags.
This function can be called after DMAConfigureChannel() when need to set specific flags. As a first step. the function clear all flags and then set the specified channel flags.
| channel | is the DMA channel to configure. |
| config | is the DMA channel configuration for the peripheral. The parameter is the bitwise OR of five values:
|
References ASSERT, DMA_CH_OFFSET, DMA_CONFIG_ALLOWED_MASK, DMA_NUM_CHANNELS, HOST_DMA_O_CH0JCTL, HOST_DMA_TGT_BASE, and HWREG.
| __STATIC_INLINE void DMAEnableDestinationFifoMode | ( | uint32_t | channel | ) |
Enable FIFO mode behavior for the destination pointer.
When FIFO mode is enabled, the destination pointer is not incremented.
This function can be called after DMAInitChannel().
| channel | is the DMA channel to configure. |
References ASSERT, DMA_CH_OFFSET, DMA_NUM_CHANNELS, HOST_DMA_CH0JCTL_FIFOMODD, HOST_DMA_O_CH0JCTL, HOST_DMA_TGT_BASE, and HWREG.
| __STATIC_INLINE void DMADisableDestinationFifoMode | ( | uint32_t | channel | ) |
Disable FIFO mode behavior for the destination pointer.
When FIFO mode is disabled, the destination pointer will be incremented after every transfer according to the word size.
This function can be called after DMAInitChannel().
| channel | is the DMA channel to configure. |
References ASSERT, DMA_CH_OFFSET, DMA_NUM_CHANNELS, HOST_DMA_CH0JCTL_FIFOMODD, HOST_DMA_O_CH0JCTL, HOST_DMA_TGT_BASE, and HWREG.
| __STATIC_INLINE uint32_t DMAGetChannelPeripheral | ( | uint32_t | channel | ) |
Get channel linked peripheral.
This function can be called after DMAInitChannel() when need to get the linked peripheral to specific channel.
| channel | is the DMA channel to get linked peripheral. |
References DMA_CHCTL_FIELD_WIDTH, DMA_CHCTRL_NUMBER_OF_FIELDS, HOST_DMA_O_CHCTL0, HOST_DMA_TGT_BASE, and HWREG.