Bouffalo SDK  1.0
Bouffalolab Software Development Kit
bflb_dma.h File Reference
#include "bflb_core.h"
Include dependency graph for bflb_dma.h:

Go to the source code of this file.

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
 

Macros

#define DMA_MEMORY_TO_MEMORY   0
 
#define DMA_MEMORY_TO_PERIPH   1
 
#define DMA_PERIPH_TO_MEMORY   2
 
#define DMA_PERIPH_TO_PERIPH   3
 
#define DMA_ADDR_INCREMENT_DISABLE   0
 
#define DMA_ADDR_INCREMENT_ENABLE   1
 
#define DMA_DATA_WIDTH_8BIT   0
 
#define DMA_DATA_WIDTH_16BIT   1
 
#define DMA_DATA_WIDTH_32BIT   2
 
#define DMA_BURST_INCR1   0
 
#define DMA_BURST_INCR4   1
 
#define DMA_BURST_INCR8   2
 
#define DMA_BURST_INCR16   3
 
#define DMA_CMD_SET_SRCADDR_INCREMENT   (0x01)
 
#define DMA_CMD_SET_DSTADDR_INCREMENT   (0x02)
 
#define DMA_CMD_SET_ADD_MODE   (0x03)
 
#define DMA_CMD_SET_REDUCE_MODE   (0x04)
 
#define DMA_CMD_SET_LLI_CONFIG   (0x05)
 
#define DMA_CMD_GET_LLI_SRCADDR   (0x06)
 
#define DMA_CMD_GET_LLI_DSTADDR   (0x07)
 
#define DMA_CMD_GET_LLI_CONTROL   (0x08)
 
#define DMA_CMD_GET_LLI_COUNT   (0x09)
 

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...