diff --git a/src/devOpt/devAnalytekGpib.c b/src/devOpt/devAnalytekGpib.c index a0ed82de5..a3c4bf1ba 100644 --- a/src/devOpt/devAnalytekGpib.c +++ b/src/devOpt/devAnalytekGpib.c @@ -42,21 +42,18 @@ #include #include -#ifndef VALID_ALARM -#define VALID_ALARM INVALID_ALARM -#endif - +#define STATIC static + long devGpibLib_initWf(); long devGpibLib_readWf(); int devGpibLib_wfGpibWork(); -long init_dev_sup(), report(); -int aiGpibSrq(), liGpibSrq(), biGpibSrq(), mbbiGpibSrq(), stringinGpibSrq(); -static struct devGpibParmBlock devSupParms; +STATIC long init_dev_sup(), report(); +STATIC struct devGpibParmBlock devSupParms; -int getamprange(); /* used to get signal amplitude range */ -int getrange(); /* used to get signal range */ -int getoffset(); /* used to get signal offset */ +STATIC int getamprange(); /* used to get signal amplitude range */ +STATIC int getrange(); /* used to get signal range */ +STATIC int getoffset(); /* used to get signal offset */ int convertWave(); /* parses waveform data from analytek digitizer */ @@ -593,9 +590,8 @@ static struct devGpibParmBlock devSupParms = { * This function will no longer be required after epics 3.3 is released * ******************************************************************************/ -static long -init_dev_sup(parm) -int parm; +STATIC long +init_dev_sup(int parm) { return(devGpibLib_initDevSup(parm, &DSET_AI)); } @@ -608,17 +604,13 @@ int parm; * This function will no longer be required after epics 3.3 is released * ******************************************************************************/ -static long -report() +STATIC long +report(void) { return(devGpibLib_report(&DSET_AI)); } -static int getamprange(pdpvt, p1, p2, p3) -struct gpibDpvt *pdpvt; -int p1; -int p2; -char **p3; +STATIC int getamprange(struct gpibDpvt *pdpvt, int p1, int p2, char **p3) { int amprange; int i; @@ -657,9 +649,9 @@ char **p3; } else { - if (pai->nsev < VALID_ALARM) + if (pai->nsev < INVALID_ALARM) { - pai->nsev = VALID_ALARM; + pai->nsev = INVALID_ALARM; pai->nsta = READ_ALARM; } } @@ -670,11 +662,7 @@ char **p3; /* conversion routine */ -static int getrange(pdpvt, p1, p2, p3) -struct gpibDpvt *pdpvt; -int p1; -int p2; -char **p3; +STATIC int getrange(struct gpibDpvt *pdpvt, int p1, int p2, char **p3) { int range; int i; @@ -709,9 +697,9 @@ char **p3; } else { - if (pai->nsev < VALID_ALARM) + if (pai->nsev < INVALID_ALARM) { - pai->nsev = VALID_ALARM; + pai->nsev = INVALID_ALARM; pai->nsta = READ_ALARM; } } @@ -721,11 +709,7 @@ char **p3; /* conversion routine */ -static int getoffset(pdpvt, p1, p2, p3) -struct gpibDpvt *pdpvt; -int p1; -int p2; -char **p3; +STATIC int getoffset(struct gpibDpvt *pdpvt, int p1, int p2, char **p3) { float offset; int i; @@ -760,9 +744,9 @@ char **p3; } else { - if (pai->nsev < VALID_ALARM) + if (pai->nsev < INVALID_ALARM) { - pai->nsev = VALID_ALARM; + pai->nsev = INVALID_ALARM; pai->nsta = READ_ALARM; } } @@ -770,11 +754,7 @@ char **p3; return(OK); } -convertWave(pdpvt, p1, p2, p3) -struct gpibDpvt *pdpvt; -int p1; -int p2; -char **p3; +STATIC convertWave(struct gpibDpvt *pdpvt, int p1, int p2, char **p3) { struct waveformRecord *pwf = (struct waveformRecord *) (pdpvt->precord); short *raw; @@ -793,7 +773,7 @@ char **p3; craw = pdpvt->msg; if (*craw != '#') { /* don't have a valid analytek waveform */ - devGpibLib_setPvSevr(pwf,READ_ALARM,VALID_ALARM); + devGpibLib_setPvSevr(pwf,READ_ALARM,INVALID_ALARM); printf("Got an invalid waveform back!\n"); return(ERROR); @@ -812,7 +792,7 @@ char **p3; if (sscanf (asciiLen, "%d", &numElem) != 1) { - devGpibLib_setPvSevr(pwf,READ_ALARM,VALID_ALARM); + devGpibLib_setPvSevr(pwf,READ_ALARM,INVALID_ALARM); printf("Got an invalid waveform back!!\n"); return(ERROR); diff --git a/src/devOpt/devBBInteract.c b/src/devOpt/devBBInteract.c index 70f74e089..38865acda 100644 --- a/src/devOpt/devBBInteract.c +++ b/src/devOpt/devBBInteract.c @@ -90,14 +90,17 @@ int bbMsgDly = 0; extern int bbDebug; static int replyIsBack; -int sendMsg(); -int bbWork(); -int configMsg(); -int getInt(); -int getChar(); -int getString(); -int showBbMsg(); -int timingStudy(); +static int sendMsg(); +static int bbWork(); +static int configMsg(); +static int getInt(); +static int getChar(); +static int getString(); +static int showBbMsg(); +static int timingStudy(); +static int pingEm(); +static int downLoadCode(); +static int hex2bin(); static int firstTime = 1; static FAST_LOCK msgReply; @@ -309,7 +312,7 @@ timingStudy() */ static int -sendMsg() +sendMsg(void) { int msgNum; /* index to array of messages */ @@ -543,7 +546,7 @@ downLoadCode() /* read the file 1 line at a time & send the code to the bug */ msgBytes=0; - while (fgets(hexBuf, sizeof(hexBuf), fp) > 0) + while (fgets(hexBuf, sizeof(hexBuf), fp) != NULL) { /* parse the headers in the hex record */ if (hexBuf[0] != ':' || (hex2bin(&(hexBuf[7]) ,&recType) == ERROR)) diff --git a/src/devOpt/devGpibInteract.c b/src/devOpt/devGpibInteract.c index fc21a0382..cfa10bd9b 100644 --- a/src/devOpt/devGpibInteract.c +++ b/src/devOpt/devGpibInteract.c @@ -48,16 +48,21 @@ */ #include -#if 0 /* COMMENTED OUT */ +#include +#include +/* #include #include #include #include -#include -#include #include -#endif /* COMMENTED OUT */ -#include +*/ + +#include +#include +#include +#include +#include #include #include @@ -80,7 +85,7 @@ int GITime = 60; /* shell-setable DMA timeout value */ extern struct drvGpibSet drvGpib; /* entry points to driver functions */ -int gpibWork(); +static int gpibWork(); struct gpibIntCmd { struct dpvtGpibHead head; @@ -106,14 +111,16 @@ BOOL replyIsBack; /* reset by sender, set by replyReceived() */ extern int ibDebug; int GIDebug = 0; - int sendMsg(); - int gpibWork(); - int configMsg(); - int getInt(); - int getChar(); - int getString(); - int showGpibMsg(); - int timingStudy(); +static int sendMsg(); +static int gpibWork(); +static int configMsg(); +static int getInt(); +static int getChar(); +static int getString(); +static int showGpibMsg(); +static int timingStudy(); + +static void hexDump(unsigned char *string, int indent); static int firstTime = 1; static int hexmode = 1; @@ -128,7 +135,7 @@ GI() if(firstTime) { firstTime = 0; - msgReply = semCreate(); + msgReply = semBCreate(SEM_Q_FIFO, SEM_EMPTY); for (cnt=0; cnt < LIST_SIZE; cnt++) { /* init the elements of the command table */ @@ -138,7 +145,7 @@ GI() gpibIntCmds[cnt].head.workStart = gpibWork; gpibIntCmds[cnt].head.link = 0; gpibIntCmds[cnt].head.device = 0; - gpibIntCmds[cnt].head.bitBusDpvt= NULL; /* not supported yet */ + gpibIntCmds[cnt].head.bitBusDpvt= NULL; gpibIntCmds[cnt].type = 'R'; gpibIntCmds[cnt].cmd[0] = '\0'; @@ -254,9 +261,9 @@ timingStudy() printf("Enter the number of messages to send > "); if (!getInt(&inInt)) - return; /* if no entry, return to main menu */ + return(0); /* if no entry, return to main menu */ if(inInt < 0) - return; + return(0); reps = inInt; Reps = reps; @@ -296,7 +303,7 @@ timingStudy() else i = LIST_SIZE; /* force an exit from the loop */ } - semTake(msgReply); + semTake(msgReply, WAIT_FOREVER); } endTime = tickGet(); @@ -315,7 +322,7 @@ timingStudy() else i = LIST_SIZE; } - return(OK); + return(0); } /* sendMsg() *************************************************** @@ -434,9 +441,9 @@ configMsg() printf("\nEnter Message # to Configure (1 thru 5) > "); if (!getInt(&inInt)) - return; /* if no entry, return to main menu */ + return(0); /* if no entry, return to main menu */ if((inInt >= LIST_SIZE) || (inInt < 0)) - return; + return(0); msgNum = inInt; pCmd = &gpibIntCmds[msgNum]; /* assign pointer to desired entry */ @@ -628,9 +635,7 @@ char *pString; } /* utility fuinction to print a hex dump */ -static void hexDump(string, indent) -unsigned char *string; -int indent; +static void hexDump(unsigned char *string, int indent) { char ascBuf[17]; /* for the ascii xlation part of the dump */ int strLength; diff --git a/src/devOpt/devXxDc5009Gpib.c b/src/devOpt/devXxDc5009Gpib.c index 9d34c8515..c45d01b68 100644 --- a/src/devOpt/devXxDc5009Gpib.c +++ b/src/devOpt/devXxDc5009Gpib.c @@ -55,6 +55,8 @@ #define DSET_SI devSiDc5009Gpib #define DSET_SO devSoDc5009Gpib +#define STATIC static + #include #include #include @@ -85,10 +87,9 @@ #include #include -long init_dev_sup(), report(); -int srqHandler(); -int aiGpibSrq(), liGpibSrq(), biGpibSrq(), mbbiGpibSrq(), stringinGpibSrq(); -static struct devGpibParmBlock devSupParms; +STATIC long init_dev_sup(), report(); +STATIC int srqHandler(); +STATIC struct devGpibParmBlock devSupParms; /****************************************************************************** * @@ -280,7 +281,7 @@ static struct gpibCmd gpibCmds[] = * scanned"... not passive. * ******************************************************************************/ -static struct devGpibParmBlock devSupParms = { +STATIC struct devGpibParmBlock devSupParms = { &Dc5009Debug, /* debugging flag pointer */ -1, /* device does not respond to writes */ TIME_WINDOW, /* # of clock ticks to skip after a device times out */ @@ -304,9 +305,8 @@ static struct devGpibParmBlock devSupParms = { * with a param value of 1. * ******************************************************************************/ -static long -init_dev_sup(parm) -int parm; +STATIC long +init_dev_sup(int parm) { return(devGpibLib_initDevSup(parm,&DSET_AI)); } @@ -317,8 +317,8 @@ int parm; * module. * ******************************************************************************/ -static long -report() +STATIC long +report(void) { return(devGpibLib_report(&DSET_AI)); } @@ -351,9 +351,7 @@ report() #define DC5009_OPC 66 /* operation just completed */ #define DC5009_USER 67 /* user requested SRQ */ -static int srqHandler(phwpvt, srqStatus) -struct hwpvt *phwpvt; -int srqStatus; /* The poll response from the device */ +STATIC int srqHandler(struct hwpvt *phwpvt, int srqStatus) { int status = IDLE; /* assume device will be idle when finished */ @@ -393,9 +391,9 @@ int srqStatus; /* The poll response from the device */ printf("dc5009 srqHandler: Unsolicited SRQ being handled from link %d, device %d, status = 0x%02.2X\n", phwpvt->link, phwpvt->device, srqStatus); - ((struct gpibDpvt*)(phwpvt->unsolicitedDpvt))->head.header.callback.finishProc = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process; + ((struct gpibDpvt*)(phwpvt->unsolicitedDpvt))->head.header.callback.callback = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process; ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->head.header.callback.priority = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->processPri; - callbackRequest(phwpvt->unsolicitedDpvt); + callbackRequest((CALLBACK*)phwpvt->unsolicitedDpvt); } else { diff --git a/src/devOpt/devXxDg535Gpib.c b/src/devOpt/devXxDg535Gpib.c index 118f93d3f..d7b4d4c6f 100644 --- a/src/devOpt/devXxDg535Gpib.c +++ b/src/devOpt/devXxDg535Gpib.c @@ -78,13 +78,16 @@ #include #include -#ifndef VALID_ALARM -#define VALID_ALARM INVALID_ALARM -#endif -long init_dev_sup(), report(); -int srqHandler(); -int aiGpibSrq(), liGpibSrq(), biGpibSrq(), mbbiGpibSrq(), stringinGpibSrq(); -static struct devGpibParmBlock devSupParms; +#define STATIC static + +STATIC long init_dev_sup(), report(); +STATIC int srqHandler(); +STATIC struct devGpibParmBlock devSupParms; + +/* forward declarations of some custom convert routines */ +STATIC int setDelay(); +STATIC int rdDelay(); + /****************************************************************************** * @@ -231,9 +234,6 @@ static char *(userOffOn[]) = {"USER OFF;", "USER ON;", NULL}; * ******************************************************************************/ -/* forward declarations of some custom convert routines */ -int setDelay(); -int rdDelay(); static struct gpibCmd gpibCmds[] = { @@ -700,9 +700,8 @@ static struct devGpibParmBlock devSupParms = { * with a param value of 1. * ******************************************************************************/ -static long -init_dev_sup(parm) -int parm; +STATIC long +init_dev_sup(int parm) { return(devGpibLib_initDevSup(parm, &DSET_AI)); } @@ -713,8 +712,8 @@ int parm; * module. * ******************************************************************************/ -static long -report() +STATIC long +report(void) { return(devGpibLib_report(&DSET_AI)); } @@ -739,11 +738,7 @@ report() * in the val field of the SI record. (ex: T + .000000500000) *****************************************************************************/ -static int rdDelay(pdpvt, p1, p2, p3) -struct gpibDpvt *pdpvt; -int p1; -int p2; -char **p3; +STATIC int rdDelay(struct gpibDpvt *pdpvt, int p1, int p2, char **p3) { int status; double delay; @@ -783,9 +778,9 @@ char **p3; } else { - if (prec->si.nsev < VALID_ALARM) + if (prec->si.nsev < INVALID_ALARM) { - prec->si.nsev = VALID_ALARM; + prec->si.nsev = INVALID_ALARM; prec->si.nsta = READ_ALARM; } } @@ -802,9 +797,9 @@ char **p3; } else { - if (prec->ai.nsev < VALID_ALARM) + if (prec->ai.nsev < INVALID_ALARM) { - prec->ai.nsev = VALID_ALARM; + prec->ai.nsev = INVALID_ALARM; prec->ai.nsta = READ_ALARM; } } @@ -820,9 +815,9 @@ char **p3; } else { - if (prec->mbbi.nsev < VALID_ALARM) + if (prec->mbbi.nsev < INVALID_ALARM) { - prec->mbbi.nsev = VALID_ALARM; + prec->mbbi.nsev = INVALID_ALARM; prec->mbbi.nsta = READ_ALARM; } } @@ -843,11 +838,7 @@ char **p3; * *************************************************************************/ -static int setDelay(pdpvt, p1, p2, p3) -struct gpibDpvt *pdpvt; -int p1; -int p2; -char **p3; +STATIC int setDelay(struct gpibDpvt *pdpvt, int p1, int p2, char **p3) { int status; char curChan; diff --git a/src/devOpt/devXxDig500Msg232.c b/src/devOpt/devXxDig500Msg232.c index b8c38658c..8786bf178 100644 --- a/src/devOpt/devXxDig500Msg232.c +++ b/src/devOpt/devXxDig500Msg232.c @@ -72,11 +72,12 @@ #define DSET_BP devBpdig500Msg232 +#define STATIC static int dig500MsgDebug = 0; -static long init(), report(); -static msgParmBlock parmBlock; +STATIC long init(), report(); +STATIC msgParmBlock parmBlock; /***************************************************************************** * @@ -85,9 +86,8 @@ static msgParmBlock parmBlock; ******************************************************************************/ static msgRecEnum local_bp = { "PE dig500" }; -static long -local_initBp(pbp) -struct brownpileRecord *pbp; +STATIC long +local_initBp(struct brownpileRecord *pbp) { char message[100]; long status; @@ -111,9 +111,8 @@ struct brownpileRecord *pbp; } /*****************************************************************************/ -static long -local_procBp(pbp) -struct brownpileRecord *pbp; +STATIC long +local_procBp(struct brownpileRecord *pbp) { if (dig500MsgDebug > 10) printf("local_procBp entered\n"); @@ -210,10 +209,8 @@ static msgCmd cmds[] = { #define REC_BP_CHOICE_PUMP_220 3 /* 220 Liter/sec */ -static long -local_xactWork(pxact, pop) -msgXact *pxact; -msgCmdOp *pop; +STATIC long +local_xactWork(msgXact *pxact, msgCmdOp *pop) { char msg[100]; /* A place to format error messages */ char buf[100]; /* A place to build & parse strings */ @@ -684,14 +681,13 @@ static msgParmBlock parmBlock = { local_xactWork, &parmBB232extension }; -static long -init(parm) -int parm; +STATIC long +init(int parm) { return(drvMsg_initMsg(parm, &devAidig500Msg232)); } -static long -report() +STATIC long +report(void) { return(drvMsg_reportMsg(&devAidig500Msg232)); } diff --git a/src/devOpt/devXxK196Gpib.c b/src/devOpt/devXxK196Gpib.c index 6efb71833..313546a34 100644 --- a/src/devOpt/devXxK196Gpib.c +++ b/src/devOpt/devXxK196Gpib.c @@ -33,8 +33,6 @@ * * Modification Log: * ----------------- - * .01 05-30-91 jrw Initial Release - * .02 01-06-92 nda dg535 support under EPICS 3.3 */ #define DSET_AI devAiK196Gpib @@ -78,7 +76,7 @@ #include #include -long init_dev_sup(), report(); +static long init_dev_sup(), report(); static struct devGpibParmBlock devSupParms; /****************************************************************************** @@ -222,10 +220,6 @@ static char *(userOffOn[]) = {"USER OFF;", "USER ON;", NULL}; * ******************************************************************************/ -/* forward declarations of some custom convert routines */ -int setDelay(); -int rdDelay(); - static struct gpibCmd gpibCmds[] = { /* Param 0, (model) */ @@ -284,8 +278,7 @@ static struct devGpibParmBlock devSupParms = { * ******************************************************************************/ static long -init_dev_sup(parm) -int parm; +init_dev_sup(int parm) { return(devGpibLib_initDevSup(parm, &DSET_AI)); } @@ -299,7 +292,7 @@ int parm; * ******************************************************************************/ static long -report() +report(void) { return(devGpibLib_report(&DSET_AI)); } diff --git a/src/devOpt/devXxK263Gpib.c b/src/devOpt/devXxK263Gpib.c index 688b2b0a4..cc851e455 100644 --- a/src/devOpt/devXxK263Gpib.c +++ b/src/devOpt/devXxK263Gpib.c @@ -78,7 +78,7 @@ #include #include -long init_dev_sup(), report(); +static long init_dev_sup(), report(); static struct devGpibParmBlock devSupParms; /****************************************************************************** @@ -149,72 +149,7 @@ int K263Debug = 0; /* debugging flags */ #define TIME_WINDOW 600 /* 10 seconds on a getTick call */ #define DMA_TIME 30 /* 1/2 second on a watchdog time */ -/* - * Strings used by the init routines to fill in the znam, onam, ... - * fields in BI, BO, MBBI, and MBBO record types. - */ -static char *offOnList[] = { "Off", "On" }; -static struct devGpibNames offOn = { 2, offOnList, NULL, 1 }; - -static char *disableEnableList[] = { "Disable", "Enable" }; -static struct devGpibNames disableEnable = { 2, disableEnableList, NULL, 1 }; - -static char *resetList[] = { "Reset", "Reset" }; -static struct devGpibNames reset = { 2, resetList, NULL, 1 }; - -static char *lozHizList[] = { "50 OHM", "IB_Q_HIGH Z" }; -static struct devGpibNames lozHiz = {2, lozHizList, NULL, 1}; - -static char *invertNormList[] = { "INVERT", "NORM" }; -static struct devGpibNames invertNorm = { 2, invertNormList, NULL, 1 }; - -static char *fallingRisingList[] = { "FALLING", "RISING" }; -static struct devGpibNames fallingRising = { 2, fallingRisingList, NULL, 1 }; - -static char *singleShotList[] = { "SINGLE", "SHOT" }; -static struct devGpibNames singleShot = { 2, singleShotList, NULL, 1 }; - -static char *clearList[] = { "CLEAR", "CLEAR" }; -static struct devGpibNames clear = { 2, clearList, NULL, 1 }; - -static char *tABCDList[] = { "T", "A", "B", "C", "D" }; -static unsigned long tABCDVal[] = { 1, 2, 3, 5, 6 }; -static struct devGpibNames tABCD = { 5, tABCDList, tABCDVal, 3 }; - -static char *ttlNimEclVarList[] = { "TTL", "NIM", "ECL", "VAR" }; -static unsigned long ttlNimEclVarVal[] = { 0, 1, 2, 3 }; -static struct devGpibNames ttlNimEclVar = { 4, ttlNimEclVarList, - ttlNimEclVarVal, 2 }; - -static char *intExtSsBmStopList[] = { "INTERNAL", "EXTERNAL", - "SINGLE SHOT", "BURST MODE", "STOP" }; -static unsigned long intExtSsBmStopVal[] = { 0, 1, 2, 3, 2 }; -static struct devGpibNames intExtSsBm = { 4, intExtSsBmStopList, - intExtSsBmStopVal, 2 }; -static struct devGpibNames intExtSsBmStop = { 5, intExtSsBmStopList, - intExtSsBmStopVal, 3 }; - - -/****************************************************************************** - * - * String arrays for EFAST operations. Note that the last entry must be - * NULL. - * - * On input operations, only as many bytes as are found in the string array - * elements are compared. If there are more bytes than that in the input - * message, they are ignored. The first matching string found (starting - * from the 0'th element) will be used as a match. - * - * NOTE: For the input operations, the strings are compared literally! This - * can cause problems if the instrument is returning things like \r and \n - * characters. You must take care when defining input strings so you include - * them as well. - * - ******************************************************************************/ - -static char *(userOffOn[]) = {"USER OFF;", "USER ON;", NULL}; - /****************************************************************************** * * Array of structures that define all GPIB messages @@ -222,10 +157,6 @@ static char *(userOffOn[]) = {"USER OFF;", "USER ON;", NULL}; * ******************************************************************************/ -/* forward declarations of some custom convert routines */ -int setDelay(); -int rdDelay(); - static struct gpibCmd gpibCmds[] = { /* Param 0, (model) */ @@ -283,8 +214,7 @@ static struct devGpibParmBlock devSupParms = { * ******************************************************************************/ static long -init_dev_sup(parm) -int parm; +init_dev_sup(int parm) { return(devGpibLib_initDevSup(parm, &DSET_AI)); } @@ -298,7 +228,7 @@ int parm; * ******************************************************************************/ static long -report() +report(void) { return(devGpibLib_report(&DSET_AI)); } diff --git a/src/devOpt/devXxSkeletonGpib.c b/src/devOpt/devXxSkeletonGpib.c index 53519dd0d..6e47381d9 100644 --- a/src/devOpt/devXxSkeletonGpib.c +++ b/src/devOpt/devXxSkeletonGpib.c @@ -85,8 +85,10 @@ #include #include -long init_dev_sup(), report(); -int srqHandler(); +#define STATIC static + +STATIC long init_dev_sup(), report(); +STATIC int srqHandler(); static struct devGpibParmBlock devSupParms; /****************************************************************************** @@ -307,9 +309,8 @@ static struct devGpibParmBlock devSupParms = { * with a param value of 1. * ******************************************************************************/ -static long -init_dev_sup(parm) -int parm; +STATIC long +init_dev_sup(int parm) { return(devGpibLib_initDevSup(parm,&DSET_AI)); } @@ -322,12 +323,11 @@ int parm; * This function will no longer be required after epics 3.3 is released * ******************************************************************************/ -static long -report() +STATIC long +report(void) { return(devGpibLib_report(&DSET_AI)); } - /****************************************************************************** * * A sample SRQ handler. This one is taken from the DC5009 gpib device support @@ -358,50 +358,59 @@ report() * ******************************************************************************/ -#define DC5009_GOODBITS 0xef /* I only care about these bits from the poll*/ +#define DC5009_GOODBITS 0xef /* I only care about these bits */ #define DC5009_PON 65 /* power just turned on */ #define DC5009_OPC 66 /* operation just completed */ +#define DC5009_USER 67 /* user requested SRQ */ -static int srqHandler(phwpvt, srqStatus) -struct hwpvt *phwpvt; -int srqStatus; /* The poll response from the device */ +STATIC int srqHandler(struct hwpvt *phwpvt, int srqStatus) { int status = IDLE; /* assume device will be idle when finished */ - if (SkeletonDebug || ibSrqDebug) - logMsg("srqHandler(0x%08.8X, 0x%02.2X): called\n", phwpvt, srqStatus); + if (Dc5009Debug || ibSrqDebug) + printf("dc5009 srqHandler(0x%08.8X, 0x%02.2X): called\n", phwpvt, srqStatus); switch (srqStatus & DC5009_GOODBITS) { case DC5009_OPC: - /* Invoke the command-type specific SRQ handler (in the library code) */ + /* Invoke the command-type specific SRQ handler */ if (phwpvt->srqCallback != NULL) status = ((*(phwpvt->srqCallback))(phwpvt->parm, srqStatus)); else - logMsg("Unsolicited operation complete from DC5009 device support!\n"); + printf("dc5009 srqHandler: Unsolicited operation complete from DC5009 device support!\n"); break; +/* BUG - I have to clear out the error status by doing an err? read operation */ + + case DC5009_USER: + + /* user requested srq event is specific to the Dc5009 */ + printf("dc5009 srqHandler: Dc5009 User requested srq event link %d, device %d\n", phwpvt->link, phwpvt->device); + break; +/* BUG - I have to clear out the error status by doing an err? read operation */ case DC5009_PON: - logMsg("Power cycled on DC5009\n"); + printf("dc5009 srqHandler: Power cycled on DC5009\n"); break; +/* BUG - I have to clear out the error status by doing an err? read operation */ + + default: - default: /* unsolicited SRQ */ if (phwpvt->unsolicitedDpvt != NULL) - { /* If a record spec'd the magic parm number, process it. */ - if(SkeletonDebug || ibSrqDebug) - logMsg("Unsolicited SRQ being handled from link %d, device %d, status = 0x%02.2X\n", + { + if(Dc5009Debug || ibSrqDebug) + printf("dc5009 srqHandler: Unsolicited SRQ being handled from link %d, device %d, status = 0x%02.2X\n", phwpvt->link, phwpvt->device, srqStatus); - ((struct gpibDpvt*)(phwpvt->unsolicitedDpvt))->head.header.callback.finishProc = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process; + ((struct gpibDpvt*)(phwpvt->unsolicitedDpvt))->head.header.callback.callback = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process; ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->head.header.callback.priority = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->processPri; callbackRequest(phwpvt->unsolicitedDpvt); } else { - logMsg("Unsolicited SRQ ignored from link %d, device %d, status = 0x%02.2X\n", + printf("dc5009 srqHandler: Unsolicited SRQ ignored from link %d, device %d, status = 0x%02.2X\n", phwpvt->link, phwpvt->device, srqStatus); } } diff --git a/src/devOpt/devXxSr620Gpib.c b/src/devOpt/devXxSr620Gpib.c index a943efdec..3bdf2934a 100644 --- a/src/devOpt/devXxSr620Gpib.c +++ b/src/devOpt/devXxSr620Gpib.c @@ -77,9 +77,10 @@ #include #include -long init_dev_sup(), report(); -int srqHandler(); -int aiGpibSrq(), liGpibSrq(), biGpibSrq(), mbbiGpibSrq(), stringinGpibSrq(); +#define STATIC static + +STATIC long init_dev_sup(), report(); +STATIC int srqHandler(); static struct devGpibParmBlock devSupParms; /****************************************************************************** @@ -258,9 +259,7 @@ static struct devGpibParmBlock devSupParms = { #define SR620_MAV 0x10 #define SR630_ESB 0x20 -static int srqHandler(phwpvt, srqStatus) -struct hwpvt *phwpvt; -int srqStatus; /* The poll response from the device */ +STATIC int srqHandler(struct hwpvt *phwpvt, int srqStatus) { int status = IDLE; /* assume device will be idle when finished */ @@ -283,9 +282,9 @@ int srqStatus; /* The poll response from the device */ logMsg("Unsolicited SRQ being handled from link %d, device %d, status = 0x%02.2X\n", phwpvt->link, phwpvt->device, srqStatus); - ((struct gpibDpvt*)(phwpvt->unsolicitedDpvt))->head.header.callback.finishProc = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process; + ((struct gpibDpvt*)(phwpvt->unsolicitedDpvt))->head.header.callback.callback = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process; ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->head.header.callback.priority = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->processPri; - callbackRequest(phwpvt->unsolicitedDpvt); + callbackRequest((CALLBACK*)phwpvt->unsolicitedDpvt); } else { @@ -305,9 +304,8 @@ int srqStatus; /* The poll response from the device */ * with a param value of 1. * ******************************************************************************/ -static long -init_dev_sup(parm) -int parm; +STATIC long +init_dev_sup(int parm) { return(devGpibLib_initDevSup(parm, &DSET_AI)); } @@ -318,8 +316,8 @@ int parm; * module. * ******************************************************************************/ -static long -report() +STATIC long +report(void) { return(devGpibLib_report(&DSET_AI)); } diff --git a/src/vxWorks/devOpt/devAnalytekGpib.c b/src/vxWorks/devOpt/devAnalytekGpib.c index a0ed82de5..a3c4bf1ba 100644 --- a/src/vxWorks/devOpt/devAnalytekGpib.c +++ b/src/vxWorks/devOpt/devAnalytekGpib.c @@ -42,21 +42,18 @@ #include #include -#ifndef VALID_ALARM -#define VALID_ALARM INVALID_ALARM -#endif - +#define STATIC static + long devGpibLib_initWf(); long devGpibLib_readWf(); int devGpibLib_wfGpibWork(); -long init_dev_sup(), report(); -int aiGpibSrq(), liGpibSrq(), biGpibSrq(), mbbiGpibSrq(), stringinGpibSrq(); -static struct devGpibParmBlock devSupParms; +STATIC long init_dev_sup(), report(); +STATIC struct devGpibParmBlock devSupParms; -int getamprange(); /* used to get signal amplitude range */ -int getrange(); /* used to get signal range */ -int getoffset(); /* used to get signal offset */ +STATIC int getamprange(); /* used to get signal amplitude range */ +STATIC int getrange(); /* used to get signal range */ +STATIC int getoffset(); /* used to get signal offset */ int convertWave(); /* parses waveform data from analytek digitizer */ @@ -593,9 +590,8 @@ static struct devGpibParmBlock devSupParms = { * This function will no longer be required after epics 3.3 is released * ******************************************************************************/ -static long -init_dev_sup(parm) -int parm; +STATIC long +init_dev_sup(int parm) { return(devGpibLib_initDevSup(parm, &DSET_AI)); } @@ -608,17 +604,13 @@ int parm; * This function will no longer be required after epics 3.3 is released * ******************************************************************************/ -static long -report() +STATIC long +report(void) { return(devGpibLib_report(&DSET_AI)); } -static int getamprange(pdpvt, p1, p2, p3) -struct gpibDpvt *pdpvt; -int p1; -int p2; -char **p3; +STATIC int getamprange(struct gpibDpvt *pdpvt, int p1, int p2, char **p3) { int amprange; int i; @@ -657,9 +649,9 @@ char **p3; } else { - if (pai->nsev < VALID_ALARM) + if (pai->nsev < INVALID_ALARM) { - pai->nsev = VALID_ALARM; + pai->nsev = INVALID_ALARM; pai->nsta = READ_ALARM; } } @@ -670,11 +662,7 @@ char **p3; /* conversion routine */ -static int getrange(pdpvt, p1, p2, p3) -struct gpibDpvt *pdpvt; -int p1; -int p2; -char **p3; +STATIC int getrange(struct gpibDpvt *pdpvt, int p1, int p2, char **p3) { int range; int i; @@ -709,9 +697,9 @@ char **p3; } else { - if (pai->nsev < VALID_ALARM) + if (pai->nsev < INVALID_ALARM) { - pai->nsev = VALID_ALARM; + pai->nsev = INVALID_ALARM; pai->nsta = READ_ALARM; } } @@ -721,11 +709,7 @@ char **p3; /* conversion routine */ -static int getoffset(pdpvt, p1, p2, p3) -struct gpibDpvt *pdpvt; -int p1; -int p2; -char **p3; +STATIC int getoffset(struct gpibDpvt *pdpvt, int p1, int p2, char **p3) { float offset; int i; @@ -760,9 +744,9 @@ char **p3; } else { - if (pai->nsev < VALID_ALARM) + if (pai->nsev < INVALID_ALARM) { - pai->nsev = VALID_ALARM; + pai->nsev = INVALID_ALARM; pai->nsta = READ_ALARM; } } @@ -770,11 +754,7 @@ char **p3; return(OK); } -convertWave(pdpvt, p1, p2, p3) -struct gpibDpvt *pdpvt; -int p1; -int p2; -char **p3; +STATIC convertWave(struct gpibDpvt *pdpvt, int p1, int p2, char **p3) { struct waveformRecord *pwf = (struct waveformRecord *) (pdpvt->precord); short *raw; @@ -793,7 +773,7 @@ char **p3; craw = pdpvt->msg; if (*craw != '#') { /* don't have a valid analytek waveform */ - devGpibLib_setPvSevr(pwf,READ_ALARM,VALID_ALARM); + devGpibLib_setPvSevr(pwf,READ_ALARM,INVALID_ALARM); printf("Got an invalid waveform back!\n"); return(ERROR); @@ -812,7 +792,7 @@ char **p3; if (sscanf (asciiLen, "%d", &numElem) != 1) { - devGpibLib_setPvSevr(pwf,READ_ALARM,VALID_ALARM); + devGpibLib_setPvSevr(pwf,READ_ALARM,INVALID_ALARM); printf("Got an invalid waveform back!!\n"); return(ERROR); diff --git a/src/vxWorks/devOpt/devGpibInteract.c b/src/vxWorks/devOpt/devGpibInteract.c index fc21a0382..cfa10bd9b 100644 --- a/src/vxWorks/devOpt/devGpibInteract.c +++ b/src/vxWorks/devOpt/devGpibInteract.c @@ -48,16 +48,21 @@ */ #include -#if 0 /* COMMENTED OUT */ +#include +#include +/* #include #include #include #include -#include -#include #include -#endif /* COMMENTED OUT */ -#include +*/ + +#include +#include +#include +#include +#include #include #include @@ -80,7 +85,7 @@ int GITime = 60; /* shell-setable DMA timeout value */ extern struct drvGpibSet drvGpib; /* entry points to driver functions */ -int gpibWork(); +static int gpibWork(); struct gpibIntCmd { struct dpvtGpibHead head; @@ -106,14 +111,16 @@ BOOL replyIsBack; /* reset by sender, set by replyReceived() */ extern int ibDebug; int GIDebug = 0; - int sendMsg(); - int gpibWork(); - int configMsg(); - int getInt(); - int getChar(); - int getString(); - int showGpibMsg(); - int timingStudy(); +static int sendMsg(); +static int gpibWork(); +static int configMsg(); +static int getInt(); +static int getChar(); +static int getString(); +static int showGpibMsg(); +static int timingStudy(); + +static void hexDump(unsigned char *string, int indent); static int firstTime = 1; static int hexmode = 1; @@ -128,7 +135,7 @@ GI() if(firstTime) { firstTime = 0; - msgReply = semCreate(); + msgReply = semBCreate(SEM_Q_FIFO, SEM_EMPTY); for (cnt=0; cnt < LIST_SIZE; cnt++) { /* init the elements of the command table */ @@ -138,7 +145,7 @@ GI() gpibIntCmds[cnt].head.workStart = gpibWork; gpibIntCmds[cnt].head.link = 0; gpibIntCmds[cnt].head.device = 0; - gpibIntCmds[cnt].head.bitBusDpvt= NULL; /* not supported yet */ + gpibIntCmds[cnt].head.bitBusDpvt= NULL; gpibIntCmds[cnt].type = 'R'; gpibIntCmds[cnt].cmd[0] = '\0'; @@ -254,9 +261,9 @@ timingStudy() printf("Enter the number of messages to send > "); if (!getInt(&inInt)) - return; /* if no entry, return to main menu */ + return(0); /* if no entry, return to main menu */ if(inInt < 0) - return; + return(0); reps = inInt; Reps = reps; @@ -296,7 +303,7 @@ timingStudy() else i = LIST_SIZE; /* force an exit from the loop */ } - semTake(msgReply); + semTake(msgReply, WAIT_FOREVER); } endTime = tickGet(); @@ -315,7 +322,7 @@ timingStudy() else i = LIST_SIZE; } - return(OK); + return(0); } /* sendMsg() *************************************************** @@ -434,9 +441,9 @@ configMsg() printf("\nEnter Message # to Configure (1 thru 5) > "); if (!getInt(&inInt)) - return; /* if no entry, return to main menu */ + return(0); /* if no entry, return to main menu */ if((inInt >= LIST_SIZE) || (inInt < 0)) - return; + return(0); msgNum = inInt; pCmd = &gpibIntCmds[msgNum]; /* assign pointer to desired entry */ @@ -628,9 +635,7 @@ char *pString; } /* utility fuinction to print a hex dump */ -static void hexDump(string, indent) -unsigned char *string; -int indent; +static void hexDump(unsigned char *string, int indent) { char ascBuf[17]; /* for the ascii xlation part of the dump */ int strLength; diff --git a/src/vxWorks/devOpt/devXxDc5009Gpib.c b/src/vxWorks/devOpt/devXxDc5009Gpib.c index 9d34c8515..c45d01b68 100644 --- a/src/vxWorks/devOpt/devXxDc5009Gpib.c +++ b/src/vxWorks/devOpt/devXxDc5009Gpib.c @@ -55,6 +55,8 @@ #define DSET_SI devSiDc5009Gpib #define DSET_SO devSoDc5009Gpib +#define STATIC static + #include #include #include @@ -85,10 +87,9 @@ #include #include -long init_dev_sup(), report(); -int srqHandler(); -int aiGpibSrq(), liGpibSrq(), biGpibSrq(), mbbiGpibSrq(), stringinGpibSrq(); -static struct devGpibParmBlock devSupParms; +STATIC long init_dev_sup(), report(); +STATIC int srqHandler(); +STATIC struct devGpibParmBlock devSupParms; /****************************************************************************** * @@ -280,7 +281,7 @@ static struct gpibCmd gpibCmds[] = * scanned"... not passive. * ******************************************************************************/ -static struct devGpibParmBlock devSupParms = { +STATIC struct devGpibParmBlock devSupParms = { &Dc5009Debug, /* debugging flag pointer */ -1, /* device does not respond to writes */ TIME_WINDOW, /* # of clock ticks to skip after a device times out */ @@ -304,9 +305,8 @@ static struct devGpibParmBlock devSupParms = { * with a param value of 1. * ******************************************************************************/ -static long -init_dev_sup(parm) -int parm; +STATIC long +init_dev_sup(int parm) { return(devGpibLib_initDevSup(parm,&DSET_AI)); } @@ -317,8 +317,8 @@ int parm; * module. * ******************************************************************************/ -static long -report() +STATIC long +report(void) { return(devGpibLib_report(&DSET_AI)); } @@ -351,9 +351,7 @@ report() #define DC5009_OPC 66 /* operation just completed */ #define DC5009_USER 67 /* user requested SRQ */ -static int srqHandler(phwpvt, srqStatus) -struct hwpvt *phwpvt; -int srqStatus; /* The poll response from the device */ +STATIC int srqHandler(struct hwpvt *phwpvt, int srqStatus) { int status = IDLE; /* assume device will be idle when finished */ @@ -393,9 +391,9 @@ int srqStatus; /* The poll response from the device */ printf("dc5009 srqHandler: Unsolicited SRQ being handled from link %d, device %d, status = 0x%02.2X\n", phwpvt->link, phwpvt->device, srqStatus); - ((struct gpibDpvt*)(phwpvt->unsolicitedDpvt))->head.header.callback.finishProc = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process; + ((struct gpibDpvt*)(phwpvt->unsolicitedDpvt))->head.header.callback.callback = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process; ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->head.header.callback.priority = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->processPri; - callbackRequest(phwpvt->unsolicitedDpvt); + callbackRequest((CALLBACK*)phwpvt->unsolicitedDpvt); } else { diff --git a/src/vxWorks/devOpt/devXxDg535Gpib.c b/src/vxWorks/devOpt/devXxDg535Gpib.c index 118f93d3f..d7b4d4c6f 100644 --- a/src/vxWorks/devOpt/devXxDg535Gpib.c +++ b/src/vxWorks/devOpt/devXxDg535Gpib.c @@ -78,13 +78,16 @@ #include #include -#ifndef VALID_ALARM -#define VALID_ALARM INVALID_ALARM -#endif -long init_dev_sup(), report(); -int srqHandler(); -int aiGpibSrq(), liGpibSrq(), biGpibSrq(), mbbiGpibSrq(), stringinGpibSrq(); -static struct devGpibParmBlock devSupParms; +#define STATIC static + +STATIC long init_dev_sup(), report(); +STATIC int srqHandler(); +STATIC struct devGpibParmBlock devSupParms; + +/* forward declarations of some custom convert routines */ +STATIC int setDelay(); +STATIC int rdDelay(); + /****************************************************************************** * @@ -231,9 +234,6 @@ static char *(userOffOn[]) = {"USER OFF;", "USER ON;", NULL}; * ******************************************************************************/ -/* forward declarations of some custom convert routines */ -int setDelay(); -int rdDelay(); static struct gpibCmd gpibCmds[] = { @@ -700,9 +700,8 @@ static struct devGpibParmBlock devSupParms = { * with a param value of 1. * ******************************************************************************/ -static long -init_dev_sup(parm) -int parm; +STATIC long +init_dev_sup(int parm) { return(devGpibLib_initDevSup(parm, &DSET_AI)); } @@ -713,8 +712,8 @@ int parm; * module. * ******************************************************************************/ -static long -report() +STATIC long +report(void) { return(devGpibLib_report(&DSET_AI)); } @@ -739,11 +738,7 @@ report() * in the val field of the SI record. (ex: T + .000000500000) *****************************************************************************/ -static int rdDelay(pdpvt, p1, p2, p3) -struct gpibDpvt *pdpvt; -int p1; -int p2; -char **p3; +STATIC int rdDelay(struct gpibDpvt *pdpvt, int p1, int p2, char **p3) { int status; double delay; @@ -783,9 +778,9 @@ char **p3; } else { - if (prec->si.nsev < VALID_ALARM) + if (prec->si.nsev < INVALID_ALARM) { - prec->si.nsev = VALID_ALARM; + prec->si.nsev = INVALID_ALARM; prec->si.nsta = READ_ALARM; } } @@ -802,9 +797,9 @@ char **p3; } else { - if (prec->ai.nsev < VALID_ALARM) + if (prec->ai.nsev < INVALID_ALARM) { - prec->ai.nsev = VALID_ALARM; + prec->ai.nsev = INVALID_ALARM; prec->ai.nsta = READ_ALARM; } } @@ -820,9 +815,9 @@ char **p3; } else { - if (prec->mbbi.nsev < VALID_ALARM) + if (prec->mbbi.nsev < INVALID_ALARM) { - prec->mbbi.nsev = VALID_ALARM; + prec->mbbi.nsev = INVALID_ALARM; prec->mbbi.nsta = READ_ALARM; } } @@ -843,11 +838,7 @@ char **p3; * *************************************************************************/ -static int setDelay(pdpvt, p1, p2, p3) -struct gpibDpvt *pdpvt; -int p1; -int p2; -char **p3; +STATIC int setDelay(struct gpibDpvt *pdpvt, int p1, int p2, char **p3) { int status; char curChan; diff --git a/src/vxWorks/devOpt/devXxK196Gpib.c b/src/vxWorks/devOpt/devXxK196Gpib.c index 6efb71833..313546a34 100644 --- a/src/vxWorks/devOpt/devXxK196Gpib.c +++ b/src/vxWorks/devOpt/devXxK196Gpib.c @@ -33,8 +33,6 @@ * * Modification Log: * ----------------- - * .01 05-30-91 jrw Initial Release - * .02 01-06-92 nda dg535 support under EPICS 3.3 */ #define DSET_AI devAiK196Gpib @@ -78,7 +76,7 @@ #include #include -long init_dev_sup(), report(); +static long init_dev_sup(), report(); static struct devGpibParmBlock devSupParms; /****************************************************************************** @@ -222,10 +220,6 @@ static char *(userOffOn[]) = {"USER OFF;", "USER ON;", NULL}; * ******************************************************************************/ -/* forward declarations of some custom convert routines */ -int setDelay(); -int rdDelay(); - static struct gpibCmd gpibCmds[] = { /* Param 0, (model) */ @@ -284,8 +278,7 @@ static struct devGpibParmBlock devSupParms = { * ******************************************************************************/ static long -init_dev_sup(parm) -int parm; +init_dev_sup(int parm) { return(devGpibLib_initDevSup(parm, &DSET_AI)); } @@ -299,7 +292,7 @@ int parm; * ******************************************************************************/ static long -report() +report(void) { return(devGpibLib_report(&DSET_AI)); } diff --git a/src/vxWorks/devOpt/devXxK263Gpib.c b/src/vxWorks/devOpt/devXxK263Gpib.c index 688b2b0a4..cc851e455 100644 --- a/src/vxWorks/devOpt/devXxK263Gpib.c +++ b/src/vxWorks/devOpt/devXxK263Gpib.c @@ -78,7 +78,7 @@ #include #include -long init_dev_sup(), report(); +static long init_dev_sup(), report(); static struct devGpibParmBlock devSupParms; /****************************************************************************** @@ -149,72 +149,7 @@ int K263Debug = 0; /* debugging flags */ #define TIME_WINDOW 600 /* 10 seconds on a getTick call */ #define DMA_TIME 30 /* 1/2 second on a watchdog time */ -/* - * Strings used by the init routines to fill in the znam, onam, ... - * fields in BI, BO, MBBI, and MBBO record types. - */ -static char *offOnList[] = { "Off", "On" }; -static struct devGpibNames offOn = { 2, offOnList, NULL, 1 }; - -static char *disableEnableList[] = { "Disable", "Enable" }; -static struct devGpibNames disableEnable = { 2, disableEnableList, NULL, 1 }; - -static char *resetList[] = { "Reset", "Reset" }; -static struct devGpibNames reset = { 2, resetList, NULL, 1 }; - -static char *lozHizList[] = { "50 OHM", "IB_Q_HIGH Z" }; -static struct devGpibNames lozHiz = {2, lozHizList, NULL, 1}; - -static char *invertNormList[] = { "INVERT", "NORM" }; -static struct devGpibNames invertNorm = { 2, invertNormList, NULL, 1 }; - -static char *fallingRisingList[] = { "FALLING", "RISING" }; -static struct devGpibNames fallingRising = { 2, fallingRisingList, NULL, 1 }; - -static char *singleShotList[] = { "SINGLE", "SHOT" }; -static struct devGpibNames singleShot = { 2, singleShotList, NULL, 1 }; - -static char *clearList[] = { "CLEAR", "CLEAR" }; -static struct devGpibNames clear = { 2, clearList, NULL, 1 }; - -static char *tABCDList[] = { "T", "A", "B", "C", "D" }; -static unsigned long tABCDVal[] = { 1, 2, 3, 5, 6 }; -static struct devGpibNames tABCD = { 5, tABCDList, tABCDVal, 3 }; - -static char *ttlNimEclVarList[] = { "TTL", "NIM", "ECL", "VAR" }; -static unsigned long ttlNimEclVarVal[] = { 0, 1, 2, 3 }; -static struct devGpibNames ttlNimEclVar = { 4, ttlNimEclVarList, - ttlNimEclVarVal, 2 }; - -static char *intExtSsBmStopList[] = { "INTERNAL", "EXTERNAL", - "SINGLE SHOT", "BURST MODE", "STOP" }; -static unsigned long intExtSsBmStopVal[] = { 0, 1, 2, 3, 2 }; -static struct devGpibNames intExtSsBm = { 4, intExtSsBmStopList, - intExtSsBmStopVal, 2 }; -static struct devGpibNames intExtSsBmStop = { 5, intExtSsBmStopList, - intExtSsBmStopVal, 3 }; - - -/****************************************************************************** - * - * String arrays for EFAST operations. Note that the last entry must be - * NULL. - * - * On input operations, only as many bytes as are found in the string array - * elements are compared. If there are more bytes than that in the input - * message, they are ignored. The first matching string found (starting - * from the 0'th element) will be used as a match. - * - * NOTE: For the input operations, the strings are compared literally! This - * can cause problems if the instrument is returning things like \r and \n - * characters. You must take care when defining input strings so you include - * them as well. - * - ******************************************************************************/ - -static char *(userOffOn[]) = {"USER OFF;", "USER ON;", NULL}; - /****************************************************************************** * * Array of structures that define all GPIB messages @@ -222,10 +157,6 @@ static char *(userOffOn[]) = {"USER OFF;", "USER ON;", NULL}; * ******************************************************************************/ -/* forward declarations of some custom convert routines */ -int setDelay(); -int rdDelay(); - static struct gpibCmd gpibCmds[] = { /* Param 0, (model) */ @@ -283,8 +214,7 @@ static struct devGpibParmBlock devSupParms = { * ******************************************************************************/ static long -init_dev_sup(parm) -int parm; +init_dev_sup(int parm) { return(devGpibLib_initDevSup(parm, &DSET_AI)); } @@ -298,7 +228,7 @@ int parm; * ******************************************************************************/ static long -report() +report(void) { return(devGpibLib_report(&DSET_AI)); } diff --git a/src/vxWorks/devOpt/devXxSkeletonGpib.c b/src/vxWorks/devOpt/devXxSkeletonGpib.c index 53519dd0d..6e47381d9 100644 --- a/src/vxWorks/devOpt/devXxSkeletonGpib.c +++ b/src/vxWorks/devOpt/devXxSkeletonGpib.c @@ -85,8 +85,10 @@ #include #include -long init_dev_sup(), report(); -int srqHandler(); +#define STATIC static + +STATIC long init_dev_sup(), report(); +STATIC int srqHandler(); static struct devGpibParmBlock devSupParms; /****************************************************************************** @@ -307,9 +309,8 @@ static struct devGpibParmBlock devSupParms = { * with a param value of 1. * ******************************************************************************/ -static long -init_dev_sup(parm) -int parm; +STATIC long +init_dev_sup(int parm) { return(devGpibLib_initDevSup(parm,&DSET_AI)); } @@ -322,12 +323,11 @@ int parm; * This function will no longer be required after epics 3.3 is released * ******************************************************************************/ -static long -report() +STATIC long +report(void) { return(devGpibLib_report(&DSET_AI)); } - /****************************************************************************** * * A sample SRQ handler. This one is taken from the DC5009 gpib device support @@ -358,50 +358,59 @@ report() * ******************************************************************************/ -#define DC5009_GOODBITS 0xef /* I only care about these bits from the poll*/ +#define DC5009_GOODBITS 0xef /* I only care about these bits */ #define DC5009_PON 65 /* power just turned on */ #define DC5009_OPC 66 /* operation just completed */ +#define DC5009_USER 67 /* user requested SRQ */ -static int srqHandler(phwpvt, srqStatus) -struct hwpvt *phwpvt; -int srqStatus; /* The poll response from the device */ +STATIC int srqHandler(struct hwpvt *phwpvt, int srqStatus) { int status = IDLE; /* assume device will be idle when finished */ - if (SkeletonDebug || ibSrqDebug) - logMsg("srqHandler(0x%08.8X, 0x%02.2X): called\n", phwpvt, srqStatus); + if (Dc5009Debug || ibSrqDebug) + printf("dc5009 srqHandler(0x%08.8X, 0x%02.2X): called\n", phwpvt, srqStatus); switch (srqStatus & DC5009_GOODBITS) { case DC5009_OPC: - /* Invoke the command-type specific SRQ handler (in the library code) */ + /* Invoke the command-type specific SRQ handler */ if (phwpvt->srqCallback != NULL) status = ((*(phwpvt->srqCallback))(phwpvt->parm, srqStatus)); else - logMsg("Unsolicited operation complete from DC5009 device support!\n"); + printf("dc5009 srqHandler: Unsolicited operation complete from DC5009 device support!\n"); break; +/* BUG - I have to clear out the error status by doing an err? read operation */ + + case DC5009_USER: + + /* user requested srq event is specific to the Dc5009 */ + printf("dc5009 srqHandler: Dc5009 User requested srq event link %d, device %d\n", phwpvt->link, phwpvt->device); + break; +/* BUG - I have to clear out the error status by doing an err? read operation */ case DC5009_PON: - logMsg("Power cycled on DC5009\n"); + printf("dc5009 srqHandler: Power cycled on DC5009\n"); break; +/* BUG - I have to clear out the error status by doing an err? read operation */ + + default: - default: /* unsolicited SRQ */ if (phwpvt->unsolicitedDpvt != NULL) - { /* If a record spec'd the magic parm number, process it. */ - if(SkeletonDebug || ibSrqDebug) - logMsg("Unsolicited SRQ being handled from link %d, device %d, status = 0x%02.2X\n", + { + if(Dc5009Debug || ibSrqDebug) + printf("dc5009 srqHandler: Unsolicited SRQ being handled from link %d, device %d, status = 0x%02.2X\n", phwpvt->link, phwpvt->device, srqStatus); - ((struct gpibDpvt*)(phwpvt->unsolicitedDpvt))->head.header.callback.finishProc = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process; + ((struct gpibDpvt*)(phwpvt->unsolicitedDpvt))->head.header.callback.callback = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process; ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->head.header.callback.priority = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->processPri; callbackRequest(phwpvt->unsolicitedDpvt); } else { - logMsg("Unsolicited SRQ ignored from link %d, device %d, status = 0x%02.2X\n", + printf("dc5009 srqHandler: Unsolicited SRQ ignored from link %d, device %d, status = 0x%02.2X\n", phwpvt->link, phwpvt->device, srqStatus); } } diff --git a/src/vxWorks/devOpt/devXxSr620Gpib.c b/src/vxWorks/devOpt/devXxSr620Gpib.c index a943efdec..3bdf2934a 100644 --- a/src/vxWorks/devOpt/devXxSr620Gpib.c +++ b/src/vxWorks/devOpt/devXxSr620Gpib.c @@ -77,9 +77,10 @@ #include #include -long init_dev_sup(), report(); -int srqHandler(); -int aiGpibSrq(), liGpibSrq(), biGpibSrq(), mbbiGpibSrq(), stringinGpibSrq(); +#define STATIC static + +STATIC long init_dev_sup(), report(); +STATIC int srqHandler(); static struct devGpibParmBlock devSupParms; /****************************************************************************** @@ -258,9 +259,7 @@ static struct devGpibParmBlock devSupParms = { #define SR620_MAV 0x10 #define SR630_ESB 0x20 -static int srqHandler(phwpvt, srqStatus) -struct hwpvt *phwpvt; -int srqStatus; /* The poll response from the device */ +STATIC int srqHandler(struct hwpvt *phwpvt, int srqStatus) { int status = IDLE; /* assume device will be idle when finished */ @@ -283,9 +282,9 @@ int srqStatus; /* The poll response from the device */ logMsg("Unsolicited SRQ being handled from link %d, device %d, status = 0x%02.2X\n", phwpvt->link, phwpvt->device, srqStatus); - ((struct gpibDpvt*)(phwpvt->unsolicitedDpvt))->head.header.callback.finishProc = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process; + ((struct gpibDpvt*)(phwpvt->unsolicitedDpvt))->head.header.callback.callback = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process; ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->head.header.callback.priority = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->processPri; - callbackRequest(phwpvt->unsolicitedDpvt); + callbackRequest((CALLBACK*)phwpvt->unsolicitedDpvt); } else { @@ -305,9 +304,8 @@ int srqStatus; /* The poll response from the device */ * with a param value of 1. * ******************************************************************************/ -static long -init_dev_sup(parm) -int parm; +STATIC long +init_dev_sup(int parm) { return(devGpibLib_initDevSup(parm, &DSET_AI)); } @@ -318,8 +316,8 @@ int parm; * module. * ******************************************************************************/ -static long -report() +STATIC long +report(void) { return(devGpibLib_report(&DSET_AI)); }