os

Toy OS
git clone git://git.christosmarg.xyz
Log | Files | Refs | README | LICENSE

tty.h (821B)


      1 #ifndef _KERNEL_TTY_H_
      2 #define _KERNEL_TTY_H_
      3 
      4 #include <stddef.h>
      5 
      6 #define _VGA_MEM 0xb8000;
      7 #define _VGA_COLS 80
      8 #define _VGA_ROWS 25
      9 #define _PUTC(c) (((uint16_t)tty.color << 8) | (c))
     10 
     11 #define VGA_SET_COLOR(fg, bg) ((fg) | (bg) << 4)
     12 
     13 struct tty_info {
     14 	volatile uint16_t *buf;
     15 	size_t row;
     16 	size_t col;
     17 	uint8_t color;
     18 };
     19 
     20 enum vga_color {
     21 	VGA_BLACK = 0,
     22 	VGA_BLUE,
     23 	VGA_GREEN,
     24 	VGA_CYAN,
     25 	VGA_RED,
     26 	VGA_MAGENTA,
     27 	VGA_BROWN,
     28 	VGA_LIGHT_GREY,
     29 	VGA_DARK_GREY,
     30 	VGA_LIGHT_BLUE,
     31 	VGA_LIGHT_GREEN,
     32 	VGA_LIGHT_CYAN,
     33 	VGA_LIGHT_RED,
     34 	VGA_LIGHT_MAGENTA,
     35 	VGA_LIGHT_BROWN,
     36 	VGA_WHITE,
     37 };
     38 
     39 void tty_clear(void);
     40 void tty_putc(char);
     41 void tty_write(const char *);
     42 void tty_curs_enable(uint8_t, uint8_t);
     43 void tty_curs_disable(void);
     44 void tty_curs_setpos(int, int);
     45 uint16_t tty_curs_getpos(void);
     46 
     47 #endif /* _KERNEL_TTY_H_ */