diff --git a/modules/database/src/std/rec/mbboRecord.c b/modules/database/src/std/rec/mbboRecord.c index 83448f19a..7140c7c62 100644 --- a/modules/database/src/std/rec/mbboRecord.c +++ b/modules/database/src/std/rec/mbboRecord.c @@ -35,7 +35,7 @@ #include "special.h" #include "menuOmsl.h" #include "menuIvoa.h" -#include "menuYesNo.h" +#include "menuSimm.h" #define GEN_SIZE_OFFSET #include "mbboRecord.h" @@ -448,14 +448,18 @@ static long writeValue(mbboRecord *prec) } switch (prec->simm) { - case menuYesNoNO: + case menuSimmNO: status = pdset->write_mbbo(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; @@ -467,7 +471,6 @@ static long writeValue(mbboRecord *prec) prec->pact = TRUE; } break; - } default: recGblSetSevr(prec, SOFT_ALARM, INVALID_ALARM); diff --git a/modules/database/src/std/rec/mbboRecord.dbd.pod b/modules/database/src/std/rec/mbboRecord.dbd.pod index 56d031760..ff16cb34f 100644 --- a/modules/database/src/std/rec/mbboRecord.dbd.pod +++ b/modules/database/src/std/rec/mbboRecord.dbd.pod @@ -165,8 +165,9 @@ for converting VAL to RVAL. 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 +If SIMM (fetched through SIML, if populated) is YES, the record is put in SIMS severity and the value is written through SIOL, without conversion. +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. @@ -657,7 +658,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 908d42989..466480531 100644 --- a/modules/database/test/std/rec/simmTest.c +++ b/modules/database/test/std/rec/simmTest.c @@ -66,7 +66,8 @@ static char *rawSupp[] = { "mbbi", "mbbiDirect", "ao", - "bo" + "bo", + "mbbo" }; static @@ -80,6 +81,7 @@ int hasRawSimmSupport(const char *rectype) { #define PVNAMELENGTH 60 static char nameVAL[PVNAMELENGTH]; static char nameB0[PVNAMELENGTH]; +static char nameONVL[PVNAMELENGTH]; static char nameRVAL[PVNAMELENGTH]; static char nameROFF[PVNAMELENGTH]; static char nameSGNL[PVNAMELENGTH]; @@ -103,7 +105,8 @@ static char nameSimvalLEN[PVNAMELENGTH]; static void setNames(const char *name) { - SETNAME(VAL); SETNAME(B0); SETNAME(RVAL); SETNAME(ROFF); SETNAME(SGNL); + SETNAME(VAL); SETNAME(B0); SETNAME(ONVL); + SETNAME(RVAL); SETNAME(ROFF); SETNAME(SGNL); SETNAME(SVAL); SETNAME(SIMM); SETNAME(SIML); SETNAME(SIOL); SETNAME(SIMS); SETNAME(SCAN); SETNAME(PROC); SETNAME(PACT); SETNAME(STAT); SETNAME(SEVR); SETNAME(TSE); @@ -421,6 +424,11 @@ void testSiolWrite(const char *name, testdbPutFieldOk(nameVAL, DBR_USHORT, 1); testdbGetFieldEqual(nameRVAL, DBR_ULONG, 0x55); testdbGetFieldEqual(nameSimval, DBR_ULONG, 0x55); + } else if (strcmp(name, "mbbo") == 0) { + testdbPutFieldOk(nameONVL, DBR_ULONG, 5); + testdbPutFieldOk(nameVAL, DBR_UCHAR, 1); + testdbGetFieldEqual(nameRVAL, DBR_ULONG, 5); + testdbGetFieldEqual(nameSimval, DBR_UCHAR, 5); } testdbPutFieldOk(nameSIML, DBR_STRING, nameSimmode); } @@ -542,7 +550,7 @@ void testAllRecTypes(void) MAIN(simmTest) { - testPlan(1221); + testPlan(1244); startSimmTestIoc("simmTest.db"); testSimmSetup();