SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Functions
sys-uart.c File Reference

Allwinner Platform UART (Universal Asynchronous Receiver/Transmitter) Driver. More...

#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>
#include <io.h>
#include <timer.h>
#include <log.h>
#include <sys-uart.h>
#include <sys-clk.h>
Include dependency graph for sys-uart.c:

Functions

void sunxi_serial_clock_init (sunxi_serial_t *uart)
 Initialize the UART clock.
 
void sunxi_serial_init (sunxi_serial_t *uart)
 Initialize the UART interface.
 
void __attribute__ ((weak))
 Output a character to the UART.
 

Detailed Description

Allwinner Platform UART (Universal Asynchronous Receiver/Transmitter) Driver.

This file implements the UART driver for Allwinner platforms. The UART driver provides functionality for serial communication, including initialization, configuration, and basic input/output operations. It supports various UART settings such as baud rate, parity, stop bits, and data length.

SPDX-License-Identifier: GPL-2.0+

Function Documentation

◆ __attribute__()

void __attribute__ ( (weak)  )

Output a character to the UART.

Check if a character is available to read from the UART.

Read a character from the UART.

This function sends a single character to the UART transmit buffer. It waits until the transmit holding register is empty before writing the character.

Parameters
[in]argPointer to the UART structure (cast to void* for compatibility)
[in]cThe character to be transmitted

This function reads a single character from the UART receive buffer. It waits until data is available before reading.

Parameters
[in]argPointer to the UART structure (cast to void* for compatibility)
Returns
The received character

This function checks the UART line status register to determine if there is data available in the receive buffer.

Parameters
[in]argPointer to the UART structure (cast to void* for compatibility)
Returns
Non-zero value if data is available, zero otherwise

◆ sunxi_serial_clock_init()

void sunxi_serial_clock_init ( sunxi_serial_t uart)

Initialize the UART clock.

This function configures the UART clock by setting the reset control and enabling the clock gate for the UART module. It prepares the UART hardware for further configuration.

Parameters
[in]uartPointer to the UART structure containing clock configuration

◆ sunxi_serial_init()

void sunxi_serial_init ( sunxi_serial_t uart)

Initialize the UART interface.

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]uartPointer to the UART structure containing complete configuration including base address, clock settings, baud rate, and GPIO pins