Teletype (console) screen text manipulation routines. More...
Go to the source code of this file.
Data Structures | |
| struct | screenpos_t |
| tty screen text position. More... | |
Macros | |
| #define | MAX_TTYS 4 |
| The number of available virtual consoles. More... | |
Typedefs | |
| typedef enum textcolor | textcolor_t |
Enumerations |
Functions | |
| void | tty_init () |
| Initialize all virtual consoles. More... | |
| void | tty_activate (int id) |
| Activate the requested virtual console. More... | |
| void | tty_set_textcolor (int id, textcolor_t fg, textcolor_t bg) |
| Set the foreground and background colors used to display text on the virtual console. More... | |
| void | tty_set_textcolor_fg (int id, textcolor_t fg) |
| Set the foreground color used to display text on the virtual console. More... | |
| void | tty_set_textcolor_bg (int id, textcolor_t bg) |
| Set the background color used to display text on the virtual console. More... | |
| textcolor_t | tty_get_textcolor_fg (int id) |
| Get the foreground color used to display text on the virtual console. More... | |
| textcolor_t | tty_get_textcolor_bg (int id) |
| Get the background color used to display text on the virtual console. More... | |
| void | tty_clear (int id) |
| Clear the virtual console screen's contents using the current text background color. More... | |
| void | tty_setpos (int id, screenpos_t pos) |
| Set the position of the cursor on the virtual console. More... | |
| void | tty_getpos (int id, screenpos_t *pos) |
| Get the current position of the cursor on the virtual console. More... | |
| void | tty_print (int id, const char *str) |
| Output a null-terminated string to the virtual console using the console's current text color and screen position. More... | |
| void | tty_printc (int id, char ch) |
| Output a single character to the virtual console using the console's current text color and screen position. More... | |
| int | tty_printf (int id, const char *format,...) |
| Output a printf-formatted string to the virtual console using the console's current text color and screen position. More... | |
Teletype (console) screen text manipulation routines.
Definition in file tty.h.
| struct screenpos |
| #define MAX_TTYS 4 |
The number of available virtual consoles.
Definition at line 20 of file tty.h.
Referenced by tty_activate(), tty_clear(), tty_get_textcolor_bg(), tty_get_textcolor_fg(), tty_getpos(), tty_init(), tty_print(), tty_printc(), tty_printf(), tty_set_textcolor(), tty_set_textcolor_bg(), tty_set_textcolor_fg(), and tty_setpos().
| typedef enum textcolor textcolor_t |
| enum textcolor |
Color values used for tty text.
| void tty_init | ( | ) |
| void tty_activate | ( | int | id | ) |
Activate the requested virtual console.
The virtual console's buffer is immediately displayed on the screen.
| [in] | id | Virtual tty id (0-3). |
Definition at line 107 of file tty.c.
Referenced by isr_fatal().
| void tty_set_textcolor | ( | int | id, |
| textcolor_t | fg, | ||
| textcolor_t | bg | ||
| ) |
Set the foreground and background colors used to display text on the virtual console.
| [in] | id | Virtual tty id (0-3). |
| [in] | fg | Foreground color. |
| [in] | bg | Background color. |
Definition at line 122 of file tty.c.
Referenced by isr_fatal(), and kmain().
| void tty_set_textcolor_fg | ( | int | id, |
| textcolor_t | fg | ||
| ) |
| void tty_set_textcolor_bg | ( | int | id, |
| textcolor_t | bg | ||
| ) |
| textcolor_t tty_get_textcolor_fg | ( | int | id | ) |
Get the foreground color used to display text on the virtual console.
| [in] | id | Virtual tty id (0-3). |
Definition at line 154 of file tty.c.
Referenced by tty_set_textcolor_bg().
| textcolor_t tty_get_textcolor_bg | ( | int | id | ) |
Get the background color used to display text on the virtual console.
| [in] | id | Virtual tty id (0-3). |
Definition at line 164 of file tty.c.
Referenced by tty_set_textcolor_fg().
| void tty_clear | ( | int | id | ) |
Clear the virtual console screen's contents using the current text background color.
| [in] | id | Virtual tty id (0-3). |
Definition at line 174 of file tty.c.
Referenced by isr_fatal(), and kmain().
| void tty_setpos | ( | int | id, |
| screenpos_t | pos | ||
| ) |
| void tty_getpos | ( | int | id, |
| screenpos_t * | pos | ||
| ) |
| void tty_print | ( | int | id, |
| const char * | str | ||
| ) |
Output a null-terminated string to the virtual console using the console's current text color and screen position.
A newline character (\n) causes the screen position to be updated as though a carriage return and line feed were performed.
To change the foreground color on the fly without having to call a console function, you may use the escape sequence \033[x], where x is a single character representing the foreground color to use for all following text. If x is a hexadecimal digit, then it represents one of the 16 textcolor codes. If x is '-', then it represents the console's original foreground color setting.
To change the background color on the fly, use the escape sequence \033{x}. The meaning of x is the same as with the foreground color escape sequence.
| [in] | id | Virtual tty id (0-3). |
| [in] | str | The null-terminated string to be printed. |
Definition at line 343 of file tty.c.
Referenced by cmd_display_apic(), cmd_display_help(), cmd_display_pcie(), cmd_switch_to_keycodes(), command_prompt(), dump_context(), isr_breakpoint(), kmain(), and tty_printf().
| void tty_printc | ( | int | id, |
| char | ch | ||
| ) |
Output a single character to the virtual console using the console's current text color and screen position.
See tty_print for further details.
| [in] | id | Virtual tty id (0-3). |
| [in] | ch | The character to be printed. |
Definition at line 357 of file tty.c.
Referenced by command_run().
| int tty_printf | ( | int | id, |
| const char * | format, | ||
| ... | |||
| ) |
Output a printf-formatted string to the virtual console using the console's current text color and screen position.
See tty_print for further details.
| [in] | id | Virtual tty id (0-3). |
| [in] | format | The null-terminated format string used to format the text to be printed. |
| [in] | ... | Variable arguments list to be initialized with va_start. |
Definition at line 372 of file tty.c.
Referenced by cmd_display_apic(), cmd_display_help(), cmd_display_pcie(), command_exec(), dump_context(), isr_fatal(), keycode_run(), and probe_function().