#ifndef SERIAL_MAC #define SERIAL_MAC #include "serial.h" #define BAUD300 baud300 #define BAUD1200 baud1200 #define BAUD2400 baud2400 #define BAUD9600 baud9600 #define BAUD19200 baud19200 #define BAUD38400 baud38400 #define CHAR5 data5 #define CHAR6 data6 #define CHAR7 data7 #define CHAR8 data8 #define STOP1 stop10 #define STOP2 stop20 #define NO_PARITY noParity #define ODD_PARITY oddParity #define EVEN_PARITY evenParity // Check the code directly //#define DEFAULT_SERIAL_PORT "\p.AOut" typedef struct { short in; short out; Handle bufHandle; } SerialID; // The size of the serial input buffer #define kInputBufSize (1024) /*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