noxos (docs): documented tty
This commit is contained in:
parent
9e63f336cf
commit
0b5927f563
|
@ -0,0 +1,48 @@
|
|||
---
|
||||
title: "tty.h"
|
||||
summary: "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.
|
|
@ -12,15 +12,16 @@ The maximum amount of processes, which can write data to one pipe.
|
|||
The size of a pipes stream buffer, in bytes.
|
||||
|
||||
# `pipe_T` - struct
|
||||
| Name | Type | Description |
|
||||
|----------------|-------------------------------|---------------------------------------------------------|
|
||||
| stream | stream_T* | The stream, where the pipes data is saved. |
|
||||
| receiver | process_T* | The process which is allowed to read from the pipe. |
|
||||
| senders | process_T* [PIPE_MAX_SENDERS] | The processes which are allowed to write to the pipe. |
|
||||
| senders_bitmap | bitmap_T | Indicates which fields of _senders_ are currently used. |
|
||||
| Name | Type | Description |
|
||||
|----------------|-------------------------------|-----------------------------------------------------------------------------------------|
|
||||
| stream | stream_T* | The stream, where the pipes data is saved. |
|
||||
| receiver | process_T* | The process which is allowed to read from the pipe. |
|
||||
| senders | process_T* [PIPE_MAX_SENDERS] | The processes which are allowed to write to the pipe. |
|
||||
| senders_bitmap | bitmap_T | Indicates which fields of _senders_ are currently used. |
|
||||
| on_write | void function pointer | If this is not NULL, this function will be called when data is written into the stream. |
|
||||
|
||||
|
||||
# `pipe_init(pipe*, receiver*)` - function (void)
|
||||
# `pipe_init(pipe*, receiver*, (*on_write)())` - function (void)
|
||||
Initializes **_pipe_** and allocates a stream for it.
|
||||
|
||||
# `pipe_destruct(pipe*)` - function (void)
|
||||
|
|
Reference in New Issue