Convert all Async Soft Channel input devices to use link support

This commit is contained in:
Andrew Johnson
2017-05-27 20:35:53 -05:00
parent 07aa712b07
commit c8fcfbea9f
7 changed files with 93 additions and 147 deletions

View File

@@ -4,7 +4,7 @@
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* devBiSoftCallback.c */
/*
@@ -78,10 +78,11 @@ static long add_record(dbCommon *pcommon)
devPvt *pdevPvt;
processNotify *ppn;
if (plink->type == CONSTANT) return 0;
if (dbLinkIsDefined(plink) && dbLinkIsConstant(plink))
return 0;
if (plink->type != PV_LINK) {
long status = S_db_badField;
long status = S_db_badField;
recGblRecordError(status, (void *)prec,
"devBiSoftCallback (add_record) Illegal INP field");
@@ -90,7 +91,7 @@ static long add_record(dbCommon *pcommon)
chan = dbChannelCreate(plink->value.pv_link.pvname);
if (!chan) {
long status = S_db_notFound;
long status = S_db_notFound;
recGblRecordError(status, (void *)prec,
"devBiSoftCallback (add_record) link target not found");
@@ -127,7 +128,9 @@ static long del_record(dbCommon *pcommon) {
DBLINK *plink = &prec->inp;
devPvt *pdevPvt = (devPvt *)prec->dpvt;
if (plink->type == CONSTANT) return 0;
if (dbLinkIsDefined(plink) && dbLinkIsConstant(plink))
return 0;
assert(plink->type == PN_LINK);
dbNotifyCancel(&pdevPvt->pn);
@@ -150,21 +153,9 @@ static long init(int pass)
static long init_record(biRecord *prec)
{
/* INP must be CONSTANT or PN_LINK */
switch (prec->inp.type) {
case CONSTANT:
if (recGblInitConstantLink(&prec->inp, DBR_ENUM, &prec->val))
prec->udf = FALSE;
break;
case PN_LINK:
/* Handled by add_record */
break;
default:
recGblRecordError(S_db_badField, (void *)prec,
"devBiSoftCallback (init_record) Illegal INP field");
prec->pact = TRUE;
return S_db_badField;
}
if (recGblInitConstantLink(&prec->inp, DBR_ENUM, &prec->val))
prec->udf = FALSE;
return 0;
}
@@ -205,9 +196,10 @@ static long read_bi(biRecord *prec)
break;
}
if (prec->tsel.type == CONSTANT &&
if (dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
prec->time = pdevPvt->buffer.time;
return 2;
}