Bouffalo SDK  1.0
Bouffalolab Software Development Kit
DMA
Collaboration diagram for DMA:

Modules

 dma transfer direction definition
 
 dma source and destination address increment definition
 
 dma data width definition
 
 dma burst increment count definition
 
 dma feature control cmd definition
 

Data Structures

union  bflb_dma_lli_control_s
 
struct  bflb_dma_channel_lli_pool_s
 DMA channel lli pool structure. More...
 
struct  bflb_dma_channel_lli_transfer_s
 DMA channel lli transfer structure. More...
 
struct  bflb_dma_channel_config_s
 DMA configuration structure. More...
 
struct  bflb_rx_cycle_dma
 

Functions

void bflb_dma_channel_init (struct bflb_device_s *dev, const struct bflb_dma_channel_config_s *config)
 Initialize dma channel. More...
 
void bflb_dma_channel_deinit (struct bflb_device_s *dev)
 Deinitialize dma channel. More...
 
void bflb_dma_channel_start (struct bflb_device_s *dev)
 Start dma channel transfer. More...
 
void bflb_dma_channel_stop (struct bflb_device_s *dev)
 Stop dma channel transfer. More...
 
bool bflb_dma_channel_isbusy (struct bflb_device_s *dev)
 Check if dma channel is in busy. More...
 
void bflb_dma_channel_irq_attach (struct bflb_device_s *dev, void(*callback)(void *arg), void *arg)
 Register dma channel transmission completion interrupt callback. More...
 
void bflb_dma_channel_irq_detach (struct bflb_device_s *dev)
 Unregister dma channel transmission completion interrupt callback. More...
 
int bflb_dma_channel_lli_reload (struct bflb_device_s *dev, struct bflb_dma_channel_lli_pool_s *lli_pool, uint32_t max_lli_count, struct bflb_dma_channel_lli_transfer_s *transfer, uint32_t count)
 Config dma channel lli. More...
 
void bflb_dma_channel_lli_link_head (struct bflb_device_s *dev, struct bflb_dma_channel_lli_pool_s *lli_pool, uint32_t used_lli_count)
 Enable lli continueous mode. More...
 
void bflb_rx_cycle_dma_init (struct bflb_rx_cycle_dma *rx_dma, struct bflb_device_s *dma_ch, struct bflb_dma_channel_lli_pool_s *rx_llipool, uint8_t rx_llipool_size, uint32_t src_addr, uint8_t *dst_buf, uint32_t dst_buf_size, void(*copy)(uint8_t *data, uint32_t len))
 Init rx cycle dma. More...
 
void bflb_rx_cycle_dma_process (struct bflb_rx_cycle_dma *rx_dma, bool in_dma_isr)
 Rx cycle dma process. More...
 
int bflb_dma_feature_control (struct bflb_device_s *dev, int cmd, size_t arg)
 Control dma feature. More...
 
void bflb_dma_channel_tcint_mask (struct bflb_device_s *dev, bool mask)
 Enable or disable dma channel transmission completion interrupt. More...
 
bool bflb_dma_channel_get_tcint_status (struct bflb_device_s *dev)
 Check if dma channel transfers completely. More...
 
void bflb_dma_channel_tcint_clear (struct bflb_device_s *dev)
 Clear dma channel transmission completion interrupt status. More...
 

Detailed Description

Function Documentation

◆ bflb_dma_channel_deinit()

void bflb_dma_channel_deinit ( struct bflb_device_s dev)

Deinitialize dma channel.

Parameters
[in]devdevice handle

◆ bflb_dma_channel_get_tcint_status()

bool bflb_dma_channel_get_tcint_status ( struct bflb_device_s dev)

Check if dma channel transfers completely.

Parameters
[in]devdevice handle
Returns
true means yes, false means no.

◆ bflb_dma_channel_init()

void bflb_dma_channel_init ( struct bflb_device_s dev,
const struct bflb_dma_channel_config_s config 
)

Initialize dma channel.

Parameters
[in]devdevice handle
[in]configpointer to save dma channel configuration

◆ bflb_dma_channel_irq_attach()

void bflb_dma_channel_irq_attach ( struct bflb_device_s dev,
void(*)(void *arg)  callback,
void *  arg 
)

Register dma channel transmission completion interrupt callback.

Parameters
[in]devdevice handle
[in]callbackinterrupt callback
[in]arguser data

◆ bflb_dma_channel_irq_detach()

void bflb_dma_channel_irq_detach ( struct bflb_device_s dev)

Unregister dma channel transmission completion interrupt callback.

Parameters
[in]devdevice handle

◆ bflb_dma_channel_isbusy()

bool bflb_dma_channel_isbusy ( struct bflb_device_s dev)

Check if dma channel is in busy.

Parameters
[in]devdevice handle
Returns
true means dma channel does not transfer completely, otherwise transfers completely.

◆ bflb_dma_channel_lli_link_head()

void bflb_dma_channel_lli_link_head ( struct bflb_device_s dev,
struct bflb_dma_channel_lli_pool_s lli_pool,
uint32_t  used_lli_count 
)

Enable lli continueous mode.

Parameters
[in]devdevice handle
[in]lli_poolpointer to lli pool
[in]used_lli_countnumber of used lli.

◆ bflb_dma_channel_lli_reload()

int bflb_dma_channel_lli_reload ( struct bflb_device_s dev,
struct bflb_dma_channel_lli_pool_s lli_pool,
uint32_t  max_lli_count,
struct bflb_dma_channel_lli_transfer_s transfer,
uint32_t  count 
)

Config dma channel lli.

Parameters
[in]devdevice handle
[in]lli_poolpointer to lli pool
[in]max_lli_countlli pool size
[in]transferpointer to transfer structure
[in]counttransfer count.
Returns
A negated errno value on failure, otherwise means number of used lli.

◆ bflb_dma_channel_start()

void bflb_dma_channel_start ( struct bflb_device_s dev)

Start dma channel transfer.

Parameters
[in]devdevice handle

◆ bflb_dma_channel_stop()

void bflb_dma_channel_stop ( struct bflb_device_s dev)

Stop dma channel transfer.

Parameters
[in]devdevice handle

◆ bflb_dma_channel_tcint_clear()

void bflb_dma_channel_tcint_clear ( struct bflb_device_s dev)

Clear dma channel transmission completion interrupt status.

Parameters
[in]devdevice handle

◆ bflb_dma_channel_tcint_mask()

void bflb_dma_channel_tcint_mask ( struct bflb_device_s dev,
bool  mask 
)

Enable or disable dma channel transmission completion interrupt.

Parameters
[in]devdevice handle
[in]masktrue means disable, false means enable

◆ bflb_dma_feature_control()

int bflb_dma_feature_control ( struct bflb_device_s dev,
int  cmd,
size_t  arg 
)

Control dma feature.

Parameters
[in]devdevice handle
[in]cmdfeature command. use dma feature control cmd definition
[in]arguser data
Returns
A negated errno value on failure.

◆ bflb_rx_cycle_dma_init()

void bflb_rx_cycle_dma_init ( struct bflb_rx_cycle_dma rx_dma,
struct bflb_device_s dma_ch,
struct bflb_dma_channel_lli_pool_s rx_llipool,
uint8_t  rx_llipool_size,
uint32_t  src_addr,
uint8_t *  dst_buf,
uint32_t  dst_buf_size,
void(*)(uint8_t *data, uint32_t len)  copy 
)

Init rx cycle dma.

Parameters
[in]rx_dmarx dma handle
[in]dma_chdma channel handle
[in]rx_llipoolpointer to lli pool
[in]rx_llipool_sizenumber of used lli
[in]src_addrdma source addr
[in]dst_bufdma dest addr
[in]dst_buf_sizedma dest buffer size
[in]copypointer to data copy

◆ bflb_rx_cycle_dma_process()

void bflb_rx_cycle_dma_process ( struct bflb_rx_cycle_dma rx_dma,
bool  in_dma_isr 
)

Rx cycle dma process.

Parameters
[in]rx_dmarx dma handle
[in]in_dma_isrif called in dma isr