about summary refs log tree commit diff stats
path: root/tools/iso/kernel.soso/tty.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/iso/kernel.soso/tty.h')
-rw-r--r--tools/iso/kernel.soso/tty.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/tools/iso/kernel.soso/tty.h b/tools/iso/kernel.soso/tty.h
new file mode 100644
index 00000000..df39e6cd
--- /dev/null
+++ b/tools/iso/kernel.soso/tty.h
@@ -0,0 +1,41 @@
+#ifndef TTY_H
+#define TTY_H
+
+#include "common.h"
+#include "fifobuffer.h"
+#include "termios.h"
+
+#define TTY_LINEBUFFER_SIZE 1024
+
+typedef struct Tty Tty;
+
+typedef void (*TtyFlushScreenFunction)(Tty* tty);
+
+typedef struct Tty {
+    uint16 lineCount;
+    uint16 columnCount;
+    uint8* buffer;
+    uint16 currentLine;
+    uint16 currentColumn;
+    uint8 color;
+    void* privateData;
+    uint8 lineBuffer[TTY_LINEBUFFER_SIZE];
+    uint32 lineBufferIndex;
+    FifoBuffer* keyBuffer;
+    struct termios term;
+    TtyFlushScreenFunction flushScreen;
+} Tty;
+
+
+
+Tty* createTty(uint16 lineCount, uint16 columnCount, TtyFlushScreenFunction flushFunction);
+void destroyTty(Tty* tty);
+
+void Tty_Print(Tty* tty, int row, int column, const char* text);
+void Tty_Clear(Tty* tty);
+void Tty_PutChar(Tty* tty, char c);
+void Tty_PutText(Tty* tty, const char* text);
+void Tty_MoveCursor(Tty* tty, uint16 line, uint16 column);
+void Tty_ScrollUp(Tty* tty);
+
+#endif // TTY_H