/*
* Milimage AS0920-500T device support
*/
#include <epicsStdio.h>
#include <devCommonGpib.h>
#include <string.h>
#include <strings.h>
/******************************************************************************
*
* The following define statements are used to declare the names to be used
* for the dset tables.
*
* A DSET_AI entry must be declared here and referenced in an application
* database description file even if the device provides no AI records.
*
******************************************************************************/
#define DSET_AI devAiAS0920
#define DSET_AO devAoAS0920
#define DSET_BI devBiAS0920
#define DSET_BO devBoAS0920
#define DSET_EV devEvAS0920
#define DSET_LI devLiAS0920
#define DSET_LO devLoAS0920
#define DSET_MBBI devMbbiAS0920
#define DSET_MBBID devMbbidAS0920
#define DSET_MBBO devMbboAS0920
#define DSET_MBBOD devMbbodAS0920
#define DSET_SI devSiAS0920
#define DSET_SO devSoAS0920
#define DSET_WF devWfAS0920
#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 */
# line 2 "devAS0920.gt"
/* static short get_onedata(char wa1[]);
static int rd_data(char wav[], short temp[]);
static int rd_wf_data(struct gpibDpvt *pdpvt, int p1, int p2, char **p3);
*/
/*static int rd_efast_data(struct gpibDpvt *pdpvt, int p1, int p2, char **p3);
*/
/******************************************************************************
* Strings used by the init routines to fill in the znam,onam,...
* fields in BI and BO record types.
******************************************************************************/
/*static char *AcqStateList[] = { "STOP", "RUN" };
static struct devGpibNames AcqState = { 2, AcqStateList, 0, 1 };
*/
static char *OnOffList[]={"Off","On"};
static struct devGpibNames OnOffState ={2, OnOffList,0, 1};
static char *PowerModeList[] = { "CW" ,"PULSE" };
static struct devGpibNames PowerState={2, PowerModeList,0,1};
/******************************************************************************
* Structures used by the init routines to fill in the onst,twst,... and the
* onvl,twvl,... fields in MBBI and MBBO record types.
*
* Note that the intExtSsBm and intExtSsBmStop structures use the same
* intExtSsBmStopList and intExtSsBmStopVal lists but have a different number
* of elements in them that they use... The intExtSsBm structure only represents
* 4 elements,while the intExtSsBmStop structure represents 5.
******************************************************************************/
/******************************************************************************
* String arrays for EFAST operations. The last entry must be 0.
*
* On input operations,only as many bytes as are found in the string array
* elements are compared. Additional bytes are ignored.
* The first matching string will be used as a match.
*
* For the input operations,the strings are compared literally! This
* can cause problems if the instrument is returning things like \r and \n
* characters. When defining input strings so you include them as well.
******************************************************************************/
static char *(OnOffLine[])={"LINE 0\n\r","LINE 1\n\r",0};
static char *(OnOffRF[])={"OUTP 0\n\r","OUTP 1\n\r",0};
static char *(PowerModeO[])={"POWER:CW\n\r","POWER:PULSE\n\r",0};
static char *(PowerModeI[])={"CW\n\r","PULSE\n\r",0};
/******************************************************************************
* Array of structures that define all GPIB messages
* supported for this type of instrument.
******************************************************************************/
static struct gpibCmd gpibCmds[] = {
/* Command 0 Line on off SET */
{&DSET_BO, GPIBEFASTO, IB_Q_LOW, NULL, NULL, 0, 127, NULL, 0, 0, OnOffLine, &OnOffState, NULL },
/* Command 1 Line on off READ */
{&DSET_BI, GPIBREAD, IB_Q_LOW, "LINE?\n\r", NULL, 0, 127, NULL, 0, 0, NULL, &OnOffState, NULL },
/* Command 2 RF on off SET */
{&DSET_BO,GPIBEFASTO, IB_Q_LOW, NULL,NULL,0,127,NULL,0,0,OnOffRF,&OnOffState,NULL},
/* Command 3 RF on off READ */
{&DSET_BI,GPIBREAD, IB_Q_LOW,"OUTP?\n\r",NULL,0,127,NULL,0,0,NULL,&OnOffState, NULL},
/* Command 4 Reset */
{&DSET_AO,GPIBWRITE,IB_Q_LOW,NULL, "RES\n\r",0,127,NULL,0,0,NULL,NULL,NULL },
/* Command 5 Power In Read */
{&DSET_AI,GPIBREAD,IB_Q_LOW,"POWER:INPUT?\n\r","%lf\n\r",0,127,NULL,0,0,NULL,NULL,NULL},
/* Command 6 Power Foward Read */
{&DSET_AI,GPIBREAD,IB_Q_LOW,"POWER:OUTPUT?\n\r","%lf\n\r",0,127,NULL,0,0,NULL,NULL,NULL},
/* Command 7 Power Reflection Read */
{&DSET_AI,GPIBREAD,IB_Q_LOW,"POWER:REVERSE?\n\r","%lf\n\r",0,127,NULL,0,0,NULL,NULL,NULL},
/* Command 8 Mode SET */
{&DSET_BO,GPIBEFASTO,IB_Q_LOW,NULL,NULL,0,127,NULL,0,0,PowerModeO,&PowerState,NULL},
/* Command 9 Mode Read */
{&DSET_BI,GPIBEFASTI,IB_Q_LOW,"POWER:MODE?\n\r",NULL,0,127,0,0,0,PowerModeI,&PowerState,NULL},
/* Command 10 Status bite */
{&DSET_MBBID, GPIBREAD, IB_Q_LOW, "*STB?\n\r","%d\n\r",0,127,NULL,0,0,NULL,NULL,NULL}
};
/* The following is the number of elements in the command array above. */
#define NUMPARAMS sizeof(gpibCmds)/sizeof(struct gpibCmd)
/******************************************************************************
* Initialize device support parameters
*
*****************************************************************************/
static long init_ai(int parm)
{
if(parm==0) {
devSupParms.name = "devAS0920";
devSupParms.gpibCmds = gpibCmds;
devSupParms.numparams = NUMPARAMS;
devSupParms.timeout = TIMEOUT;
devSupParms.timeWindow = TIMEWINDOW;
devSupParms.respond2Writes = -1;
}
return(0);
}
/******************************************************************************
*
* c code
*
*****************************************************************************/
# line 60 "devAS0920.gt"
mailto: makoto.tobiyama@kek.jp
Last update: 4/Jul/2011