|
AquilaOS documentation
How it works, and its code
|
#include <core/system.h>#include <dev/tty.h>#include <ds/ringbuf.h>#include <ds/queue.h>#include <aquila/kd.h>#include <aquila/vt.h>Go to the source code of this file.
Data Structures | |
| struct | vt_cell |
| A character cell. More... | |
| struct | vt_display |
| A display that virtual terminals are shown on. More... | |
| struct | vt_cursor |
| The cursor's state, saved by DECSC. More... | |
| struct | vt |
| A virtual terminal: its screen, its emulator's state, and its tty. More... | |
Macros | |
| #define | VT_COUNT 6 |
| #define | VT_BOLD 0x01 |
| #define | VT_DIM 0x02 |
| #define | VT_UNDERLINE 0x04 |
| #define | VT_BLINK 0x08 |
| #define | VT_REVERSE 0x10 |
| #define | VT_INVISIBLE 0x20 |
| #define | VT_ITALIC 0x40 |
| #define | VT_CURSOR 0x80 |
Functions | |
| int | vt_fb_probe (void) |
| Sets up the virtual terminals on the framebuffer, if there is one the terminals can draw on, and clears the screen. | |
| int | vt_vga_probe (void) |
| Says whether VGA text mode can be used. | |
| uint32_t | vt_palette (uint8_t color) |
| Returns one of the 256 colours of xterm's palette: the 16 colours, a 6 x 6 x 6 cube, and 24 greys. | |
| uint8_t | vt_vga_attr (struct vt_cell cell) |
| Returns the VGA text mode attribute of a cell (its colours, in VGA's order), for the VGA display and /dev/vcsa. | |
| int | vt_term_init (struct vt *vt, int rows, int cols) |
| Sets a terminal's screens up, the main one and the alternate one, both cleared, and resets it. | |
| void | vt_term_reset (struct vt *vt) |
| Resets a terminal (RIS, ESC c): the defaults, the tab stops every 8 columns, the main screen cleared, and the cursor at the top left. | |
| void | vt_term_write (struct vt *vt, const char *buf, size_t size) |
| Takes what programs write to a terminal, and changes its screen. | |
| void | vt_input (const char *buf, size_t size) |
| Gives what keys sent to the foreground terminal, as input. | |
| void | vt_switch (int id) |
| Switches to another terminal, for Alt+Fn and VT_ACTIVATE. | |
| void | vt_keypress (void) |
| Undoes, at a key press, the modes that a process which is gone had set on the foreground terminal: otherwise the keyboard could be left to no one. | |
| struct vt * | vt_foreground (void) |
| Returns the terminal in the foreground. | |
| void | vt_scancode (int scancode) |
| Takes a scancode from the keyboard, and sends what the key means to the foreground terminal, in its keyboard mode. | |
| void | vt_keyboard_reset (void) |
| Forgets a prefix or a sequence that a change of mode cut in the middle. | |
| int | vt_keymap (int table, int keycode) |
| Says what a key is, for KDGKBENT: programs that read key codes (K_MEDIUMRAW) use it to know what each key means. | |
Variables | |
| struct vt_display | vt_fb_display |
| struct vt_display | vt_vga_display |
| struct dev | vtdev |
| #define VT_BOLD 0x01 |
Definition at line 25 of file vt.h.
Referenced by fb_draw(), sgr(), and vt_vga_attr().
| #define VT_COUNT 6 |
Definition at line 22 of file vt.h.
Referenced by sttydev_mux(), vcs_read(), vt_get(), vt_kd_ioctl(), vt_probe(), and vt_switch().
| #define VT_INVISIBLE 0x20 |
Definition at line 30 of file vt.h.
Referenced by fb_draw(), sgr(), and vt_vga_attr().
| #define VT_REVERSE 0x10 |
| int vt_fb_probe | ( | void | ) |
Sets up the virtual terminals on the framebuffer, if there is one the terminals can draw on, and clears the screen.
Definition at line 100 of file fb.c.
References bytes_pp, vt_display::cols, fb, fbdev_primary(), FONT_H, FONT_W, memset(), NULL, pitch, vt_display::rows, vt_fb_display, and vt_fb_probe().
Referenced by vt_fb_probe(), and vt_probe().
| struct vt * vt_foreground | ( | void | ) |
Returns the terminal in the foreground.
Definition at line 261 of file vt.c.
References fg, and vt_foreground().
Referenced by cursor_key(), vt_foreground(), and vt_scancode().
| void vt_input | ( | const char * | buf, |
| size_t | size ) |
Gives what keys sent to the foreground terminal, as input.
| buf | what the keys sent |
| size | its size, in bytes |
Definition at line 375 of file vt.c.
References busy, fg, refresh(), vt_input(), vt_input_to(), and vt_reply().
Referenced by send(), send_byte(), send_char(), and vt_input().
| void vt_keyboard_reset | ( | void | ) |
Forgets a prefix or a sequence that a change of mode cut in the middle.
Definition at line 198 of file keyboard.c.
References extended, skip, and vt_keyboard_reset().
Referenced by vt_check(), vt_kd_ioctl(), vt_keyboard_reset(), and vt_switch_now().
| int vt_keymap | ( | int | table, |
| int | keycode ) |
Says what a key is, for KDGKBENT: programs that read key codes (K_MEDIUMRAW) use it to know what each key means.
| table | the table: none, Shift, AltGr, or both (AltGr is the same as without: the US layout has no AltGr) |
| keycode | the key's Linux key code |
Definition at line 130 of file keyboard.c.
References KEY_PAUSE, keys, SC_ALT, SC_BS, SC_CAPS, SC_CTRL, SC_ENTER, SC_ESC, SC_F1, SC_F10, SC_F11, SC_F12, SC_KP7, SC_KP_DEL, SC_KP_MUL, SC_LSHIFT, SC_NUM, SC_RSHIFT, SC_TAB, shifted, table(), and vt_keymap().
Referenced by vt_kd_ioctl(), and vt_keymap().
| void vt_keypress | ( | void | ) |
Undoes, at a key press, the modes that a process which is gone had set on the foreground terminal: otherwise the keyboard could be left to no one.
Definition at line 363 of file vt.c.
References fg, vt_check(), and vt_keypress().
Referenced by vt_keypress(), and vt_scancode().
Returns one of the 256 colours of xterm's palette: the 16 colours, a 6 x 6 x 6 cube, and 24 greys.
| color | the colour's number |
Definition at line 73 of file vt.c.
References ansi_colors, and vt_palette().
Referenced by color16(), fb_draw(), and vt_palette().
| void vt_scancode | ( | int | scancode | ) |
Takes a scancode from the keyboard, and sends what the key means to the foreground terminal, in its keyboard mode.
The PS/2 keyboard driver calls it from the keyboard's interrupt.
| scancode | the scancode (set 1) |
Definition at line 307 of file keyboard.c.
References alt, caps, control(), ctrl, cursor_key(), e0_keycodes, editing_key(), extended, fkeys, vt::kb_mode, kernel_ctrlaltdel(), KEY_PAUSE, keypad_digits, keypad_keys, keys, vt::mode, modifier(), num, SC_BS, SC_CAPS, SC_ENTER, SC_ESC, SC_F1, SC_F10, SC_F11, SC_F12, SC_KP7, SC_KP_DEL, SC_KP_MUL, SC_LSHIFT, SC_NUM, SC_RSHIFT, SC_TAB, send(), send_byte(), send_char(), send_key(), shift, shifted, skip, vt_foreground(), vt_keypress(), vt_scancode(), and vt_switch().
Referenced by ps2kbd_probe(), and vt_scancode().
| void vt_switch | ( | int | id | ) |
Switches to another terminal, for Alt+Fn and VT_ACTIVATE.
If the foreground terminal's process asked to decide (VT_PROCESS), it is asked instead, and the switch waits for its answer (VT_RELDISP).
| id | the terminal's index: 0 for /dev/tty1 |
Definition at line 341 of file vt.c.
References fg, vt::id, vt::mode, pending, vt_check(), VT_COUNT, vt_signal(), vt_switch(), vt_switch_now(), and vts.
Referenced by vt_kd_ioctl(), vt_scancode(), and vt_switch().
| int vt_term_init | ( | struct vt * | vt, |
| int | rows, | ||
| int | cols ) |
Sets a terminal's screens up, the main one and the alternate one, both cleared, and resets it.
| vt | the terminal |
| rows | the screen's rows |
| cols | the screen's columns |
Definition at line 420 of file term.c.
References vt::alt, vt_cell::ch, clear_screen(), vt::cols, DEFAULT_BG, DEFAULT_FG, kfree(), kmalloc(), vt::main, NULL, vt::pen, vt::rows, vt::screen, vt_term_init(), and vt_term_reset().
Referenced by vt_setup(), and vt_term_init().
| void vt_term_reset | ( | struct vt * | vt | ) |
Resets a terminal (RIS, ESC c): the defaults, the tab stops every 8 columns, the main screen cleared, and the cursor at the top left.
| vt | the terminal |
Definition at line 395 of file term.c.
References clear_screen(), vt::col, vt::last, vt::main, vt::reverse_screen, vt::row, S_GROUND, vt::screen, soft_reset(), vt::state, tab_set(), vt::utf8_left, and vt_term_reset().
Referenced by esc(), vt_term_init(), and vt_term_reset().
Takes what programs write to a terminal, and changes its screen.
| vt | the terminal |
| buf | what was written |
| size | its size, in bytes |
Definition at line 957 of file term.c.
References term_char(), and vt_term_write().
Referenced by vt_kmsg(), vt_term_write(), and vt_tty_output().
Returns the VGA text mode attribute of a cell (its colours, in VGA's order), for the VGA display and /dev/vcsa.
| cell | the cell |
Definition at line 122 of file vt.c.
References vt_cell::attr, vt_cell::bg, color16(), fg, vt_cell::fg, vga, VT_BOLD, VT_INVISIBLE, VT_REVERSE, and vt_vga_attr().
Referenced by vcs_read(), vga_draw(), and vt_vga_attr().
| int vt_vga_probe | ( | void | ) |
Says whether VGA text mode can be used.
It always can, on a PC.
Definition at line 48 of file vga.c.
References vt_vga_probe().
Referenced by vt_probe(), and vt_vga_probe().
|
extern |
Definition at line 130 of file fb.c.
Referenced by vt_fb_probe(), and vt_probe().
|
extern |
Definition at line 53 of file vga.c.
Referenced by vt_probe().
|
extern |
Definition at line 774 of file vt.c.
Referenced by sttydev_mux(), and ttydev_mux().