oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
Functions
HAL UART Interface

Hardware Abstraction Layer interface for UART operations. More...

Functions

int ove_hal_uart_open (ove_uart_t uart, const struct ove_uart_cfg *cfg)
 Configure and enable the UART peripheral.
 
void ove_hal_uart_close (ove_uart_t uart)
 Disable and release the UART peripheral.
 
int ove_hal_uart_tx (ove_uart_t uart, const void *data, size_t len, uint32_t timeout_ms, size_t *bytes_written)
 Blocking transmit of data.
 
int ove_hal_uart_rx_enable (ove_uart_t uart)
 Enable the RX interrupt / start RX reception.
 
int ove_hal_uart_tx_flush (ove_uart_t uart)
 Flush the TX hardware FIFO.
 

Detailed Description

Hardware Abstraction Layer interface for UART operations.

Declares the low-level UART functions that every platform HAL must implement. The portable UART layer handles RX buffering (via Stream) and TX locking.

The HAL does not manage the RX buffer. Instead, the backend's RX ISR calls ove_uart_rx_isr_push() to deliver bytes to the portable layer's internal stream.

Function Documentation

◆ ove_hal_uart_open()

int ove_hal_uart_open ( ove_uart_t  uart,
const struct ove_uart_cfg cfg 
)

Configure and enable the UART peripheral.

Maps the instance index to hardware, configures baud rate and framing, and enables the RX interrupt path.

Parameters
[in]uartUART handle with storage already assigned.
[in]cfgUART configuration descriptor.
Returns
OVE_OK on success, negative error code on failure.

◆ ove_hal_uart_close()

void ove_hal_uart_close ( ove_uart_t  uart)

Disable and release the UART peripheral.

Parameters
[in]uartUART handle.

◆ ove_hal_uart_tx()

int ove_hal_uart_tx ( ove_uart_t  uart,
const void *  data,
size_t  len,
uint32_t  timeout_ms,
size_t *  bytes_written 
)

Blocking transmit of data.

Called under the TX mutex.

Parameters
[in]uartUART handle.
[in]dataData to transmit.
[in]lenNumber of bytes.
[in]timeout_msMaximum wait time.
[out]bytes_writtenActual bytes written, or NULL.
Returns
OVE_OK on success, negative error code on failure.

◆ ove_hal_uart_rx_enable()

int ove_hal_uart_rx_enable ( ove_uart_t  uart)

Enable the RX interrupt / start RX reception.

Called after the RX stream is set up. The ISR should call ove_uart_rx_isr_push() for each received byte.

Parameters
[in]uartUART handle.
Returns
OVE_OK on success, negative error code on failure.

◆ ove_hal_uart_tx_flush()

int ove_hal_uart_tx_flush ( ove_uart_t  uart)

Flush the TX hardware FIFO.

Blocks until all pending bytes have been physically transmitted.

Parameters
[in]uartUART handle.
Returns
OVE_OK on success, negative error code on failure.