MTB CAT1 Peripheral driver library

General Description

Functions

__STATIC_INLINE void Cy_DMAC_Enable (DMAC_Type *base)
 Enables the DMACblock. More...
 
__STATIC_INLINE void Cy_DMAC_Disable (DMAC_Type *base)
 Disables the DMACblock. More...
 
__STATIC_INLINE uint32_t Cy_DMAC_GetActiveChannel (DMAC_Type const *base)
 Returns the status of the active/pending channels of the DMACblock. More...
 

Function Documentation

◆ Cy_DMAC_Enable()

__STATIC_INLINE void Cy_DMAC_Enable ( DMAC_Type *  base)

Enables the DMACblock.

Parameters
baseThe pointer to the hardware DMAC block.
Function Usage
#define DATA_COUNT (8UL)
/* Scenario: Initialize a 1D descriptor */
cy_stc_dmac_descriptor_t nextDescriptor;
uint32_t src[DATA_COUNT];
uint32_t dst[DATA_COUNT];
{
.interruptType = CY_DMAC_DESCR,
.triggerOutType = CY_DMAC_DESCR,
.channelState = CY_DMAC_CHANNEL_ENABLED,
.triggerInType = CY_DMAC_DESCR,
.dataSize = CY_DMAC_WORD,
.srcTransferSize = CY_DMAC_TRANSFER_SIZE_WORD,
.dstTransferSize = CY_DMAC_TRANSFER_SIZE_WORD,
.descriptorType = CY_DMAC_1D_TRANSFER,
.srcAddress = &src,
.dstAddress = &dst,
.srcXincrement = 1U,
.dstXincrement = 1U,
.xCount = DATA_COUNT,
.srcYincrement = 0U,
.dstYincrement = 0U,
.yCount = 1UL,
.nextDescriptor = &nextDescriptor,
};
if (CY_DMAC_SUCCESS != Cy_DMAC_Descriptor_Init(&descriptor, &descriptor_cfg))
{
/* Insert error handling */
}
/* Scenario: Setup and enable the DMAC channel 0 */
channelConfig.enable = false;
channelConfig.bufferable = false;
if (CY_DMAC_SUCCESS != Cy_DMAC_Channel_Init(DMAC, 0UL, &channelConfig))
{
/* Insert error handling */
}
Cy_DMAC_Channel_SetDescriptor(DMAC, 0UL, &descriptor);
Cy_DMAC_Channel_SetPriority(DMAC, 0UL, 3UL);

◆ Cy_DMAC_Disable()

__STATIC_INLINE void Cy_DMAC_Disable ( DMAC_Type *  base)

Disables the DMACblock.

Parameters
baseThe pointer to the hardware DMAC block.
Function Usage
/* Scenario: Disable the DMAC channel 0 if it's priority equals 3 */
if (3UL == Cy_DMAC_Channel_GetPriority(DMAC, 0UL))
{
if (0UL != Cy_DMAC_GetActiveChannel(DMAC))
{
/* if needed (if there is only channel used) the whole block can be disabled */
}
}

◆ Cy_DMAC_GetActiveChannel()

__STATIC_INLINE uint32_t Cy_DMAC_GetActiveChannel ( DMAC_Type const *  base)

Returns the status of the active/pending channels of the DMACblock.

Parameters
baseThe pointer to the hardware DMAC block.
Returns
Returns a bit-field with all of the currently active/pending channels in the DMAC block.
Function Usage
/* Scenario: Disable the DMAC channel 0 if it's priority equals 3 */
if (3UL == Cy_DMAC_Channel_GetPriority(DMAC, 0UL))
{
if (0UL != Cy_DMAC_GetActiveChannel(DMAC))
{
/* if needed (if there is only channel used) the whole block can be disabled */
}
}