/* devRC4SPDT.c */
/*
 *      Author: Makoto Tobiyama
 *      Date:   4/Mar/2017
 */
#include <epicsStdio.h>
#include <devCommonGpib.h>
#include <string.h>
#include <strings.h>
/***********************************************************************
* asynDriver is distributed subject to a Software License Agreement
* found in file LICENSE that is included with this distribution.
***********************************************************************/
#defineDSET_AIdevAiRC4SPDT
#defineDSET_AOdevAoRC4SPDT
#defineDSET_BIdevBiRC4SPDT
#defineDSET_BOdevBoRC4SPDT
#defineDSET_LIdevLiRC4SPDT
#defineDSET_LOdevLoRC4SPDT
#defineDSET_MBBOdevMbboRC4SPDT
#defineDSET_MBBIdevMbbiRC4SPDT
#defineDSET_MBBODdevMbbodRC4SPDT
#defineDSET_MBBIDdevMbbidRC4SPDT
#defineDSET_SIdevSiRC4SPDT
#defineDSET_SOdevSoRC4SPDT
#include <devGpib.h> /* must be included after DSET defines */ #define TIMEOUT 1.0 /* I/O must complete within this time */ #define TIMEWINDOW 2.0 /* Wait this long after device timeout */ /* * Define end-of-string character(s) here to allow * easier changes when testing the driver. */ #define EOSNL NULL static struct gpibCmd gpibCmds[] = { /* Command 0 set_channel */ {&DSET_MBBOD, GPIBWRITE, IB_Q_LOW, NULL, "SETP=%ld\r\n", 0, 32, NULL, 0, 0, NULL, NULL, EOSNL }, /* Command 1 get_channel */ {&DSET_MBBID, GPIBREAD, IB_Q_LOW, "SWPORT?\r\n", "%ld\r\n", 0, 1023, NULL, 0, 0, NULL, NULL, EOSNL }, /* Command 2 get model name */ {&DSET_SI,GPIBREAD,IB_Q_LOW,"MN?\r\n","MN=%s\r\n",0,1024,NULL,0,0,NULL,NULL, EOSNL}, /* Command 3 get serial number */ {&DSET_SI,GPIBREAD,IB_Q_LOW,"SN?\r\n","SN=%s\r\n",0,1024,NULL,0,0,NULL,NULL, EOSNL}, /* Command 4 get firmware */ {&DSET_SI,GPIBREAD,IB_Q_LOW,"FIRMWARE?\r\n","%s\r\n",0,1024,NULL,0,0,NULL,NULL, EOSNL} }; /* The following is the number of elements in the command array above. */
#define NUMPARAMSsizeof(gpibCmds)/sizeof(struct gpibCmd)
/****************************************************************************** * * Initialization for device support * This is called one time before any records are initialized with a parm * value of 0. And then again AFTER all record-level init is complete * with a param value of 1. * ******************************************************************************/ static long init_ai(int parm) { if(parm==0) { devSupParms.name = "devRC4SPDT"; devSupParms.gpibCmds = gpibCmds; devSupParms.numparams = NUMPARAMS; devSupParms.timeout = TIMEOUT; devSupParms.timeWindow = TIMEWINDOW; devSupParms.respond2Writes = 1.0; } return(0); }