HAL DMA Functions

Initialization and De-initialization functions

group DMA_Exported_Functions_Group1

This subsection provides a set of functions allowing 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 – Specifie the 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 by aborting any DMA ongoing transfer.

Parameters :

hdma – Pointer to DMA channel handle

Configuration functions

group DMA_Exported_Functions_Group2

This subsection provides a set of functions allowing 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_SetConfigDirectXferPort ( hal_dma_handle_t * hdma , hal_dma_port_t src_port , hal_dma_port_t dest_port )

Set the DMA channel direct transfer source and destination allocated port configuration.

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

  • HAL_OK – Direct transfer port is successfully configured

hal_status_t HAL_DMA_ResetConfigDirectXferPort ( hal_dma_handle_t * hdma )

Reset the DMA channel direct transfer port 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 port configuration is successful

void HAL_DMA_GetConfigDirectXferPort ( hal_dma_handle_t * hdma , hal_dma_port_t * p_src_port , hal_dma_port_t * p_dest_port )

Get the DMA channel direct transfer port configuration.

Parameters :
hal_status_t HAL_DMA_SetConfigDirectXferBurst ( hal_dma_handle_t * hdma , uint32_t src_burst_length_byte , uint32_t dest_burst_length_byte )

Set the DMA channel direct transfer burst configuration.

Parameters :
  • hdma – Pointer to DMA channel handle

  • src_burst_length_byte – Source burst length in byte

  • dest_burst_length_byte – Destination burst length in byte

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

  • HAL_OK – Direct transfer burst is successfully configured

hal_status_t HAL_DMA_ResetConfigDirectXferBurst ( hal_dma_handle_t * hdma )

Reset the DMA channel direct transfer burst 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 burst configuration is successful

void HAL_DMA_GetConfigDirectXferBurst ( hal_dma_handle_t * hdma , uint32_t * p_src_burst_length_byte , uint32_t * p_dest_burst_length_byte )

Get the DMA channel direct transfer burst configuration.

Parameters :
  • hdma – Pointer to DMA channel handle

  • p_src_burst_length_byte – Source burst length in byte

  • p_dest_burst_length_byte – Destination burst length in byte

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_SetConfigDirectXferRepeatBlock ( hal_dma_handle_t * hdma , const hal_dma_repeat_block_config_t * p_config )

Set the DMA channel direct transfer repeated block 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 repeated block is successfully configured

hal_status_t HAL_DMA_ResetConfigDirectXferRepeatBlock ( hal_dma_handle_t * hdma )

Reset the DMA channel direct transfer repeated block 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 repeated block configuration is successful

void HAL_DMA_GetConfigDirectXferRepeatBlock ( hal_dma_handle_t * hdma , hal_dma_repeat_block_config_t * p_config )

Get the DMA channel direct transfer repeated block configuration.

Parameters :
hal_status_t HAL_DMA_SetConfigAccessAttributes ( hal_dma_handle_t * hdma , hal_dma_sec_attr_t src_attr , hal_dma_sec_attr_t dest_attr )

Set the DMA channel security access attributes configuration.

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

  • HAL_OK – Security access attributes is successfully configured

hal_status_t HAL_DMA_ResetConfigAccessAttributes ( hal_dma_handle_t * hdma )

Reset the DMA channel security access attributes 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 security access attributes configuration is successful

void HAL_DMA_GetConfigAccessAttributes ( hal_dma_handle_t * hdma , hal_dma_sec_attr_t * p_src_attr , hal_dma_sec_attr_t * p_dest_attr )

Get the DMA channel security access attributes configuration.

Parameters :
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_SetLinkedListXferFetchNodePort ( hal_dma_handle_t * hdma , hal_dma_port_t fetch_port )

Set the DMA channel linked-list transfer fetch node port configuration.

Parameters :
  • hdma – Pointer to DMA channel handle

  • fetch_port – Element in hal_dma_port_t enumeration

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

  • HAL_OK – Linked-list transfer fetch node port is successfully configured

hal_status_t HAL_DMA_ResetLinkedListXferFetchNodePort ( hal_dma_handle_t * hdma )

Reset the DMA channel linked-list transfer fetch node port 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 fetech node port configuration is successful

hal_dma_port_t HAL_DMA_GetLinkedListXferFetchNodePort ( hal_dma_handle_t * hdma )

Get the DMA channel linked-list transfer fetch node port configuration.

Parameters :

hdma – Pointer to DMA channel handle

Return values :
  • HAL_DMA_PORT0 – DMA channel port 0

  • HAL_DMA_PORT1 – DMA channel port 1

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 :
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 allowing 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_FillNodePort ( hal_dma_node_t * p_node , hal_dma_port_t src_port , hal_dma_port_t dest_port )

Fill node port configuration.

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

  • HAL_OK – Fill node port is successfully configured

void HAL_DMA_GetNodePort ( const hal_dma_node_t * p_node , hal_dma_port_t * p_src_port , hal_dma_port_t * p_dest_port )

Get the configuration of node port.

Parameters :
hal_status_t HAL_DMA_FillNodeBurst ( hal_dma_node_t * p_node , uint32_t src_burst_length_byte , uint32_t dest_burst_length_byte )

Fill node burst configuration.

Parameters :
  • p_node – Pointer to hal_dma_node_t node structure

  • src_burst_length_byte – Source burst length in byte

  • dest_burst_length_byte – Source burst length in byte

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

  • HAL_OK – Fill node burst is successfully configured

void HAL_DMA_GetNodeBurst ( const hal_dma_node_t * p_node , uint32_t * p_src_burst_length_byte , uint32_t * p_dest_burst_length_byte )

Get the configuration of node port.

Parameters :
  • p_node – Pointer to hal_dma_node_t node structure

  • p_src_burst_length_byte – Source burst length in byte

  • p_dest_burst_length_byte – Source burst length in byte

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_REPEATED_BLOCK – DMA Channel transfer event mode is at repeated 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_FillNodeRepeatBlock ( hal_dma_node_t * p_node , const hal_dma_repeat_block_config_t * p_config )

Fill node repeated block configuration.

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

  • HAL_OK – Fill node repeated block is successfully configured

void HAL_DMA_GetNodeRepeatBlock ( const hal_dma_node_t * p_node , hal_dma_repeat_block_config_t * p_config )

Get the configuration of node repeated block.

Parameters :
hal_status_t HAL_DMA_FillNodeAccessAttributes ( hal_dma_node_t * p_node , hal_dma_sec_attr_t src_attr , hal_dma_sec_attr_t dest_attr )

Fill node access attributes.

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

  • HAL_OK – Fill node access attributes is successfully configured

void HAL_DMA_GetNodeAccessAttributes ( const hal_dma_node_t * p_node , hal_dma_sec_attr_t * p_src_attr , hal_dma_sec_attr_t * p_dest_attr )

Get node access attributes.

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 allowing 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 – Specifies the DMA optional interrupt to be enable. 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_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 – Specifies the DMA optional interrupt to be enable. 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 instantantly any suspended DMA channel transfer.

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_msec )

Polling for transfer status for finite DMA channel silent transfers.

Parameters :
  • hdma – Pointer to DMA channel handle

  • xfer_level – Specifies the DMA channel transfer level

  • timeout_msec – Specifies the user timeout in milli-second

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 allowing 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 – Specifies the 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 – Specifies the 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 – Specifies the 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 – Specifies the 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 – Specifies the 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 allowing to get the DMA channel data information and status:

Functions

uint32_t HAL_DMA_GetFifoDataByte ( const hal_dma_handle_t * hdma )

Get the DMA channel remaining data in the FIFO in byte.

Parameters :

hdma – Pointer to DMA channel handle

Return values :

uint32_t – FIFO remaining data in byte

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 the processes asynchronous errors