HAL DMA Functions

Initialization and De-initialization functions

group DMA_Exported_Functions_Group1

This subsection provides a set of functions to initialize and de-initialize a DMA channel peripheral:

  • Call the function HAL_DMA_Init() to initialize the DMA channel handle and associate a physical channel instance. (As optional, DMA clock is enabled inside the function)

  • Call the function HAL_DMA_DeInit() to restore the physical and logical default configuration (after reset) of the selected DMA channel peripheral.

Functions

hal_status_t HAL_DMA_Init ( hal_dma_handle_t * hdma , hal_dma_channel_t instance )

Initialize the DMA channel handle and associate physical channel instance.

Parameters :
  • hdma – Pointer to DMA channel handle

  • instance – DMA channel instance

Return values :
  • HAL_INVALID_PARAM – Invalid parameter when hdma pointer is NULL

  • HAL_OK – DMA channel is successfully initialized

void HAL_DMA_DeInit ( hal_dma_handle_t * hdma )

Deinitialize the DMA channel handle and the associated physical channel instance.

Parameters :

hdma – Pointer to DMA channel handle

hal_dma_channel_t HAL_DMA_GetInstance ( const hal_dma_handle_t * hdma )

Retrieve the HAL DMA channel instance.

Parameters :

hdma – Pointer to DMA channel handle.

Return values :

DMA – channel instance, element in hal_dma_channel_t enumeration.

DMA_Channel_TypeDef * HAL_DMA_GetLLInstance ( const hal_dma_handle_t * hdma )

Retrieve the LL DMA channel instance.

Parameters :

hdma – Pointer to DMA channel handle.

Return values :

DMA – channel instance.

Configuration functions

group DMA_Exported_Functions_Group2

This subsection provides a set of functions to configure the DMA channel peripheral:

Basic transfer configuration

Functions

hal_status_t HAL_DMA_SetConfigDirectXfer ( hal_dma_handle_t * hdma , const hal_dma_direct_xfer_config_t * p_config )

Set the DMA channel direct transfer configuration.

Parameters :
Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL

  • HAL_OK – Direct transfer is successfully configured

void HAL_DMA_GetConfigDirectXfer ( hal_dma_handle_t * hdma , hal_dma_direct_xfer_config_t * p_config )

Get the DMA channel direct transfer configuration.

Parameters :
hal_status_t HAL_DMA_SetConfigDirectXferHardwareRequestMode ( hal_dma_handle_t * hdma , hal_dma_hardware_request_mode_t hw_request_mode )

Set the DMA channel direct transfer hardware request mode configuration.

Parameters :
Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when transfer mode parameter is not direct

  • HAL_OK – Request mode is successfully configured

hal_status_t HAL_DMA_ResetConfigDirectXferHardwareRequestMode ( hal_dma_handle_t * hdma )

Reset the DMA channel direct transfer hardware request mode configuration.

Parameters :

hdma – Pointer to DMA channel handle

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when transfer mode parameter is not direct

  • HAL_OK – Reset direct transfer request mode configuration is successful

hal_dma_hardware_request_mode_t HAL_DMA_GetConfigDirectXferHardwareRequestMode ( hal_dma_handle_t * hdma )

Get the DMA channel direct transfer hardware request mode configuration.

Parameters :

hdma – Pointer to DMA channel handle

Return values :

Returned – value can be one of the following values:

hal_status_t HAL_DMA_SetConfigDirectXferFlowControlMode ( hal_dma_handle_t * hdma , hal_dma_flow_control_mode_t flow_control_mode )

Set the DMA channel direct transfer flow control mode configuration.

Parameters :
Return values :

HAL_OK – Direct transfer flow control mode is successfully configured

hal_status_t HAL_DMA_ResetConfigDirectXferFlowControlMode ( hal_dma_handle_t * hdma )

Reset the DMA channel direct transfer flow control mode configuration.

Parameters :

hdma – Pointer to DMA channel handle

Return values :

HAL_OK – Direct transfer flow control mode is successfully configured

hal_dma_flow_control_mode_t HAL_DMA_GetConfigDirectXferFlowControlMode ( hal_dma_handle_t * hdma )

Get the DMA channel direct transfer flow control mode configuration.

Parameters :

hdma – Pointer to DMA channel handle

Return values :

Returned – value can be one of the following values:

hal_status_t HAL_DMA_SetConfigDirectXferTrigger ( hal_dma_handle_t * hdma , const hal_dma_trigger_config_t * p_config )

Set the DMA channel direct transfer trigger configuration.

Parameters :
Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when transfer mode parameter is not direct or p_config pointer is NULL

  • HAL_OK – Direct transfer trigger is successfully configured

hal_status_t HAL_DMA_ResetConfigDirectXferTrigger ( hal_dma_handle_t * hdma )

Reset the DMA channel direct transfer trigger configuration.

Parameters :

hdma – Pointer to DMA channel handle

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when transfer mode parameter is not direct

  • HAL_OK – Reset direct transfer trigger configuration is successful

void HAL_DMA_GetConfigDirectXferTrigger ( hal_dma_handle_t * hdma , hal_dma_trigger_config_t * p_config )

Get the DMA channel direct transfer trigger configuration.

Parameters :
hal_status_t HAL_DMA_SetConfigDirectXferDataHandling ( hal_dma_handle_t * hdma , const hal_dma_data_handling_config_t * p_config )

Set the DMA channel direct transfer data handling configuration.

Parameters :
Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when transfer mode parameter is not direct or p_config pointer is NULL

  • HAL_OK – Direct transfer data handling is successfully configured

hal_status_t HAL_DMA_ResetConfigDirectXferDataHandling ( hal_dma_handle_t * hdma )

Reset the DMA channel direct transfer data handling configuration.

Parameters :

hdma – Pointer to DMA channel handle

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when transfer mode parameter is not direct

  • HAL_OK – Reset direct transfer data handling configuration is successful

void HAL_DMA_GetConfigDirectXferDataHandling ( hal_dma_handle_t * hdma , hal_dma_data_handling_config_t * p_config )

Get the DMA channel direct transfer data handling configuration.

Parameters :
hal_status_t HAL_DMA_SetPrivAttr ( hal_dma_channel_t instance , hal_dma_priv_attr_t priv_attr )

Set the DMA channel privileged access level attribute.

Parameters :
Return values :
  • HAL_ERROR – Operation failed, not in privileged execution mode.

  • HAL_OK – Privileged attribute set successfully.

hal_dma_priv_attr_t HAL_DMA_GetPrivAttr ( hal_dma_channel_t instance )

Get the DMA channel privileged access attribute configuration.

Parameters :

instance – DMA channel instance

Return values :

Returned – value can be one of the following values:

hal_status_t HAL_DMA_LockAttr ( hal_dma_channel_t instance )

Lock the privileged access levels attribute for item(s).

Parameters :

instance – DMA channel instance

Return values :
  • HAL_ERROR – Operation failed, not in privileged execution mode.

  • HAL_OK – Privilege attribute locked successfully

hal_dma_attr_lock_status_t HAL_DMA_IsLockedAttr ( hal_dma_channel_t instance )

Check if the DMA channel privilege attribute is locked.

Parameters :

instance – DMA channel instance

Return values :

Privilege – attribute lock status, element in hal_dma_attr_lock_status_t enumeration

hal_status_t HAL_DMA_SetConfigPeriphDirectXfer ( hal_dma_handle_t * hdma , const hal_dma_direct_xfer_config_t * p_config )

Set the DMA channel peripheral direct transfer configuration.

Parameters :
Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL

  • HAL_OK – Peripheral direct transfer is successfully configured

void HAL_DMA_GetConfigPeriphDirectXfer ( hal_dma_handle_t * hdma , hal_dma_direct_xfer_config_t * p_config )

Get the DMA channel peripheral direct transfer configuration.

Parameters :
hal_status_t HAL_DMA_SetConfigLinkedListXfer ( hal_dma_handle_t * hdma , const hal_dma_linkedlist_xfer_config_t * p_config )

Set the DMA channel linked list transfer configuration.

Parameters :
Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL

  • HAL_OK – Linked list transfer is successfully configured

void HAL_DMA_GetConfigLinkedListXfer ( hal_dma_handle_t * hdma , hal_dma_linkedlist_xfer_config_t * p_config )

Get the DMA channel linked list transfer configuration.

Parameters :
hal_status_t HAL_DMA_SetLinkedListXferEventMode ( hal_dma_handle_t * hdma , hal_dma_linkedlist_xfer_event_mode_t xfer_event_mode )

Set the DMA channel linked list transfer event mode configuration.

Parameters :
Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when transfer mode parameter is direct

  • HAL_OK – Linked list transfer event mode is successfully configured

hal_status_t HAL_DMA_ResetLinkedListXferEventMode ( hal_dma_handle_t * hdma )

Reset the DMA channel linked list transfer event mode configuration.

Parameters :

hdma – Pointer to DMA channel handle

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when transfer mode parameter is direct

  • HAL_OK – Reset linked list transfer event mode configuration is successful

hal_dma_linkedlist_xfer_event_mode_t HAL_DMA_GetLinkedListXferEventMode ( hal_dma_handle_t * hdma )

Get the DMA channel linked list transfer event mode configuration.

Parameters :

hdma – Pointer to DMA channel handle

Return values :
  • HAL_DMA_LINKEDLIST_XFER_EVENT_BLOCK – Linked list transfer event block

  • HAL_DMA_LINKEDLIST_XFER_EVENT_REPEATED_BLOCK – Linked list transfer event repeated block

  • HAL_DMA_LINKEDLIST_XFER_EVENT_NODE – Linked list transfer event node

  • HAL_DMA_LINKEDLIST_XFER_EVENT_Q – Linked list transfer event Q

hal_status_t HAL_DMA_SetLinkedListXferPriority ( hal_dma_handle_t * hdma , hal_dma_priority_t priority )

Set the DMA channel linked list transfer priority configuration.

Parameters :
  • hdma – Pointer to DMA channel handle

  • priority – Element in hal_dma_priority_t enumeration

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when transfer mode parameter is direct

  • HAL_OK – Linked list transfer priority is successfully configured

hal_status_t HAL_DMA_ResetLinkedListXferPriority ( hal_dma_handle_t * hdma )

Reset the DMA channel linked list transfer priority configuration.

Parameters :

hdma – Pointer to DMA channel handle

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when transfer mode parameter is direct

  • HAL_OK – Reset linked list transfer priority configuration is successful

hal_dma_priority_t HAL_DMA_GetLinkedListXferPriority ( hal_dma_handle_t * hdma )

Get the DMA channel linked list transfer priority configuration.

Parameters :

hdma – Pointer to DMA channel handle

Return values :
  • HAL_DMA_PRIORITY_LOW_WEIGHT_LOW – DMA channel priority low and weight low

  • HAL_DMA_PRIORITY_LOW_WEIGHT_MID – DMA channel priority low and weight mid

  • HAL_DMA_PRIORITY_LOW_WEIGHT_HIGH – DMA channel priority low and weight high

  • HAL_DMA_PRIORITY_HIGH – DMA channel priority high

hal_status_t HAL_DMA_SetLinkedListXferExecutionMode ( hal_dma_handle_t * hdma , hal_dma_linkedlist_execution_mode_t exec_mode )

Set the DMA channel linked list transfer execution mode configuration.

Parameters :
Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when transfer mode parameter is direct

  • HAL_OK – Linked list transfer execution mode is successfully configured

hal_status_t HAL_DMA_ResetLinkedListXferExecutionMode ( hal_dma_handle_t * hdma )

Reset the DMA channel linked list transfer execution mode configuration.

Parameters :

hdma – Pointer to DMA channel handle

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when transfer mode parameter is direct

  • HAL_OK – Reset linked list transfer execution mode configuration is successful

hal_dma_linkedlist_execution_mode_t HAL_DMA_GetLinkedListXferExecutionMode ( hal_dma_handle_t * hdma )

Get the DMA channel linked list transfer execution mode configuration.

Parameters :

hdma – Pointer to DMA channel handle

Return values :
  • HAL_DMA_LINKEDLIST_EXECUTION_Q – DMA channel is executed for the full linked list

  • HAL_DMA_LINKEDLIST_NODE_EXECUTION – DMA channel is executed once for the current linked list

hal_status_t HAL_DMA_SetConfigPeriphLinkedListCircularXfer ( hal_dma_handle_t * hdma , hal_dma_node_t * p_node , const hal_dma_direct_xfer_config_t * p_node_config )

Set the DMA channel peripheral linked list circular transfer configuration.

Parameters :
Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when node or node_config pointer is NULL

  • HAL_OK – Peripheral linked list circular transfer is successfully configured

void HAL_DMA_GetConfigPeriphLinkedListCircularXfer ( hal_dma_handle_t * hdma , hal_dma_node_t * p_node , hal_dma_direct_xfer_config_t * p_node_config )

Get the DMA channel peripheral linked list circular transfer configuration.

Parameters :

Linked list node management functions

group DMA_Exported_Functions_Group3

This subsection provides a set of functions to configure the DMA channel peripheral:

Node configuration

Functions

hal_status_t HAL_DMA_FillNodeConfig ( hal_dma_node_t * p_node , const hal_dma_node_config_t * p_conf , hal_dma_node_type_t node_type )

Fill node configuration.

Parameters :
Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when p_node or p_conf pointer is NULL

  • HAL_OK – Fill node is successfully configured

void HAL_DMA_GetNodeConfig ( const hal_dma_node_t * p_node , hal_dma_node_config_t * p_conf , hal_dma_node_type_t * p_node_type )

Get the configuration of node.

Parameters :
hal_status_t HAL_DMA_FillNodeDirectXfer ( hal_dma_node_t * p_node , const hal_dma_direct_xfer_config_t * p_config , hal_dma_node_type_t node_type )

Fill node direct transfer configuration.

Parameters :
Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when p_node or p_config pointer is NULL

  • HAL_OK – Fill node direct transfer is successfully configured

void HAL_DMA_GetNodeDirectXfer ( const hal_dma_node_t * p_node , hal_dma_direct_xfer_config_t * p_config , hal_dma_node_type_t * p_node_type )

Get the configuration of node direct transfer.

Parameters :
hal_status_t HAL_DMA_FillNodeHardwareRequestMode ( hal_dma_node_t * p_node , hal_dma_hardware_request_mode_t hw_request_mode )

Fill node hardware request mode configuration.

Parameters :
Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when p_node pointer is NULL

  • HAL_OK – Fill node hardware request mode is successfully configured

hal_dma_hardware_request_mode_t HAL_DMA_GetNodeHardwareRequestMode ( const hal_dma_node_t * p_node )

Get the configuration of node hardware request mode.

Parameters :

p_node – Pointer to hal_dma_node_t node structure

Return values :
  • HAL_DMA_HARDWARE_REQUEST_BURST – DMA channel hardware request mode is burst

  • HAL_DMA_HARDWARE_REQUEST_BLOCK – DMA channel hardware request mode is block

hal_status_t HAL_DMA_FillNodeFlowControlMode ( hal_dma_node_t * p_node , hal_dma_flow_control_mode_t flow_control_mode )

Fill node flow control mode configuration.

Parameters :
Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when p_node pointer is NULL

  • HAL_OK – Fill node flow control request is successfully configured

hal_dma_flow_control_mode_t HAL_DMA_GetNodeFlowControlMode ( const hal_dma_node_t * p_node )

Get the configuration of node flow control mode .

Parameters :

p_node – Pointer to hal_dma_node_t node structure

Return values :
  • HAL_DMA_FLOW_CONTROL_DMA – DMA request DMA channel flow control mode

  • HAL_DMA_FLOW_CONTROL_PERIPH – DMA request peripheral flow control mode

hal_status_t HAL_DMA_FillNodeXferEventMode ( hal_dma_node_t * p_node , hal_dma_linkedlist_xfer_event_mode_t xfer_event_mode )

Fill node transfer event mode configuration.

Parameters :
Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when p_node is NULL

  • HAL_OK – Fill node transfer event mode is successfully configured

hal_dma_linkedlist_xfer_event_mode_t HAL_DMA_GetNodeXferEventMode ( const hal_dma_node_t * p_node )

Get the configuration of node transfer event mode.

Parameters :

p_node – Pointer to hal_dma_node_t node structure

Return values :
  • HAL_DMA_LINKEDLIST_XFER_EVENT_BLOCK – DMA channel transfer event mode is at block level.

  • HAL_DMA_LINKEDLIST_XFER_EVENT_NODE – DMA channel transfer event mode is at each linked list item.

  • HAL_DMA_LINKEDLIST_XFER_EVENT_Q – DMA channel transfer event mode is at last linked list item.

hal_status_t HAL_DMA_FillNodeTrigger ( hal_dma_node_t * p_node , const hal_dma_trigger_config_t * p_config )

Fill node trigger configuration.

Parameters :
Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when p_node or p_config pointer is NULL

  • HAL_OK – Fill node trigger is successfully configured

void HAL_DMA_GetNodeTrigger ( const hal_dma_node_t * p_node , hal_dma_trigger_config_t * p_config )

Get the configuration of node trigger.

Parameters :
hal_status_t HAL_DMA_FillNodeDataHandling ( hal_dma_node_t * p_node , const hal_dma_data_handling_config_t * p_config )

Fill node data handling configuration.

Parameters :
Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when p_node or p_config pointer is NULL

  • HAL_OK – Fill node data handling is successfully configured

void HAL_DMA_GetNodeDataHandling ( const hal_dma_node_t * p_node , hal_dma_data_handling_config_t * p_config )

Get the configuration of node data handling.

Parameters :
hal_status_t HAL_DMA_FillNodeData ( hal_dma_node_t * p_node , uint32_t src_addr , uint32_t dest_addr , uint32_t size_byte )

Fill node data configuration.

Parameters :
  • p_node – Pointer to hal_dma_node_t node structure

  • src_addr – Source address

  • dest_addr – Destination address

  • size_byte – Size in byte

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when p_node pointer is NULL

  • HAL_OK – Fill node data is successfully configured

void HAL_DMA_GetNodeData ( const hal_dma_node_t * p_node , uint32_t * p_src_addr , uint32_t * p_dest_addr , uint32_t * p_size_byte )

Get the configuration of node data.

Parameters :
  • p_node – Pointer to hal_dma_node_t node structure

  • p_src_addr – Source address

  • p_dest_addr – Destination address

  • p_size_byte – Size in byte

hal_status_t HAL_DMA_ConvertQNodesToDynamic ( hal_q_t * p_q )

Convert linked list queue associated to the handle to dynamic format.

Parameters :

p_q – Pointer to hal_q_t configuration structure

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when p_q pointer is NULL

  • HAL_OK – Q nodes to dynamic conversion is successfully configured

hal_status_t HAL_DMA_ConvertQNodesToStatic ( hal_q_t * p_q )

Convert linked list queue associated to the handle to static format.

Parameters :

p_q – Pointer to hal_q_t configuration structure

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when p_q pointer is NULL

  • HAL_OK – Q nodes to static conversion is successfully configured

Process management functions

group DMA_Exported_Functions_Group4

This subsection provides a set of functions to configure the DMA channel peripheral:

Functions

hal_status_t HAL_DMA_StartDirectXfer ( hal_dma_handle_t * hdma , uint32_t src_addr , uint32_t dest_addr , uint32_t size_byte )

Start the DMA channel direct transfer in silent mode.

Parameters :
  • hdma – Pointer to DMA channel handle

  • src_addr – Source address

  • dest_addr – Destination address

  • size_byte – Size in byte

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when transfer mode parameter is not direct

  • HAL_BUSY – DMA channel state is active when calling this API

  • HAL_OK – Silent direct transfer is successfully started

hal_status_t HAL_DMA_StartDirectXfer_IT ( hal_dma_handle_t * hdma , uint32_t src_addr , uint32_t dest_addr , uint32_t size_byte )

Start the DMA channel direct transfer in interrupt mode with default optional interrupts configuration.

Parameters :
  • hdma – Pointer to DMA channel handle

  • src_addr – Source address

  • dest_addr – Destination address

  • size_byte – Size in byte

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when transfer mode parameter is not direct

  • HAL_BUSY – DMA channel state is active when calling this API

  • HAL_OK – Interrupt direct transfer is successfully started

hal_status_t HAL_DMA_StartDirectXfer_IT_Opt ( hal_dma_handle_t * hdma , uint32_t src_addr , uint32_t dest_addr , uint32_t size_byte , uint32_t interrupts )

Start the DMA channel direct transfer in interrupt mode with customized optional interrupts configuration.

Parameters :
  • hdma – Pointer to DMA channel handle

  • src_addr – Source address

  • dest_addr – Destination address

  • size_byte – Size in byte

  • interrupts – DMA optional interrupts to be enabled. This parameter can be one of Optional interrupts group.

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when transfer mode parameter is not direct

  • HAL_BUSY – DMA channel state is active when calling this API

  • HAL_OK – Interrupt direct transfer is successfully started

hal_status_t HAL_DMA_StartPeriphXfer_IT_Opt ( hal_dma_handle_t * hdma , uint32_t src_addr , uint32_t dest_addr , uint32_t size_byte , uint32_t interrupts )

Start the DMA channel peripheral transfer.

Note

This function is intended exclusively for internal use by HAL PPP drivers for transfers over DMA.

Parameters :
  • hdma – Pointer to DMA channel handle

  • src_addr – Source address

  • dest_addr – Destination address

  • size_byte – Size in byte

  • interrupts – DMA optional interrupts to be enabled. This parameter can be one of Optional interrupts group.

Return values :
  • HAL_ERROR – Transfer mode parameter is linked list linear

  • HAL_BUSY – DMA channel state is active when calling this API

  • HAL_OK – Peripheral transfer is successfully started

hal_status_t HAL_DMA_StartLinkedListXfer ( hal_dma_handle_t * hdma , const hal_q_t * p_q )

Start the DMA channel linked list transfer in silent mode.

Parameters :
  • hdma – Pointer to DMA channel handle

  • p_q – Pointer to hal_q_t configuration structure

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when p_q pointer is NULL or transfer mode parameter is direct

  • HAL_BUSY – DMA channel state is active when calling this API

  • HAL_OK – Silent linked list transfer is successfully started

hal_status_t HAL_DMA_StartLinkedListXfer_IT ( hal_dma_handle_t * hdma , const hal_q_t * p_q )

Start the DMA channel linked list transfer in interrupt mode with default optional interrupts configuration.

Parameters :
  • hdma – Pointer to DMA channel handle

  • p_q – Pointer to hal_q_t configuration structure

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when p_q pointer is NULL or transfer mode parameter is direct

  • HAL_BUSY – DMA channel state is active when calling this API

  • HAL_OK – Interrupt linked list transfer is successfully started

hal_status_t HAL_DMA_StartLinkedListXfer_IT_Opt ( hal_dma_handle_t * hdma , const hal_q_t * p_q , uint32_t interrupts )

Start the DMA channel linked list transfer in interrupt mode with customized optional interrupts configuration.

Parameters :
  • hdma – Pointer to DMA channel handle

  • p_q – Pointer to hal_q_t configuration structure

  • interrupts – DMA optional interrupts to be enabled. This parameter can be one of Optional interrupts group.

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when p_q pointer is NULL or transfer mode parameter is direct

  • HAL_BUSY – DMA channel state is active when calling this API

  • HAL_OK – Interrupt linked list transfer is successfully started

hal_status_t HAL_DMA_Abort ( hal_dma_handle_t * hdma )

Abort any ongoing DMA channel transfer in blocking mode.

Parameters :

hdma – Pointer to DMA channel handle

Return values :
  • HAL_ERROR – DMA channel not aborted

  • HAL_OK – Transfer in blocking mode is successfully aborted

hal_status_t HAL_DMA_Abort_IT ( hal_dma_handle_t * hdma )

Abort any ongoing DMA channel transfer in interrupt mode.

Parameters :

hdma – Pointer to DMA channel handle

Return values :
  • HAL_ERROR – DMA channel not aborted

  • HAL_OK – Transfer in interrupt mode is successfully aborted

hal_status_t HAL_DMA_Suspend ( hal_dma_handle_t * hdma )

Suspend any ongoing DMA channel transfer in blocking mode.

Parameters :

hdma – Pointer to DMA channel handle

Return values :
  • HAL_ERROR – DMA channel not suspended

  • HAL_OK – Transfer in blocking mode is successfully suspended

hal_status_t HAL_DMA_Suspend_IT ( hal_dma_handle_t * hdma )

Suspend any ongoing DMA channel transfer in interrupt mode.

Parameters :

hdma – Pointer to DMA channel handle

Return values :
  • HAL_ERROR – DMA channel not suspended

  • HAL_OK – Transfer in interrupt mode is successfully suspended

hal_status_t HAL_DMA_Resume ( hal_dma_handle_t * hdma )

Resume any suspended DMA channel transfer immediately.

Parameters :

hdma – Pointer to DMA channel handle

Return values :
  • HAL_BUSY – DMA channel state is active when calling this API

  • HAL_OK – Transfer is successfully resumed

hal_status_t HAL_DMA_PollForXfer ( hal_dma_handle_t * hdma , hal_dma_xfer_level_t xfer_level , uint32_t timeout_ms )

Polling for transfer status for finite DMA channel silent transfers.

Parameters :
  • hdma – Pointer to DMA channel handle

  • xfer_level – DMA channel transfer level

  • timeout_ms – User timeout in milliseconds

Return values :
  • HAL_TIMEOUT – User timeout

  • HAL_ERROR – DMA channel error

  • HAL_OK – Polling for transfer is successfully configured

void HAL_DMA_IRQHandler ( hal_dma_handle_t * hdma )

Handle any DMA channel interrupt.

Parameters :

hdma – Pointer to DMA channel handle

Callbacks functions

group DMA_Exported_Functions_Group5

This subsection provides a set of functions to register the DMA channel process and error callbacks:

Functions

hal_status_t HAL_DMA_RegisterXferHalfCpltCallback ( hal_dma_handle_t * hdma , hal_dma_cb_t callback )

Store the given callback into the DMA handle.

Parameters :
  • hdma – Pointer to DMA channel handle

  • callback – Half transfer complete callback

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when callback pointer is NULL

  • HAL_OK – DMA channel half transfer complete callback is successfully stored

hal_status_t HAL_DMA_RegisterXferCpltCallback ( hal_dma_handle_t * hdma , hal_dma_cb_t callback )

Store the given callback into the DMA handle.

Parameters :
  • hdma – Pointer to DMA channel handle

  • callback – Transfer complete callback

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when callback pointer is NULL

  • HAL_OK – DMA channel transfer complete callback is successfully stored

hal_status_t HAL_DMA_RegisterXferAbortCallback ( hal_dma_handle_t * hdma , hal_dma_cb_t callback )

Store the given callback into the DMA handle.

Parameters :
  • hdma – Pointer to DMA channel handle

  • callback – Abort callback

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when callback pointer is NULL

  • HAL_OK – DMA channel abort transfer callback is successfully stored

hal_status_t HAL_DMA_RegisterXferSuspendCallback ( hal_dma_handle_t * hdma , hal_dma_cb_t callback )

Store the given callback into the DMA handle.

Parameters :
  • hdma – Pointer to DMA channel handle

  • callback – Suspend callback

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when callback pointer is NULL

  • HAL_OK – DMA channel suspend transfer callback is successfully stored

hal_status_t HAL_DMA_RegisterXferErrorCallback ( hal_dma_handle_t * hdma , hal_dma_cb_t callback )

Store the given callback into the DMA handle.

Parameters :
  • hdma – Pointer to DMA channel handle

  • callback – Error callback

Return values :
  • HAL_INVALID_PARAM – Invalid parameter return when callback pointer is NULL

  • HAL_OK – DMA channel error transfer callback is successfully stored

void HAL_DMA_XferHalfCpltCallback ( hal_dma_handle_t * hdma )

DMA channel half transfer complete default callback.

Parameters :

hdma – Pointer to DMA channel handle

void HAL_DMA_XferCpltCallback ( hal_dma_handle_t * hdma )

DMA channel transfer complete default callback.

Parameters :

hdma – Pointer to DMA channel handle

void HAL_DMA_XferAbortCallback ( hal_dma_handle_t * hdma )

DMA channel abort default callback.

Parameters :

hdma – Pointer to DMA channel handle

void HAL_DMA_XferSuspendCallback ( hal_dma_handle_t * hdma )

DMA channel suspend default callback.

Parameters :

hdma – Pointer to DMA channel handle

void HAL_DMA_XferErrorCallback ( hal_dma_handle_t * hdma )

DMA channel suspend default callback.

Parameters :

hdma – Pointer to DMA channel handle

void HAL_DMA_SetUserData ( hal_dma_handle_t * hdma , const void * p_user_data )

Store the user data into the DMA channel handle.

Parameters :
  • hdma – Pointer to DMA channel handle

  • p_user_data – Pointer to the user data

const void * HAL_DMA_GetUserData ( const hal_dma_handle_t * hdma )

Retrieve the user data from the DMA channel handle.

Parameters :

hdma – Pointer to DMA channel handle

Return values :

Pointer – to the user data

Status functions

group DMA_Exported_Functions_Group6

This subsection provides a set of functions to get the DMA channel data information and status:

Functions

uint32_t HAL_DMA_GetDirectXferRemainingDataByte ( const hal_dma_handle_t * hdma )

Get the DMA channel remaining data in the current transfer in byte.

Parameters :

hdma – Pointer to DMA channel handle

Return values :

uint32_t – Direct transfer remaining data in byte

hal_dma_state_t HAL_DMA_GetState ( const hal_dma_handle_t * hdma )

Get the DMA channel current state.

Parameters :

hdma – Pointer to DMA channel handle

Return values :

hal_dma_state_t – DMA channel state

uint32_t HAL_DMA_GetLastErrorCodes ( const hal_dma_handle_t * hdma )

Get last error codes.

Parameters :

hdma – Pointer to DMA channel handle

Return values :

uint32_t – Last error codes which can be a combination of Error code definition reflecting asynchronous process errors