PSOC E8XXGP Device Support Library

| PSOC E8XXGP Device Support Library

Functions
DMAC (Direct Memory Access Controller)
HAL API Reference » Implementation Specific » DMA (Direct Memory Access)

## General Description

Implementation specific interface for using the DMAC peripheral.

## Functions
cy_rslt_t | _mtb_hal_dma_dmac_setup (mtb_hal_dma_t *obj, const mtb_hal_dma_configurator_t *config)
| Sets up a HAL instance to use the specified hardware resource. More...
cy_rslt_t | _mtb_hal_dma_dmac_set_src_addr (mtb_hal_dma_t *obj, uint32_t src_addr)
| Set the source address for the DMA transfer. More...
cy_rslt_t | _mtb_hal_dma_dmac_set_dst_addr (mtb_hal_dma_t *obj, uint32_t dst_addr)
| Set the destination address for the DMA transfer. More...
cy_rslt_t | _mtb_hal_dma_dmac_set_length (mtb_hal_dma_t *obj, uint32_t length)
| Set the length for the DMA transfer. More...
cy_rslt_t | _mtb_hal_dma_dmac_enable (mtb_hal_dma_t *obj)
| Enable the DMA transfer so that it can start transferring data when triggered. More...
cy_rslt_t | _mtb_hal_dma_dmac_disable (mtb_hal_dma_t *obj)
| Disable the DMA transfer so that it does not continue to trigger. More...
cy_rslt_t | _mtb_hal_dma_dmac_start_transfer (mtb_hal_dma_t *obj)
| Initiates DMA channel transfer for specified DMA object. More...
bool | _mtb_hal_dma_dmac_is_busy (mtb_hal_dma_t *obj)
| Checks if the transfer has been triggered, but not yet complete (eg: is pending, blocked or running) More...
cy_rslt_t | _mtb_hal_dma_dmac_process_interrupt (mtb_hal_dma_t *obj)
| Process interrupts related related to a DMA instance. More...
void | _mtb_hal_dma_dmac_enable_event (mtb_hal_dma_t *obj, mtb_hal_dma_event_t event, bool enable)
| Configure DMA event enablement. More...
uint32_t | _mtb_hal_dma_dmac_get_max_elements_per_burst (mtb_hal_dma_t *obj)
| Max number of elements, that can be transferred by one burst. More...

## Function Documentation

## ◆ _mtb_hal_dma_dmac_setup()

cy_rslt_t _mtb_hal_dma_dmac_setup | ( | mtb_hal_dma_t * | obj,
|  | const mtb_hal_dma_configurator_t * | config
| ) |  |

Sets up a HAL instance to use the specified hardware resource.

This hardware resource must have already been configured via the PDL.

Parameters

  [out] | obj | The HAL driver instance object. The caller must allocate the memory for this object, but the HAL will initialize its contents
  [in] | config | The configurator-generated HAL config structure for this peripheral instance

Returns
  the status of the HAL setup

## ◆ _mtb_hal_dma_dmac_set_src_addr()

cy_rslt_t _mtb_hal_dma_dmac_set_src_addr | ( | mtb_hal_dma_t * | obj,
|  | uint32_t | src_addr
| ) |  |

Set the source address for the DMA transfer.

Parameters

  [in] | obj | The DMA object
  [in] | src_addr | The source address

Returns
  The status of the request

## ◆ _mtb_hal_dma_dmac_set_dst_addr()

cy_rslt_t _mtb_hal_dma_dmac_set_dst_addr | ( | mtb_hal_dma_t * | obj,
|  | uint32_t | dst_addr
| ) |  |

Set the destination address for the DMA transfer.

Parameters

  [in] | obj | The DMA object
  [in] | dst_addr | The destination address

Returns
  The status of the request

## ◆ _mtb_hal_dma_dmac_set_length()

cy_rslt_t _mtb_hal_dma_dmac_set_length | ( | mtb_hal_dma_t * | obj,
|  | uint32_t | length
| ) |  |

Set the length for the DMA transfer.

Parameters

  [in] | obj | The DMA object
  [in] | length | The transfer length, in bytes

Returns
  The status of the request

## ◆ _mtb_hal_dma_dmac_enable()

cy_rslt_t _mtb_hal_dma_dmac_enable | ( | mtb_hal_dma_t * | obj | ) |

Enable the DMA transfer so that it can start transferring data when triggered.

A trigger is caused either by calling mtb_hal_dma_start_transfer or by hardware as a result of connection made using the interconnect components in the device configurator. The DMA can be disabled by calling mtb_hal_dma_disable

Parameters

  [in] | obj | The DMA object

Returns
  The status of the enable request

## ◆ _mtb_hal_dma_dmac_disable()

cy_rslt_t _mtb_hal_dma_dmac_disable | ( | mtb_hal_dma_t * | obj | ) |

Disable the DMA transfer so that it does not continue to trigger.

It can be reenabled by calling mtb_hal_dma_enable

Parameters

  [in] | obj | The DMA object

Returns
  The status of the disable request

## ◆ _mtb_hal_dma_dmac_start_transfer()

cy_rslt_t _mtb_hal_dma_dmac_start_transfer | ( | mtb_hal_dma_t * | obj | ) |

Initiates DMA channel transfer for specified DMA object.

This should only be done after the channel has been configured and setup and any necessary event callbacks setup (mtb_hal_dma_register_callback mtb_hal_dma_enable_event)

Parameters

  [in] | obj | The DMA object

Returns
  The status of the start_transfer request

## ◆ _mtb_hal_dma_dmac_is_busy()

bool _mtb_hal_dma_dmac_is_busy | ( | mtb_hal_dma_t * | obj | ) |

Checks if the transfer has been triggered, but not yet complete (eg: is pending, blocked or running)

Parameters

  [in] | obj | The DMA object

Returns
  True if DMA channel is busy

## ◆ _mtb_hal_dma_dmac_process_interrupt()

cy_rslt_t _mtb_hal_dma_dmac_process_interrupt | ( | mtb_hal_dma_t * | obj | ) |

Process interrupts related related to a DMA instance.

Parameters

  obj | HAL object for which the interrupt should be processed

Returns
  CY_RSLT_SUCCESS if the interrupt was processed successfully; otherwise an error

## ◆ _mtb_hal_dma_dmac_enable_event()

void _mtb_hal_dma_dmac_enable_event | ( | mtb_hal_dma_t * | obj,
|  | mtb_hal_dma_event_t | event,
|  | bool | enable
| ) |  |

Configure DMA event enablement.

When an enabled event occurs, the function specified by mtb_hal_dma_register_callback will be called.

Parameters

  [in] | obj | The DMA object
  [in] | event | The DMA event type recent call will take precedence, i.e all events will have the same priority.
  [in] | enable | True to turn on interrupts, False to turn off

## ◆ _mtb_hal_dma_dmac_get_max_elements_per_burst()

uint32_t _mtb_hal_dma_dmac_get_max_elements_per_burst | ( | mtb_hal_dma_t * | obj | ) |

Max number of elements, that can be transferred by one burst.

Parameters

  [in] | obj | The DMA object

Returns
  Max number of elements, that can be transferred by one burst