/*drvGpibRegister.c */
/***********************************************************************
* 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.
***********************************************************************/
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <iocsh.h>
#include "drvGpibInterface.h"
#ifdef __cplusplus
extern "C" {
#endif	/* __cplusplus */
static const iocshArg LogDataArg0 = {"link", iocshArgInt};
static const iocshArg LogDataArg1 = {"addr", iocshArgInt};
static const iocshArg LogDataArg2 = {"(0,1)=>(no,yes)", iocshArgInt};
static const iocshArg *LogDataArgs[3] =
{&LogDataArg0, &LogDataArg1, &LogDataArg2};
static const iocshFuncDef LogDataDef = {"drvGpibLogData", 3, LogDataArgs};
static void LogDataCall(const iocshArgBuf * args) {
	drvGpibLogData(args[0].ival, args[1].ival, args[2].ival);
}

static const iocshArg ResetLinkArg0 = {"link", iocshArgInt};
static const iocshArg *ResetLinkArgs[1] = {&ResetLinkArg0};
static const iocshFuncDef ResetLinkDef =
    {"drvGpibResetLink", 1, ResetLinkArgs};
static void ResetLinkCall(const iocshArgBuf * args) {
	drvGpibResetLink(args[0].ival);
}

static const iocshArg PollArg0 = {"link", iocshArgInt};
static const iocshArg PollArg1 = {"addr", iocshArgInt};
static const iocshArg PollArg2 = {"(0,1)=>(no,yes)", iocshArgInt};
static const iocshArg *PollArgs[3] =
{&PollArg0, &PollArg1, &PollArg2};
static const iocshFuncDef PollDef = {"drvGpibPoll", 3, PollArgs};
static void PollCall(const iocshArgBuf * args) {
	drvGpibPoll(args[0].ival, args[1].ival, args[2].ival);
}

static const iocshFuncDef GIDef = {"GI", 0, 0};
static void GICall(const iocshArgBuf *) {
	GI();
}

static const iocshArg ibDebugArg0 = {"value", iocshArgInt};
static const iocshArg *const ibDebugArgs[1] = {&ibDebugArg0};
static const iocshFuncDef ibDebugDef = {"setibDebug", 1, ibDebugArgs};
static void ibDebugCall(const iocshArgBuf * args) {
	ibDebug = args[0].ival;
}

static const iocshArg ibSrqDebugArg0 = {"value", iocshArgInt};
static const iocshArg *const ibSrqDebugArgs[1] = {&ibSrqDebugArg0};
static const iocshFuncDef ibSrqDebugDef =
    {"setibSrqDebug", 1, ibSrqDebugArgs};
static void ibSrqDebugCall(const iocshArgBuf * args) {
	ibSrqDebug = args[0].ival;
}

static const iocshArg ibSrqLockArg0 = {"value", iocshArgInt};
static const iocshArg *const ibSrqLockArgs[1] = {&ibSrqLockArg0};
static const iocshFuncDef ibSrqLockDef = {"setibSrqLock", 1, ibSrqLockArgs};
static void ibSrqLockCall(const iocshArgBuf * args) {
	ibSrqLock = args[0].ival;
}

static const iocshArg ibTimeoutSquelchArg0 = {"value", iocshArgInt};
static const iocshArg *const ibTimeoutSquelchArgs[1] =
    {&ibTimeoutSquelchArg0};
static const iocshFuncDef ibTimeoutSquelchDef =
    {"setibTimeoutSquelch", 1, ibTimeoutSquelchArgs};
static void ibTimeoutSquelchCall(const iocshArgBuf * args) {
	ibTimeoutSquelch = args[0].ival;
}

static const iocshArg ibSrqTimeoutArg0 = {"value", iocshArgInt};
static const iocshArg *const ibSrqTimeoutArgs[1] = {&ibSrqTimeoutArg0};
static const iocshFuncDef ibSrqTimeoutDef =
    {"setibSrqTimeout", 1, ibSrqTimeoutArgs};
static void ibSrqTimeoutCall(const iocshArgBuf * args) {
	ibSrqTimeout = args[0].ival;
}

static const iocshArg ibSrqRingSizeArg0 = {"value", iocshArgInt};
static const iocshArg *const ibSrqRingSizeArgs[1] = {&ibSrqRingSizeArg0};
static const iocshFuncDef ibSrqRingSizeDef =
    {"setibSrqRingSize", 1, ibSrqRingSizeArgs};
static void ibSrqRingSizeCall(const iocshArgBuf * args) {
	ibSrqRingSize = args[0].ival;
}

static const iocshArg ibSrqPollTimeoutArg0 = {"value", iocshArgInt};
static const iocshArg *const ibSrqPollTimeoutArgs[1] = {&ibSrqPollTimeoutArg0};
static const iocshFuncDef ibSrqPollTimeoutDef =
    {"setibSrqPollTimeout", 1, ibSrqPollTimeoutArgs};
static void ibSrqPollTimeoutCall(const iocshArgBuf * args) {
	ibSrqPollTimeout = args[0].ival;
}

static const iocshArg ibSrqPollRateArg0 = {"value", iocshArgInt};
static const iocshArg *const ibSrqPollRateArgs[1] = {&ibSrqPollRateArg0};
static const iocshFuncDef ibSrqPollRateDef =
    {"setibSrqPollRate", 1, ibSrqPollRateArgs};
static void ibSrqPollRateCall(const iocshArgBuf * args) {
	ibSrqPollRate = (double)args[0].ival;
}

void drvGpibRegister() {
	static int firstTime = 1;
	if  (!firstTime)
	    return;
	firstTime = 0;
	iocshRegister(&LogDataDef, LogDataCall);
	iocshRegister(&ResetLinkDef, ResetLinkCall);
	iocshRegister(&PollDef, PollCall);
	iocshRegister(&GIDef, GICall);
	iocshRegister(&ibDebugDef, ibDebugCall);
	iocshRegister(&ibSrqDebugDef, ibSrqDebugCall);
	iocshRegister(&ibSrqLockDef, ibSrqLockCall);
	iocshRegister(&ibTimeoutSquelchDef, ibTimeoutSquelchCall);
	iocshRegister(&ibSrqTimeoutDef, ibSrqTimeoutCall);
	iocshRegister(&ibSrqRingSizeDef, ibSrqRingSizeCall);
	iocshRegister(&ibSrqPollTimeoutDef, ibSrqPollTimeoutCall);
	iocshRegister(&ibSrqPollRateDef, ibSrqPollRateCall);
}
#ifdef __cplusplus
}
#endif	/* __cplusplus */
class gpibCommonInit {
    public:
    gpibCommonInit() {
	drvGpibRegister();
    }
};
static gpibCommonInit gpibCommonInitObj;
