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 |
Universal asynchronous receiver/transmitter (UART0/UART1) HW driver header file.
#define NEORV32_UART0 ((neorv32_uart_t*) (NEORV32_UART0_BASE)) |
UART0 module hardware access (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_rx_clear | ( | ) |
#define neorv32_uart0_scan | ( | buffer, | |
max_size, | |||
echo ) |
#define neorv32_uart0_setup | ( | baudrate, | |
irq_mask ) |
#define neorv32_uart0_tx_busy | ( | ) |
#define neorv32_uart0_tx_clear | ( | ) |
#define NEORV32_UART1 ((neorv32_uart_t*) (NEORV32_UART1_BASE)) |
UART1 module hardware access (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_rx_clear | ( | ) |
#define neorv32_uart1_scan | ( | buffer, | |
max_size, | |||
echo ) |
#define neorv32_uart1_setup | ( | baudrate, | |
irq_mask ) |
#define neorv32_uart1_tx_busy | ( | ) |
#define neorv32_uart1_tx_clear | ( | ) |
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. Print full line break "\r\n" for every '
'.
[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. |
void neorv32_uart_rx_clear | ( | neorv32_uart_t * | UARTx | ) |
Clear RX FIFO.
[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 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. |
void neorv32_uart_tx_clear | ( | neorv32_uart_t * | UARTx | ) |
Clear TX FIFO.
[in,out] | UARTx | Hardware handle to UART register struct, neorv32_uart_t. |
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. |