#ifndef SERIAL_SGI #define SERIAL_SGI #include #define BAUD300 B300 #define BAUD2400 B2400 #define BAUD9600 B9600 #define BAUD19200 B19200 #define BAUD38400 B38400 #define CHAR5 CS5 #define CHAR6 CS6 #define CHAR7 CS7 #define CHAR8 CS8 #define STOP1 0 #define STOP2 CSTOPB #define NO_PARITY 0 #define ODD_PARITY (PARENB|PARODD) #define EVEN_PARITY PARENB #define DEFAULT_SERIAL_PORT "/dev/ttyd2" typedef int SerialID; /*Open a serial port for activity*/ SerialID Serial_OpenPort(long baud,long parity, long char_bits, long stop_bits); /*Read all available input without blocking. Returns chars read. */ /*Reads at most length characters*/ int Serial_Read(SerialID port, char* buf, int length); /*Read all input, but block waiting for at least something.*/ int Serial_ReadBlocking(SerialID port, char* buf, int length); /*Write length chars from buf*/ int Serial_Write(SerialID port, char* buf, int length); /* Close the port */ int Serial_ClosePort(SerialID port); /* Are their bytes waiting to be read? 0 indicates nothing waiting */ /* any other indicates minimum bytes waiting */ int Serial_BytesAvailable(SerialID port); /* Flush the input queue */ int Serial_FlushInput(SerialID port); #endif