#include <types.h>
#include <sys-clk.h>
#include <sys-gpio.h>
Go to the source code of this file.
|
| enum | sunxi_serial_baudrate_t {
UART_BAUDRATE_300 = 300
, UART_BAUDRATE_600 = 600
, UART_BAUDRATE_1200 = 1200
, UART_BAUDRATE_2400 = 2400
,
UART_BAUDRATE_4800 = 4800
, UART_BAUDRATE_9600 = 9600
, UART_BAUDRATE_19200 = 19200
, UART_BAUDRATE_38400 = 38400
,
UART_BAUDRATE_57600 = 57600
, UART_BAUDRATE_115200 = 115200
, UART_BAUDRATE_230400 = 230400
, UART_BAUDRATE_460800 = 460800
,
UART_BAUDRATE_921600 = 921600
, UART_BAUDRATE_1500000 = 1500000
, UART_BAUDRATE_MAX
} |
| |
| enum | sunxi_serial_parity_t { UART_PARITY_NO = 0
, UART_PARITY_ODD
, UART_PARITY_EVEN
} |
| |
| enum | sunxi_serial_stop_bit_t { UART_STOP_BIT_0 = 0
, UART_STOP_BIT_1
} |
| |
| enum | sunxi_serial_dlen_t { UART_DLEN_5 = 0
, UART_DLEN_6
, UART_DLEN_7
, UART_DLEN_8
} |
| |
|
| void | sunxi_serial_init (sunxi_serial_t *uart) |
| | Initialize the Sunxi serial interface with the specified configuration.
|
| |
| void | sunxi_serial_putc (void *arg, char c) |
| | Send a character via the Sunxi serial interface.
|
| |
| int | sunxi_serial_tstc (void *arg) |
| | Check if there is any character available for reading from the Sunxi serial interface.
|
| |
| char | sunxi_serial_getc (void *arg) |
| | Read a character from the Sunxi serial interface.
|
| |
◆ SERIAL_DEFAULT_CLK_GATE_OFFSET
| #define SERIAL_DEFAULT_CLK_GATE_OFFSET |
( |
|
x | ) |
(x) |
◆ SERIAL_DEFAULT_CLK_RST_OFFSET
| #define SERIAL_DEFAULT_CLK_RST_OFFSET |
( |
|
x | ) |
(x + 16) |
◆ SERIAL_DEFAULT_PARENT_CLK
| #define SERIAL_DEFAULT_PARENT_CLK (24000000) |
◆ sunxi_serial_baudrate_t
| Enumerator |
|---|
| UART_BAUDRATE_300 | |
| UART_BAUDRATE_600 | |
| UART_BAUDRATE_1200 | |
| UART_BAUDRATE_2400 | |
| UART_BAUDRATE_4800 | |
| UART_BAUDRATE_9600 | |
| UART_BAUDRATE_19200 | |
| UART_BAUDRATE_38400 | |
| UART_BAUDRATE_57600 | |
| UART_BAUDRATE_115200 | |
| UART_BAUDRATE_230400 | |
| UART_BAUDRATE_460800 | |
| UART_BAUDRATE_921600 | |
| UART_BAUDRATE_1500000 | |
| UART_BAUDRATE_MAX | |
◆ sunxi_serial_dlen_t
| Enumerator |
|---|
| UART_DLEN_5 | |
| UART_DLEN_6 | |
| UART_DLEN_7 | |
| UART_DLEN_8 | |
◆ sunxi_serial_parity_t
| Enumerator |
|---|
| UART_PARITY_NO | |
| UART_PARITY_ODD | |
| UART_PARITY_EVEN | |
◆ sunxi_serial_stop_bit_t
| Enumerator |
|---|
| UART_STOP_BIT_0 | |
| UART_STOP_BIT_1 | |
◆ sunxi_serial_getc()
| char sunxi_serial_getc |
( |
void * |
arg | ) |
|
Read a character from the Sunxi serial interface.
- Parameters
-
| arg | Pointer to the Sunxi serial interface argument. |
- Returns
- The character read from the interface.
◆ sunxi_serial_init()
Initialize the Sunxi serial interface with the specified configuration.
- Parameters
-
| uart | Pointer to the Sunxi serial interface structure. |
Initialize the Sunxi serial interface with the specified configuration.
This function initializes the UART interface by configuring the clock, baud rate, line control settings (parity, stop bits, data length), FIFO control, and GPIO pins. It sets up the UART for serial communication based on the provided configuration.
- Parameters
-
| [in] | uart | Pointer to the UART structure containing complete configuration including base address, clock settings, baud rate, and GPIO pins |
◆ sunxi_serial_putc()
| void sunxi_serial_putc |
( |
void * |
arg, |
|
|
char |
c |
|
) |
| |
Send a character via the Sunxi serial interface.
- Parameters
-
| arg | Pointer to the Sunxi serial interface argument. |
| c | The character to send. |
◆ sunxi_serial_tstc()
| int sunxi_serial_tstc |
( |
void * |
arg | ) |
|
Check if there is any character available for reading from the Sunxi serial interface.
- Parameters
-
| arg | Pointer to the Sunxi serial interface argument. |
- Returns
- 1 if there is a character available, 0 otherwise.