xref: /minix3/minix/lib/libsys/arch/i386/ser_putc.c (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc #include "sysutil.h"
2*433d6423SLionel Sambuc 
3*433d6423SLionel Sambuc #define COM1_BASE       0x3F8
4*433d6423SLionel Sambuc #define COM1_THR        (COM1_BASE + 0)
5*433d6423SLionel Sambuc #define         LSR_THRE        0x20
6*433d6423SLionel Sambuc #define COM1_LSR        (COM1_BASE + 5)
7*433d6423SLionel Sambuc 
8*433d6423SLionel Sambuc /*===========================================================================*
9*433d6423SLionel Sambuc  *                               ser_putc			    	     *
10*433d6423SLionel Sambuc  *===========================================================================*/
ser_putc(char c)11*433d6423SLionel Sambuc void ser_putc(char c)
12*433d6423SLionel Sambuc {
13*433d6423SLionel Sambuc         u32_t b;
14*433d6423SLionel Sambuc         int i;
15*433d6423SLionel Sambuc         int lsr, thr;
16*433d6423SLionel Sambuc 
17*433d6423SLionel Sambuc         lsr= COM1_LSR;
18*433d6423SLionel Sambuc         thr= COM1_THR;
19*433d6423SLionel Sambuc         for (i= 0; i<10000; i++)
20*433d6423SLionel Sambuc         {
21*433d6423SLionel Sambuc                 if (sys_inb(lsr, &b) != OK)
22*433d6423SLionel Sambuc 			return;
23*433d6423SLionel Sambuc                 if (b & LSR_THRE)
24*433d6423SLionel Sambuc                         break;
25*433d6423SLionel Sambuc         }
26*433d6423SLionel Sambuc         sys_outb(thr, c);
27*433d6423SLionel Sambuc }
28