InPlay API
All Data Structures Functions Variables Typedefs Enumerations Enumerator Modules
uart driver

HAL_UART. More...

Functions

void * hal_uart_open (int id, uart_init_t *init)
 Open the uart driver. More...
 
void hal_uart_close (void *hdl)
 Close the uart driver. More...
 
void hal_uart_putc (void *hdl, char c)
 Output 1 char. More...
 
int hal_uart_xmit_poll (void *hdl, uint8_t *buffer, uint32_t buffer_len)
 Uart TX by polling. More...
 
int hal_uart_rcvd_poll (void *hdl, uint8_t *buffer, uint32_t buffer_len)
 Uart RX by polling. More...
 
int hal_uart_xmit_intr (void *hdl, uint8_t *buffer, uint32_t buffer_len)
 Uart TX by interrupt. More...
 
int hal_uart_xmit_intr_hci (void *hdl, uint8_t *buffer, uint32_t buffer_len, void *cb_arg, void(*callback)(void *arg, int length, int error))
 HCI Uart TX by interrupt. More...
 
int hal_uart_rcvd_intr (void *hdl, uint8_t *buffer, uint32_t buffer_len, uint32_t tmo, uint32_t *actual_rx_len)
 Uart RX by interrupt. More...
 
int hal_uart_rcvd_intr_hci (void *hdl, uint8_t *buffer, uint32_t buffer_len, void *cb_arg, void(*callback)(void *arg, int length, int error))
 HCI Uart RX by interrupt. More...
 
int hal_uart_flow_on (void *hdl)
 Manually turn on RTS request. More...
 
int hal_uart_flow_off (void *hdl)
 Manually turn off RTS request. More...
 
int hal_uart_xmit_dma (void *hdl, uint8_t *buffer, uint32_t buffer_len)
 Uart TX by DMA. More...
 
int hal_uart_rcvd_dma (void *hdl, uint8_t *buffer, uint32_t buffer_len, uint32_t tmo, uint32_t *actual_rx_len)
 Uart RX by DMA. More...
 
void hal_uart_cancel (void *hdl)
 cancel uart rx More...
 
int hal_uart_en_break (void *hdl, char en, void(*cb)(void *), void *arg)
 enable uart break feature. Use uart break signal to wake chip. More...
 
int hal_uart_en_unbreak_int (void *hdl)
 enable uart break interrupt More...
 

Variables

int baud_rate
 Uart baud rate.
 
int data_len
 Uart char length,. More...
 
int stop_bit
 Uart stop bits, 0: 1 stop bit, 1: 2 stop bits.
 
int parity_en
 Uart parity enable, 0: disable, 1: enable.
 
int even_parity
 Uart even parity, 0: odd parity, 1: even parity.
 
int fc
 Uart controller flow control enable, 1: enable, 0: disable.
 
int no_intr
 Uart don't generate interrupt.
 
int prio
 interrupt priority
 
void * rx_arg
 rx callback argument
 
void(* rx_cb )(void *arg, int length, int error)
 rx callback
 
void * tx_arg
 tx callback argument
 
void(* tx_cb )(void *arg, int length, int error)
 tx callback
 

Detailed Description

HAL_UART.

Function Documentation

◆ hal_uart_cancel()

void hal_uart_cancel ( void *  hdl)

cancel uart rx


Parameters
[in]hdl
Returns
none

◆ hal_uart_close()

void hal_uart_close ( void *  hdl)

Close the uart driver.

Parameters
[in]hdlUart handle from the open API
Returns
No return

◆ hal_uart_en_break()

int hal_uart_en_break ( void *  hdl,
char  en,
void(*)(void *)  cb,
void *  arg 
)

enable uart break feature. Use uart break signal to wake chip.


Parameters
[in]hdl
[in]en1: enable, 0: disable
[in]cbcallback function
[in]argcallback function argument
Returns
Driver error return code,
See also
enum uart_err

◆ hal_uart_en_unbreak_int()

int hal_uart_en_unbreak_int ( void *  hdl)

enable uart break interrupt


Parameters
[in]hdl
Returns
Driver error return code,
See also
enum uart_err

◆ hal_uart_flow_off()

int hal_uart_flow_off ( void *  hdl)

Manually turn off RTS request.

Parameters
[in]hdlUart handle from the open API
Returns
Driver error return code,
See also
enum uart_err

◆ hal_uart_flow_on()

int hal_uart_flow_on ( void *  hdl)

Manually turn on RTS request.

Parameters
[in]hdlUart handle from the open API
Returns
Driver error return code,
See also
enum uart_err

◆ hal_uart_open()

void* hal_uart_open ( int  id,
uart_init_t *  init 
)

Open the uart driver.

Parameters
[in]idUart Id,
See also
enum uart_id
Parameters
[in]initinit parameter,
See also
uart_init_t
Returns
Uart driver handle if successful; NULL otherwise

◆ hal_uart_putc()

void hal_uart_putc ( void *  hdl,
char  c 
)

Output 1 char.

Note
This function is to support C printf function
Parameters
[in]hdlUart handle from the open API
[in]cCharacter code
Returns
No return

◆ hal_uart_rcvd_dma()

int hal_uart_rcvd_dma ( void *  hdl,
uint8_t *  buffer,
uint32_t  buffer_len,
uint32_t  tmo,
uint32_t *  actual_rx_len 
)

Uart RX by DMA.

Parameters
[in]hdlUart handle from the open API
[in]bufferData buffer pointer for RX
[in]buffer_lenData buffer length. Max 2047 for dma transmission.
[in]tmoTimeout for block call, 0: means wait forever
[out]actual_rx_lenBlocking call return the exact RX bytes
Returns
Driver error return code,
See also
enum uart_err

◆ hal_uart_rcvd_intr()

int hal_uart_rcvd_intr ( void *  hdl,
uint8_t *  buffer,
uint32_t  buffer_len,
uint32_t  tmo,
uint32_t *  actual_rx_len 
)

Uart RX by interrupt.

Note
This function can be in either block or non-block mode. If RX completion call back function is not specified, this function will be blocked until RX completed. Otherwise, this function will return (non-block) without waiting for the RX completion. Later on, the RX completion callback function will be called from the driver's interrupt service routine to indicate transfer completed, the exact receive bytes and any errors.
Parameters
[in]hdlUart handle from the open API
[in]bufferData buffer to RX
[in]buffer_lenData buffer length
[in]tmoTimeout for block call, 0: means wait forever
[out]actual_rx_lenBlocking call return the exact RX bytes
Returns
Driver error return code,
See also
enum uart_err

◆ hal_uart_rcvd_intr_hci()

int hal_uart_rcvd_intr_hci ( void *  hdl,
uint8_t *  buffer,
uint32_t  buffer_len,
void *  cb_arg,
void(*)(void *arg, int length, int error)  callback 
)

HCI Uart RX by interrupt.

Note
This function is used for BLE HCI. Don't use it in normal application.
Parameters
[in]hdlUart handle from the open API
[in]bufferData buffer to RX
[in]buffer_lenData buffer length
[in]cb_argArgument that user wants to pass to the RX completion call back function
[in]callbackRX completion call back function provided by the user
Returns
Driver error return code,
See also
enum uart_err

◆ hal_uart_rcvd_poll()

int hal_uart_rcvd_poll ( void *  hdl,
uint8_t *  buffer,
uint32_t  buffer_len 
)

Uart RX by polling.

Parameters
[in]hdlUart handle from the open API
[in]bufferData buffer to RX
[in]buffer_lenData buffer length
Returns
Driver error return code,
See also
enum uart_err

◆ hal_uart_xmit_dma()

int hal_uart_xmit_dma ( void *  hdl,
uint8_t *  buffer,
uint32_t  buffer_len 
)

Uart TX by DMA.

Parameters
[in]hdlUart handle from the open API
[in]bufferData buffer to TX
[in]buffer_lenData buffer length
Returns
Driver error return code,
See also
enum uart_err

◆ hal_uart_xmit_intr()

int hal_uart_xmit_intr ( void *  hdl,
uint8_t *  buffer,
uint32_t  buffer_len 
)

Uart TX by interrupt.

Note
This function can be in either block or non-block mode. If TX completion call back function is not specified, this function will be blocked until TX completed. Otherwise, this function will return (non-block) without waiting for the TX completion. Later on, the TX completion callback function will be called from the driver's interrupt service routine to indicate transfer completed, the exact transmit bytes and any errors.
Parameters
[in]hdlUart handle from the open API
[in]bufferData buffer to TX
[in]buffer_lenData buffer length
[in]cb_argArgument that user wants to pass to the TX completion call back function
[in]callbackTX completion call back function provided by the user
Returns
Driver error return code,
See also
enum uart_err

◆ hal_uart_xmit_intr_hci()

int hal_uart_xmit_intr_hci ( void *  hdl,
uint8_t *  buffer,
uint32_t  buffer_len,
void *  cb_arg,
void(*)(void *arg, int length, int error)  callback 
)

HCI Uart TX by interrupt.

Note
This function is used for BLE HCI. Don't use it in normal application.
Parameters
[in]hdlUart handle from the open API
[in]bufferData buffer to TX
[in]buffer_lenData buffer length
[in]cb_argArgument that user wants to pass to the TX completion call back function
[in]callbackTX completion call back function provided by the user
Returns
Driver error return code,
See also
enum uart_err

◆ hal_uart_xmit_poll()

int hal_uart_xmit_poll ( void *  hdl,
uint8_t *  buffer,
uint32_t  buffer_len 
)

Uart TX by polling.

Parameters
[in]hdlUart handle from the open API
[in]bufferData buffer to TX
[in]buffer_lenData buffer length
Returns
Driver error return code,
See also
enum uart_err

Variable Documentation

◆ data_len

int data_len

Uart char length,.

See also
enum uart_len