From: Ben Gras Date: Thu, 11 Dec 2008 14:55:06 +0000 (+0000) Subject: straggler. X-Git-Tag: v3.1.4~182 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/cppcheck-error.log?a=commitdiff_plain;h=fe3e0181d4467afaad37bac44556b9b69a44edcf;p=minix.git straggler. --- diff --git a/lib/sysutil/ser_putc.c b/lib/sysutil/ser_putc.c new file mode 100644 index 000000000..26a3b0746 --- /dev/null +++ b/lib/sysutil/ser_putc.c @@ -0,0 +1,27 @@ +#include "sysutil.h" +#include + +#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); +}