*#ident "$Revision: 1.7 $"
*
* GPIB - Communications Controller
*
*FLAG	PREFIX	SOFT	#DEV	DEPENDENCIES
c	gpib	32	-

$$$
#include "sys/ugpib.h"
#include "sys/gpib1014.h"
#include "sys/gpib.h"

/*
 * Edit this file to change default parameters of the GPIB interface.
 * (Formerly, the "ibconf" program was run that accomplished this.)
 *
 * Upon an ibonl(), the current values in an iboard (or idevice)
 * entry are copied into a corresponding ibboards (or ibdevices)
 * entry.
 */

unsigned ibglobals = 0;   /* G_DEBUG to turn on printfs */

struct board iboard[] = {

	/*     flags              VME       primary  secondary  end-of-string
	 *   (see below)          addr     gpib addr gpib addr    character
	 *    ---------           ---      --------- --------     ---------
	 *     timeout          parallel   interrupt interrupt   UNIX signal
	 *      value           poll byte   level     vector       to send
	 */

	{EOT|HLD|TDCL|SRE|SC|TRI,   0,         0,        0,          0,
	 T10s,                   0x70,         2,      100,          2},

	{EOT|HLD|TDCL|SRE|SC|TRI,   0,         0,        0,          0,
	 T10s,                   0x70,         2,       101,         2}
};

/*
 * Board flags (may be OR'd together with `|'):
 *	EOT	assert EOI with last byte of each write
 *	HLD	holdoff handshake at end of each read
 *	REOS	terminate read on eos
 *	XEOS	assert EOI with eos byte
 *	BIN	eight-bit compare
 *	TDCL	terminate I/O on device clear
 *	TTICK	if set, b_tmo is ticks not scale factor
 *	IST	individual status bit
 *	SRE	assert REN when SC
 *	SC	interface is system controller
 *	TRI	use tri-state timing
 *	NOPOLL	do not perform automatic serial polling
 *
 * Timeout values:
 *	TNONE	Infinite timeout (disabled)
 *	T10us	Timeout of 10 us (ideal)
 *	T30us	Timeout of 30 us (ideal)
 *	T100us	Timeout of 100 us (ideal)
 *	T300us	Timeout of 300 us (ideal)
 *	T1ms	Timeout of 1 ms (ideal)
 *	T3ms	Timeout of 3 ms (ideal)
 *	T10ms	Timeout of 10 ms (ideal)
 *	T30ms	Timeout of 30 ms (ideal)
 *	T100ms	Timeout of 100 ms (ideal)
 *	T300ms	Timeout of 300 ms (ideal)
 *	T1s	Timeout of 1 s (ideal)
 *	T3s	Timeout of 3 s (ideal)
 *	T10s	Timeout of 10 s (ideal)
 *	T30s	Timeout of 30 s (ideal)
 *	T100s	Timeout of 100 s (ideal)
 *	T300s	Timeout of 300 s (ideal)
 *	T1000s	Timeout of 1000 s (maximum)
 */

struct device idevice[]= {

	/*     flags          board primary second   end of timeout  parallel
	 *   (see below)       num   gpib    gpib    string  value    poll
	 *                           addr    addr     char  (above)  enable
	 *                                                            byte
	 */

	{EOT|HLD|TDCL|REOS,     0,     1,     0,     '\n',    T10s,     0},
	{EOT|HLD|TDCL|REOS,     0,     2,     0,     '\n',    T10s,     0},    
	{EOT|HLD|TDCL|REOS,     0,     3,     0,     '\n',    T10s,     0},
	{EOT|HLD|TDCL|REOS,     0,     4,     0,     '\n',    T10s,     0},
	{EOT|HLD|TDCL|REOS,     0,     5,     0,     '\n',    T10s,     0},
	{EOT|HLD|TDCL|REOS,     0,     6,     0,     '\n',    T10s,     0},
	{EOT|HLD|TDCL|REOS,     0,     7,     0,     '\n',    T10s,     0},
	{EOT|HLD|TDCL|REOS,     0,     8,     0,     '\n',    T10s,     0},
	{EOT|HLD|TDCL|REOS,     0,     9,     0,     '\n',    T10s,     0},
	{EOT|HLD|TDCL|REOS,     0,     10,    0,     '\n',    T10s,     0},
	{EOT|HLD|TDCL|REOS,     0,     11,    0,     '\n',    T10s,     0},
	{EOT|HLD|TDCL|REOS,     0,     12,    0,     '\n',    T10s,     0},
	{EOT|HLD|TDCL|REOS,     0,     13,    0,     '\n',    T10s,     0},
	{EOT|HLD|TDCL|REOS,     0,     14,    0,     '\n',    T10s,     0},
	{EOT|HLD|TDCL|REOS,     0,     15,    0,     '\n',    T10s,     0},
	{EOT|HLD|TDCL|REOS,     0,     16,    0,     '\n',    T10s,     0},
};

/*
 * Device flags (may be OR'd together with `|'):
 *      EOT    assert EOI with last byte of each write
 *      HLD    holdoff handshake at end of each read
 *      REOS   terminate read on eos
 *      XEOS   assert EOI with eos byte
 *      BIN    eight-bit compare
 *      TDCL   terminate I/O on device clear
 */

/* allocated here to ensure same # of elements as in iboard and idevice */

struct kboard ibboards[sizeof(iboard)/sizeof(iboard[0])];
struct kdevice ibdevices[sizeof(idevice)/sizeof(idevice[0])];

int maxbrd = sizeof(iboard)/sizeof(iboard[0]);
int nibdev = sizeof(idevice)/sizeof(idevice[0]);
