/****************************************************************************/
/* Copyright 1991 - 2003 MBARI											*/
/****************************************************************************/
/* $Header: /home/cvs/oasis4/src/controller/system/drvTbl.h,v 1.3 2015/01/22 18:31:49 bobh Exp $					   */
/* Summary	: Default Driver Table for OASIS3 Mooring Controller			*/
/* Filename : drvTbl.h														*/
/* Author	: Robert Herlien (rah)											*/
/* Project	: OASIS Mooring													*/
/* $Revision: 1.3 $															*/
/* Created	: 01/30/2003												*/
/************************************************************************/
/* Modification History:												*/
/* 30jan2003 rah - created from OASIS drvr.h							*/
/************************************************************************/

#ifndef INCdrvTblh
#define INCdrvTblh		  1

#include <oasis.h>
#include <serial.h>

#define NUM_DRVRS		(sizeof(drv_default)/sizeof(DrvDesc))

/********************************/
/*		External Functions		*/
/********************************/

#if 0
Extern Void		analog_drv();			/* A/D driver					*/
Extern Void		ctd_drv();				/* Seabird CTD driver			*/
Extern Void		freewave_drv();			/* Freewave Radio driver		*/
Extern Void		gf_drv();				/* Ground Fault Driver			*/
Extern Void		log_drv();				/* Dummy data logger			*/
Extern Void		microcat_drv();			/* microCat CTD driver			*/
Extern Void		onoff_drv();			/* Simple drvr to turn on/off	*/
Extern Void		pswitch_drv();			/* Simple drvr to turn on/off	*/
Extern Void		usr_drv();				/* User I/F driver routine		*/
Extern Void		optrode_drv();			/* Optrode Driver				*/
Extern Void		envDrv(Driver *dp);		/* environmental data driver	*/
Extern Void		emeter_drv();			/* Power Meter driver			*/
Extern Void		pH_drv();				/* MBARI pH sensor amp board	*/
Extern Void		ctdsim_drv();			/* CTD simulator driver			*/
Extern Void		serialAtoD_drv(Driver *dp); /* Serial A/D				*/
#else
#define analog_drv		nullDrvrFunc
#define ctd_drv			nullDrvrFunc
#define freewave_drv	nullDrvrFunc
#define gf_drv			nullDrvrFunc
Extern Void				log_drv();		/* Dummy data logger			*/
#define microcat_drv	nullDrvrFunc
#define onoff_drv		nullDrvrFunc
#define pswitch_drv		nullDrvrFunc
#define usr_drv			nullDrvrFunc
#define optrode_drv		nullDrvrFunc
#define envDrv			nullDrvrFunc
#define emeter_drv		nullDrvrFunc
#define pH_drv			nullDrvrFunc
#define ctdsim_drv		nullDrvrFunc
#define seriaAtoD_drv	nullDrvrFunc
#endif


/****************************************/
/*		Driver Descriptors				*/
/****************************************/

#define MODE_N81		(NO_PTY	  | BIT8 | STOP1 | FLOW)
#define MODE_N81NF		(NO_PTY	  | BIT8 | STOP1)
#define MODE_E71		(EVEN_PTY | BIT7 | STOP1 | FLOW)
#define MODE_N72NF		(NO_PTY	  | BIT7 | STOP2)

/* Mask to turn off sampling from 1800 to 0600 hours local (for Eqpac) */
/*#define DAYMASK		  0xfc003fL */

/* Continuous sampling for local deployments */
#define DAYMASK			0L


/************************************************************************/
/* drvDescs Table - This is the table that describes ALL of the possible*/
/*		drivers that can be included via the OASIS.CFG file.  There is	*/
/*		one entry for each driver type.	 The drv_parms indicate the		*/
/*		default parameters (serial port number, baud rate, power bit, etc)*/
/*		but these are used ONLY if the system configurator doesn't		*/
/*		override them in the config file.  In most cases, s/he will		*/
/*		want to override these defaults.								*/
/************************************************************************/
/* In order to add support for a new driver, simply add the entry for	*/
/* that driver into this table.											*/
/*																		*/
/* Note that most instruments are declared with NO_SERIAL and no power	*/
/* bits.  We don't know in advance what ports/bits will be assigned.	*/
/* The system configurator MUST declare the serial port & power bits for*/
/* these instruments in OASIS.CFG										*/
/************************************************************************/

const DrvDesc drvDescs[] = 
{
/* Note that UserIF has no flow control.  Serial port 0 (user console)	*/
/* doesn't support XON/XOFF, so it does you no good to try to turn it on*/

  { "UserIF", usr_drv, nullWakeFunc,
	SECS_PER_DAY, 0, 38400, (MODE_N81NF | ECHO | AUTOCR), 0, LOG_BIN, 0,
	120, 0, 0, 0},

  { "Freewave", freewave_drv, nullWakeFunc,
	600, 1, 19200, (MODE_N81 | NEWCR), 0x02, LOG_BIN, 0,
	240, 20, 0, 0},

  { "Teledesign", freewave_drv, nullWakeFunc,
	600, 1, 9600, (MODE_N81 | ECHO | AUTOCR), 0x02, LOG_BIN, 0,
	240, 20, 2, 0},

  { "Viper", freewave_drv, nullWakeFunc,
	600, 1, 9600, (MODE_N81 | ECHO | AUTOCR), 0x02, LOG_BIN, 0,
	240, 20, 15, 0},

  { "CTD", ctd_drv, nullWakeFunc,
	600, NO_SERIAL, 9600, MODE_N81NF, 0, LOG_ASCII, 0, 3, 10, 3, 0},

  { "Microcat", microcat_drv, nullWakeFunc,
	600, NO_SERIAL, 9600, MODE_N81NF, 0, LOG_ASCII, 0, 3, 10, 0, 0},

  { "Analog", analog_drv, nullWakeFunc,
	1800, NO_SERIAL, 0, 0, 0, LOG_BIN, 0, 60, 5, 1, 100},

  { "GF", gf_drv, nullWakeFunc,
	1800, NO_SERIAL, 9600, MODE_N81NF, 0, LOG_BIN, 0, 3, 5, 0, 0},

  { "OASIS", analog_drv,nullWakeFunc,
	1800, NO_SERIAL, 0, 0, 0, LOG_BIN, 0, 3, 0, 3, 100},

  { "AanderaaO2", optrode_drv, nullWakeFunc,
	600, NO_SERIAL, 9600, MODE_N81NF, 0, LOG_ASCII, 0, 5, 1, 0, 0},

  { "Logger", log_drv, nullWakeFunc,
	0, NO_SERIAL, 0, 0, 0, LOG_ASCII, 0, 1, 1000, 0, 0},
  
  { "FileLogger", file_drv, nullWakeFunc,
	0, NO_SERIAL, 0, 0, 0, LOG_ASCII, 0, 1, 1000, 0, 0},
  
  { "env", envDrv, nullWakeFunc,
	600, NO_SERIAL, 0, 0, 0, LOG_BIN, 0, 0, 0, 0, 0},

  { "OnOff", onoff_drv, nullWakeFunc,
	0, NO_SERIAL, 0, 0, 0, LOG_ASCII, 0, 60, 0, 0, 0},

  { "emeter", emeter_drv, nullWakeFunc,
	600, NO_SERIAL, 9600, MODE_N81NF, 2, LOG_ASCII, 0, 15, 1, 3, 0},

  { "isfet_pH", pH_drv, nullWakeFunc,
	600, NO_SERIAL, 9600, MODE_N81NF, 0, LOG_ASCII, 0, 5, 2, 40, 0},

  { "PowerSwitch", pswitch_drv, nullWakeFunc,
	0, NO_SERIAL, 0, 0, 0, LOG_ASCII, 0, 0, 0, 0, 0},

  { "CTDSim", ctdsim_drv, nullWakeFunc,
	30, NO_SERIAL, 9600, MODE_N81NF, 0, LOG_ASCII, 0, 10, 0, 0, 0}

};


/************************************************************************/
/* drv_default Table - This is the table of drivers that get built if	*/
/*		OASIS.CFG doesn't exist, is corrupt, or doesn't have any drivers*/
/*		in it.	In other words, this is what the system will use as a	*/
/*		last resort.													*/
/************************************************************************/

const DrvDesc drv_default[] = 
{

  { "UserIF", usr_drv, nullWakeFunc,
	SECS_PER_DAY, 0, 38400, (MODE_N81NF | ECHO | AUTOCR), 0, LOG_BIN, 0,
	120, 0, 0, 0},

  { "OASIS", analog_drv, nullWakeFunc,
	1800, NO_SERIAL, 0, 0, 0, LOG_BIN, 0, 3, 0, 3, 100}

};

#endif /* INCdrvrh */

