minix/lib/libsys/ser_putc.c

27 lines
692 B
C
Raw Normal View History

2008-12-11 15:55:06 +01:00
#include "sysutil.h"
#define COM1_BASE 0x3F8
#define COM1_THR (COM1_BASE + 0)
#define LSR_THRE 0x20
#define COM1_LSR (COM1_BASE + 5)
/*===========================================================================*
* ser_putc *
*===========================================================================*/
2012-03-25 20:25:53 +02:00
void ser_putc(char c)
2008-12-11 15:55:06 +01:00
{
2012-03-05 00:11:41 +01:00
u32_t b;
2008-12-11 15:55:06 +01:00
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);
}