Modify soft devices to synchronize TSEL=-2 timestamps

Use dbLinkDoLocked() to ensure a timestamp set by TSEL=-2
comes from the same update as the value.
This commit is contained in:
Andrew Johnson
2017-04-19 16:50:38 -05:00
parent d2db634ed2
commit 89f13aa51b
15 changed files with 236 additions and 62 deletions
+15 -4
View File
@@ -60,18 +60,19 @@ static long init_record(subArrayRecord *prec)
return status;
}
static long read_sa(subArrayRecord *prec)
static long readLocked(struct link *pinp, void *dummy)
{
subArrayRecord *prec = (subArrayRecord *) pinp->precord;
long nRequest = prec->indx + prec->nelm;
long ecount;
if (nRequest > prec->malm)
nRequest = prec->malm;
if (dbLinkIsConstant(&prec->inp))
if (dbLinkIsConstant(pinp))
nRequest = prec->nord;
else
dbGetLink(&prec->inp, prec->ftvl, prec->bptr, 0, &nRequest);
dbGetLink(pinp, prec->ftvl, prec->bptr, 0, &nRequest);
ecount = nRequest - prec->indx;
if (ecount > 0) {
@@ -89,7 +90,17 @@ static long read_sa(subArrayRecord *prec)
if (nRequest > 0 &&
dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);
dbGetTimeStamp(pinp, &prec->time);
return 0;
}
static long read_sa(subArrayRecord *prec)
{
long status = dbLinkDoLocked(&prec->inp, readLocked, NULL);
if (status == S_db_noLSET)
status = readLocked(&prec->inp, NULL);
return status;
}