PSOC E8XXGP Device Support Library

| PSOC E8XXGP Device Support Library

Functions
Channel Functions
PDL API Reference » DMA (Direct Memory Access) » Functions

## General Description

## Functions
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. More...
void | Cy_DMA_Channel_DeInit (DW_Type *base, uint32_t channel)
| Clears the content of registers corresponding to the channel. More...
__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. More...
__STATIC_INLINE void | Cy_DMA_Channel_Enable (DW_Type *base, uint32_t channel)
| The function is used to enable a DMA channel. More...
__STATIC_INLINE bool | Cy_DMA_Channel_IsEnabled (DW_Type *base, uint32_t channel)
| The function checks whether a channel is in the enabled state. More...
__STATIC_INLINE void | Cy_DMA_Channel_Disable (DW_Type *base, uint32_t channel)
| The function is used to disable a DMA channel. More...
__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. More...
__STATIC_INLINE uint32_t | Cy_DMA_Channel_GetPriority (DW_Type const *base, uint32_t channel)
| Returns the priority of the DMA channel. More...
__STATIC_INLINE cy_en_dma_intr_cause_t | Cy_DMA_Channel_GetStatus (DW_Type const *base, uint32_t channel)
| Returns the interrupt reason of the specified channel. More...
__STATIC_INLINE cy_stc_dma_descriptor_t * | Cy_DMA_Channel_GetCurrentDescriptor (DW_Type const *base, uint32_t channel)
| Returns the descriptor that is active in the channel. More...
__STATIC_INLINE uint8_t | Cy_DMA_Channel_GetCurrentYIndex (DW_Type const *base, uint32_t channel)
| Returns the current Y loop index for the channel. More...
__STATIC_INLINE uint32_t | Cy_DMA_Channel_GetInterruptStatus (DW_Type const *base, uint32_t channel)
| Returns the interrupt status of the specified channel. More...
__STATIC_INLINE void | Cy_DMA_Channel_ClearInterrupt (DW_Type *base, uint32_t channel)
| Clears the interrupt status of the specified channel. More...
__STATIC_INLINE void | Cy_DMA_Channel_SetInterrupt (DW_Type *base, uint32_t channel)
| Sets the interrupt for the specified channel. More...
__STATIC_INLINE uint32_t | Cy_DMA_Channel_GetInterruptMask (DW_Type const *base, uint32_t channel)
| Returns the interrupt mask value of the specified channel. More...
__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. More...
__STATIC_INLINE uint32_t | Cy_DMA_Channel_GetInterruptStatusMasked (DW_Type const *base, uint32_t channel)
| Returns the logical AND of the corresponding INTR and INTR_MASK fields in a single-load operation. More...
__STATIC_FORCEINLINE void | Cy_DMA_Channel_SetSWTrigger (DW_Type const *base, uint32_t channel)
| The function is used to set a SW trigger for a channel. More...

## Function Documentation

## ◆ Cy_DMA_Channel_Init()

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.

Parameters

  base | The pointer to the hardware DMA block.
  channel | A channel number.
  channelConfig | The structure that has the initialization information for the channel.

Returns
  The status cy_en_dma_status_t .

Function Usage
  /* Scenario: Initialize a 1D descriptor */
  #define DATACNT (8UL)
  #define CY_DMA_INTR_MASK (0x01UL)
  cy_stc_dma_descriptor_t descriptor;
  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.*/
  Cy_DMA_Channel_SetInterruptMask(DW0, 0UL, CY_DMA_INTR_MASK);
  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_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 */
  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);
  if (true != Cy_DMA_Channel_IsEnabled(DW0, 0UL))
  {
  /* Insert error handling */
  }
  currentYIndex = Cy_DMA_Channel_GetCurrentYIndex(DW0, 0UL);
  (void) currentYIndex;
  Cy_DMA_Enable
  __STATIC_INLINE void Cy_DMA_Enable(DW_Type *base)
  Enables the DMA block.
  Definition: cy_dma.h:552
  Cy_DMA_Channel_Enable
  __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:1545
  Cy_DMA_Channel_SetDescriptor
  __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:1520
  Cy_DMA_Channel_IsEnabled
  __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:1593
  Cy_DMA_Channel_Init
  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
  Cy_DMA_Channel_SetInterruptMask
  __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:1859
  Cy_DMA_Channel_GetCurrentYIndex
  __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:1701
  Cy_DMA_Channel_SetPriority
  __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:1620
  cy_stc_dma_channel_config_t::enable
  bool enable
  This parameter specifies whether the channel is enabled after initializing.
  Definition: cy_dma.h:391
  cy_stc_dma_channel_config_t::bufferable
  bool bufferable
  This parameter specifies whether a write transaction can complete.
  Definition: cy_dma.h:392
  cy_stc_dma_channel_config_t::preemptable
  bool preemptable
  Specifies whether the channel is preemptable by another higher-priority channel.
  Definition: cy_dma.h:389
  cy_stc_dma_descriptor_config_t::retrigger
  cy_en_dma_retrigger_t retrigger
  Specifies whether the DW controller should wait for the input trigger to be deactivated.
  Definition: cy_dma.h:362
  cy_stc_dma_channel_config_t
  This structure holds the initialization values for the DMA channel.
  Definition: cy_dma.h:387
  cy_stc_dma_descriptor_config_t
  This structure is a configuration structure pre-initialized by the user and passed as a parameter to ...
  Definition: cy_dma.h:361
  cy_stc_dma_descriptor_t
  DMA descriptor structure type.
  Definition: cy_dma.h:343
  Cy_DMA_Descriptor_Init
  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
  @ CY_DMA_WORD
  Full word (four bytes).
  Definition: cy_dma.h:223
  CY_DMA_TRANSFER_SIZE_WORD
  @ CY_DMA_TRANSFER_SIZE_WORD
  A full word (four bytes).
  Definition: cy_dma.h:239
  CY_DMA_DESCR
  @ CY_DMA_DESCR
  One descriptor transfer.
  Definition: cy_dma.h:214
  CY_DMA_1D_TRANSFER
  @ CY_DMA_1D_TRANSFER
  1D transfer.
  Definition: cy_dma.h:204
  CY_DMA_CHANNEL_ENABLED
  @ CY_DMA_CHANNEL_ENABLED
  Channel stays enabled.
  Definition: cy_dma.h:245
  CY_DMA_RETRIG_IM
  @ CY_DMA_RETRIG_IM
  Retrigger immediately.
  Definition: cy_dma.h:229
  CY_DMA_SUCCESS
  @ CY_DMA_SUCCESS
  Success.
  Definition: cy_dma.h:252
  CY_DMA_INTR_MASK
  #define CY_DMA_INTR_MASK
  The DMA channel interrupt mask.
  Definition: cy_dma.h:158

## ◆ Cy_DMA_Channel_DeInit()

void Cy_DMA_Channel_DeInit | ( | DW_Type * | base,
|  | uint32_t | channel
| ) |  |

Clears the content of registers corresponding to the channel.

Parameters

  base | The pointer to the hardware DMA block.
  channel | A channel number.

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);
  }
  }
  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.
  Definition: cy_dma.h:600
  Cy_DMA_Disable
  __STATIC_INLINE void Cy_DMA_Disable(DW_Type *base)
  Disables the DMA block.
  Definition: cy_dma.h:571
  Cy_DMA_Channel_GetPriority
  __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:1648
  Cy_DMA_Channel_Disable
  __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:1569
  Cy_DMA_Channel_DeInit
  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_Channel_SetDescriptor()

__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.

Parameters

  base | The pointer to the hardware DMA block.
  channel | The channel number.
  descriptor | This is the descriptor to be associated with the channel. When D-Cache is present and enabled this pointer needs to point to 32 byte aligned structure.

Function Usage
  /* Scenario: Initialize a 1D descriptor */
  #define DATACNT (8UL)
  #define CY_DMA_INTR_MASK (0x01UL)
  cy_stc_dma_descriptor_t descriptor;
  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.*/
  Cy_DMA_Channel_SetInterruptMask(DW0, 0UL, CY_DMA_INTR_MASK);
  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_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 */
  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);
  if (true != Cy_DMA_Channel_IsEnabled(DW0, 0UL))
  {
  /* Insert error handling */
  }
  currentYIndex = Cy_DMA_Channel_GetCurrentYIndex(DW0, 0UL);
  (void) currentYIndex;

## ◆ Cy_DMA_Channel_Enable()

__STATIC_INLINE void Cy_DMA_Channel_Enable | ( | DW_Type * | base,
|  | uint32_t | channel
| ) |  |

The function is used to enable a DMA channel.

Parameters

  base | The pointer to the hardware DMA block.
  channel | The channel number.

Function Usage
  /* Scenario: Initialize a 1D descriptor */
  #define DATACNT (8UL)
  #define CY_DMA_INTR_MASK (0x01UL)
  cy_stc_dma_descriptor_t descriptor;
  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.*/
  Cy_DMA_Channel_SetInterruptMask(DW0, 0UL, CY_DMA_INTR_MASK);
  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_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 */
  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);
  if (true != Cy_DMA_Channel_IsEnabled(DW0, 0UL))
  {
  /* Insert error handling */
  }
  currentYIndex = Cy_DMA_Channel_GetCurrentYIndex(DW0, 0UL);
  (void) currentYIndex;

## ◆ Cy_DMA_Channel_IsEnabled()

__STATIC_INLINE bool Cy_DMA_Channel_IsEnabled | ( | DW_Type * | base,
|  | uint32_t | channel
| ) |  |

The function checks whether a channel is in the enabled state.

Parameters

  base | The pointer to the hardware DMA block.
  channel | The channel number.

Function Usage
  /* Scenario: Initialize a 1D descriptor */
  #define DATACNT (8UL)
  #define CY_DMA_INTR_MASK (0x01UL)
  cy_stc_dma_descriptor_t descriptor;
  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.*/
  Cy_DMA_Channel_SetInterruptMask(DW0, 0UL, CY_DMA_INTR_MASK);
  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_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 */
  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);
  if (true != Cy_DMA_Channel_IsEnabled(DW0, 0UL))
  {
  /* Insert error handling */
  }
  currentYIndex = Cy_DMA_Channel_GetCurrentYIndex(DW0, 0UL);
  (void) currentYIndex;

## ◆ Cy_DMA_Channel_Disable()

__STATIC_INLINE void Cy_DMA_Channel_Disable | ( | DW_Type * | base,
|  | uint32_t | channel
| ) |  |

The function is used to disable a DMA channel.

Parameters

  base | The pointer to the hardware DMA block.
  channel | The channel number.

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);
  }
  }

## ◆ Cy_DMA_Channel_SetPriority()

__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.

Parameters

  base | The pointer to the hardware DMA block.
  channel | The channel number.
  priority | The priority to be set for the DMA channel. The allowed values are 0,1,2,3.

Function Usage
  /* Scenario: Initialize a 1D descriptor */
  #define DATACNT (8UL)
  #define CY_DMA_INTR_MASK (0x01UL)
  cy_stc_dma_descriptor_t descriptor;
  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.*/
  Cy_DMA_Channel_SetInterruptMask(DW0, 0UL, CY_DMA_INTR_MASK);
  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_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 */
  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);
  if (true != Cy_DMA_Channel_IsEnabled(DW0, 0UL))
  {
  /* Insert error handling */
  }
  currentYIndex = Cy_DMA_Channel_GetCurrentYIndex(DW0, 0UL);
  (void) currentYIndex;

## ◆ Cy_DMA_Channel_GetPriority()

__STATIC_INLINE uint32_t Cy_DMA_Channel_GetPriority | ( | DW_Type const * | base,
|  | uint32_t | channel
| ) |  |

Returns the priority of the DMA channel.

Parameters

  base | The pointer to the hardware DMA block.
  channel | The channel number.

Returns
  The priority of the channel.

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);
  }
  }

## ◆ Cy_DMA_Channel_GetStatus()

__STATIC_INLINE cy_en_dma_intr_cause_t Cy_DMA_Channel_GetStatus | ( | DW_Type const * | base,
|  | uint32_t | channel
| ) |  |

Returns the interrupt reason of the specified channel.

Parameters

  base | The pointer to the hardware DMA block.
  channel | The channel number.

Returns
  The cause cy_en_dma_intr_cause_t of the interrupt.

Function Usage
  /* Scenario: Inside the interrupt service routine for block DW0 channel 0: */
  if (CY_DMA_INTR_MASK == Cy_DMA_Channel_GetInterruptStatusMasked(DW0, 0UL))
  {
  /* Get the interrupt cause */
  cy_en_dma_intr_cause_t cause = Cy_DMA_Channel_GetStatus(DW0, 0UL);
  if (CY_DMA_INTR_CAUSE_COMPLETION != cause)
  {
  /* Insert error handling */
  }
  /* Clear the interrupt */
  Cy_DMA_Channel_ClearInterrupt(DW0, 0UL);
  }
  Cy_DMA_Channel_GetInterruptStatusMasked
  __STATIC_INLINE uint32_t Cy_DMA_Channel_GetInterruptStatusMasked(DW_Type const *base, uint32_t channel)
  Returns the logical AND of the corresponding INTR and INTR_MASK fields in a single-load operation.
  Definition: cy_dma.h:1884
  Cy_DMA_Channel_GetStatus
  __STATIC_INLINE cy_en_dma_intr_cause_t Cy_DMA_Channel_GetStatus(DW_Type const *base, uint32_t channel)
  Returns the interrupt reason of the specified channel.
  Definition: cy_dma.h:1754
  Cy_DMA_Channel_ClearInterrupt
  __STATIC_INLINE void Cy_DMA_Channel_ClearInterrupt(DW_Type *base, uint32_t channel)
  Clears the interrupt status of the specified channel.
  Definition: cy_dma.h:1778
  cy_en_dma_intr_cause_t
  cy_en_dma_intr_cause_t
  Contains the possible interrupt cause values.
  Definition: cy_dma.h:188
  CY_DMA_INTR_CAUSE_COMPLETION
  @ CY_DMA_INTR_CAUSE_COMPLETION
  Completion.
  Definition: cy_dma.h:190

## ◆ Cy_DMA_Channel_GetCurrentDescriptor()

__STATIC_INLINE cy_stc_dma_descriptor_t * Cy_DMA_Channel_GetCurrentDescriptor | ( | DW_Type const * | base,
|  | uint32_t | channel
| ) |  |

Returns the descriptor that is active in the channel.

Parameters

  base | The pointer to the hardware DMA block.
  channel | The channel number.

Returns
  The pointer to the descriptor associated with the channel.

Function Usage
  cy_stc_dma_descriptor_t descriptor = {0};
  /* Scenario: Disable a descriptor */
  if (&descriptor != Cy_DMA_Channel_GetCurrentDescriptor(DW0, 0UL)) /* Make sure it is not in use */
  {
  Cy_DMA_Descriptor_DeInit(&descriptor);
  }
  Cy_DMA_Channel_GetCurrentDescriptor
  __STATIC_INLINE cy_stc_dma_descriptor_t * Cy_DMA_Channel_GetCurrentDescriptor(DW_Type const *base, uint32_t channel)
  Returns the descriptor that is active in the channel.
  Definition: cy_dma.h:1675
  Cy_DMA_Descriptor_DeInit
  void Cy_DMA_Descriptor_DeInit(cy_stc_dma_descriptor_t *descriptor)
  Clears the content of the specified descriptor.
  Definition: cy_dma.c:223

## ◆ Cy_DMA_Channel_GetCurrentYIndex()

__STATIC_INLINE uint8_t Cy_DMA_Channel_GetCurrentYIndex | ( | DW_Type const * | base,
|  | uint32_t | channel
| ) |  |

Returns the current Y loop index for the channel.

Parameters

  base | The pointer to the hardware DMA block.
  channel | The channel number.

Returns
  Y loop index value.

Function Usage
  /* Scenario: Initialize a 1D descriptor */
  #define DATACNT (8UL)
  #define CY_DMA_INTR_MASK (0x01UL)
  cy_stc_dma_descriptor_t descriptor;
  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.*/
  Cy_DMA_Channel_SetInterruptMask(DW0, 0UL, CY_DMA_INTR_MASK);
  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_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 */
  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);
  if (true != Cy_DMA_Channel_IsEnabled(DW0, 0UL))
  {
  /* Insert error handling */
  }
  currentYIndex = Cy_DMA_Channel_GetCurrentYIndex(DW0, 0UL);
  (void) currentYIndex;

## ◆ Cy_DMA_Channel_GetInterruptStatus()

__STATIC_INLINE uint32_t Cy_DMA_Channel_GetInterruptStatus | ( | DW_Type const * | base,
|  | uint32_t | channel
| ) |  |

Returns the interrupt status of the specified channel.

Parameters

  base | The pointer to the hardware DMA block.
  channel | The channel number.

Returns
  The status of an interrupt for the specified channel.

Function Usage
  /* Scenario: Need to check the interrupt status regardless of whether it is enabled (masked) or not */
  if (CY_DMA_INTR_MASK == Cy_DMA_Channel_GetInterruptStatus (DW0, 0UL))
  {
  /* The DW0 channel 0 interrupt is pending */
  }
  Cy_DMA_Channel_GetInterruptStatus
  __STATIC_INLINE uint32_t Cy_DMA_Channel_GetInterruptStatus(DW_Type const *base, uint32_t channel)
  Returns the interrupt status of the specified channel.
  Definition: cy_dma.h:1727

## ◆ Cy_DMA_Channel_ClearInterrupt()

__STATIC_INLINE void Cy_DMA_Channel_ClearInterrupt | ( | DW_Type * | base,
|  | uint32_t | channel
| ) |  |

Clears the interrupt status of the specified channel.

Parameters

  base | The pointer to the hardware DMA block.
  channel | The channel number.

Function Usage
  /* Scenario: Inside the interrupt service routine for block DW0 channel 0: */
  if (CY_DMA_INTR_MASK == Cy_DMA_Channel_GetInterruptStatusMasked(DW0, 0UL))
  {
  /* Get the interrupt cause */
  cy_en_dma_intr_cause_t cause = Cy_DMA_Channel_GetStatus(DW0, 0UL);
  if (CY_DMA_INTR_CAUSE_COMPLETION != cause)
  {
  /* Insert error handling */
  }
  /* Clear the interrupt */
  Cy_DMA_Channel_ClearInterrupt(DW0, 0UL);
  }

## ◆ Cy_DMA_Channel_SetInterrupt()

__STATIC_INLINE void Cy_DMA_Channel_SetInterrupt | ( | DW_Type * | base,
|  | uint32_t | channel
| ) |  |

Sets the interrupt for the specified channel.

Parameters

  base | The pointer to the hardware DMA block.
  channel | The channel number.

Function Usage
  /* Scenario: Enable interrupts for block DW0 channel 0 */
  Cy_DMA_Channel_SetInterruptMask (DW0, 0UL, CY_DMA_INTR_MASK);
  /* Scenario: Test the interrupt for block DW0 channel 0 */
  Cy_DMA_Channel_SetInterrupt(DW0, 0UL);
  /* Now the interrupt should occur (if it is enabled, of course) */
  /* Scenario: Disable interrupts for block DW0 channel 0 if it is enabled */
  if (CY_DMA_INTR_MASK == Cy_DMA_Channel_GetInterruptMask(DW0, 0UL))
  {
  Cy_DMA_Channel_SetInterruptMask (DW0, 0UL, 0UL);
  }
  Cy_DMA_Channel_SetInterrupt
  __STATIC_INLINE void Cy_DMA_Channel_SetInterrupt(DW_Type *base, uint32_t channel)
  Sets the interrupt for the specified channel.
  Definition: cy_dma.h:1804
  Cy_DMA_Channel_GetInterruptMask
  __STATIC_INLINE uint32_t Cy_DMA_Channel_GetInterruptMask(DW_Type const *base, uint32_t channel)
  Returns the interrupt mask value of the specified channel.
  Definition: cy_dma.h:1831

## ◆ Cy_DMA_Channel_GetInterruptMask()

__STATIC_INLINE uint32_t Cy_DMA_Channel_GetInterruptMask | ( | DW_Type const * | base,
|  | uint32_t | channel
| ) |  |

Returns the interrupt mask value of the specified channel.

Parameters

  base | The pointer to the hardware DMA block.
  channel | The channel number.

Returns
  The interrupt mask value.

Function Usage
  /* Scenario: Enable interrupts for block DW0 channel 0 */
  Cy_DMA_Channel_SetInterruptMask (DW0, 0UL, CY_DMA_INTR_MASK);
  /* Scenario: Test the interrupt for block DW0 channel 0 */
  Cy_DMA_Channel_SetInterrupt(DW0, 0UL);
  /* Now the interrupt should occur (if it is enabled, of course) */
  /* Scenario: Disable interrupts for block DW0 channel 0 if it is enabled */
  if (CY_DMA_INTR_MASK == Cy_DMA_Channel_GetInterruptMask(DW0, 0UL))
  {
  Cy_DMA_Channel_SetInterruptMask (DW0, 0UL, 0UL);
  }

## ◆ Cy_DMA_Channel_SetInterruptMask()

__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.

Parameters

  base | The pointer to the hardware DMA block.
  channel | The channel number.
  interrupt | The interrupt mask: CY_DMA_INTR_MASK to enable the interrupt or 0UL to disable the interrupt.

Function Usage
  /* Scenario: Enable interrupts for block DW0 channel 0 */
  Cy_DMA_Channel_SetInterruptMask (DW0, 0UL, CY_DMA_INTR_MASK);
  /* Scenario: Test the interrupt for block DW0 channel 0 */
  Cy_DMA_Channel_SetInterrupt(DW0, 0UL);
  /* Now the interrupt should occur (if it is enabled, of course) */
  /* Scenario: Disable interrupts for block DW0 channel 0 if it is enabled */
  if (CY_DMA_INTR_MASK == Cy_DMA_Channel_GetInterruptMask(DW0, 0UL))
  {
  Cy_DMA_Channel_SetInterruptMask (DW0, 0UL, 0UL);
  }

## ◆ Cy_DMA_Channel_GetInterruptStatusMasked()

__STATIC_INLINE uint32_t Cy_DMA_Channel_GetInterruptStatusMasked | ( | DW_Type const * | base,
|  | uint32_t | channel
| ) |  |

Returns the logical AND of the corresponding INTR and INTR_MASK fields in a single-load operation.

Parameters

  base | The pointer to the hardware DMA block.
  channel | The channel number.

Function Usage
  /* Scenario: Inside the interrupt service routine for block DW0 channel 0: */
  if (CY_DMA_INTR_MASK == Cy_DMA_Channel_GetInterruptStatusMasked(DW0, 0UL))
  {
  /* Get the interrupt cause */
  cy_en_dma_intr_cause_t cause = Cy_DMA_Channel_GetStatus(DW0, 0UL);
  if (CY_DMA_INTR_CAUSE_COMPLETION != cause)
  {
  /* Insert error handling */
  }
  /* Clear the interrupt */
  Cy_DMA_Channel_ClearInterrupt(DW0, 0UL);
  }

## ◆ Cy_DMA_Channel_SetSWTrigger()

__STATIC_FORCEINLINE void Cy_DMA_Channel_SetSWTrigger | ( | DW_Type const * | base,
|  | uint32_t | channel
| ) |  |

The function is used to set a SW trigger for a channel.

Parameters

  base | The pointer to the hardware DMA block.
  channel | The channel number.