Text Video Drivers

A text video driver provides a means of putting printable characters to the screen. A higher-level system component, e.g., a console, uses video text operations to communicate with the text video driver.

Text Video Drivers provided by tomOSii

Datatypes Provided for the Video Text Drivers

Video Text Operations

The interface between higher-level system components like a console and the text video driver.

struct video_text_operations_t

Callbacks provided by video text drivers.

These callbacks provide a higher-level console driver with access to lower-level hardware via a common interface. The callbacks have to be implemented by a video text driver, e.g., the video vga text driver.

This data structure and the callbacks defined in it are based on struct consw from the Linux kernel (as of 6.17.5). They are adapted and simplified and may have long diverged in order to make tomOSii a prototypical teaching operating system.

Public Members

int (*vid_txt_open)(console_t *con)

Open the text display, initialize the required fields in con.

void (*vid_txt_putc)(console_t *con, uint16_t ca, unsigned int y, unsigned int x)

Emit one character with attributes ca to [x, y].

void (*vid_txt_clear)(console_t *con, unsigned int y, unsigned int x, size_t count)

Erase count characters starting at [x, y].

void (*vid_txt_cursor)(console_t *con, unsigned int y, unsigned int x, bool enable)

Set the cursor’s [x, y] position and enabled state.

void (*vid_txt_scroll)(console_t *con, unsigned int top, unsigned int bottom, vid_txt_scroll_t dir, unsigned int lines)

scroll the display from top (inclusive) to bottom (exclusive) in direction dir by lines.

^ Back to top.

Video Text Scroll Directions

The direction for scrolling the text display has its own type to avoid magic numbers:

enum vid_txt_scroll_t

Determine the direction of scrolling the display’s content.

Values:

enumerator VID_TXT_SCROLL_DOWN
enumerator VID_TXT_SCROLL_UP

^ Back to top.