This repository has been archived on 2023-09-28. You can view files and clone it, but cannot push or open issues or pull requests.
homepage/content/projects/noxos/docs/codebase/drivers/tty.h.md

2.2 KiB

title summary
tty.h A virtual text output device

The TTY is a virtual device, that acts as a text IO layer. It prints keyboard input and process output to the screen. The keyboard input can be directed to a processes stdin and the processes stdout can be printed to the screen.

Schematic:

+-------------------+
| Graphics Renderer |
+-------------------+
            ^  ^
            |  |  +----------+      +-----------------+
            |  |  | TTY      |      | Process (shell) |
            |  |  |          |      |                 |
            |  |--|-[Input]--|-<----|-[stdout]        |
            |     |          |      |                 |
-[Keyboard]----->-|-[Output]-|->----| [stdin]         |
                  +----------+      +-----------------+

tty_T - struct

Name Type Description
graphics_buffer graphics_buffer_T* The graphics buffer where all output will be rendered to.
output pipe_T* Points to the linked processes stdin pipe.
input pipe_T This pipes content will be rendered to the screen. The linked processes stdout should point here.
cursor position_T The cursors position.
color color_argb_T The current drawing color.

tty_init() - function (void)

Initializes g_tty.

tty_update() - function (void)

Renders the text from the ttys input pipe onto the screen. This will be automatically called when writing into the ttys input pipe.

tty_write(string) - function (uint32_t)

Renders the text from string onto the screen. This also writes string into the ttys output pipe.

g_tty - global variable

This is the systems TTY. Currently, there is no support planned for multiple ttys.