diff --git a/modules/database/src/std/rec/boRecord.c b/modules/database/src/std/rec/boRecord.c index 05195b880..e093f9cbb 100644 --- a/modules/database/src/std/rec/boRecord.c +++ b/modules/database/src/std/rec/boRecord.c @@ -34,7 +34,7 @@ #include "special.h" #include "menuIvoa.h" #include "menuOmsl.h" -#include "menuYesNo.h" +#include "menuSimm.h" #define GEN_SIZE_OFFSET #include "boRecord.h" @@ -427,14 +427,18 @@ static long writeValue(boRecord *prec) } switch (prec->simm) { - case menuYesNoNO: + case menuSimmNO: status = pdset->write_bo(prec); break; - case menuYesNoYES: { + case menuSimmYES: + case menuSimmRAW: recGblSetSevr(prec, SIMM_ALARM, prec->sims); if (prec->pact || (prec->sdly < 0.)) { - status = dbPutLink(&prec->siol, DBR_USHORT, &prec->val, 1); + if (prec->simm == menuSimmYES) + status = dbPutLink(&prec->siol, DBR_USHORT, &prec->val, 1); + else /* prec->simm == menuSimmRAW */ + status = dbPutLink(&prec->siol, DBR_ULONG, &prec->rval, 1); prec->pact = FALSE; } else { /* !prec->pact && delay >= 0. */ epicsCallback *pvt = prec->simpvt; @@ -446,7 +450,6 @@ static long writeValue(boRecord *prec) prec->pact = TRUE; } break; - } default: recGblSetSevr(prec, SOFT_ALARM, INVALID_ALARM); diff --git a/modules/database/src/std/rec/boRecord.dbd.pod b/modules/database/src/std/rec/boRecord.dbd.pod index bfbc8e820..8c3deabcd 100644 --- a/modules/database/src/std/rec/boRecord.dbd.pod +++ b/modules/database/src/std/rec/boRecord.dbd.pod @@ -206,8 +206,9 @@ The WPDT field is a private field for honoring seconds to hold HIGH. The following fields are used to operate the record in simulation mode. -If SIMM (fetched through SIML) is YES, the record is put in SIMS -severity and the value is written through SIOL. +If SIMM (fetched through SIML, if populated) is YES, the record is put +in SIMS severity and the unconverted value is written through SIOL. +If SIMM is RAW, the value is converted and RVAL is written. SSCN sets a different SCAN mechanism to use in simulation mode. SDLY sets a delay (in sec) that is used for asynchronous simulation processing. @@ -352,7 +353,7 @@ for more information on simulation mode and its fields. prompt("Simulation Mode") special(SPC_MOD) interest(1) - menu(menuYesNo) + menu(menuSimm) } field(SIMS,DBF_MENU) { prompt("Simulation Mode Severity") diff --git a/modules/database/test/std/rec/simmTest.c b/modules/database/test/std/rec/simmTest.c index 14deb7a1f..908d42989 100644 --- a/modules/database/test/std/rec/simmTest.c +++ b/modules/database/test/std/rec/simmTest.c @@ -65,7 +65,8 @@ static char *rawSupp[] = { "bi", "mbbi", "mbbiDirect", - "ao" + "ao", + "bo" }; static @@ -403,15 +404,24 @@ void testSiolWrite(const char *name, testdbPutFieldOk(nameVAL, DBR_LONG, 1); testdbGetFieldEqual(nameSimval, DBR_USHORT, 1); - if(hasRawSimmSupport(name)){ + if (hasRawSimmSupport(name)) { testDiag("in simmRAW, RVAL should be written to SIOL"); testDiag("SIML overrides SIMM, disable it here"); testdbPutFieldOk(nameSIML, DBR_STRING, ""); testdbPutFieldOk(nameSIMM, DBR_STRING, "RAW"); - testdbPutFieldOk(nameROFF, DBR_ULONG, 2); - testdbPutFieldOk(nameVAL, DBR_DOUBLE, 5.); - testdbGetFieldEqual(nameRVAL, DBR_LONG, 3); - testdbGetFieldEqual(nameSimval, DBR_DOUBLE, 3.); + if (strcmp(name, "ao") == 0) { + testdbPutFieldOk(nameROFF, DBR_ULONG, 2); + testdbPutFieldOk(nameVAL, DBR_DOUBLE, 5.); + testdbGetFieldEqual(nameRVAL, DBR_LONG, 3); + testdbGetFieldEqual(nameSimval, DBR_DOUBLE, 3.); + } else if (strcmp(name, "bo") == 0) { + boRecord *prec; + prec = (boRecord *) testdbRecordPtr("bo"); + prec->mask = 0x55; + testdbPutFieldOk(nameVAL, DBR_USHORT, 1); + testdbGetFieldEqual(nameRVAL, DBR_ULONG, 0x55); + testdbGetFieldEqual(nameSimval, DBR_ULONG, 0x55); + } testdbPutFieldOk(nameSIML, DBR_STRING, nameSimmode); } @@ -532,7 +542,7 @@ void testAllRecTypes(void) MAIN(simmTest) { - testPlan(1199); + testPlan(1221); startSimmTestIoc("simmTest.db"); testSimmSetup();