VSF Documented
Macros | Functions
dma_common.c File Reference
#include "hal/driver/driver.h"

Macros

#define VSF_DMA_CFG_FUNCTION_RENAME   DISABLED
 

Functions

vsf_err_t vsf_dma_init (vsf_dma_t *dma_ptr, vsf_dma_cfg_t *cfg_ptr)
 Initialize a DMA instance.
 
void vsf_dma_fini (vsf_dma_t *dma_ptr)
 Finalize a DMA instance.
 
vsf_dma_capability_t vsf_dma_capability (vsf_dma_t *dma_ptr)
 Get the capabilities of DMA instance.
 
int8_t vsf_dma_channel_request (vsf_dma_t *dma_ptr, vsf_dma_channel_hint_t *channel_hint_ptr)
 DMA request a new channel.
 
void vsf_dma_channel_release (vsf_dma_t *dma_ptr, uint8_t channel)
 Release a DMA channel.
 
vsf_err_t vsf_dma_channel_config (vsf_dma_t *dma_ptr, uint8_t channel, vsf_dma_channel_cfg_t *cfg_ptr)
 Configure a DMA channel.
 
vsf_err_t vsf_dma_channel_start (vsf_dma_t *dma_ptr, uint8_t channel, uint32_t src_address, uint32_t dst_address, uint32_t count)
 Start a DMA channel transfer.
 
vsf_err_t vsf_dma_channel_sg_config_desc (vsf_dma_t *dma_ptr, uint8_t channel, vsf_dma_isr_t isr, vsf_dma_channel_sg_desc_t *sg_desc_ptr, uint32_t sg_count)
 Configure a DMA channel for scatter-gather transfer.
 
vsf_err_t vsf_dma_channel_sg_start (vsf_dma_t *dma_ptr, uint8_t channel)
 Start a DMA scatter-gather transfer.
 
vsf_err_t vsf_dma_channel_cancel (vsf_dma_t *dma_ptr, uint8_t channel)
 Cancel the transmission of a specific DMA channel.
 
uint32_t vsf_dma_channel_get_transferred_count (vsf_dma_t *dma_ptr, uint8_t channel)
 Get the counter of bytes transferred for a specific DMA channel.
 
vsf_dma_channel_status_t vsf_dma_channel_status (vsf_dma_t *dma_ptr, uint8_t channel)
 Get status of a DMA channel.
 

Macro Definition Documentation

◆ VSF_DMA_CFG_FUNCTION_RENAME

#define VSF_DMA_CFG_FUNCTION_RENAME   DISABLED

Function Documentation

◆ vsf_dma_init()

vsf_err_t vsf_dma_init ( vsf_dma_t dma_ptr,
vsf_dma_cfg_t cfg_ptr 
)

Initialize a DMA instance.

Parameters
[in]dma_ptra pointer to structure vsf_dma_t
[in]cfg_ptra pointer to structure vsf_dma_cfg_t
Returns
vsf_err_t: VSF_ERR_NONE if initialization successful, otherwise returns error code
Note
It is not necessary to call vsf_dma_fini() to deinitialization. vsf_dma_init() should be called before any other DMA API except vsf_dma_capability().

◆ vsf_dma_fini()

void vsf_dma_fini ( vsf_dma_t dma_ptr)

Finalize a DMA instance.

Parameters
[in]dma_ptra pointer to structure vsf_dma_t
Returns
none

◆ vsf_dma_capability()

vsf_dma_capability_t vsf_dma_capability ( vsf_dma_t dma_ptr)

Get the capabilities of DMA instance.

Parameters
[in]dma_ptra pointer to structure vsf_dma_t
Returns
vsf_dma_capability_t: All capabilities of current DMA vsf_dma_capability_t

◆ vsf_dma_channel_request()

int8_t vsf_dma_channel_request ( vsf_dma_t dma_ptr,
vsf_dma_channel_hint_t channel_hint_ptr 
)

DMA request a new channel.

Parameters
[in]dma_ptra pointer to structure vsf_dma_t
[in]channel_hint_ptra pointer to DMA channel hint
Returns
int8_t: if request was successful, return non-negative channel number, otherwise return error code

◆ vsf_dma_channel_release()

void vsf_dma_channel_release ( vsf_dma_t dma_ptr,
uint8_t  channel 
)

Release a DMA channel.

Parameters
[in]dma_ptra pointer to structure vsf_dma_t
[in]channelchannel number
Returns
none

◆ vsf_dma_channel_config()

vsf_err_t vsf_dma_channel_config ( vsf_dma_t dma_ptr,
uint8_t  channel,
vsf_dma_channel_cfg_t cfg_ptr 
)

Configure a DMA channel.

Parameters
[in]dma_ptra pointer to structure vsf_dma_t
[in]channelchannel number
[in]cfg_ptra pointer to DMA channel configuration
Returns
vsf_err_t: VSF_ERR_NONE if the configuration was successful, otherwise returns error code

◆ vsf_dma_channel_start()

vsf_err_t vsf_dma_channel_start ( vsf_dma_t dma_ptr,
uint8_t  channel,
uint32_t  src_address,
uint32_t  dst_address,
uint32_t  count 
)

Start a DMA channel transfer.

Parameters
[in]dma_ptra pointer to structure vsf_dma_t
[in]channelchannel number
[in]src_addresssource address
[in]dst_addressdestination address
[in]countcounter of data to be transferred (in byte)
Returns
vsf_err_t: VSF_ERR_NONE if the start request was successful, otherwise returns error code

◆ vsf_dma_channel_sg_config_desc()

vsf_err_t vsf_dma_channel_sg_config_desc ( vsf_dma_t dma_ptr,
uint8_t  channel,
vsf_dma_isr_t  isr,
vsf_dma_channel_sg_desc_t sg_desc_ptr,
uint32_t  sg_count 
)

Configure a DMA channel for scatter-gather transfer.

Parameters
[in]dma_ptra pointer to structure vsf_dma_t
[in]channelchannel number
[in]isrDMA interrupt handler
[in]cfg_ptra pointer to DMA channel scatter-gather configuration
[in]sg_countnumber of scatter-gather configurations
Returns
vsf_err_t: VSF_ERR_NONE if the configuration was successful, otherwise returns error code

◆ vsf_dma_channel_sg_start()

vsf_err_t vsf_dma_channel_sg_start ( vsf_dma_t dma_ptr,
uint8_t  channel 
)

Start a DMA scatter-gather transfer.

Parameters
[in]dma_ptra pointer to structure vsf_dma_t
[in]channelchannel number
Returns
vsf_err_t: VSF_ERR_NONE if the start request was successful, otherwise returns error code

◆ vsf_dma_channel_cancel()

vsf_err_t vsf_dma_channel_cancel ( vsf_dma_t dma_ptr,
uint8_t  channel 
)

Cancel the transmission of a specific DMA channel.

Parameters
[in]dma_ptra pointer to structure vsf_dma_t
[in]channelchannel number
Returns
vsf_err_t: VSF_ERR_NONE if the cancel request was successful, otherwise returns error code

◆ vsf_dma_channel_get_transferred_count()

uint32_t vsf_dma_channel_get_transferred_count ( vsf_dma_t dma_ptr,
uint8_t  channel 
)

Get the counter of bytes transferred for a specific DMA channel.

Parameters
[in]dma_ptra pointer to structure vsf_dma_t
[in]channelchannel number
Returns
uint32_t: Number of bytes transferred
Note
: If called after VSF_DMA_IRQ_MASK_CPL interrupt trigger, it should return 0.
: It is usually called after call vsf_dma_channel_cancel() to get the counter that has been transferred.

◆ vsf_dma_channel_status()

vsf_dma_channel_status_t vsf_dma_channel_status ( vsf_dma_t dma_ptr,
uint8_t  channel 
)

Get status of a DMA channel.

Parameters
[in]dma_ptra pointer to structure vsf_dma_t
[in]channelchannel number
Returns
vsf_dma_channel_status_t: Status of the DMA channel
Generated from commit: vsfteam/vsf@0c4049f