![]() |
NEORV32 - Software Framework Documentation
|
Universal asynchronous receiver/transmitter (UART0/UART1) HW driver source file. More...
Functions | |
int | putchar (int ch) |
int | getchar (void) |
int | neorv32_uart0_available (void) |
void | neorv32_uart0_setup (uint32_t baudrate, uint8_t parity, uint8_t flow_con) |
void | neorv32_uart0_disable (void) |
void | neorv32_uart0_enable (void) |
void | neorv32_uart0_putc (char c) |
int | neorv32_uart0_tx_busy (void) |
char | neorv32_uart0_getc (void) |
int | neorv32_uart0_getc_safe (char *data) |
int | neorv32_uart0_char_received (void) |
char | neorv32_uart0_char_received_get (void) |
void | neorv32_uart0_print (const char *s) |
void | neorv32_uart0_printf (const char *format,...) |
int | neorv32_uart0_scan (char *buffer, int max_size, int echo) |
int | neorv32_uart1_available (void) |
void | neorv32_uart1_setup (uint32_t baudrate, uint8_t parity, uint8_t flow_con) |
void | neorv32_uart1_disable (void) |
void | neorv32_uart1_enable (void) |
void | neorv32_uart1_putc (char c) |
int | neorv32_uart1_tx_busy (void) |
char | neorv32_uart1_getc (void) |
int | neorv32_uart1_getc_safe (char *data) |
int | neorv32_uart1_char_received (void) |
char | neorv32_uart1_char_received_get (void) |
void | neorv32_uart1_print (const char *s) |
void | neorv32_uart1_printf (const char *format,...) |
int | neorv32_uart1_scan (char *buffer, int max_size, int echo) |
static void | __neorv32_uart_itoa (uint32_t x, char *res) |
static void | __neorv32_uart_tohex (uint32_t x, char *res) |
static void | __neorv32_uart_touppercase (uint32_t len, char *ptr) |
Universal asynchronous receiver/transmitter (UART0/UART1) HW driver source file.
|
static |
Private function for 'neorv32_printf' to convert into decimal.
[in] | x | Unsigned input number. |
[in,out] | res | Pointer for storing the reuslting number string (11 chars). |
|
static |
Private function for 'neorv32_printf' to convert into hexadecimal.
[in] | x | Unsigned input number. |
[in,out] | res | Pointer for storing the resulting number string (9 chars). |
|
static |
Private function to cast a string to UPPERCASE.
[in] | len | Total length of input string. |
[in,out] | ptr | Pointer for input/output string. |
int getchar | ( | void | ) |
Read char from UART0.
int neorv32_uart0_available | ( | void | ) |
Check if UART0 unit was synthesized.
int neorv32_uart0_char_received | ( | void | ) |
Check if UART0 has received a char.
char neorv32_uart0_char_received_get | ( | void | ) |
Get a received char from UART0.
void neorv32_uart0_disable | ( | void | ) |
Disable UART0.
void neorv32_uart0_enable | ( | void | ) |
Enable UART0.
char neorv32_uart0_getc | ( | void | ) |
Get char from UART0.
int neorv32_uart0_getc_safe | ( | char * | data | ) |
Get char from UART0 (and check errors).
[in,out] | data | Received char. |
void neorv32_uart0_print | ( | const char * | s | ) |
Print string (zero-terminated) via UART0. Print full line break "\r\n" for every '
'.
[in] | s | Pointer to string. |
void neorv32_uart0_printf | ( | const char * | format, |
... | |||
) |
Custom version of 'printf' function using UART0.
[in] | format | Pointer to format string. |
s | String (array of chars, zero-terminated) |
c | Single char |
d/i | 32-bit signed number, printed as decimal |
u | 32-bit unsigned number, printed as decimal |
x | 32-bit number, printed as 8-char hexadecimal - lower-case |
X | 32-bit number, printed as 8-char hexadecimal - upper-case |
p | 32-bit pointer, printed as 8-char hexadecimal - lower-case |
void neorv32_uart0_putc | ( | char | c | ) |
Send single char via UART0.
[in] | c | Char to be send. |
int neorv32_uart0_scan | ( | char * | buffer, |
int | max_size, | ||
int | echo | ||
) |
Simplified custom version of 'scanf' function for UART0.
[in,out] | buffer | Pointer to array of chars to store string. |
[in] | max_size | Maximum number of chars to sample. |
[in] | echo | Echo UART input when 1. |
void neorv32_uart0_setup | ( | uint32_t | baudrate, |
uint8_t | parity, | ||
uint8_t | flow_con | ||
) |
Enable and configure primary UART (UART0).
[in] | baudrate | Targeted BAUD rate (e.g. 9600). |
[in] | parity | Parity configuration (00=off, 10=even, 11=odd), see NEORV32_UART_PARITY_enum. |
[in] | flow_con | Hardware flow control configuration (00=off, 01=RTS, 10=CTS, 11=RTS/CTS), see NEORV32_UART_FLOW_CONTROL_enum. |
int neorv32_uart0_tx_busy | ( | void | ) |
Check if UART0 TX is busy (transmitter busy or data left in TX buffer).
int neorv32_uart1_available | ( | void | ) |
Check if UART1 unit was synthesized.
int neorv32_uart1_char_received | ( | void | ) |
Check if UART1 has received a char.
char neorv32_uart1_char_received_get | ( | void | ) |
Get a received char from UART1.
void neorv32_uart1_disable | ( | void | ) |
Disable UART1.
void neorv32_uart1_enable | ( | void | ) |
Enable UART1.
char neorv32_uart1_getc | ( | void | ) |
Get char from UART1.
int neorv32_uart1_getc_safe | ( | char * | data | ) |
Get char from UART1 (and check errors).
[in,out] | data | Received char. |
void neorv32_uart1_print | ( | const char * | s | ) |
Print string (zero-terminated) via UART1. Print full line break "\r\n" for every '
'.
[in] | s | Pointer to string. |
void neorv32_uart1_printf | ( | const char * | format, |
... | |||
) |
Custom version of 'printf' function using UART1.
[in] | format | Pointer to format string. |
s | String (array of chars, zero-terminated) |
c | Single char |
d/i | 32-bit signed number, printed as decimal |
u | 32-bit unsigned number, printed as decimal |
x | 32-bit number, printed as 8-char hexadecimal - lower-case |
X | 32-bit number, printed as 8-char hexadecimal - upper-case |
p | 32-bit pointer, printed as 8-char hexadecimal - lower-case |
void neorv32_uart1_putc | ( | char | c | ) |
Send single char via UART1.
[in] | c | Char to be send. |
int neorv32_uart1_scan | ( | char * | buffer, |
int | max_size, | ||
int | echo | ||
) |
Simplified custom version of 'scanf' function for UART1.
[in,out] | buffer | Pointer to array of chars to store string. |
[in] | max_size | Maximum number of chars to sample. |
[in] | echo | Echo UART input when 1. |
void neorv32_uart1_setup | ( | uint32_t | baudrate, |
uint8_t | parity, | ||
uint8_t | flow_con | ||
) |
Enable and configure secondary UART (UART1).
[in] | baudrate | Targeted BAUD rate (e.g. 9600). |
[in] | parity | Parity configuration (00=off, 10=even, 11=odd), see NEORV32_UART_PARITY_enum. |
[in] | flow_con | Hardware flow control configuration (00=off, 01=RTS, 10=CTS, 11=RTS/CTS), see NEORV32_UART_FLOW_CONTROL_enum. |
int neorv32_uart1_tx_busy | ( | void | ) |
Check if UART1 TX is busy (transmitter busy or data left in TX buffer).
int putchar | ( | int | ch | ) |
Send char via UART0
[in] | Char | to be send. |