tty.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* Copyright (C) 2021 Rain */
  2. /* This file is part of XNIX. */
  3. /*
  4. XNIX is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) and later version.
  8. */
  9. /*
  10. XNIX is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. */
  15. /*
  16. You should have received a copy of the GNU General Public License
  17. along with XNIX. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. #ifndef _MOD_TTY_H
  20. #define _MOD_TTY_H
  21. #include <kernel/types.h>
  22. #include <kernel/errno.h>
  23. #define TAB_SIZE 8
  24. errno_t tty_init(void);
  25. void putc(char, __uint8_t);
  26. void print(__uint8_t, char *);
  27. int printk(__uint8_t, char *, ...);
  28. void syslog(const char *);
  29. void update_cursor(void);
  30. __uint16_t read_cursor(void);
  31. void roll_screen(void);
  32. extern __uint8_t x, y;
  33. #define gotoxy(__x, __y) x = (__x);y = (__y);update_cursor();
  34. #define FB_ADDR ((__uint16_t *) 0xb8000)
  35. /* x and y in this vga mode */
  36. #define VGA_X (bootarg->vga_x)
  37. #define VGA_Y (bootarg->vga_y)
  38. #define CURSOR_INDEX 0x03d4
  39. #define CURSOR_DATA 0x03d5
  40. #define CMD_POS_HI 0x0e
  41. #define CMD_POS_LO 0x0f
  42. #define white 0x07
  43. #define red 0x04
  44. #define yellow 0x0e
  45. #endif