/******************************************************************************/
/* Copyright 1991 to 1993 MBARI                                               */
/******************************************************************************/
/* Summary  : General Micro Systems SIO32 Serial Board misc. definitions      */
/* Filename : sio32.h                                                         */
/* Author   : Andrew Pearce                                                   */
/* Project  : GMS Serial Board Driver for VxWorks                             */
/* Version  : Version 1.0                                                     */
/* Created  : 06/20/91                                                        */
/* Modified : 06/14/93                                                        */
/* Archived :                                                                 */
/******************************************************************************/

#ifndef _SIO32_H
#define _SIO32_H

#define DIAG_OFF        0               /* No diagnostic messages printed     */
#define DIAG_ON         1               /* Some diagnostic messages printed   */
#define DIAG_FULL       2               /* All diagnostic messages printed    */

#define SIO32_DIAG_LEVEL DIAG_OFF       /* Select diagnostic level            */

#define BUFFER_SIZE   512               /* Size of Tx and Rx buffers in bytes */

#define SIO32_CLK_FREQ   3686400        /* Crystal Frequency                  */

typedef enum
{
  RS232_MODE,                           /* Select RS232 mode                  */
  RS485_MODE,                           /* Select RS485 X.ANDY protocol       */
  RS485_NO_PROTO                        /* Select RS485 mode (no protocol)    */
} sioProto;

#define FIOLOOPBACK   100               /* Ioctl function for loopback control*/
#define FIOGETRXACKNO 101               /* Ioctl gets seq no of frame acked   */
#define FIOGETTXSEQNO 102               /* Ioctl gets seq no of next tx frame */
#define FIOSETTXSEQNO 103               /* Ioctl sets seq no of next tx frame */
#define FIOSETRXSEQNO 104               /* Ioctl sets seq no of next rx frame */

#define ESIO32_NO_CARD   (M_GMSSIO32 | 12)   /* Board hardware is missing     */
#define ESIO32_NO_DRIVER (M_GMSSIO32 | 13)   /* SIO4 driver not initialzed    */
#define ESIO32_BAD_IVEC  (M_GMSSIO32 | 14)   /* bad Interrupt Vector Base     */
#define ESIO32_NO_CHAN   (M_GMSSIO32 | 15)   /* bad channel number            */
#define ESIO32_CEXIST    (M_GMSSIO32 | 16)   /* channel already exists        */
#define ESIO32_MALLOC    (M_GMSSIO32 | 17)   /* malloc failed - no  memory    */
#define ESIO32_EBAUD     (M_GMSSIO32 | 18)   /* Bad Baud Rate value specified */
#define ESIO32_EDBITS    (M_GMSSIO32 | 19)   /* Bad Data Bits value specified */
#define ESIO32_ESBITS    (M_GMSSIO32 | 20)   /* Bad Stop Bits value specified */
#define ESIO32_EPARITY   (M_GMSSIO32 | 21)   /* Bad Parity value specified    */
#define ESIO32_COPEN     (M_GMSSIO32 | 22)   /* Channel already open          */
#define ESIO32_EREQUEST  (M_GMSSIO32 | 23)   /* IOCTL request not valid       */
#define ESIO32_TY_DEV    (M_GMSSIO32 | 24)   /* Error creating tty device     */
#define ESIO32_COLLISION (M_GMSSIO32 | 25)   /* Transmit collision detected   */
#define ESIO32_NO_TIMER  (M_GMSSIO32 | 26)   /* No Timers are available       */

#ifdef __STDC__

                               /* SIO32 Driver initialization call by usrRoot*/
STATUS sio32Drv(Nat16 sio32IntVecBase, Nat16 sio32IntLevel);

                               /* SIO32 Device creation - called by the user */
STATUS sio32DevCreate(char *name, Nat32 channel, Nat32 baudRate, Nat32 dataBits,
    Nat32 stopBits, char *parity, sioProto protocol);

Void sio32Interrupt(Nat32 intSource);

#endif /* __STDC__ */

#endif /* _SIO32_H */


