minix/lib/libsys/arch/i386/ser_putc.c
Thomas Veerman 264c20159d Split libsys in arch dependent parts
The ARM part is not finished yet and will be fixed in a later commit.
2013-01-25 17:07:01 +00:00

28 lines
713 B
C

#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 *
*===========================================================================*/
void ser_putc(char c)
{
u32_t b;
int i;
int lsr, thr;
lsr= COM1_LSR;
thr= COM1_THR;
for (i= 0; i<10000; i++)
{
if (sys_inb(lsr, &b) != OK)
return;
if (b & LSR_THRE)
break;
}
sys_outb(thr, c);
}