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 -3
View File
@@ -54,13 +54,25 @@ static long init_record(mbbiDirectRecord *prec)
return 0;
}
static long read_mbbi(mbbiDirectRecord *prec)
static long readLocked(struct link *pinp, void *dummy)
{
if (!dbGetLink(&prec->inp, DBR_USHORT, &prec->val, 0, 0)) {
mbbiDirectRecord *prec = (mbbiDirectRecord *) pinp->precord;
if (!dbGetLink(pinp, DBR_USHORT, &prec->val, 0, 0)) {
prec->udf = FALSE;
if (dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);
dbGetTimeStamp(pinp, &prec->time);
}
return 2;
}
static long read_mbbi(mbbiDirectRecord *prec)
{
long status = dbLinkDoLocked(&prec->inp, readLocked, NULL);
if (status == S_db_noLSET)
status = readLocked(&prec->inp, NULL);
return status;
}