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

Modules

 uart direction enable definition
 
 uart data bits definition
 
 uart stop bits definition
 
 uart parity definition
 
 uart bitorder definition
 
 uart flow ctrl definition
 
 uart interrupt status definition
 
 uart interrupt clear definition
 
 uart feature control cmd definition
 

Data Structures

struct  bflb_uart_ir_config_s
 
struct  bflb_uart_config_s
 UART configuration structure. More...
 

Macros

#define UART_AUTO_BAUD_START   0
 
#define UART_AUTO_BAUD_0X55   1
 

Functions

void bflb_uart_init (struct bflb_device_s *dev, const struct bflb_uart_config_s *config)
 Initialize uart. More...
 
void bflb_uart_deinit (struct bflb_device_s *dev)
 Deinitialize uart. More...
 
void bflb_uart_enable (struct bflb_device_s *dev)
 Enable uart. More...
 
void bflb_uart_disable (struct bflb_device_s *dev)
 Disable uart. More...
 
void bflb_uart_link_txdma (struct bflb_device_s *dev, bool enable)
 Enable uart tx dma. More...
 
void bflb_uart_link_rxdma (struct bflb_device_s *dev, bool enable)
 Enable uart rx dma. More...
 
int bflb_uart_putchar (struct bflb_device_s *dev, int ch)
 Put one char on uart. More...
 
int bflb_uart_getchar (struct bflb_device_s *dev)
 Get char from uart. More...
 
int bflb_uart_put (struct bflb_device_s *dev, uint8_t *data, uint32_t len)
 Put a block of data on uart.This is a poll api. More...
 
int bflb_uart_put_block (struct bflb_device_s *dev, uint8_t *data, uint32_t len)
 Put a block of data on uart.Block before sending done. More...
 
int bflb_uart_get (struct bflb_device_s *dev, uint8_t *data, uint32_t len)
 Get a block of data from uart. This is a asynchronous api. More...
 
bool bflb_uart_txready (struct bflb_device_s *dev)
 Check if there is free space in tx fifo. More...
 
bool bflb_uart_txempty (struct bflb_device_s *dev)
 Check if there is no data in tx fifo. More...
 
bool bflb_uart_rxavailable (struct bflb_device_s *dev)
 Check if there is data in rx fifo. More...
 
void bflb_uart_txint_mask (struct bflb_device_s *dev, bool mask)
 Enable or disable uart tx fifo threhold interrupt. More...
 
void bflb_uart_rxint_mask (struct bflb_device_s *dev, bool mask)
 Enable or disable uart rx fifo threhold interrupt. More...
 
void bflb_uart_errint_mask (struct bflb_device_s *dev, bool mask)
 Enable or disable uart error interrupt. More...
 
uint32_t bflb_uart_get_intstatus (struct bflb_device_s *dev)
 Get uart interrupt status. More...
 
void bflb_uart_int_clear (struct bflb_device_s *dev, uint32_t int_clear)
 Clear uart interrupt status. More...
 
int bflb_uart_feature_control (struct bflb_device_s *dev, int cmd, size_t arg)
 Control uart feature. More...
 

Detailed Description

Macro Definition Documentation

◆ UART_AUTO_BAUD_0X55

#define UART_AUTO_BAUD_0X55   1

Definition at line 162 of file bflb_uart.h.

◆ UART_AUTO_BAUD_START

#define UART_AUTO_BAUD_START   0

Definition at line 161 of file bflb_uart.h.

Function Documentation

◆ bflb_uart_deinit()

void bflb_uart_deinit ( struct bflb_device_s dev)

Deinitialize uart.

Parameters
[in]devdevice handle

◆ bflb_uart_disable()

void bflb_uart_disable ( struct bflb_device_s dev)

Disable uart.

Parameters
[in]devdevice handle

◆ bflb_uart_enable()

void bflb_uart_enable ( struct bflb_device_s dev)

Enable uart.

Parameters
[in]devdevice handle

◆ bflb_uart_errint_mask()

void bflb_uart_errint_mask ( struct bflb_device_s dev,
bool  mask 
)

Enable or disable uart error interrupt.

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

◆ bflb_uart_feature_control()

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

Control uart feature.

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

◆ bflb_uart_get()

int bflb_uart_get ( struct bflb_device_s dev,
uint8_t *  data,
uint32_t  len 
)

Get a block of data from uart. This is a asynchronous api.

Parameters
[in]devdevice handle
[in]datapointer to save received data
[in]lenmax length wants to receive
Returns
actual received length

◆ bflb_uart_get_intstatus()

uint32_t bflb_uart_get_intstatus ( struct bflb_device_s dev)

Get uart interrupt status.

Parameters
[in]devdevice handle
Returns
interrupt status, use uart interrupt status definition

◆ bflb_uart_getchar()

int bflb_uart_getchar ( struct bflb_device_s dev)

Get char from uart.

Parameters
[in]devdevice handle
Returns
A negated errno value on failure, otherwise received char.

◆ bflb_uart_init()

void bflb_uart_init ( struct bflb_device_s dev,
const struct bflb_uart_config_s config 
)

Initialize uart.

Parameters
[in]devdevice handle
[in]configpointer to save uart config

◆ bflb_uart_int_clear()

void bflb_uart_int_clear ( struct bflb_device_s dev,
uint32_t  int_clear 
)

Clear uart interrupt status.

Parameters
[in]devdevice handle
[in]int_clearclear value, use uart interrupt clear definition

◆ bflb_uart_link_rxdma()

void bflb_uart_link_rxdma ( struct bflb_device_s dev,
bool  enable 
)

Enable uart rx dma.

Parameters
[in]devdevice handle
[in]enabletrue means enable, otherwise disable.

◆ bflb_uart_link_txdma()

void bflb_uart_link_txdma ( struct bflb_device_s dev,
bool  enable 
)

Enable uart tx dma.

Parameters
[in]devdevice handle
[in]enabletrue means enable, otherwise disable.

◆ bflb_uart_put()

int bflb_uart_put ( struct bflb_device_s dev,
uint8_t *  data,
uint32_t  len 
)

Put a block of data on uart.This is a poll api.

Parameters
[in]devdevice handle
[in]datapointer to save send data
[in]lenlength to send
Returns
A negated errno value on failure.

◆ bflb_uart_put_block()

int bflb_uart_put_block ( struct bflb_device_s dev,
uint8_t *  data,
uint32_t  len 
)

Put a block of data on uart.Block before sending done.

Parameters
[in]devdevice handle
[in]datapointer to save send data
[in]lenlength to send
Returns
A negated errno value on failure.

◆ bflb_uart_putchar()

int bflb_uart_putchar ( struct bflb_device_s dev,
int  ch 
)

Put one char on uart.

Parameters
[in]devdevice handle
[in]chchar
Returns
A negated errno value on failure.

◆ bflb_uart_rxavailable()

bool bflb_uart_rxavailable ( struct bflb_device_s dev)

Check if there is data in rx fifo.

Parameters
[in]devdevice handle
Returns
true means yes.Otherwise there is no data in rx fifo

◆ bflb_uart_rxint_mask()

void bflb_uart_rxint_mask ( struct bflb_device_s dev,
bool  mask 
)

Enable or disable uart rx fifo threhold interrupt.

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

◆ bflb_uart_txempty()

bool bflb_uart_txempty ( struct bflb_device_s dev)

Check if there is no data in tx fifo.

Parameters
[in]devdevice handle
Returns
Return true if all characters have been sent

◆ bflb_uart_txint_mask()

void bflb_uart_txint_mask ( struct bflb_device_s dev,
bool  mask 
)

Enable or disable uart tx fifo threhold interrupt.

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

◆ bflb_uart_txready()

bool bflb_uart_txready ( struct bflb_device_s dev)

Check if there is free space in tx fifo.

Parameters
[in]devdevice handle
Returns
Return true if the tranmsit hardware is ready to send another byte