/***                LISTING 6                 ***/
/***                                          ***/
/***                 sout.c                   ***/
/*** **************************************** ***/
/***    OUTPUT A CHARACTER TO SERIAL PORT     ***/
/*** **************************************** ***/
#include "serial.h"
#include <time.h>

extern int portbase;

int SerialOut (char Char_Value)
  {
   clock_t start, timeout;

   start = (clock());

   while((inp(portbase + LSR) & XMTRDY) == 0)
    {
     timeout = (clock());

     if((timeout-start) > 1)
      {
       return(-1);
      }
    }

  outp(portbase + TXR,Char_Value);
  return (0);
}
