Convert devI64inSoft for Link Support
Includes tests to make sure it actually works
This commit is contained in:
@@ -47,32 +47,32 @@ epicsExportAddress(dset, devI64inSoft);
|
||||
|
||||
static long init_record(int64inRecord *prec)
|
||||
{
|
||||
/* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/
|
||||
switch (prec->inp.type) {
|
||||
case CONSTANT:
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_INT64, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
break;
|
||||
case PV_LINK:
|
||||
case DB_LINK:
|
||||
case CA_LINK:
|
||||
break;
|
||||
default:
|
||||
recGblRecordError(S_db_badField, (void *)prec,
|
||||
"devI64inSoft (init_record) Illegal INP field");
|
||||
return S_db_badField;
|
||||
}
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_INT64, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long readLocked(struct link *pinp, void *dummy)
|
||||
{
|
||||
int64inRecord *prec = (int64inRecord *) pinp->precord;
|
||||
long status = dbGetLink(&prec->inp, DBR_INT64, &prec->val, 0, 0);
|
||||
|
||||
if (status) return status;
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(pinp, &prec->time);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static long read_int64in(int64inRecord *prec)
|
||||
{
|
||||
long status;
|
||||
long status = dbLinkDoLocked(&prec->inp, readLocked, NULL);
|
||||
|
||||
if (status == S_db_noLSET)
|
||||
status = readLocked(&prec->inp, NULL);
|
||||
|
||||
status = dbGetLink(&prec->inp, DBR_INT64, &prec->val, 0, 0);
|
||||
if (!status &&
|
||||
prec->tsel.type == CONSTANT &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -165,6 +165,13 @@ static void testArrayInputs()
|
||||
testdbPutFieldOk("sa2.VAL", DBF_LONG, 1);
|
||||
testdbGetArrFieldEqual("sa2.VAL", DBF_LONG, 10, 1, &oneToTwelve[0]);
|
||||
|
||||
testDiag("testScalarInputs");
|
||||
|
||||
testdbGetFieldEqual("li1", DBR_LONG, 1);
|
||||
testdbGetFieldEqual("i64i1", DBR_LONG, 1);
|
||||
testdbGetFieldEqual("li2", DBR_LONG, 1);
|
||||
testdbGetFieldEqual("i64i2", DBR_INT64, 1);
|
||||
|
||||
testIocShutdownOk();
|
||||
testdbCleanup();
|
||||
}
|
||||
@@ -206,7 +213,7 @@ static void testEventRecord()
|
||||
|
||||
MAIN(linkInitTest)
|
||||
{
|
||||
testPlan(68);
|
||||
testPlan(72);
|
||||
|
||||
testLongStringInit();
|
||||
testCalcInit();
|
||||
|
||||
@@ -64,6 +64,19 @@ record(waveform, "wf2") {
|
||||
field(INP, {const:[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]})
|
||||
}
|
||||
|
||||
record(longin, "li1") {
|
||||
field(INP, 1)
|
||||
}
|
||||
record(int64in, "i64i1") {
|
||||
field(INP, 1)
|
||||
}
|
||||
record(longin, "li2") {
|
||||
field(INP, {const:1})
|
||||
}
|
||||
record(int64in, "i64i2") {
|
||||
field(INP, {const:1})
|
||||
}
|
||||
|
||||
record(longin, "count1" ) {
|
||||
field(INP, {calc: {expr:"VAL+1"}})
|
||||
field(SCAN, "Event")
|
||||
|
||||
Reference in New Issue
Block a user