tty.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #include <kernel/init.h>
  20. #include <kernel/errno.h>
  21. #include <kernel/types.h>
  22. #include <modules/tty.h>
  23. #include <arch/io.h>
  24. #include <arch/sys.h>
  25. #include <arch/x86/int.h>
  26. /*
  27. * we supports PSF format in XNIX.
  28. * in linux, PSF fonts are in /usr/share/kbd/consolefonts, and they are always compressed.
  29. * */
  30. #define PSF_MAGIC 0x864ab572
  31. struct psf_header {
  32. __uint32_t magic;
  33. /* zero */
  34. __uint32_t version;
  35. __uint32_t header_size;
  36. /* zero if there's no unicode table */
  37. __uint32_t flags;
  38. /* in psf, a font calls glyph */
  39. __uint32_t glyphs_count;
  40. /* size of a glyph */
  41. __uint32_t glyph_size;
  42. __uint32_t height;
  43. __uint32_t width;
  44. };