DMAC (Direct Memory Access Controller)

group group_hal_impl_dma_dmac

Implementation specific interface for using the DMAC DMA peripheral.

Functions

cy_rslt_t _cyhal_dma_dmac_init(cyhal_dma_t *obj, cyhal_source_t *src, cyhal_dest_t *dest, uint8_t priority)

Initialize the DMAC peripheral.

Parameters
  • obj[out] The DMA object to initialize

  • src[in] An optional, input signal to connect to.

  • dest[in] An optional, output target to drive.

  • priority[in] The priority of this DMA operation relative to others. Values must be between 0-3 with 0 being the highest priority.

Returns

The status of the init request

void _cyhal_dma_dmac_free(cyhal_dma_t *obj)

Frees the DMAC specific object.

This expects that common resources will be freed by caller.

Parameters

obj[inout] The DMA object

cy_rslt_t _cyhal_dma_dmac_configure(cyhal_dma_t *obj, const cyhal_dma_cfg_t *cfg)

Setup a DMAC descriptor for the dma resource.

Parameters
  • obj[in] The DMA object

  • cfg[in] Configuration parameters for the transfer

Returns

The status of the configure request

cy_rslt_t _cyhal_dma_dmac_start_transfer(cyhal_dma_t *obj)

Start a DMAC transfer.

Initiates DMA channel transfer for specified DMA object

Parameters

obj[in] The DMA object

Returns

The status of the start_transfer request

void _cyhal_dma_dmac_enable_event(cyhal_dma_t *obj, cyhal_dma_event_t event, uint8_t intr_priority, bool enable)

Configure DMAC event enablement.

Parameters
  • obj[in] The DMA object

  • event[in] The DMA event type

  • intr_priority[in] The priority for NVIC interrupt events. The priority from the most recent call will take precedence, i.e all events will have the same priority.

  • enable[in] True to turn on interrupts, False to turn off

bool _cyhal_dma_dmac_is_busy(cyhal_dma_t *obj)

Checks whether a transfer is pending or running on the DMA channel.

Parameters

obj[in] The DMA object

Returns

True if DMA channel is busy

cy_rslt_t _cyhal_dma_dmac_connect_digital(cyhal_dma_t *obj, cyhal_source_t source, cyhal_dma_input_t input)

Connects a source signal and enables the specified input to the DMA channel.

Parameters
  • obj[in] The DMA object

  • source[in] Source signal obtained from another driver’s cyhal_<PERIPH>_enable_output

  • input[in] Which input to enable

Returns

The status of the connection

cy_rslt_t _cyhal_dma_dmac_enable_output(cyhal_dma_t *obj, cyhal_dma_output_t output, cyhal_source_t *source)

Enables the specified output signal from a DMA channel that is triggered when a transfer is completed.

Parameters
  • obj[in] The DMA object

  • output[in] Which event triggers the output

  • source[out] Pointer to user-allocated source signal object which will be initialized by enable_output. source should be passed to (dis)connect_digital functions to (dis)connect the associated endpoints.

Returns

The status of the output enable

cy_rslt_t _cyhal_dma_dmac_disconnect_digital(cyhal_dma_t *obj, cyhal_source_t source, cyhal_dma_input_t input)

Disconnects a source signal and disables the specified input to the DMA channel.

Parameters
  • obj[in] The DMA object

  • source[in] Source signal from cyhal_<PERIPH>_enable_output to disable

  • input[in] Which input to disable

Returns

The status of the disconnect

cy_rslt_t _cyhal_dma_dmac_disable_output(cyhal_dma_t *obj, cyhal_dma_output_t output)

Disables the specified output signal from a DMA channel.

Parameters
  • obj[in] The DMA object

  • output[in] Which output to disable

Returns

The status of the disablement