#ifndef GIMMELIB_COMMUNIC_H
#define GIMMELIB_COMMUNIC_H


#ifdef I_AM_COMMUNIC
/* internal constants */
#ifndef MILLION
#define MILLION 	1000000L
#endif
#define SMALL_SECS	0L		/* "small" time-out */
#define SMALL_MICROS	(MILLION / 2)
#define BIG_SECS	2L		/* "large" time-out */
#define BIG_MICROS	0L

#define DEFAULT_EOL	0x0d	    /* CR */
#endif I_AM_COMMUNIC


/* Constants used for setup parameters */
#define C_SER_7 	1	/* 7 wire handshaking */
#define C_SER_3 	2	/* 3 wire XON/XOFF handshaking */

#define C_NO_PARITY	1	/* No parity */
#define C_EVEN_PARITY	2	/* Even parity */
#define C_ODD_PARITY	3	/* Odd parity */

/* Setup parameter structure */
typedef struct c_parameters {
    WORD C_MODE;		/* Mode of communications to be used */
    WORD C_BAUD;
    WORD C_STOP;
    WORD C_PARITY;
    WORD C_RLEN;
    WORD C_WLEN;
} SERPARMS;

/* Error Condition values */
#define C_ERR_OK	0	/* No error occured */
#define C_ERR_INITIAL	1	/* System not initialized */
#define C_ERR_OPEN	2	/* Channel already opened */
#define C_ERR_CANT	3	/* Can't open channel */
#define C_ERR_PARAMS	4	/* Can't set parameters as specified */
#define C_ERR_CHAN	5	/* Channel not open */
#define C_ERR_GET	6	/* Timeout before character recieved */
#define C_ERR_PUT	7	/* Can't send character */
#define C_ERR_PARITY	8	/* Parity specified is not valid */
#define C_ERR_ILLEGAL	9	/* Illegal length parameter for get/put s */
#define C_ERR_BADPARM	10	/* Invalid parameter given to routine */

#ifndef I_AM_COMMUNIC
extern short c_error;		/* error number of last communic routine */
#endif !I_AM_COMMUNIC

#endif !GIMMELIB_COMMUNIC_H
