Functions for using Universal Asynchronous Receive/Transmit (UART) peripheral. More...

Modules

Types
Hardware UART data types.
 

Functions

zos_result_t zn_uart_configure (zos_uart_t uart, const zos_uart_config_t *config, const zos_uart_buffer_t *buffer)
 Configure UART hardware. More...
 
zos_result_t zn_uart_transmit_bytes (zos_uart_t uart, const void *data, uint32_t size)
 Transmit data on a UART interface. More...
 
zos_result_t zn_uart_receive_bytes (zos_uart_t uart, void *data, uint32_t size, uint32_t timeout)
 Receive data on a UART interface. More...
 
uint32_t zn_uart_get_bytes_received (zos_uart_t uart)
 Get number of bytes read from previous zn_uart_receive_bytes() call.
 
zos_result_t zn_uart_peek_bytes (zos_uart_t uart, const uint8_t **data, uint16_t *byte_pending)
 View pending data and size (without actually reading data) More...
 
zos_result_t zn_uart_set_packet_mode (zos_uart_t uart, const zos_uart_mode_config_t *config)
 Change the data reception Mode. More...
 
zos_bool_t zn_uart_is_processing_packet (zos_uart_t uart)
 A rx data packet is being populated. More...
 
zos_result_t zn_uart_set_packet (zos_uart_t uart, void *data, uint16_t length)
 Add packet to hold rx data. More...
 
zos_result_t zn_uart_set_packet_timed_out (zos_uart_t uart)
 Signal that rx packet has timedout. More...
 
zos_uart_callback_t zn_uart_set_tx_processor (zos_uart_t uart, zos_uart_callback_t processor_callback)
 Register callback to periodically trigger will data is pending to be transmitted. More...
 
zos_uart_callback_t zn_uart_register_rx_callback (zos_uart_t uart, zos_uart_callback_t rx_callback)
 Register rx character callback. More...
 

Detailed Description

Functions for using Universal Asynchronous Receive/Transmit (UART) peripheral.

Function Documentation

zos_result_t zn_uart_configure ( zos_uart_t  uart,
const zos_uart_config_t config,
const zos_uart_buffer_t buffer 
)
zos_bool_t zn_uart_is_processing_packet ( zos_uart_t  uart)

A rx data packet is being populated.

zos_result_t zn_uart_peek_bytes ( zos_uart_t  uart,
const uint8_t **  data,
uint16_t *  byte_pending 
)

View pending data and size (without actually reading data)

Examples:
basic/ftp_upload/ftp_upload.c, and basic/uart/uart.c.
zos_result_t zn_uart_receive_bytes ( zos_uart_t  uart,
void *  data,
uint32_t  size,
uint32_t  timeout 
)

Receive data on a UART interface.

Parameters
[in]uart: the UART interface
[out]data: pointer to the buffer which will store incoming data
[in]size: number of bytes to receive
[in]timeout: timeout in milisecond
Returns
zos_result_t result of API call
Examples:
basic/ftp_upload/ftp_upload.c, basic/http_methods/main.c, basic/uart/uart.c, and demo/uart_blaster/uart_blaster.c.
zos_uart_callback_t zn_uart_register_rx_callback ( zos_uart_t  uart,
zos_uart_callback_t  rx_callback 
)

Register rx character callback.

Note
The callback executes in the UART IRQ. The callback MUST be very lightweight and do minimal processing.
Parameters
uartzos_uart_t to register callback with
rx_callbackCallback to be called when uart has RX data
Returns
Previously registered callback
Examples:
basic/uart/uart.c, and demo/uart_blaster/uart_blaster.c.
zos_result_t zn_uart_set_packet ( zos_uart_t  uart,
void *  data,
uint16_t  length 
)

Add packet to hold rx data.

zos_result_t zn_uart_set_packet_mode ( zos_uart_t  uart,
const zos_uart_mode_config_t config 
)

Change the data reception Mode.

zos_result_t zn_uart_set_packet_timed_out ( zos_uart_t  uart)

Signal that rx packet has timedout.

zos_uart_callback_t zn_uart_set_tx_processor ( zos_uart_t  uart,
zos_uart_callback_t  processor_callback 
)

Register callback to periodically trigger will data is pending to be transmitted.

Parameters
uartzos_uart_t to register tx processor callback
processor_callbackCallback to be periodically called while UART data is waiting to be sent
Returns
Previously registered callback
zos_result_t zn_uart_transmit_bytes ( zos_uart_t  uart,
const void *  data,
uint32_t  size 
)

Transmit data on a UART interface.

Parameters
[in]uart: the UART interface
[in]data: pointer to the start of data
[in]size: number of bytes to transmit
Returns
zos_result_t result of API call
Examples:
basic/http_methods/main.c, basic/uart/uart.c, and demo/uart_blaster/uart_blaster.c.