Compare commits

...

8 Commits

Author SHA1 Message Date
John Winans
e7e17f07af Probable race condition in PEP TX task. Moved the final transmission
byte assignment into the point where the busy list is locked.  This
is how the Xycom TX task has worked all along.  This change fixed
seems to have fixed an apparant race condition where the receive task
gets a response to a transmitted message BEFORE the TX task gets
it on the busy list.
1995-03-24 21:24:25 +00:00
Janet B. Anderson
8a23d381c4 Added define for USG 1995-03-24 15:29:08 +00:00
Janet B. Anderson
46b9bb6e6a Changed bcopy to memcpy and added include for string.h 1995-03-24 15:28:20 +00:00
Marty Kraimer
9ab85124d3 Allow pvnames to contain ; 1995-03-24 13:42:21 +00:00
Ned Arnold
b8f07e873d Version 1.15 always fills in RxCV, even if RxPV's are not valid. 1995-03-17 17:51:55 +00:00
John Winans
0cfd58942f Added waveform writing support 1995-03-10 16:55:40 +00:00
Jeff Hill
b75d3964d7 more ANSI C changes and fixed send call back lost problem 1995-03-08 17:44:46 +00:00
cvs2svn
b9c8cd50e0 This commit was manufactured by cvs2svn to create tag 'R3.12.0-beta9'. 1995-03-08 13:48:39 +00:00
12 changed files with 129 additions and 77 deletions

View File

@@ -1,6 +1,6 @@
integer [0-9]
name [a-zA-Z0-9_\.]
pvname [a-zA-Z0-9_:\.\[\]<>]
pvname [a-zA-Z0-9_:\.\[\]<>;]
string [a-zA-Z0-9_\,\./\*#\[\]%: ;!|\'\-&\(\)@\?\+<>=\$]
%{

View File

@@ -1,5 +1,5 @@
pvname [a-zA-Z0-9_\-:\.\[\]<>]
pvname [a-zA-Z0-9_\-:\.\[\]<>;]
value [a-zA-Z0-9_\,\^~\./\*#\[\]%: ;!|\'\-&\(\)@\?\+<>=\$\{\}]
%{

View File

@@ -3,6 +3,9 @@
/*
* $Log$
* Revision 1.23 1995/01/06 16:55:52 winans
* Added the log parameter to the doc
*
*
* Author: John Winans
* Origional Author: Ned D. Arnold
@@ -2464,6 +2467,7 @@ void (*process)();
/* make sure the command type makes sendse for the record type */
if (parmBlock->gpibCmds[((struct gpibDpvt *)pwf->dpvt)->parm].type != GPIBREAD &&
parmBlock->gpibCmds[((struct gpibDpvt *)pwf->dpvt)->parm].type != GPIBWRITE &&
parmBlock->gpibCmds[((struct gpibDpvt *)pwf->dpvt)->parm].type != GPIBSOFT &&
parmBlock->gpibCmds[((struct gpibDpvt *)pwf->dpvt)->parm].type != GPIBREADW)
{
@@ -2540,9 +2544,11 @@ int
devGpibLib_wfGpibWork(pdpvt)
struct gpibDpvt *pdpvt;
{
int OperationStatus;
struct waveformRecord *pwf= ((struct waveformRecord *)(pdpvt->precord));
struct gpibCmd *pCmd;
struct devGpibParmBlock *parmBlock;
short ibnode = pdpvt->head.device;
parmBlock = (struct devGpibParmBlock *)(((gDset*)(pwf->dset))->funPtr[pwf->dset->number]);
@@ -2553,31 +2559,60 @@ struct gpibDpvt *pdpvt;
if(*(parmBlock->debugFlag))
printf("devGpibLib_wfGpibWork: starting ...command type = %d\n",pCmd->type);
if (devGpibLib_xxGpibWork(pdpvt, pCmd->type, -1) == ERROR)
{
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(&pdpvt->head.header.callback);
#endif
/**** Handle writes internally... the generic routine will not work ****/
if (pCmd->type == GPIBWRITE)
{
/*
* check to see if this node has timed out within last 10 sec
*/
if(tickGet() < (pdpvt->phwpvt->tmoVal + parmBlock->timeWindow) )
{
if (*parmBlock->debugFlag)
printf("devGpibLib_xxGpibWork(): timeout flush\n");
OperationStatus = ERROR;
}
else
{
OperationStatus = (*(drvGpib.writeIb))(pdpvt->head.pibLink,
ibnode, pdpvt->msg, pCmd->msgLen, pdpvt->head.dmaTimeout);
if(*parmBlock->debugFlag)
printf("devGpibLib_xxGpibWork : done, status = %d\n",OperationStatus);
/* if error occurrs then mark it with time */
if(OperationStatus == ERROR)
{
(pdpvt->phwpvt->tmoCount)++; /* count timeouts */
pdpvt->phwpvt->tmoVal = tickGet(); /* set last timeout time */
}
}
}
else
{
OperationStatus = devGpibLib_xxGpibWork(pdpvt, pCmd->type, -1);
}
if (OperationStatus == ERROR)
{
devGpibLib_setPvSevr(pwf,READ_ALARM,VALID_ALARM);
RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt);
}
else
{
if (pCmd->type != GPIBREADW)
devGpibLib_wfGpibFinish(pdpvt); /* If not waiting on SRQ, finish */
else
{
if (*(parmBlock->debugFlag) || ibSrqDebug)
printf("%s: marking srq Handler for READW operation\n", parmBlock->name);
pdpvt->phwpvt->srqCallback = (int (*)())(((gDset*)(pwf->dset))->funPtr[pwf->dset->number + 2]);
pdpvt->phwpvt->parm = (caddr_t)pdpvt; /* mark the handler */
return(BUSY); /* indicate device still in use */
else
{
if (*(parmBlock->debugFlag) || ibSrqDebug)
printf("%s: marking srq Handler for READW operation\n", parmBlock->name);
pdpvt->phwpvt->srqCallback = (int (*)())(((gDset*)(pwf->dset))->funPtr[pwf->dset->number + 2]);
pdpvt->phwpvt->parm = (caddr_t)pdpvt; /* mark the handler */
return(BUSY); /* indicate device still in use */
}
}
}
return(IDLE); /* indicate device is now idle */
}
@@ -2608,13 +2643,7 @@ 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(&pdpvt->head.header.callback);
#endif
}
devGpibLib_wfGpibFinish(pdpvt); /* and finish the processing */
@@ -2651,13 +2680,7 @@ 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(&pdpvt->head.header.callback);
#endif
return(0);
}

View File

@@ -65,6 +65,10 @@
* This driver currently needs work on error message generation.
*
* $Log$
* Revision 1.36 1994/12/16 16:11:26 winans
* Added debug flag guards to ALL printing. The default debug level is set
* to 1 -- this provides the same output as the old version.
*
* Revision 1.35 1994/12/12 16:02:57 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
@@ -2459,10 +2463,13 @@ STATIC int pepTxTask(int link)
/* Send the message in polled mode */
txTCount = pnode->txMsg.length;
/* BUG -- would be nice if we verify the length >6 here */
txCCount = 0;
txMsg = &(pnode->txMsg.length);
while ((txCCount < txTCount) && (pBBLink[link]->abortFlag == 0)) {
while ((txCCount < txTCount -1) && (pBBLink[link]->abortFlag == 0)) {
stuck = 1000;
while (((pBBLink[link]->l.PepLink.bbRegs->stat_ctl & PEP_BB_TFNF)
@@ -2487,12 +2494,13 @@ STATIC int pepTxTask(int link)
if (bbDebug>30)
printf("pepTxTask(%d): outputting %2.2X\n",link,0x00);
pBBLink[link]->l.PepLink.bbRegs->data = 0x00;
}
else if (txCCount == (txTCount -1)) { /* last byte of package */
#if 0
} else if (txCCount == (txTCount -1)) { /* last byte of package */
pBBLink[link]->l.PepLink.bbRegs->stat_ctl = *txMsg;
if (bbDebug>30)
printf("pepTxTask(%d): outputting last byte %2.2X\n",
link,*txMsg);
#endif
} else { /* regular ol' message byte */
pBBLink[link]->l.PepLink.bbRegs->data = *txMsg;
if (bbDebug>30)
@@ -2536,6 +2544,11 @@ STATIC int pepTxTask(int link)
{
/* Lock the busy list */
semTake(pBBLink[link]->busyList.sem, WAIT_FOREVER);
pBBLink[link]->l.PepLink.bbRegs->stat_ctl = *txMsg;
if (bbDebug>30)
printf("pepTxTask(%d): outputting last byte %2.2X\n",
link,*txMsg);
/* set the retire time */
pnode->retire = tickGet();

View File

@@ -62,6 +62,10 @@
* if we are in fdmgr_pend_event()
* .15 joh 011993 Created fdmgr header file
* .16 joh 011993 Converted to ANSI C
* .17 joh 030895 More ANSI C changes and fixed lost send callback
* problem (send call back discarded when fdmgr pend
* event time out expires even if the send call back
* has not been called at least once).
*
* NOTES:
*
@@ -98,6 +102,7 @@ static char *pSccsId = "@(#) $Id$";
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
#ifdef vxWorks
#include <vxWorks.h>
@@ -183,9 +188,7 @@ fdctx *pfdctx,
struct timeval *pt
);
LOCAL void select_alarm(
fdctx *pfdctx
);
LOCAL void select_alarm(void *pParam);
LOCAL int fdmgr_select(
fdctx *pfdctx,
@@ -270,7 +273,7 @@ int fdmgr_delete(fdctx *pfdctx)
fdmgrAlarm *fdmgr_add_timeout(
fdctx *pfdctx,
struct timeval *ptimeout,
void (*func)(),
void (*func)(void *),
void *param
)
{
@@ -331,10 +334,10 @@ void *param
}
}
if(pa){
ellInsert(&pfdctx->alarm_list, pa->node.previous, (ELLNODE*)palarm);
ellInsert(&pfdctx->alarm_list, pa->node.previous, &palarm->node);
}
else{
ellAdd(&pfdctx->alarm_list,(ELLNODE*) palarm);
ellAdd(&pfdctx->alarm_list, &palarm->node);
}
palarm->alt = alt_alarm;
UNLOCK(pfdctx);
@@ -361,8 +364,8 @@ fdmgrAlarm *palarm
LOCK(pfdctx);
alt = palarm->alt;
if(alt == alt_alarm){
ellDelete(&pfdctx->alarm_list, (ELLNODE*)palarm);
ellAdd(&pfdctx->free_alarm_list, (ELLNODE*)palarm);
ellDelete(&pfdctx->alarm_list, &palarm->node);
ellAdd(&pfdctx->free_alarm_list, &palarm->node);
palarm->alt = alt_free;
status = OK;
}
@@ -424,7 +427,7 @@ fdmgrAlarm *palarm
int fdmgr_add_fd(
fdctx *pfdctx,
int fd,
void (*pfunc)(),
void (*pfunc)(void *),
void *param
)
{
@@ -450,7 +453,7 @@ int fdmgr_add_callback(
fdctx *pfdctx,
int fd,
enum fdi_type fdi,
void (*pfunc)(),
void (*pfunc)(void *),
void *param
)
{
@@ -496,7 +499,7 @@ void *param
pfdentry->delete_pending = FALSE;
LOCK(pfdctx);
ellAdd(&pfdctx->fdentry_list, (ELLNODE*)pfdentry);
ellAdd(&pfdctx->fdentry_list, &pfdentry->node);
UNLOCK(pfdctx);
return OK;
@@ -543,7 +546,7 @@ enum fdi_type fdi
pfdentry = (fdentry *) pfdentry->node.next){
if(pfdentry->fd == fd && pfdentry->fdi == fdi){
ellDelete(&pfdctx->fdentry_list, (ELLNODE*)pfdentry);
ellDelete(&pfdctx->fdentry_list, &pfdentry->node);
fdmgr_finish_off_fdentry(pfdctx, pfdentry);
status = OK;
break;
@@ -604,7 +607,7 @@ register fdentry *pfdentry
)
{
FD_CLR(pfdentry->fd, pfdentry->pfds);
ellAdd(&pfdctx->fdentry_free_list, (ELLNODE*)pfdentry);
ellAdd(&pfdctx->fdentry_free_list, &pfdentry->node);
}
@@ -619,9 +622,8 @@ struct timeval *ptimeout
)
{
int status;
extern errno;
struct timeval t;
fdmgrAlarm *palarm;
fdmgrAlarm *palarm;
lockFDMGRPendEvent(pfdctx);
@@ -740,8 +742,8 @@ struct timeval *ptimeout
ptimeout->tv_usec);
else
fdmgrPrintf(
"fdmgr: error from select %d\n",
errno);
"fdmgr: error from select %s\n",
strerror(errno));
return labor_performed;
}
@@ -752,14 +754,14 @@ struct timeval *ptimeout
LOCK(pfdctx)
pfdentry = (fdentry *) pfdentry->node.next;
if(pfdentry){
ellDelete(&pfdctx->fdentry_list, (ELLNODE*)pfdentry);
ellDelete(&pfdctx->fdentry_list, &pfdentry->node);
/*
*
* holding place where it can be marked
* pending delete but not deleted
*
*/
ellAdd(&pfdctx->fdentry_in_use_list, (ELLNODE*)pfdentry);
ellAdd(&pfdctx->fdentry_in_use_list, &pfdentry->node);
}
UNLOCK(pfdctx)
@@ -784,26 +786,29 @@ struct timeval *ptimeout
*/
if(!pfdentry->delete_pending){
(*pfdentry->pfunc)(pfdentry->param);
/*
* writes are one shots
*/
if (pfdentry->fdi==fdi_write) {
pfdentry->delete_pending = TRUE;
}
labor_performed = TRUE;
}
UNLOCK_FD_HANDLER(pfdctx);
}
LOCK(pfdctx)
ellDelete(&pfdctx->fdentry_in_use_list, (ELLNODE*)pfdentry);
ellDelete(&pfdctx->fdentry_in_use_list, &pfdentry->node);
/*
* if it is marked pending delete
* reset it and place it on the free list
*
* write fd interest is treated as a one shot
* so remove them after each action
*/
if(pfdentry->delete_pending || pfdentry->fdi==fdi_write){
if(pfdentry->delete_pending){
fdmgr_finish_off_fdentry(pfdctx, pfdentry);
}
else{
ellAdd(&pfdctx->fdentry_list, (ELLNODE*)pfdentry);
ellAdd(&pfdctx->fdentry_list, &pfdentry->node);
}
UNLOCK(pfdctx)
@@ -828,8 +833,8 @@ struct timeval *poffset
{
struct timeval t;
int status;
fdmgrAlarm *pa;
fdmgrAlarm *nextpa;
fdmgrAlarm *pa;
fdmgrAlarm *nextpa;
status = fdmgr_gettimeval(pfdctx, &t);
assert (status >= 0);
@@ -842,9 +847,9 @@ struct timeval *poffset
if(pa->t.tv_usec > t.tv_usec)
break;
nextpa = (fdmgrAlarm*)pa->node.next;
ellDelete(&pfdctx->alarm_list, (ELLNODE*)pa);
ellAdd(&pfdctx->expired_alarm_list, (ELLNODE*)pa);
nextpa = (fdmgrAlarm*) pa->node.next;
ellDelete(&pfdctx->alarm_list, &pa->node);
ellAdd(&pfdctx->expired_alarm_list, &pa->node);
pa->alt = alt_expired;
}
UNLOCK(pfdctx);
@@ -924,10 +929,10 @@ struct timeval *poffset
* select_alarm()
*
*/
LOCAL void select_alarm(
fdctx *pfdctx
)
LOCAL void select_alarm(void *pParam)
{
fdctx *pfdctx = pParam;
pfdctx->select_tmo = TRUE;
}

View File

@@ -57,9 +57,12 @@
* .13 03-02-95 nda Post .val field when a new point is complete during a
* scan. This will assist in poin by point plots.
* .14 03-02-95 nda Bug fix on filling PxRA's. ALWAYS CALL CHCK_MOTORS.
* .15 03-15-95 nda If no readback PV (RxPV) is specified, copy desired
* value (PxDV) to current value (RxCV). Now, plotting
* programs can always monitor RxCV.
*/
#define VERSION 1.14
#define VERSION 1.15
@@ -1056,6 +1059,7 @@ struct scanRecord *pscan;
abortScan = 1;
}
} else {
pscan->r1cv = pscan->p1dv;
pscan->p1ra[pscan->cpt] = pscan->p1dv;
}
if(!pscan->r2nv) {
@@ -1071,6 +1075,7 @@ struct scanRecord *pscan;
abortScan = 1;
}
} else { /* no readback PV, stuff with desired value */
pscan->r2cv = pscan->p2dv;
pscan->p2ra[pscan->cpt] = pscan->p2dv;
}
if(!pscan->r3nv) {
@@ -1086,6 +1091,7 @@ struct scanRecord *pscan;
abortScan = 1;
}
} else { /* no readback PV, stuff with desired value */
pscan->r3cv = pscan->p3dv;
pscan->p3ra[pscan->cpt] = pscan->p3dv;
}
if(!pscan->r4nv) {
@@ -1101,6 +1107,7 @@ struct scanRecord *pscan;
abortScan = 1;
}
} else { /* no readback PV, stuff with desired value */
pscan->r4cv = pscan->p4dv;
pscan->p4ra[pscan->cpt] = pscan->p4dv;
}

View File

@@ -41,6 +41,7 @@
#define ANSI
#include "seq.h"
#include <string.h>
LOCAL VOID *getPtrToValue(union db_access_val *, chtype);
@@ -119,7 +120,7 @@ struct event_handler_args args;
/* Copy value returned into user variable */
pVal = getPtrToValue((union db_access_val *)args.dbr, pDB->get_type);
nbytes = pDB->size * pDB->count;
bcopy(pVal, pDB->var, nbytes);
memcpy(pDB->var, pVal, nbytes);
/* Copy status & severity */
dbr_sts_ptr = (struct dbr_sts_char *)args.dbr;
@@ -355,7 +356,7 @@ struct event_handler_args args;
/* Copy value returned into user variable */
pVal = getPtrToValue((union db_access_val *)args.dbr, pDB->get_type);
nbytes = pDB->size * pDB->count;
bcopy(pVal, pDB->var, nbytes);
memcpy(pDB->var, pVal, nbytes);
/* Copy status & severity */
dbr_sts_ptr = (struct dbr_sts_char *)args.dbr;

View File

@@ -14,6 +14,7 @@
***************************************************************************/
#define ANSI
#include "seq.h"
#include <string.h>
LOCAL int macNameLth(char *);
LOCAL int seqMacParseName(char *);
@@ -164,7 +165,7 @@ SPROG *pSP;
name = seqAlloc(pSP, nChar+1);
if (name == NULL)
break;
bcopy(pMacStr, name, nChar);
memcpy(name, pMacStr, nChar);
name[nChar] = 0;
#ifdef DEBUG
printf("name=%s, nChar=%d\n", name, nChar);
@@ -198,7 +199,7 @@ SPROG *pSP;
value = seqAlloc(pSP, nChar+1);
if (value == NULL)
break;
bcopy(pMacStr, value, nChar);
memcpy(value, pMacStr, nChar);
value[nChar] = 0;
pMacStr += nChar;
#ifdef DEBUG

View File

@@ -31,6 +31,7 @@
*/
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "parse.h"
#ifndef TRUE

View File

@@ -95,7 +95,7 @@ FPNUM (\-?(([0-9]+)(\.[0-9]*)?)|(\.[0-9]+))
line_num++;
}
<PP>{FPNUM} { nc = strlen(yytext);
bcopy(yytext, str_next, nc+1);
memcpy(str_next, yytext, nc+1);
yylval.pchar = str_next;
str_next += nc+1;
RETURN(NUMBER);

View File

@@ -16,6 +16,7 @@
extern char *sncVersion; /* snc version and date created */
#include <stdio.h>
#include <string.h>
#ifndef TRUE
#define TRUE 1
@@ -200,9 +201,9 @@ char *s;
int ls;
ls = strlen(s);
bcopy(s, in_file, ls);
memcpy(in_file, s, ls);
in_file[ls] = 0;
bcopy(s, out_file, ls);
memcpy(out_file, s, ls);
if ( strcmp(&in_file[ls-3], ".st") == 0 )
{
out_file[ls-2] = 'c';

View File

@@ -11,7 +11,7 @@ SKELETON_FILE=include/flex.skel.static
ifeq ($(T_A),hp700)
USR_CFLAGS = -DDEFAULT_SKELETON_FILE=\"$(SKELETON_FILE)\" -DSCO_UNIX
else
USR_CFLAGS = -DDEFAULT_SKELETON_FILE=\"$(SKELETON_FILE)\"
USR_CFLAGS = -DDEFAULT_SKELETON_FILE=\"$(SKELETON_FILE)\" -DUSG
endif
USR_LDLIBS = -s