tty.hpp 720 B

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include <types/allocator.hpp>
  3. #include <types/buffer.hpp>
  4. #include <types/cplusplus.hpp>
  5. #include <types/stdint.h>
  6. class tty : public types::non_copyable {
  7. public:
  8. static constexpr size_t BUFFER_SIZE = 4096;
  9. static constexpr size_t NAME_SIZE = 32;
  10. public:
  11. tty();
  12. virtual void putchar(char c) = 0;
  13. void print(const char* str);
  14. char name[NAME_SIZE];
  15. types::buffer<types::kernel_ident_allocator> buf;
  16. };
  17. class vga_tty : public virtual tty {
  18. public:
  19. vga_tty();
  20. virtual void putchar(char c) override;
  21. };
  22. class serial_tty : public virtual tty {
  23. public:
  24. serial_tty(int id);
  25. virtual void putchar(char c) override;
  26. public:
  27. uint16_t id;
  28. };
  29. inline tty* console;