aboutsummaryrefslogtreecommitdiff
path: root/devices/uart.h
diff options
context:
space:
mode:
Diffstat (limited to 'devices/uart.h')
-rw-r--r--devices/uart.h23
1 files changed, 17 insertions, 6 deletions
diff --git a/devices/uart.h b/devices/uart.h
index 8def000..3349042 100644
--- a/devices/uart.h
+++ b/devices/uart.h
@@ -1,7 +1,21 @@
#pragma once
-// #include <stdio.h>
-// #include <sys/io.h>
+#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,
@@ -13,9 +27,6 @@ enum UART {
COM7 = 0x5e8,
COM8 = 0x4e8,
};
-
-typedef struct {
- unsigned id;
-} FILE;
+#endif
FILE *uart_init(enum UART port);