PSOC E8XXGP Device Support Library

General Description

Functions

__STATIC_INLINE void Cy_DMA_Enable (DW_Type *base)
 Enables the DMA block. More...
 
__STATIC_INLINE void Cy_DMA_Disable (DW_Type *base)
 Disables the DMA block. More...
 
__STATIC_INLINE uint32_t Cy_DMA_GetActiveChannel (DW_Type const *base)
 Returns the status of the active/pending channels in the DMA block. More...
 
__STATIC_INLINE void * Cy_DMA_GetActiveSrcAddress (DW_Type const *base)
 Returns the source address being used for the current transfer. More...
 
__STATIC_INLINE void * Cy_DMA_GetActiveDstAddress (DW_Type const *base)
 Returns the destination address being used for the current transfer. More...
 
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. More...
 
__STATIC_INLINE uint32_t Cy_DMA_GetActiveChannelIndex (DW_Type const *base)
 Returns the index of the active channel within the DMA block. More...
 

Function Documentation

◆ Cy_DMA_Enable()

__STATIC_INLINE void Cy_DMA_Enable ( DW_Type base)

Enables the DMA block.

Parameters
baseThe pointer to the hardware DMA block.
Function Usage
/* Scenario: Initialize a 1D descriptor */
#define DATACNT (8UL)
#define CY_DMA_INTR_MASK (0x01UL)
cy_stc_dma_descriptor_t nextDescriptor;
uint32_t src_data[DATACNT];
uint32_t dst_data[DATACNT];
uint8_t currentYIndex;
/* Enabling the interrupt using the Cy_DMA_Channel_SetInterruptMask function for DMA channel.*/
{
.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_data,
.dstAddress = &dst_data,
.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 */
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);
if (true != Cy_DMA_Channel_IsEnabled(DW0, 0UL))
{
/* Insert error handling */
}
currentYIndex = Cy_DMA_Channel_GetCurrentYIndex(DW0, 0UL);
(void) currentYIndex;
__STATIC_INLINE void Cy_DMA_Enable(DW_Type *base)
Enables the DMA block.
Definition: cy_dma.h:549
__STATIC_INLINE void Cy_DMA_Channel_Enable(DW_Type *base, uint32_t channel)
The function is used to enable a DMA channel.
Definition: cy_dma.h:1542
__STATIC_INLINE void Cy_DMA_Channel_SetDescriptor(DW_Type *base, uint32_t channel, cy_stc_dma_descriptor_t const *descriptor)
Sets a descriptor as current for the specified DMA channel.
Definition: cy_dma.h:1517
__STATIC_INLINE bool Cy_DMA_Channel_IsEnabled(DW_Type *base, uint32_t channel)
The function checks whether a channel is in the enabled state.
Definition: cy_dma.h:1590
cy_en_dma_status_t Cy_DMA_Channel_Init(DW_Type *base, uint32_t channel, cy_stc_dma_channel_config_t const *channelConfig)
Initializes the DMA channel with a descriptor and other parameters.
Definition: cy_dma.c:259
__STATIC_INLINE void Cy_DMA_Channel_SetInterruptMask(DW_Type *base, uint32_t channel, uint32_t interrupt)
Sets an interrupt mask value for the specified channel.
Definition: cy_dma.h:1856
__STATIC_INLINE uint8_t Cy_DMA_Channel_GetCurrentYIndex(DW_Type const *base, uint32_t channel)
Returns the current Y loop index for the channel.
Definition: cy_dma.h:1698
__STATIC_INLINE void Cy_DMA_Channel_SetPriority(DW_Type *base, uint32_t channel, uint32_t priority)
The function is used to set a priority for the DMA channel.
Definition: cy_dma.h:1617
bool enable
This parameter specifies whether the channel is enabled after initializing.
Definition: cy_dma.h:388
bool bufferable
This parameter specifies whether a write transaction can complete.
Definition: cy_dma.h:389
bool preemptable
Specifies whether the channel is preemptable by another higher-priority channel.
Definition: cy_dma.h:386
cy_en_dma_retrigger_t retrigger
Specifies whether the DW controller should wait for the input trigger to be deactivated.
Definition: cy_dma.h:359
This structure holds the initialization values for the DMA channel.
Definition: cy_dma.h:384
This structure is a configuration structure pre-initialized by the user and passed as a parameter to ...
Definition: cy_dma.h:358
DMA descriptor structure type.
Definition: cy_dma.h:340
cy_en_dma_status_t Cy_DMA_Descriptor_Init(cy_stc_dma_descriptor_t *descriptor, cy_stc_dma_descriptor_config_t const *config)
Initializes the descriptor structure in SRAM from a pre-initialized configuration structure.
Definition: cy_dma.c:107
@ CY_DMA_WORD
Full word (four bytes).
Definition: cy_dma.h:220
@ CY_DMA_TRANSFER_SIZE_WORD
A full word (four bytes).
Definition: cy_dma.h:236
@ CY_DMA_DESCR
One descriptor transfer.
Definition: cy_dma.h:211
@ CY_DMA_1D_TRANSFER
1D transfer.
Definition: cy_dma.h:201
@ CY_DMA_CHANNEL_ENABLED
Channel stays enabled.
Definition: cy_dma.h:242
@ CY_DMA_RETRIG_IM
Retrigger immediately.
Definition: cy_dma.h:226
@ CY_DMA_SUCCESS
Success.
Definition: cy_dma.h:249
#define CY_DMA_INTR_MASK
The DMA channel interrupt mask.
Definition: cy_dma.h:155

◆ Cy_DMA_Disable()

__STATIC_INLINE void Cy_DMA_Disable ( DW_Type base)

Disables the DMA block.

Parameters
baseThe pointer to the hardware 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))
{
/* if needed (if there is only channel used) the whole block can be disabled */
}
}
__STATIC_INLINE uint32_t Cy_DMA_GetActiveChannel(DW_Type const *base)
Returns the status of the active/pending channels in the DMA block.
Definition: cy_dma.h:597
__STATIC_INLINE void Cy_DMA_Disable(DW_Type *base)
Disables the DMA block.
Definition: cy_dma.h:568
__STATIC_INLINE uint32_t Cy_DMA_Channel_GetPriority(DW_Type const *base, uint32_t channel)
Returns the priority of the DMA channel.
Definition: cy_dma.h:1645
__STATIC_INLINE void Cy_DMA_Channel_Disable(DW_Type *base, uint32_t channel)
The function is used to disable a DMA channel.
Definition: cy_dma.h:1566
void Cy_DMA_Channel_DeInit(DW_Type *base, uint32_t channel)
Clears the content of registers corresponding to the channel.
Definition: cy_dma.c:302

◆ Cy_DMA_GetActiveChannel()

__STATIC_INLINE uint32_t Cy_DMA_GetActiveChannel ( DW_Type const *  base)

Returns the status of the active/pending channels in the DMA block.

Parameters
baseThe pointer to the hardware DMA block.
Returns
For DW Version 1 based devices, returns a bit-field with all of the currently active/pending channels in the DMA block.
Note
For DW Version 2 based devices, returns a bit-field with first 32 channels currently active/pending in the DMA block. In addition to this, user can get the active channel index using Cy_DMA_GetActiveChannelIndex.
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))
{
/* if needed (if there is only channel used) the whole block can be disabled */
}
}

◆ Cy_DMA_GetActiveSrcAddress()

__STATIC_INLINE void * Cy_DMA_GetActiveSrcAddress ( DW_Type const *  base)

Returns the source address being used for the current transfer.

Parameters
baseThe pointer to the hardware DMA block.
Returns
Returns the pointer to the source of 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 */
}
__STATIC_INLINE void * Cy_DMA_GetActiveSrcAddress(DW_Type const *base)
Returns the source address being used for the current transfer.
Definition: cy_dma.h:664
__STATIC_INLINE void * Cy_DMA_GetActiveDstAddress(DW_Type const *base)
Returns the destination address being used for the current transfer.
Definition: cy_dma.h:686

◆ Cy_DMA_GetActiveDstAddress()

__STATIC_INLINE void * Cy_DMA_GetActiveDstAddress ( DW_Type const *  base)

Returns the destination address being used for the current transfer.

Parameters
baseThe pointer to the hardware DMA block.
Returns
Returns the pointer to the destination of 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 */
}

◆ Cy_DMA_Crc_Init()

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.

Parameters
baseThe pointer to the hardware DMA block.
crcConfigThe pointer to the CRC configuration structure cy_stc_dma_crc_config_t.
Returns
The status cy_en_dma_status_t .
Function Usage
/* Scenario: Setup the CRC for DMA block DW0 */
{
.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 */
}
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.
Definition: cy_dma.c:55
bool dataReverse
Specifies the bit order in which a data byte is processed (reversal is performed after XORing): 'fals...
Definition: cy_dma.h:397
This structure holds the initialization values for the CRC feature, only for CPUSS_ver2.
Definition: cy_dma.h:396

◆ Cy_DMA_GetActiveChannelIndex()

__STATIC_INLINE uint32_t Cy_DMA_GetActiveChannelIndex ( DW_Type const *  base)

Returns the index of the active channel within the DMA block.

Parameters
baseThe pointer to the hardware DMA block.
Returns
active channel index if present otherwise CY_DMA_NO_ACTIVE_CHANNELS