![]() |
API Reference
The NEORV32 RISC-V Processor
|
Universal asynchronous receiver/transmitter (UART0/UART1) HW driver header file. More...
Go to the source code of this file.
Data Structures | |
| struct | neorv32_uart_t |
Macros | |
UART helpers for common functions | |
| #define | neorv32_uart0_available() |
| #define | neorv32_uart0_setup(baud, rx_irq, tx_irq) |
| #define | neorv32_uart0_putc(c) |
| #define | neorv32_uart0_getc() |
| #define | neorv32_uart0_puts(s) |
| #define | neorv32_uart0_printf(...) |
| #define | neorv32_uart0_scan(buffer, max_size, echo) |
| #define | neorv32_uart1_available() |
| #define | neorv32_uart1_setup(baud, rx_irq, tx_irq) |
| #define | neorv32_uart1_putc(c) |
| #define | neorv32_uart1_getc() |
| #define | neorv32_uart1_puts(s) |
| #define | neorv32_uart1_printf(...) |
| #define | neorv32_uart1_scan(buffer, max_size, echo) |
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_getc | ( | ) |
| #define neorv32_uart0_printf | ( | ... | ) |
| #define neorv32_uart0_putc | ( | c | ) |
| #define neorv32_uart0_puts | ( | s | ) |
| #define neorv32_uart0_scan | ( | buffer, | |
| max_size, | |||
| echo ) |
| #define neorv32_uart0_setup | ( | baud, | |
| rx_irq, | |||
| tx_irq ) |
| #define NEORV32_UART1 ((neorv32_uart_t*) (NEORV32_UART1_BASE)) |
UART1 module hardware handle (neorv32_uart_t)
| #define neorv32_uart1_available | ( | ) |
| #define neorv32_uart1_getc | ( | ) |
| #define neorv32_uart1_printf | ( | ... | ) |
| #define neorv32_uart1_putc | ( | c | ) |
| #define neorv32_uart1_puts | ( | s | ) |
| #define neorv32_uart1_scan | ( | buffer, | |
| max_size, | |||
| echo ) |
| #define neorv32_uart1_setup | ( | baud, | |
| rx_irq, | |||
| tx_irq ) |
UART control register bits
| int neorv32_uart_available | ( | neorv32_uart_t * | uartx | ) |
Check if UART module was synthesized.
| [in,out] | uartx | UART hardware struct. |
| char neorv32_uart_getc | ( | neorv32_uart_t * | uartx | ) |
Get received char.
| [in,out] | uartx | UART hardware struct. |
| void neorv32_uart_printf | ( | neorv32_uart_t * | uartx, |
| const char * | format, | ||
| ... ) |
Custom version of 'printf'. This functions only provides a minimal subset of the 'printf' formatting features.
| [in,out] | uartx | UART hardware struct. |
| [in] | format | Pointer to format string. See neorv32_uart_vprintf. |
| void neorv32_uart_putc | ( | neorv32_uart_t * | uartx, |
| char | c ) |
Transmit char.
| [in,out] | uartx | UART hardware struct. |
| [in] | c | Char to be send. |
| void neorv32_uart_puts | ( | neorv32_uart_t * | uartx, |
| const char * | s ) |
Print zero-terminated string. No trailing line break is added. Newline (LF) line breaks are automatically converted to CR-LF.
| [in,out] | uartx | UART hardware struct. |
| [in] | s | Pointer to string. |
|
inlinestatic |
Check if RX data is available.
| [in,out] | uartx | UART hardware struct. |
|
inlinestatic |
Get UART RX FIFO depth.
| [in,out] | uartx | UART hardware struct. |
|
inlinestatic |
Get char from RX FIFO (and discard error bits).
| [in,out] | uartx | UART hardware struct. |
|
inlinestatic |
Check if RX interrupt is pending.
| [in,out] | uartx | UART hardware struct. |
|
inlinestatic |
Check for RX overflow. Must be executed before reading from RX FIFO.
| [in,out] | uartx | UART hardware struct.. |
| int neorv32_uart_scan | ( | neorv32_uart_t * | uartx, |
| char * | buffer, | ||
| int | max_size, | ||
| int | echo ) |
Custom version of 'scanf'.
| [in,out] | uartx | UART hardware struct. |
| [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 | baud, | ||
| int | rx_irq, | ||
| int | tx_irq ) |
Reset, configure and enable UART.
| [in,out] | uartx | UART hardware struct. |
| [in] | baud | Targeted BAUD rate (e.g. 19200, must be greater than zero). |
| [in] | rx_irq | RX interrupt condition (NEORV32_UART_RX_IRQ_SEL_enum). |
| [in] | tx_irq | TX interrupt condition (NEORV32_UART_TX_IRQ_SEL_enum). |
|
inlinestatic |
Check if TX is busy (transmitter busy or TX FIFO not empty).
| [in,out] | uartx | UART hardware struct. |
|
inlinestatic |
Get UART TX FIFO depth.
| [in,out] | uartx | UART hardware struct. |
|
inlinestatic |
Check if free space left in TX FIFO.
| [in,out] | uartx | UART hardware struct. |
|
inlinestatic |
Check if TX interrupt is pending.
| [in,out] | uartx | UART hardware handle. |
|
inlinestatic |
Put char to TX FIFO.
| [in,out] | uartx | UART hardware struct. |
| void neorv32_uart_vprintf | ( | neorv32_uart_t * | uartx, |
| const char * | format, | ||
| va_list | args ) |
Custom version of 'vprintf'. This functions only provides a minimal subset of the original formatting features. Newline (LF) line breaks are automatically converted to CR-LF.
| [in,out] | uartx | UART hardware struct. |
| [in] | format | Pointer to format string. |
| [in] | args | A value identifying a variable arguments list. |