![]() |
NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
|
Universal asynchronous receiver/transmitter (UART0/UART1) HW driver header file. More...
#include <stdint.h>
#include <stdarg.h>
Go to the source code of this file.
Data Structures | |
struct | neorv32_uart_t |
IO Device: Primary/Secondary Universal Asynchronous Receiver and Transmitter (UART0 / UART1) | |
#define | NEORV32_UART0 ((neorv32_uart_t*) (NEORV32_UART0_BASE)) |
#define | NEORV32_UART1 ((neorv32_uart_t*) (NEORV32_UART1_BASE)) |
enum | NEORV32_UART_CTRL_enum { UART_CTRL_EN = 0 , UART_CTRL_SIM_MODE = 1 , UART_CTRL_HWFC_EN = 2 , UART_CTRL_PRSC_LSB = 3 , UART_CTRL_PRSC_MSB = 5 , UART_CTRL_BAUD_LSB = 6 , UART_CTRL_BAUD_MSB = 15 , UART_CTRL_RX_NEMPTY = 16 , UART_CTRL_RX_FULL = 17 , UART_CTRL_TX_EMPTY = 18 , UART_CTRL_TX_NFULL = 19 , UART_CTRL_IRQ_RX_NEMPTY = 20 , UART_CTRL_IRQ_RX_FULL = 21 , UART_CTRL_IRQ_TX_EMPTY = 22 , UART_CTRL_IRQ_TX_NFULL = 23 , UART_CTRL_RX_OVER = 30 , UART_CTRL_TX_BUSY = 31 } |
enum | NEORV32_UART_DATA_enum { UART_DATA_RTX_LSB = 0 , UART_DATA_RTX_MSB = 7 , UART_DATA_RX_FIFO_SIZE_LSB = 8 , UART_DATA_RX_FIFO_SIZE_MSB = 11 , UART_DATA_TX_FIFO_SIZE_LSB = 12 , UART_DATA_TX_FIFO_SIZE_MSB = 15 } |
Universal asynchronous receiver/transmitter (UART0/UART1) HW driver header file.
#define NEORV32_UART0 ((neorv32_uart_t*) (NEORV32_UART0_BASE)) |
UART0 module hardware handle (neorv32_uart_t)
#define neorv32_uart0_available | ( | ) |
#define neorv32_uart0_char_received | ( | ) |
#define neorv32_uart0_char_received_get | ( | ) |
#define neorv32_uart0_disable | ( | ) |
#define neorv32_uart0_enable | ( | ) |
#define neorv32_uart0_get_rx_fifo_depth | ( | ) |
#define neorv32_uart0_get_tx_fifo_depth | ( | ) |
#define neorv32_uart0_getc | ( | ) |
#define neorv32_uart0_printf | ( | ... | ) |
#define neorv32_uart0_putc | ( | c | ) |
#define neorv32_uart0_puts | ( | s | ) |
#define neorv32_uart0_rtscts_disable | ( | ) |
#define neorv32_uart0_rtscts_enable | ( | ) |
#define neorv32_uart0_scan | ( | buffer, | |
max_size, | |||
echo ) |
#define neorv32_uart0_setup | ( | baudrate, | |
irq_mask ) |
#define neorv32_uart0_tx_busy | ( | ) |
#define neorv32_uart0_tx_free | ( | ) |
#define neorv32_uart0_tx_put | ( | c | ) |
#define NEORV32_UART1 ((neorv32_uart_t*) (NEORV32_UART1_BASE)) |
UART1 module hardware handle (neorv32_uart_t)
#define neorv32_uart1_available | ( | ) |
#define neorv32_uart1_char_received | ( | ) |
#define neorv32_uart1_char_received_get | ( | ) |
#define neorv32_uart1_disable | ( | ) |
#define neorv32_uart1_enable | ( | ) |
#define neorv32_uart1_get_rx_fifo_depth | ( | ) |
#define neorv32_uart1_get_tx_fifo_depth | ( | ) |
#define neorv32_uart1_getc | ( | ) |
#define neorv32_uart1_printf | ( | ... | ) |
#define neorv32_uart1_putc | ( | c | ) |
#define neorv32_uart1_puts | ( | s | ) |
#define neorv32_uart1_rtscts_disable | ( | ) |
#define neorv32_uart1_rtscts_enable | ( | ) |
#define neorv32_uart1_scan | ( | buffer, | |
max_size, | |||
echo ) |
#define neorv32_uart1_setup | ( | baudrate, | |
irq_mask ) |
#define neorv32_uart1_tx_busy | ( | ) |
#define neorv32_uart1_tx_free | ( | ) |
#define neorv32_uart1_tx_put | ( | c | ) |
UART control register bits
UART data register bits
int neorv32_uart_available | ( | neorv32_uart_t * | UARTx | ) |
Check if UART unit was synthesized.
[in,out] | Hardware | handle to UART register struct, neorv32_uart_t. |
int neorv32_uart_char_received | ( | neorv32_uart_t * | UARTx | ) |
Check if UART has received a char.
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
char neorv32_uart_char_received_get | ( | neorv32_uart_t * | UARTx | ) |
Get a received char from UART.
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
void neorv32_uart_disable | ( | neorv32_uart_t * | UARTx | ) |
Disable UART.
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
void neorv32_uart_enable | ( | neorv32_uart_t * | UARTx | ) |
Enable UART.
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
int neorv32_uart_get_rx_fifo_depth | ( | neorv32_uart_t * | UARTx | ) |
Get UART RX FIFO depth.
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
int neorv32_uart_get_tx_fifo_depth | ( | neorv32_uart_t * | UARTx | ) |
Get UART TX FIFO depth.
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
char neorv32_uart_getc | ( | neorv32_uart_t * | UARTx | ) |
Get char from UART.
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
void neorv32_uart_printf | ( | neorv32_uart_t * | UARTx, |
const char * | format, | ||
... ) |
Custom version of 'printf' printing to UART.
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
[in] | format | Pointer to format string. See neorv32_uart_vprintf. |
void neorv32_uart_putc | ( | neorv32_uart_t * | UARTx, |
char | c ) |
Send single char via UART.
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
[in] | c | Char to be send. |
void neorv32_uart_puts | ( | neorv32_uart_t * | UARTx, |
const char * | s ) |
Print string (zero-terminated) via UART.
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
[in] | s | Pointer to string. |
void neorv32_uart_rtscts_disable | ( | neorv32_uart_t * | UARTx | ) |
Disable RTS/CTS hardware flow-control.
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
void neorv32_uart_rtscts_enable | ( | neorv32_uart_t * | UARTx | ) |
Enable RTS/CTS hardware flow-control.
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
int neorv32_uart_scan | ( | neorv32_uart_t * | UARTx, |
char * | buffer, | ||
int | max_size, | ||
int | echo ) |
Simplified custom version of 'scanf' reading from UART.
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
[in,out] | buffer | Pointer to array of chars to store string. |
[in] | max_size | Maximum number of chars to sample (including zero-termination). |
[in] | echo | Echo UART input when 1. |
void neorv32_uart_setup | ( | neorv32_uart_t * | UARTx, |
uint32_t | baudrate, | ||
uint32_t | irq_mask ) |
Reset, configure and enable UART.
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
[in] | baudrate | Targeted BAUD rate (e.g. 19200). |
[in] | irq_mask | Interrupt configuration bit mask (CTRL's irq_* bits). |
int neorv32_uart_tx_busy | ( | neorv32_uart_t * | UARTx | ) |
Check if UART TX is busy (transmitter busy or data left in TX buffer).
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
int neorv32_uart_tx_free | ( | neorv32_uart_t * | UARTx | ) |
Check if there is free space in the TX output FIFO.
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
void neorv32_uart_tx_put | ( | neorv32_uart_t * | UARTx, |
char | c ) |
Put char to TX output FIFO.
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
[in] | c | Character to be send. |
void neorv32_uart_vprintf | ( | neorv32_uart_t * | UARTx, |
const char * | format, | ||
va_list | args ) |
Custom version of 'vprintf' printing to UART.
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
[in] | format | Pointer to format string. |
[in] | args | A value identifying a variable arguments list. |