/******************************************************************************
 *
 * drvGpibInterface.h,v
 *
 ******************************************************************************/
/***********************************************************************
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory, and the Regents of the University of
* California, as Operator of Los Alamos National Laboratory, and
* Berliner Elektronenspeicherring-Gesellschaft m.b.H. (BESSY).
* gpibCore is distributed subject to a Software License Agreement
* found in file LICENSE that is included with this distribution.
***********************************************************************/
/*
 * Interface between generic GPIB driver and device supports
 *
 * Current Author: Benjamin Franksen
 * Original Author: John Winans
 */
#ifndef DRVGPIBINTERFACE_H
#define DRVGPIBINTERFACE_H
#include <ellLib.h>
#include "drvGpib.h"
#ifdef __cplusplus
extern "C" {
#endif	/* __cplusplus */

/* return values of the work start function, see dpvtGpibHead */
#define BUSY  1	/* device is busy */
#define IDLE  0	/* device is idle */
/* priority levels for qGpibReq */
#define IB_Q_LOW  1
#define IB_Q_HIGH 2
/******************************************************************************
 * This is the structure for work requests.
 * All gpib records must have device private structures that begin with the
 * following structure.
 ******************************************************************************/
typedef struct dpvtGpibHead {
    ELLNODE node;
    int (*workStart)();	/* work start function for the transaction */
    int link;
    int device;	        /* GPIB primary address for transaction */
    int secondary;	/* secondary address. -1 means only primary */
    ibLink *pibLink;	/* used by generic driver */
}dpvtGpibHead;

/******************************************************************************
 * Call interface of generic driver (for device supports and EPICS).
 ******************************************************************************/
struct drvGpibEt {
    long number;
    long (*report) (int level);
    long (*init) (void);
    ibLink *(*getLink) (int link, int gpibAddr, int secondary);
    long (*qGpibReq) (dpvtGpibHead * pdpvt, int prio);
    long (*registerSrqHandler) (ibLink * pibLink, int gpibAddr, int secondary,
        srqHandlerFunc handler, void *parm);
    long (*read) (ibLink * pibLink, int gpibAddr, int secondary,
        char *data, int length, int timeout, int eos);
    long (*write) (ibLink * pibLink, int gpibAddr, int secondary,
        char *data, int length, int timeout);
    long (*addressedCmd) (ibLink * pibLink, int gpibAddr, int secondary,
        char *data, int length, int timeout);
    long (*universalCmd) (ibLink * pibLink, int cmd);
    long (*ifc) (ibLink * pibLink);
    long (*ren) (ibLink * pibLink, int onOff);
    long (*reset) (ibLink * pibLink);
};

#ifdef __cplusplus
}
#endif	/* __cplusplus */
/*
 * drvGpibInterface.h,v
 * Revision 1.4  2003/04/10 15:17:03  mrk
 * open source license
 *
 * Revision 1.3  2003/03/14 16:46:55  mrk
 * Changes for March 2003 version
 *
 * Revision 1.2  2002/11/01 19:29:58  mrk
 * More changes for ioctl replacement
 *
 * Revision 1.1  2002/10/18 17:21:07  mrk
 * moved to here
 *
 * Revision 1.3  2001/10/24 15:49:37  mrk
 * changes for baseR3.14.0beta1
 *
 * Revision 1.2  2001/04/17 18:40:07  mrk
 * Changes to get ready for bitBus support which will be implemented with bitBus
 *
 * Revision 1.1.1.1  2001/02/15 14:52:51  mrk
 * Import sources
 *
 * Revision 1.3  2000/05/19 20:37:36  franksen
 * fixed debug messages; overhauled report functions; fixed bug in HiDEOSGpibInit;
 * adapted everything to upper/lower interface seperation
 *
 * Revision 1.2  2000/05/19 12:57:42  franksen
 * use errlogPrintf; fixed bug in drvGpibGetLink;
 * changed type of link/gpibAddr from short to int
 *
 * Revision 1.1.1.1  2000/03/21 18:06:35  franksen
 * unbundled gpib first version
 *
 ******************************************************************************/
#endif	/* DRVGPIBINTERFACE_H */
