feat: experimental tty console with scrollback buffer.
[lunaix-os.git] / lunaix-os / includes / lunaix / tty / tty.h
1 #ifndef __LUNAIX_TTY_H
2 #define __LUNAIX_TTY_H
3 typedef unsigned short vga_attribute;
4
5 #define VGA_COLOR_BLACK 0
6 #define VGA_COLOR_BLUE 1
7 #define VGA_COLOR_GREEN 2
8 #define VGA_COLOR_CYAN 3
9 #define VGA_COLOR_RED 4
10 #define VGA_COLOR_MAGENTA 5
11 #define VGA_COLOR_BROWN 6
12 #define VGA_COLOR_DARK_GREY 8
13 #define VGA_COLOR_LIGHT_GREY 7
14 #define VGA_COLOR_LIGHT_BLUE 9
15 #define VGA_COLOR_LIGHT_GREEN 10
16 #define VGA_COLOR_LIGHT_CYAN 11
17 #define VGA_COLOR_LIGHT_RED 12
18 #define VGA_COLOR_LIGHT_MAGENTA 13
19 #define VGA_COLOR_LIGHT_BROWN 14
20 #define VGA_COLOR_WHITE 15
21
22 #define TTY_WIDTH 80
23 #define TTY_HEIGHT 25
24
25 void
26 tty_init(void* vga_buf);
27
28 void
29 tty_set_theme(vga_attribute fg, vga_attribute bg);
30
31 vga_attribute
32 tty_get_theme();
33
34 size_t
35 tty_flush_buffer(char* data, size_t pos, size_t limit, size_t buf_size);
36
37 void
38 tty_clear_line(int line_num);
39
40 void
41 tty_put_str_at(char* str, int x, int y);
42
43 #endif /* __LUNAIX_TTY_H */