]> Zhao Yanbai Git Server - minix.git/commitdiff
straggler.
authorBen Gras <ben@minix3.org>
Thu, 11 Dec 2008 14:55:06 +0000 (14:55 +0000)
committerBen Gras <ben@minix3.org>
Thu, 11 Dec 2008 14:55:06 +0000 (14:55 +0000)
lib/sysutil/ser_putc.c [new file with mode: 0644]

diff --git a/lib/sysutil/ser_putc.c b/lib/sysutil/ser_putc.c
new file mode 100644 (file)
index 0000000..26a3b07
--- /dev/null
@@ -0,0 +1,27 @@
+#include "sysutil.h"
+#include <timers.h>
+
+#define COM1_BASE       0x3F8
+#define COM1_THR        (COM1_BASE + 0)
+#define         LSR_THRE        0x20
+#define COM1_LSR        (COM1_BASE + 5)
+
+/*===========================================================================*
+ *                               ser_putc                                   *
+ *===========================================================================*/
+PUBLIC int ser_putc(char c)
+{
+        unsigned long b;
+        int i;
+        int lsr, thr;
+  
+        lsr= COM1_LSR;
+        thr= COM1_THR;
+        for (i= 0; i<10000; i++)
+        {
+                sys_inb(lsr, &b);
+                if (b & LSR_THRE)
+                        break;
+        }
+        sys_outb(thr, c);
+}