tty.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 INCLUDED_TTY_H
  20. #define INCLUDED_TTY_H
  21. /* index register of cursor */
  22. #define CURSOR_INDEX 0x03d4
  23. /* data register of cursor */
  24. #define CURSOR_DATA 0x03d5
  25. /* write to CURSOR_INDEX */
  26. #define CURSORCTL_POSHI 0x0e
  27. #define CURSORCTL_POSLO 0x0f
  28. #define TEXT_VGA_X 80
  29. #define TEXT_VGA_Y 25
  30. #ifndef ASSEMBLY
  31. #include <stdarg.h>
  32. /* kernel/asm/tty.c */
  33. void tty_init(void);
  34. void putc(char c);
  35. /* kernel/modules/tty.c */
  36. /* return value: length of string printed */
  37. /* we use number formats (1B per format), not % */
  38. __uint64_t printf(const char *fmt, ...);
  39. __uint64_t printint(long, int, int);
  40. __uint16_t read_cursor(void);
  41. __uint64_t printptr(__uint64_t);
  42. void write_cursor(__uint16_t pos);
  43. void clear_line(int line);
  44. #endif
  45. #endif