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

Low-level serial I/O for the system console. More...

Functions

int ove_console_init (void)
 Initialise the system console hardware.
 
int ove_console_getchar (void)
 Read one character from the console.
 
void ove_console_putchar (int c)
 Write one character to the console.
 
void ove_console_write (const char *buf, unsigned int len)
 Write a raw byte buffer to the console.
 

Detailed Description

Low-level serial I/O for the system console.

Provides a minimal character-oriented interface to the system console (typically a UART). This API is used internally by the logging and shell subsystems but may also be called directly by application code.

The console must be initialised with ove_console_init before any read or write operations are performed.

Note
Requires CONFIG_OVE_CONSOLE.

Function Documentation

◆ ove_console_init()

int ove_console_init ( void  )

Initialise the system console hardware.

Configures the underlying serial peripheral (baud rate, framing, etc.) as determined by the board support package. Must be called once before ove_console_getchar, ove_console_putchar, or ove_console_write are used.

Returns
OVE_OK on success, negative error code on failure.
Note
Requires CONFIG_OVE_CONSOLE.

◆ ove_console_getchar()

int ove_console_getchar ( void  )

Read one character from the console.

Returns the next available character from the console receive buffer. The call may block until a character is available depending on the backend implementation.

Returns
Character value in the range [0, 255], or -1 if no character is available or an error occurred.
Note
Requires CONFIG_OVE_CONSOLE.

◆ ove_console_putchar()

void ove_console_putchar ( int  c)

Write one character to the console.

Transmits the character c via the console output path. The call may block until the transmit buffer has space.

Parameters
[in]cCharacter to transmit, interpreted as an unsigned char.
Note
Requires CONFIG_OVE_CONSOLE.

◆ ove_console_write()

void ove_console_write ( const char *  buf,
unsigned int  len 
)

Write a raw byte buffer to the console.

Transmits exactly len bytes from buf. No newline translation or null termination is applied. The call may block until all bytes have been accepted by the transmit buffer.

Parameters
[in]bufPointer to the data to transmit.
[in]lenNumber of bytes to transmit.
Note
Requires CONFIG_OVE_CONSOLE.