Compare commits

...

8 Commits

Author SHA1 Message Date
Marty Kraimer
b7451c7a5d Allow iocInit to continue even if getResources fails 1994-12-15 16:12:44 +00:00
John Winans
a2331c9d0e Changed a printf to logMsg and added a printing delay to use when
the ibDebug flag is set so things come out closer to the proper order.
1994-12-14 22:43:48 +00:00
John Winans
f44ce3dbb0 Changed printf to logMsg in the A24Malloc code and added a few more
debug statements.
1994-12-14 22:41:06 +00:00
John Winans
d9066673ef Removed DMAC command chaining structure(s) from the ibLink
structure so they can be malloc'd seperately.  This keeps
the usage of A24 space restricted to ONLY those structures
that have to be there.
1994-12-14 22:29:14 +00:00
Janet B. Anderson
82867f0684 Now installs individual objects instead of devLibOpt 1994-12-14 15:00:16 +00:00
John Winans
6fb928ea9d Updated the GPIB request header. 1994-12-12 19:59:45 +00:00
John Winans
ad41921414 Rewrote the init code so that it always returns a zero (don't kill the
startup.cmd file.)  It is possible that this could cause some confusion
to the database, should it decide to then use a link that did not init
properly.
1994-12-12 16:03:00 +00:00
cvs2svn
17c54db7f7 This commit was manufactured by cvs2svn to create tag 'R3.12.0-beta2'. 1994-12-07 15:11:14 +00:00
13 changed files with 367 additions and 96 deletions

View File

@@ -1270,13 +1270,15 @@ void *devLibA24Malloc(size_t size)
void *ret;
if (devLibA24Debug)
printf("devLibA24Malloc(%d) entered\n", size);
logMsg("devLibA24Malloc(%d) entered\n", size, 0,0,0,0,0);
if (A24MallocFunc == NULL)
{
/* See if the sysA24Malloc() function is present. */
if(symFindByName(sysSymTbl,"_sysA24Malloc", (char**)&A24MallocFunc,&stype)==ERROR)
{ /* Could not find sysA24Malloc... use the malloc one and hope we are OK */
if (devLibA24Debug)
logMsg("devLibA24Malloc() using regular malloc\n",0,0,0,0,0,0);
A24MallocFunc = malloc;
A24FreeFunc = free;
}
@@ -1284,6 +1286,8 @@ void *devLibA24Malloc(size_t size)
{
if(symFindByName(sysSymTbl,"_sysA24Free", (char**)&A24FreeFunc, &stype) == ERROR)
{ /* That's strange... we have malloc, but no free! */
if (devLibA24Debug)
logMsg("devLibA24Malloc() using regular malloc\n",0,0,0,0,0,0);
A24MallocFunc = malloc;
A24FreeFunc = free;
}
@@ -1301,5 +1305,8 @@ void *devLibA24Malloc(size_t size)
void devLibA24Free(void *pBlock)
{
if (devLibA24Debug)
logMsg("devLibA24Free(%p) entered\n", (unsigned long)pBlock,0,0,0,0,0);
A24FreeFunc(pBlock);
}

View File

@@ -53,7 +53,6 @@
* .23 09-10-92 rcz changed funcptr pinitHooks from ret long to void
* .24 09-11-92 rcz moved setMasterTimeToSelf to a seperate C file
* .25 07-15-93 mrk Changed dbLoad for new dbStaticLib support
<<<<<<< iocInit.c
* .26 02-09-94 jbk changed to new time stamp support software ts_init()
* .27 03-18-94 mcn added comments
* .28 03-23-94 mrk Added asInit
@@ -176,11 +175,6 @@ int iocInit(char * pResourceFilename)
* Read EPICS resources.
*/
status = getResources(pResourceFilename);
if (status != 0) {
logMsg("iocInit aborting because getResources failed\n",0,0,0,0,0,0);
return(-1);
}
/* Call hook for after resources are read. */
if (pinitHooks) (*pinitHooks)(INITHOOKafterGetResources);
@@ -1078,7 +1072,7 @@ static long getResources(char *fname)
sprintf(message,
"getResources: Line too long - line=%d", lineNum);
errMessage(-1L, message);
return (-1);
continue;
}
for (i = 0; i < len; i++) {
if (buff[i] == '!') {
@@ -1090,7 +1084,7 @@ static long getResources(char *fname)
sprintf(message,
"getResources: Not enough fields - line=%d", lineNum);
errMessage(-1L, message);
return (-1);
continue;
}
found = 0;
len2 = strlen(s2);
@@ -1107,7 +1101,7 @@ static long getResources(char *fname)
sprintf(message,
"getResources: Field 2 not defined - line=%d", lineNum);
errMessage(-1L, message);
return (-1);
continue;
}
strcpy(name, "_");
strcat(name, s1);
@@ -1116,7 +1110,7 @@ static long getResources(char *fname)
sprintf(message,
"getResources: Symbol name not found - line=%d", lineNum);
errMessage(-1L, message);
return (-1);
continue;
}
if ( (strncmp(s1,"EPICS_",6)) == SAME)
epicsFlag = 1;
@@ -1143,7 +1137,7 @@ static long getResources(char *fname)
sprintf(message,
"getResources: conversion failed - line=%d", lineNum);
errMessage(-1L, message);
return (-1);
continue;
}
if ( epicsFlag ) {
sprintf(message,
@@ -1160,7 +1154,7 @@ static long getResources(char *fname)
sprintf(message,
"getResources: conversion failed - line=%d", lineNum);
errMessage(-1L, message);
return (-1);
continue;
}
if ( epicsFlag ) {
sprintf(message,
@@ -1176,7 +1170,7 @@ static long getResources(char *fname)
sprintf(message,
"getResources: conversion failed - line=%d", lineNum);
errMessage(-1L, message);
return (-1);
continue;
}
if ( epicsFlag ) {
sprintf(message,
@@ -1193,7 +1187,7 @@ static long getResources(char *fname)
sprintf(message,
"getResources: conversion failed - line=%d", lineNum);
errMessage(-1L, message);
return (-1);
continue;
}
if ( epicsFlag ) {
sprintf(message,
@@ -1209,7 +1203,7 @@ static long getResources(char *fname)
sprintf(message,
"getResources: switch default reached - line=%d", lineNum);
errMessage(-1L, message);
return (-1);
continue;
break;
}
CLEAR: memset(buff, '\0', MAX);

View File

@@ -172,6 +172,15 @@ gDset *dset; /* pointer to dset used to reference the init function */
return(OK);
}
static void RegisterProcessCallback(CALLBACK *pCallback, int Priority, void *Parm)
{
callbackSetCallback(devGpibLib_processCallback, pCallback);
callbackSetPriority(Priority, pCallback);
callbackSetUser(Parm, pCallback);
callbackRequest(pCallback);
return;
}
/******************************************************************************
*
@@ -1288,9 +1297,13 @@ struct gpibDpvt *pdpvt;
{
devGpibLib_setPvSevr(pai,READ_ALARM,VALID_ALARM);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
}
else
{
@@ -1335,9 +1348,13 @@ int srqStatus;
{
devGpibLib_setPvSevr(pai,READ_ALARM,VALID_ALARM);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
}
devGpibLib_aiGpibFinish(pdpvt); /* and finish the processing */
@@ -1382,9 +1399,13 @@ struct gpibDpvt *pdpvt;
devGpibLib_setPvSevr(pai,READ_ALARM,VALID_ALARM);
}
}
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
return(0);
}
@@ -1426,9 +1447,14 @@ struct gpibDpvt *pdpvt;
devGpibLib_setPvSevr(pao,WRITE_ALARM,VALID_ALARM);
}
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
return(IDLE);
}
@@ -1458,9 +1484,13 @@ struct gpibDpvt *pdpvt;
{
devGpibLib_setPvSevr(pli,READ_ALARM,VALID_ALARM);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
}
else
{
@@ -1505,9 +1535,13 @@ int srqStatus;
{
devGpibLib_setPvSevr(pli,READ_ALARM,VALID_ALARM);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
}
devGpibLib_liGpibFinish(pdpvt); /* and finish the processing */
@@ -1551,9 +1585,13 @@ struct gpibDpvt *pdpvt;
devGpibLib_setPvSevr(pli,READ_ALARM,VALID_ALARM);
}
}
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
return(0);
}
@@ -1595,9 +1633,13 @@ struct gpibDpvt *pdpvt;
devGpibLib_setPvSevr(plo,WRITE_ALARM,VALID_ALARM);
}
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
return(IDLE);
}
@@ -1624,9 +1666,13 @@ struct gpibDpvt *pdpvt;
{
devGpibLib_setPvSevr(pbi,READ_ALARM,VALID_ALARM);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
}
else /* interpret response that came back */
{
@@ -1669,9 +1715,13 @@ int srqStatus;
{
devGpibLib_setPvSevr(pbi,READ_ALARM,VALID_ALARM);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
}
devGpibLib_biGpibFinish(pdpvt); /* and finish the processing */
@@ -1718,9 +1768,13 @@ struct gpibDpvt *pdpvt;
devGpibLib_setPvSevr(pbi,READ_ALARM,VALID_ALARM);
}
}
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback); /* jrw */
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
return(0);
}
@@ -1763,9 +1817,14 @@ struct gpibDpvt *pdpvt;
devGpibLib_setPvSevr(pbo,WRITE_ALARM,VALID_ALARM);
}
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
return(IDLE);
}
@@ -1792,9 +1851,13 @@ struct gpibDpvt *pdpvt;
{
devGpibLib_setPvSevr(pmbbi,WRITE_ALARM,VALID_ALARM);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
}
else
{
@@ -1839,9 +1902,13 @@ int srqStatus;
{
devGpibLib_setPvSevr(pmbbi,READ_ALARM,VALID_ALARM);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
}
devGpibLib_mbbiGpibFinish(pdpvt); /* and finish the processing */
@@ -1888,9 +1955,13 @@ struct gpibDpvt *pdpvt;
devGpibLib_setPvSevr(pmbbi,READ_ALARM,VALID_ALARM);
}
}
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
return(0);
}
@@ -1934,9 +2005,13 @@ struct gpibDpvt *pdpvt;
devGpibLib_setPvSevr(pmbbo,WRITE_ALARM,VALID_ALARM);
}
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback); /* jrw */
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
return(IDLE);
}
@@ -1966,9 +2041,13 @@ struct gpibDpvt *pdpvt;
{
devGpibLib_setPvSevr(psi,READ_ALARM,VALID_ALARM);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback); /* jrw */
callbackRequest(&pdpvt->head.header.callback);
#endif
}
else
{
@@ -2013,9 +2092,13 @@ int srqStatus;
{
devGpibLib_setPvSevr(psi,READ_ALARM,VALID_ALARM);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
}
devGpibLib_stringinGpibFinish(pdpvt); /* and finish the processing */
@@ -2051,9 +2134,13 @@ struct gpibDpvt *pdpvt;
psi->val[40] = '\0';
psi->udf = FALSE;
}
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback); /* jrw */
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
return(0);
}
@@ -2094,9 +2181,13 @@ struct gpibDpvt *pdpvt;
devGpibLib_setPvSevr(pso,WRITE_ALARM,VALID_ALARM);
}
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback); /* jrw */
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
return(IDLE);
}
@@ -2279,14 +2370,16 @@ unsigned short val; /* used for EFAST operations only */
*
* The reason it is done this way is because the process() call may
* recursively call itself when records are chained and the callback
* task's stack is larger... just for this purpose.
* task's stack is larger... just for that reason.
*
******************************************************************************/
void
devGpibLib_processCallback(pDpvt)
struct gpibDpvt *pDpvt;
devGpibLib_processCallback(CALLBACK *pCallback)
{
struct gpibDpvt *pDpvt;
callbackGetUser(pDpvt, pCallback);
dbScanLock(pDpvt->precord);
(*(struct rset *)(pDpvt->precord->rset)).process(pDpvt->precord);
dbScanUnlock(pDpvt->precord);
@@ -2462,9 +2555,13 @@ struct gpibDpvt *pdpvt;
{
devGpibLib_setPvSevr(pwf,READ_ALARM,VALID_ALARM);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest((void *)pdpvt);
callbackRequest(&pdpvt->head.header.callback);
#endif
}
else
{
@@ -2509,9 +2606,13 @@ int srqStatus;
{
devGpibLib_setPvSevr(pwf,READ_ALARM,VALID_ALARM);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest((void *)pdpvt);
callbackRequest(&pdpvt->head.header.callback);
#endif
}
devGpibLib_wfGpibFinish(pdpvt); /* and finish the processing */
@@ -2547,9 +2648,14 @@ struct gpibDpvt *pdpvt;
{
devGpibLib_setPvSevr(pwf,READ_ALARM,VALID_ALARM);
}
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest((void *)pdpvt);
#if 1
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
#else
pdpvt->head.header.callback.callback = devGpibLib_processCallback;
pdpvt->head.header.callback.priority = priorityLow;
callbackRequest(&pdpvt->head.header.callback);
#endif
return(0);
}

View File

@@ -9,15 +9,11 @@ SRCS.c = \
../devGpibInteract.c ../devXxSr620Gpib.c ../devK486Gpib.c \
../devXxK196Gpib.c ../devXxDc5009Gpib.c ../devXxK263Gpib.c
OBJS = \
PROD = \
devAnalytekGpib.o devXxDg535Gpib.o devBBInteract.o \
devGpibInteract.o devXxSr620Gpib.o devK486Gpib.o \
devXxK196Gpib.o devXxDc5009Gpib.o devXxK263Gpib.o
PROD = devLibOpt
include $(EPICS)/config/RULES.Vx
devLibOpt: $(OBJS)
$(RM) $@
$(LINK.c) $@ $(OBJS) $(LDLIBS)

View File

@@ -139,8 +139,10 @@ int GI(void)
for (cnt=0; cnt < LIST_SIZE; cnt++)
{ /* init the elements of the command table */
#if 0
gpibIntCmds[cnt].head.header.list.list1 = NULL;
gpibIntCmds[cnt].head.header.list.list2 = NULL;
#endif
gpibIntCmds[cnt].head.workStart = gpibWork;
gpibIntCmds[cnt].head.link = 0;
gpibIntCmds[cnt].head.device = 0;
@@ -155,7 +157,7 @@ int GI(void)
}
ans = 0; /* set loop not to exit */
printf("\n\n");
logMsg("\n\n");
while ((ans != 'q') && (ans != 'Q'))
{
@@ -380,6 +382,8 @@ static int sendMsg(void)
if (replyIsBack)
{
if (ibDebug)
taskDelay(60); /* Allow debug printing to complete */
showGpibMsg(msgNum);
}
else
@@ -438,7 +442,7 @@ static int gpibWork(struct gpibIntCmd *pCmd)
}
else if (status > (MAX_MSG_LENGTH - 1)) /* check length of resp */
{
printf("GPIB Response length equaled allocated space !!!\n");
logMsg("GPIB Response length equaled allocated space !!!\n");
pCmd->resp[(MAX_MSG_LENGTH)] = '\0'; /* place \0 at end */
}
else

View File

@@ -391,8 +391,8 @@ STATIC int srqHandler(struct hwpvt *phwpvt, int srqStatus)
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.callback = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process;
((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->head.header.callback.priority = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->processPri;
((struct gpibDpvt*)(phwpvt->unsolicitedDpvt))->head.callback.callback = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process;
((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->head.callback.priority = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->processPri;
callbackRequest((CALLBACK*)phwpvt->unsolicitedDpvt);
}
else

View File

@@ -282,8 +282,8 @@ STATIC int srqHandler(struct hwpvt *phwpvt, int srqStatus)
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.callback = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process;
((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->head.header.callback.priority = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->processPri;
((struct gpibDpvt*)(phwpvt->unsolicitedDpvt))->head.callback.callback = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process;
((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->head.callback.priority = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->processPri;
callbackRequest((CALLBACK*)phwpvt->unsolicitedDpvt);
}
else

View File

@@ -65,6 +65,10 @@
* This driver currently needs work on error message generation.
*
* $Log$
* Revision 1.34 1994/10/19 18:31:22 winans
* ANSIfied the bitbus driver so that the compiler stopped warning about
* exery third line of code.
*
* Revision 1.33 1994/10/04 18:42:42 winans
* Added an extensive debugging facility.
*
@@ -129,6 +133,8 @@ STATIC int bbKill(int link);
STATIC void BBrebootFunc(void);
STATIC int txStuck(int link);
int BBConfig(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
int __BBConfig(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
#ifdef BB_SUPER_DEBUG
int BBHistDump(int link);
@@ -199,7 +205,16 @@ int BBConfig(unsigned long Link,
unsigned long IrqVector,
unsigned long IrqLevel)
{
__BBConfig(Link, LinkType, BaseAddr, IrqVector, IrqLevel);
return(0);
}
int __BBConfig(unsigned long Link,
unsigned long LinkType,
unsigned long BaseAddr,
unsigned long IrqVector,
unsigned long IrqLevel)
{
void *pVoid;
int j;
static int FirstTime = 1;

View File

@@ -1,7 +1,17 @@
/* drvGpib.c */
/* share/src/drv/drvGpib.c %W% %G% */
/* Author: John Winans
/******************************************************************************
*
* TODO:
* - Autodetect the need to use a bounce buffer (saves time on boards that have
* "malloc"-able A24 space.
*
* - Launch campaign against the use of National Instruments hardware.
*
******************************************************************************
*
* Author: John Winans
* Date: 09-10-91
* GPIB driver for the NI-1014 and NI-1014D VME cards.
*
@@ -52,6 +62,15 @@
*
*
* $Log$
* Revision 1.26 1994/12/12 16:03:00 winans
* Rewrote the init code so that it always returns a zero (don't kill the
* startup.cmd file.) It is possible that this could cause some confusion
* to the database, should it decide to then use a link that did not init
* properly.
*
* Revision 1.25 1994/10/28 19:55:30 winans
* Added VME bus violation prevention code/bug fix from LANL.
*
* Revision 1.24 1994/10/04 18:42:46 winans
* Added an extensive debugging facility.
*
@@ -183,6 +202,11 @@ struct cc_ary
short cc_TWO;
};
typedef struct DmaStuffStruct
{
struct cc_ary cc_array;
char cc_byte;
}DmaStuffStruct;
/******************************************************************************
*
* This structure is used to hold the hardware-specific information for a
@@ -197,8 +221,12 @@ struct niLink {
WDOG_ID watchDogId; /* watchdog for timeouts */
struct ibregs *ibregs;/* pointer to board registers */
#if 0
char cc_byte;
struct cc_ary cc_array;
#else
DmaStuffStruct *DmaStuff;
#endif
char r_isr1;
char r_isr2;
@@ -218,7 +246,7 @@ STATIC int pollInhibit[NIGPIB_NUM_LINKS][IBAPERLINK];
/******************************************************************************
*
* This structure is used to hold the hardware-specific information for a
* single Bit Bus GPIB link. They are dynamically allocated (and an ibLinkTask
* single BitBus GPIB link. They are dynamically allocated (and an ibLinkTask
* started for it) when an IOCTL command requests it.
*
* The IOCTL requests to initiate a BBGPIB_IO link comes from the device support
@@ -372,9 +400,9 @@ initGpib(void)
if (ibDebug)
logMsg("GPIB card found at address 0x%08.8X\n", pibregs);
if ((pNiLink[i] = (struct niLink *) devLibA24Malloc(sizeof(struct niLink))) == NULL)
if ((pNiLink[i] = (struct niLink *)malloc(sizeof(struct niLink))) == NULL)
{ /* This better never happen! */
logMsg("initGpib(): Can't malloc memory for NI-link data structures!");
logMsg("initGpib(): Can't malloc memory for NI-link data structures!\n");
return(ERROR);
}
@@ -402,10 +430,15 @@ initGpib(void)
pNiLink[i]->cmdSpins = 0;
pNiLink[i]->maxSpins = 0;
pNiLink[i]->cc_array.cc_ccb = 0; /* DMAC array chained structure */
pNiLink[i]->cc_array.cc_ONE = 1;
pNiLink[i]->cc_array.cc_n_1addr = 0;
pNiLink[i]->cc_array.cc_TWO = 2;
if ((pNiLink[i]->DmaStuff = (DmaStuffStruct *)devLibA24Malloc(sizeof(DmaStuffStruct))) == NULL)
{ /* This better never happen! */
logMsg("initGpib(): Can't malloc A24 memory for DMAC control structures!\n");
return(ERROR);
}
pNiLink[i]->DmaStuff->cc_array.cc_ccb = 0; /* DMAC chaining structure */
pNiLink[i]->DmaStuff->cc_array.cc_ONE = 1;
pNiLink[i]->DmaStuff->cc_array.cc_n_1addr = 0;
pNiLink[i]->DmaStuff->cc_array.cc_TWO = 2;
pNiLink[i]->first_read = 1; /* used in physIo() */
}
@@ -970,9 +1003,9 @@ int time; /* time to wait on the DMA operation */
b->auxmr = AUXRA | HR_HLDE; /* hold off on end */
if (cnt != 1)
pNiLink[link]->cc_byte = AUXRA | HR_HLDA; /* (cc) holdoff on all */
pNiLink[link]->DmaStuff->cc_byte = AUXRA | HR_HLDA; /* (cc) holdoff on all */
else
pNiLink[link]->cc_byte = b->auxmr = AUXRA | HR_HLDA; /* last byte, do now */
pNiLink[link]->DmaStuff->cc_byte = b->auxmr = AUXRA | HR_HLDA; /* last byte, do now */
b->ch0.ocr = D_DTM | D_XRQ;
/* make sure I only alter the 1014D port-specific fields here! */
b->cfg1 = D_ECC | D_IN | (NIGPIB_IRQ_LEVEL << 5) | D_BRG3 | D_DBM;
@@ -989,7 +1022,7 @@ int time; /* time to wait on the DMA operation */
memcpy(pNiLink[link]->A24BounceBuffer, buffer, length);
if (cnt != 1)
pNiLink[link]->cc_byte = AUX_SEOI; /* send EOI with last byte */
pNiLink[link]->DmaStuff->cc_byte = AUX_SEOI; /* send EOI with last byte */
else
b->auxmr = AUX_SEOI; /* last byte, do it now */
@@ -1006,28 +1039,28 @@ int time; /* time to wait on the DMA operation */
/* setup channel 1 (carry cycle) */
if(ibDebug > 5)
logMsg("PhysIO: readying to xlate cc pointers at %8.8X and %8.8X\n", &(pNiLink[link]->cc_byte), &pNiLink[link]->A24BounceBuffer[cnt - 1]);
logMsg("PhysIO: readying to xlate cc pointers at %8.8X and %8.8X\n", &(pNiLink[link]->DmaStuff->cc_byte), &pNiLink[link]->A24BounceBuffer[cnt - 1]);
#ifdef USE_OLD_XLATION
pNiLink[link]->cc_array.cc_ccb = &(pNiLink[link]->cc_byte) + (long) ram_base;
pNiLink[link]->cc_array.cc_n_1addr = &(pNiLink[link]->A24BounceBuffer[cnt - 1]) + (long)ram_base;
pNiLink[link]->DmaStuff->cc_array.cc_ccb = &(pNiLink[link]->DmaStuff->cc_byte) + (long) ram_base;
pNiLink[link]->DmaStuff->cc_array.cc_n_1addr = &(pNiLink[link]->A24BounceBuffer[cnt - 1]) + (long)ram_base;
#else
if (sysLocalToBusAdrs(VME_AM_STD_SUP_DATA, &(pNiLink[link]->cc_byte), &(pNiLink[link]->cc_array.cc_ccb)) == ERROR)
if (sysLocalToBusAdrs(VME_AM_STD_SUP_DATA, &(pNiLink[link]->DmaStuff->cc_byte), &(pNiLink[link]->DmaStuff->cc_array.cc_ccb)) == ERROR)
return(ERROR);
if (sysLocalToBusAdrs(VME_AM_STD_SUP_DATA, &(pNiLink[link]->A24BounceBuffer[cnt - 1]), &(pNiLink[link]->cc_array.cc_n_1addr)) == ERROR)
if (sysLocalToBusAdrs(VME_AM_STD_SUP_DATA, &(pNiLink[link]->A24BounceBuffer[cnt - 1]), &(pNiLink[link]->DmaStuff->cc_array.cc_n_1addr)) == ERROR)
return(ERROR);
#endif
if(ibDebug > 5)
logMsg("PhysIO: &cc_byte=%8.8X, &pNiLink[link]->A24BounceBuffer[cnt-1]=%8.8X, ", pNiLink[link]->cc_array.cc_ccb, pNiLink[link]->cc_array.cc_n_1addr);
logMsg("PhysIO: &cc_byte=%8.8X, &pNiLink[link]->A24BounceBuffer[cnt-1]=%8.8X, ", pNiLink[link]->DmaStuff->cc_array.cc_ccb, pNiLink[link]->DmaStuff->cc_array.cc_n_1addr);
cnt--;
#ifdef USE_OLD_XLATION
temp_addr = (long) (&(pNiLink[link]->cc_array)) + (long)ram_base;
temp_addr = (long) (&(pNiLink[link]->DmaStuff->cc_array)) + (long)ram_base;
#else
if (sysLocalToBusAdrs(VME_AM_STD_SUP_DATA, &(pNiLink[link]->cc_array), &temp_addr) == ERROR)
if (sysLocalToBusAdrs(VME_AM_STD_SUP_DATA, &(pNiLink[link]->DmaStuff->cc_array), &temp_addr) == ERROR)
return(ERROR);
#endif
if(ibDebug > 5)
@@ -1079,7 +1112,7 @@ int time; /* time to wait on the DMA operation */
if (ibDmaTimingError > ibDmaMaxError)
ibDmaMaxError = ibDmaTimingError;
if (ibDmaDebug)
printf("DMA timing: error = %d, total = %d, max = %d\n",
logMsg("DMA timing: error = %d, total = %d, max = %d\n",
ibDmaTimingError, ibDmaTimingErrorTotal, ibDmaMaxError);
/***************************************************************************/
@@ -1095,7 +1128,7 @@ int time; /* time to wait on the DMA operation */
if (ibDmaTimingError > ibDmaMaxError)
ibDmaMaxError = ibDmaTimingError;
if (ibDmaDebug)
printf("DMA timing: error = %d, total = %d, max = %d\n",
logMsg("DMA timing: error = %d, total = %d, max = %d\n",
ibDmaTimingError, ibDmaTimingErrorTotal, ibDmaMaxError);
/***************************************************************************/
@@ -2008,6 +2041,102 @@ int length; /* number of bytes to write out from the data buffer */
return(ERROR);
}
#ifdef INCLUDE_HIDEOS_INTERFACE
/******************************************************************************
*
* Interface functions for HiDEOS access.
*
******************************************************************************/
/******************************************************************************
*
* Read up to <length> bytes into <*buffer>.
*
******************************************************************************/
STATIC int
HideosGpibRead(struct ibLink *pibLink, int device, char *buffer, int length, int time)
{
logMsg("HideosGpibRead() entered\n");
return(bytes read | error);
}
/******************************************************************************
*
* Write <length> bytes from <*buffer> in data mode.
*
******************************************************************************/
STATIC int
HideosGpibWrite(struct ibLink *pibLink, int device, char *buffer, int length, int time)
{
logMsg("HideosGpibWrite() entered\n");
return(bytes sent | error);
}
/******************************************************************************
*
* Write <length> bytes from <*buffer> in command mode.
*
******************************************************************************/
STATIC int
HideosGpibCmd(struct ibLink *pibLink, char *buffer, int length)
{
logMsg("HideosGpibCmd() entered\n");
return(bytes sent | error);
}
/******************************************************************************
*
* Verify that the given GPIB port exists.
*
******************************************************************************/
STATIC int
HideosGpibCheckLink(int link, int bug)
{
logMsg("HideosGpibCheckLink() entered\n");
return(OK | ERROR);
}
/******************************************************************************
*
* Prevent SRQs from being polled on a given GPIB port.
*
******************************************************************************/
STATIC int
HideosGpibSrqPollInhibit(int link, int bug, int gpibAddr)
{
logMsg("HideosGpibSrqPollInhibit() entered -- NOT SUPPORTED YET\n");
return(ERROR);
}
/******************************************************************************
*
* Generate a GPIB link for a HiDEOS port.
*
******************************************************************************/
STATIC int
HideosGpibGenLink(int link, int bug)
{
logMsg("HideosGpibGenLink() entered\n");
return(ibLinkStart() | ERROR);
}
/******************************************************************************
*
* Handle a GPIB IOCTL call.
*
******************************************************************************/
STATIC int
HideosGpibIoctl(int link, int bug, int cmd, int v, caddr_t p)
{
logMsg("HideosGpibIoctl() entered\n");
return(OK | ERROR);
}
/******************************************************************************
*
* Given the port information, return a link structure.
*
******************************************************************************/
struct bbIbLink *
HideosGpibFindLink(int link, int bug)
{
logMsg("HideosGpibFindLink() entered\n");
return(bbIbLink* | NULL);
}
#endif
/******************************************************************************
*
* These are the BitBus architecture specific functions.
@@ -2524,13 +2653,13 @@ IBHistDump(int type, int link, int bug)
{
if (pibLink->linkType == GPIB_IO)
{
printf("%d GPIB-L%d-D%d: %s\n", pibLink->History.Hist[i].Time,
logMsg("%d GPIB-L%d-D%d: %s\n", pibLink->History.Hist[i].Time,
pibLink->linkId, pibLink->History.Hist[i].DevAddr,
pibLink->History.Hist[i].Msg);
}
else if (pibLink->linkType == BBGPIB_IO)
{
printf("%d BBIB-l%d-B%d-D%d: %s\n", pibLink->History.Hist[i].Time,
logMsg("%d BBIB-l%d-B%d-D%d: %s\n", pibLink->History.Hist[i].Time,
pibLink->linkId, pibLink->bug, pibLink->History.Hist[i].DevAddr,
pibLink->History.Hist[i].Msg);
}
@@ -2544,3 +2673,12 @@ IBHistDump(int type, int link, int bug)
return(0);
}
#endif
#if 1
/* A way to stop the CPU when idle... run from shell at prio 250 */
BigFFT()
{
while (1)
asm(" stop #0x3000");
}
#endif

View File

@@ -1270,13 +1270,15 @@ void *devLibA24Malloc(size_t size)
void *ret;
if (devLibA24Debug)
printf("devLibA24Malloc(%d) entered\n", size);
logMsg("devLibA24Malloc(%d) entered\n", size, 0,0,0,0,0);
if (A24MallocFunc == NULL)
{
/* See if the sysA24Malloc() function is present. */
if(symFindByName(sysSymTbl,"_sysA24Malloc", (char**)&A24MallocFunc,&stype)==ERROR)
{ /* Could not find sysA24Malloc... use the malloc one and hope we are OK */
if (devLibA24Debug)
logMsg("devLibA24Malloc() using regular malloc\n",0,0,0,0,0,0);
A24MallocFunc = malloc;
A24FreeFunc = free;
}
@@ -1284,6 +1286,8 @@ void *devLibA24Malloc(size_t size)
{
if(symFindByName(sysSymTbl,"_sysA24Free", (char**)&A24FreeFunc, &stype) == ERROR)
{ /* That's strange... we have malloc, but no free! */
if (devLibA24Debug)
logMsg("devLibA24Malloc() using regular malloc\n",0,0,0,0,0,0);
A24MallocFunc = malloc;
A24FreeFunc = free;
}
@@ -1301,5 +1305,8 @@ void *devLibA24Malloc(size_t size)
void devLibA24Free(void *pBlock)
{
if (devLibA24Debug)
logMsg("devLibA24Free(%p) entered\n", (unsigned long)pBlock,0,0,0,0,0);
A24FreeFunc(pBlock);
}

View File

@@ -139,8 +139,10 @@ int GI(void)
for (cnt=0; cnt < LIST_SIZE; cnt++)
{ /* init the elements of the command table */
#if 0
gpibIntCmds[cnt].head.header.list.list1 = NULL;
gpibIntCmds[cnt].head.header.list.list2 = NULL;
#endif
gpibIntCmds[cnt].head.workStart = gpibWork;
gpibIntCmds[cnt].head.link = 0;
gpibIntCmds[cnt].head.device = 0;
@@ -155,7 +157,7 @@ int GI(void)
}
ans = 0; /* set loop not to exit */
printf("\n\n");
logMsg("\n\n");
while ((ans != 'q') && (ans != 'Q'))
{
@@ -380,6 +382,8 @@ static int sendMsg(void)
if (replyIsBack)
{
if (ibDebug)
taskDelay(60); /* Allow debug printing to complete */
showGpibMsg(msgNum);
}
else
@@ -438,7 +442,7 @@ static int gpibWork(struct gpibIntCmd *pCmd)
}
else if (status > (MAX_MSG_LENGTH - 1)) /* check length of resp */
{
printf("GPIB Response length equaled allocated space !!!\n");
logMsg("GPIB Response length equaled allocated space !!!\n");
pCmd->resp[(MAX_MSG_LENGTH)] = '\0'; /* place \0 at end */
}
else

View File

@@ -391,8 +391,8 @@ STATIC int srqHandler(struct hwpvt *phwpvt, int srqStatus)
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.callback = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process;
((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->head.header.callback.priority = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->processPri;
((struct gpibDpvt*)(phwpvt->unsolicitedDpvt))->head.callback.callback = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process;
((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->head.callback.priority = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->processPri;
callbackRequest((CALLBACK*)phwpvt->unsolicitedDpvt);
}
else

View File

@@ -282,8 +282,8 @@ STATIC int srqHandler(struct hwpvt *phwpvt, int srqStatus)
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.callback = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process;
((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->head.header.callback.priority = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->processPri;
((struct gpibDpvt*)(phwpvt->unsolicitedDpvt))->head.callback.callback = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->process;
((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->head.callback.priority = ((struct gpibDpvt *)(phwpvt->unsolicitedDpvt))->processPri;
callbackRequest((CALLBACK*)phwpvt->unsolicitedDpvt);
}
else