aboutsummaryrefslogtreecommitdiff
path: root/devices/include/uart.h
diff options
context:
space:
mode:
Diffstat (limited to 'devices/include/uart.h')
-rw-r--r--devices/include/uart.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/devices/include/uart.h b/devices/include/uart.h
new file mode 100644
index 0000000..8b44519
--- /dev/null
+++ b/devices/include/uart.h
@@ -0,0 +1,32 @@
+#pragma once
+
+#ifdef __ARCH__
+#include <stdio.h>
+#include <sys/io.h>
+
+#else
+/* from stdio */
+typedef struct FILE {
+ int id;
+ void (*putc)(const struct FILE *, char);
+ int (*puts)(const struct FILE *, const char *, int);
+ void (*flush)(const struct FILE *);
+} FILE;
+
+/* from sys/io */
+unsigned char inb(unsigned short);
+void outb(unsigned char, unsigned short);
+
+enum UART {
+ COM1 = 0x3f8,
+ COM2 = 0x2f8,
+ COM3 = 0x3e8,
+ COM4 = 0x2e8,
+ COM5 = 0x5f8,
+ COM6 = 0x4f8,
+ COM7 = 0x5e8,
+ COM8 = 0x4e8,
+};
+#endif
+
+FILE *uart_init(unsigned short port);