UART API Calls

UART Config Struct

typedef struct{
enum UartDataLength dataLength;
enum UartParity parity;
enum UartStop stop;
u32 clockDivider;
} Uart_Config;

uart_applyConfig()

Usage void uart_applyConfig(u32 reg, Uart_Config *config)
Include driver/uart.h
Parameters [IN] reg UART base address
[IN] config struct of the UART configuration
Description Applies the UART configuration to to a register for initial configuration.

uart_TX_emptyInterruptEna()

Usage void uart_TX_emptyInterruptEna(u32 reg, char Ena)
Include driver/uart.h
Parameters [IN] reg UART base address
[IN] ena Enable interrupt
Description Enable the TX FIFO empty interrupt.

uart_RX_NotemptyInterruptEna()

Usage void uart_RX_NotemptyInterruptEna(u32 reg, char Ena)
Include driver/uart.h
Parameters [IN] reg UART base address
[IN] ena Enable interrupt
Description Enable the RX FIFO not empty interrupt.

uart_read()

Usage char uart_read(u32reg)
Include driver/uart.h
Parameters [IN] reg UART base address
Returns [OUT] reg character that is read
Description Reads a character from the UART slave.

uart_readOccupancy()

Usage u32 uart_readOccupancy(u32reg)
Include driver/uart.h
Parameters [IN] reg UART base address
Returns [OUT] reg FIFO occupancy
Description Read the number of bytes in the RX FIFO up to 128 bytes.

uart_status_read()

Usage u32 uart_status_read(u32 reg)
Include driver/uart.h
Parameters [IN] reg UART base address
Returns [OUT] 32-bit status register from the UART
Description Refers to UART Status Register: 0x0000_0004 in the Sapphire Datasheet.

uart_status_write()

Usage void uart_status_write(u32 reg, char data)
Include driver/uart.h
Parameters [IN] reg UART base address
[IN] data input data for the UART status.
Description Write the UART status. Only TXInterruptEnable and RXInterruptEnable are writable.

uart_write()

Usage void uart_write(u32 reg, char data)
Include driver/uart.h
Parameters [IN] reg UART base address
[IN] data write a character
Description Write a character to the UART.

uart_writeHex()

Usage void uart_writeHex(u32 reg, int value)
Include driver/uart.h
Parameters [IN] reg UART base address
[IN] value number to send as UART character
Description Convert a number to a character and send it to the UART in hexadecimal.

uart_writeStr()

Usage void uart_writeStr(u32 reg, const char* str)
Include driver/uart.h
Parameters [IN] reg UART base address
[IN] str string to write
Description Write a string to the UART.

uart_writeAvailability()

Usage u32 uart_writeAvailability(u32 reg)
Include driver/uart.h
Parameters [IN] reg UART base address
Returns [OUT] reg FIFO availability
Description Read the number of bytes in the TX FIFO up to 128 bytes.