Block Functions¶
-
group
group_dma_block_functions
Functions
-
__STATIC_INLINE void Cy_DMA_Enable (DW_Type *base)
Enables the DMA block.
- Function Usage
/* Scenario: Initialize a 1D descriptor */ #define DATACNT (8UL) cy_stc_dma_descriptor_t descriptor; cy_stc_dma_descriptor_t nextDescriptor; uint32_t src[DATACNT]; uint32_t dst[DATACNT]; cy_stc_dma_descriptor_config_t descriptor_cfg = { .retrigger = CY_DMA_RETRIG_IM, .interruptType = CY_DMA_DESCR, .triggerOutType = CY_DMA_DESCR, .channelState = CY_DMA_CHANNEL_ENABLED, .triggerInType = CY_DMA_DESCR, .dataSize = CY_DMA_WORD, .srcTransferSize = CY_DMA_TRANSFER_SIZE_WORD, .dstTransferSize = CY_DMA_TRANSFER_SIZE_WORD, .descriptorType = CY_DMA_1D_TRANSFER, .srcAddress = &src, .dstAddress = &dst, .srcXincrement = 1U, .dstXincrement = 1U, .xCount = DATACNT, .srcYincrement = 0U, .dstYincrement = 0U, .yCount = 1UL, .nextDescriptor = &nextDescriptor, }; if (CY_DMA_SUCCESS != Cy_DMA_Descriptor_Init(&descriptor, &descriptor_cfg)) { /* Insert error handling */ } /* Scenario: Setup and enable the DMA channel 0 of block DW0 */ cy_stc_dma_channel_config_t channelConfig; channelConfig.preemptable = false; channelConfig.enable = false; channelConfig.bufferable = false; if (CY_DMA_SUCCESS != Cy_DMA_Channel_Init(DW0, 0UL, &channelConfig)) { /* Insert error handling */ } Cy_DMA_Channel_SetDescriptor(DW0, 0UL, &descriptor); Cy_DMA_Channel_SetPriority(DW0, 0UL, 3UL); Cy_DMA_Channel_Enable(DW0, 0UL); Cy_DMA_Enable(DW0);
- Parameters
base – The pointer to the hardware DMA block.
-
__STATIC_INLINE void Cy_DMA_Disable (DW_Type *base)
Disables the DMA block.
- Function Usage
/* Scenario: Disable the DMA channel 0 of block DW0 if it's priority equals 3 */ if (3UL == Cy_DMA_Channel_GetPriority(DW0, 0UL)) { if (0UL != Cy_DMA_GetActiveChannel(DW0)) { Cy_DMA_Channel_Disable(DW0, 0UL); Cy_DMA_Channel_DeInit(DW0, 0UL); /* if needed (if there is only channel used) the whole block can be disabled */ Cy_DMA_Disable(DW0); } }
- Parameters
base – The pointer to the hardware DMA block.
-
__STATIC_INLINE uint32_t Cy_DMA_GetActiveChannel (DW_Type const *base)
Returns the status of the active/pending channels.
the DMA block.
- Function Usage
/* Scenario: Disable the DMA channel 0 of block DW0 if it's priority equals 3 */ if (3UL == Cy_DMA_Channel_GetPriority(DW0, 0UL)) { if (0UL != Cy_DMA_GetActiveChannel(DW0)) { Cy_DMA_Channel_Disable(DW0, 0UL); Cy_DMA_Channel_DeInit(DW0, 0UL); /* if needed (if there is only channel used) the whole block can be disabled */ Cy_DMA_Disable(DW0); } }
- Parameters
base – The pointer to the hardware DMA block.
- Returns
Returns a bit-field with all of the currently active/pending channels in the DMA block.
-
__STATIC_INLINE void * Cy_DMA_GetActiveSrcAddress (DW_Type const *base)
Returns the source address being used for the current transfer.
- Function Usage
/* Scenario: Make sure the array is not in use before modifying the array */ uint32_t array[16]; if (((void*) array != Cy_DMA_GetActiveSrcAddress(DW0)) && ((void*) array != Cy_DMA_GetActiveDstAddress(DW0))) { /* Modify the array content here */ }
- Parameters
base – The pointer to the hardware DMA block.
- Returns
Returns the pointer to the source of transfer.
-
__STATIC_INLINE void * Cy_DMA_GetActiveDstAddress (DW_Type const *base)
Returns the destination address being used for the current transfer.
- Function Usage
/* Scenario: Make sure the array is not in use before modifying the array */ uint32_t array[16]; if (((void*) array != Cy_DMA_GetActiveSrcAddress(DW0)) && ((void*) array != Cy_DMA_GetActiveDstAddress(DW0))) { /* Modify the array content here */ }
- Parameters
base – The pointer to the hardware DMA block.
- Returns
Returns the pointer to the destination of transfer.
-
cy_en_dma_status_t
Cy_DMA_Crc_Init
(DW_Type *base, cy_stc_dma_crc_config_t const *crcConfig) Initializes the DMA CRC functionality.
- Function Usage
/* Scenario: Setup the CRC for DMA block DW0 */ cy_stc_dma_crc_config_t crcConfig = { .dataReverse = false, .dataXor = 0x00000000UL, .polynomial = 0x04C11DB7UL, .reminderReverse = false, .reminderXor = 0x00000000UL, .lfsrInitVal = 0xFFFFFFFFUL }; if (CY_DMA_SUCCESS != Cy_DMA_Crc_Init(DW0, &crcConfig)) { /* Insert error handling */ }
- Parameters
base – The pointer to the hardware DMA block.
crcConfig – The pointer to the CRC configuration structure cy_stc_dma_crc_config_t.
- Returns
The status /ref cy_en_dma_status_t.
-