Sapphire SoC DS Sapphire SoC UG Sapphire HP SoC DS Sapphire HP SoC UG RISC-V Embedded IDE UG Board Support Package
Loading...
Searching...
No Matches

Overview

Function definitions for UART driver.

Functions

u32 uart_read (uart_instance_t *inst)
 Read 32-bit UART data.
u32 uart_status_read (uart_instance_t *inst)
 Write 32-bit UART data.
u32 uart_readOccupancy (uart_instance_t *inst)
 Checks the occupancy of the UART buffer for reading data.
u32 uart_writeAvailability (uart_instance_t *inst)
 Checks the availability of the UART buffer for writing data.
void uart_applyConfig (uart_instance_t *inst)
 Apply stored UART configuration to hardware.
void uart_write (uart_instance_t *inst, char data)
 Writes a single character to the UART data register.
void uart_writeStr (uart_instance_t *inst, const char *str)
 Write string to UART.
void uart_writeHex (uart_instance_t *inst, int value)
 Write integer as decimal to UART.
void uart_status_write (uart_instance_t *inst, u32 data)
 Writes a value to the UART status register.
void uart_TX_emptyInterruptEna (uart_instance_t *inst, char Ena)
 Enable or Disable UART TX Empty Interrupt.
void uart_RX_NotemptyInterruptEna (uart_instance_t *inst, char Ena)
 Enable or Disable UART RX Not Empty Interrupt.

Function Documentation

◆ uart_applyConfig()

void uart_applyConfig ( uart_instance_t * inst)

#include <uart.h>

Apply stored UART configuration to hardware.

Parameters
instPointer to UART instance.

Definition at line 68 of file uart.c.

◆ uart_read()

u32 uart_read ( uart_instance_t * inst)

#include <uart.h>

Read 32-bit UART data.

Parameters
instPointer to UART instance.
Returns
32-bit data value.

Definition at line 43 of file uart.c.

◆ uart_readOccupancy()

u32 uart_readOccupancy ( uart_instance_t * inst)

#include <uart.h>

Checks the occupancy of the UART buffer for reading data.

Parameters
instPointer to UART instance.
Returns
The number of occupied spaces in the UART buffer for reading data as a 32-bit unsigned integer.
Note
The function reads the UART status register and extracts the number of occupied spaces for reading data from bits 31 to 24.

Definition at line 26 of file uart.c.

◆ uart_RX_NotemptyInterruptEna()

void uart_RX_NotemptyInterruptEna ( uart_instance_t * inst,
char Ena )

#include <uart.h>

Enable or Disable UART RX Not Empty Interrupt.

Parameters
instPointer to UART instance.
EnaThe flag indicating whether to enable (1) or disable (0) the RX not empty interrupt.
Note
The function enables or disables the RX not empty interrupt in the UART status register.

Definition at line 81 of file uart.c.

◆ uart_status_read()

u32 uart_status_read ( uart_instance_t * inst)

#include <uart.h>

Write 32-bit UART data.

Parameters
instPointer to UART instance.
data32-bit data value to be written.

Definition at line 31 of file uart.c.

◆ uart_status_write()

void uart_status_write ( uart_instance_t * inst,
u32 data )

#include <uart.h>

Writes a value to the UART status register.

Parameters
instPointer to UART instance.
dataThe 32-bit value to be written to the status register.

Definition at line 37 of file uart.c.

◆ uart_TX_emptyInterruptEna()

void uart_TX_emptyInterruptEna ( uart_instance_t * inst,
char Ena )

#include <uart.h>

Enable or Disable UART TX Empty Interrupt.

Parameters
instPointer to UART instance.
EnaThe flag indicating whether to enable (1) or disable (0) the TX empty interrupt.
Note
The function enables or disables the TX empty interrupt in the UART status register.

Definition at line 75 of file uart.c.

◆ uart_write()

void uart_write ( uart_instance_t * inst,
char data )

#include <uart.h>

Writes a single character to the UART data register.

Parameters
instPointer to UART instance.
dataThe character data to be written.
Note
The function waits until there is available space in the UART buffer for writing data. Once space is available, it writes the character data to the UART data register.

Definition at line 49 of file uart.c.

◆ uart_writeAvailability()

u32 uart_writeAvailability ( uart_instance_t * inst)

#include <uart.h>

Checks the availability of the UART buffer for writing data.

Parameters
instPointer to UART instance.
Returns
The number of available spaces in the UART buffer for writing data as a 32-bit unsigned integer.
Note
The function reads the UART status register and extracts the number of available spaces for writing data from bits 23 to 16.

Definition at line 22 of file uart.c.

◆ uart_writeHex()

void uart_writeHex ( uart_instance_t * inst,
int value )

#include <uart.h>

Write integer as decimal to UART.

Parameters
instPointer to UART instance.
valueInteger value to be written in hexadecimal format.
Note
The function converts the integer value to its hexadecimal representation and writes each hexadecimal digit to the UART using the uart_write function.

Definition at line 60 of file uart.c.

◆ uart_writeStr()

void uart_writeStr ( uart_instance_t * inst,
const char * str )

#include <uart.h>

Write string to UART.

Parameters
instPointer to UART instance.
strNull-terminated string to be written.
Note
The function iterates through each character in the string and writes it to the UART using the uart_write function.

Definition at line 55 of file uart.c.