From d9742d52409f14b3e8cca243efcaa58fb82a9790 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Thu, 7 Sep 2017 10:44:53 +0200 Subject: [PATCH] std/rec: make VAL (etc.) of mbbiDirect/mbboDirect LONG (not ULONG because of CA) --- src/std/rec/mbbiDirectRecord.c | 12 ++-- src/std/rec/mbbiDirectRecord.dbd | 86 +++++++++++++++++++++- src/std/rec/mbboDirectRecord.c | 28 ++++---- src/std/rec/mbboDirectRecord.dbd | 118 ++++++++++++++++++++++++++++++- 4 files changed, 218 insertions(+), 26 deletions(-) diff --git a/src/std/rec/mbbiDirectRecord.c b/src/std/rec/mbbiDirectRecord.c index 112272925..7e0c41828 100644 --- a/src/std/rec/mbbiDirectRecord.c +++ b/src/std/rec/mbbiDirectRecord.c @@ -9,7 +9,7 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* mbbiDirectRecord.c - Record Support routines for mbboDirect records */ +/* mbbiDirectRecord.c - Record Support routines for mbbiDirect records */ /* * Original Authors: Bob Dalesio and Matthew Needes * Date: 10-07-93 @@ -92,7 +92,7 @@ struct mbbidset { /* multi bit binary input dset */ static void monitor(mbbiDirectRecord *); static long readValue(mbbiDirectRecord *); -#define NUM_BITS 16 +#define NUM_BITS 32 static long init_record(struct dbCommon *pcommon, int pass) { @@ -114,7 +114,7 @@ static long init_record(struct dbCommon *pcommon, int pass) } recGblInitConstantLink(&prec->siml, DBF_USHORT, &prec->simm); - recGblInitConstantLink(&prec->siol, DBF_USHORT, &prec->sval); + recGblInitConstantLink(&prec->siol, DBF_ULONG, &prec->sval); /* Initialize MASK if the user set NOBT instead */ if (prec->mask == 0 && prec->nobt <= 32) @@ -123,11 +123,11 @@ static long init_record(struct dbCommon *pcommon, int pass) if (pdset->init_record) { status = pdset->init_record(prec); if (status == 0) { - epicsUInt16 val = prec->val; + epicsUInt32 val = prec->val; epicsUInt8 *pBn = &prec->b0; int i; - /* Initialize B0 - BF from VAL */ + /* Initialize B0 - B1F from VAL */ for (i = 0; i < NUM_BITS; i++, pBn++, val >>= 1) *pBn = !! (val & 1); } @@ -188,7 +188,7 @@ static void monitor(mbbiDirectRecord *prec) { epicsUInt16 events = recGblResetAlarms(prec); epicsUInt16 vl_events = events | DBE_VALUE | DBE_LOG; - epicsUInt16 val = prec->val; + epicsUInt32 val = prec->val; epicsUInt8 *pBn = &prec->b0; int i; diff --git a/src/std/rec/mbbiDirectRecord.dbd b/src/std/rec/mbbiDirectRecord.dbd index c4edcfd4e..0aa0cd496 100644 --- a/src/std/rec/mbbiDirectRecord.dbd +++ b/src/std/rec/mbbiDirectRecord.dbd @@ -8,7 +8,7 @@ #************************************************************************* recordtype(mbbiDirect) { include "dbCommon.dbd" - field(VAL,DBF_USHORT) { + field(VAL,DBF_LONG) { prompt("Current Value") promptgroup("40 - Input") asl(ASL0) @@ -39,7 +39,7 @@ recordtype(mbbiDirect) { special(SPC_NOMOD) interest(1) } - field(MLST,DBF_USHORT) { + field(MLST,DBF_LONG) { prompt("Last Value Monitored") special(SPC_NOMOD) interest(3) @@ -54,7 +54,7 @@ recordtype(mbbiDirect) { promptgroup("90 - Simulate") interest(1) } - field(SVAL,DBF_ULONG) { + field(SVAL,DBF_LONG) { prompt("Simulation Value") } field(SIML,DBF_INLINK) { @@ -153,4 +153,84 @@ recordtype(mbbiDirect) { pp(TRUE) interest(1) } + field(B10,DBF_UCHAR) { + prompt("Bit 16") + pp(TRUE) + interest(1) + } + field(B11,DBF_UCHAR) { + prompt("Bit 17") + pp(TRUE) + interest(1) + } + field(B12,DBF_UCHAR) { + prompt("Bit 18") + pp(TRUE) + interest(1) + } + field(B13,DBF_UCHAR) { + prompt("Bit 19") + pp(TRUE) + interest(1) + } + field(B14,DBF_UCHAR) { + prompt("Bit 20") + pp(TRUE) + interest(1) + } + field(B15,DBF_UCHAR) { + prompt("Bit 21") + pp(TRUE) + interest(1) + } + field(B16,DBF_UCHAR) { + prompt("Bit 22") + pp(TRUE) + interest(1) + } + field(B17,DBF_UCHAR) { + prompt("Bit 23") + pp(TRUE) + interest(1) + } + field(B18,DBF_UCHAR) { + prompt("Bit 24") + pp(TRUE) + interest(1) + } + field(B19,DBF_UCHAR) { + prompt("Bit 25") + pp(TRUE) + interest(1) + } + field(B1A,DBF_UCHAR) { + prompt("Bit 26") + pp(TRUE) + interest(1) + } + field(B1B,DBF_UCHAR) { + prompt("Bit 27") + pp(TRUE) + interest(1) + } + field(B1C,DBF_UCHAR) { + prompt("Bit 28") + pp(TRUE) + interest(1) + } + field(B1D,DBF_UCHAR) { + prompt("Bit 29") + pp(TRUE) + interest(1) + } + field(B1E,DBF_UCHAR) { + prompt("Bit 30") + pp(TRUE) + interest(1) + } + field(B1F,DBF_UCHAR) { + prompt("Bit 31") + pp(TRUE) + interest(1) + } } diff --git a/src/std/rec/mbboDirectRecord.c b/src/std/rec/mbboDirectRecord.c index 0a6e3391e..ff0747072 100644 --- a/src/std/rec/mbboDirectRecord.c +++ b/src/std/rec/mbboDirectRecord.c @@ -94,7 +94,7 @@ static void convert(mbboDirectRecord *); static void monitor(mbboDirectRecord *); static long writeValue(mbboDirectRecord *); -#define NUM_BITS 16 +#define NUM_BITS 32 static long init_record(struct dbCommon *pcommon, int pass) { @@ -116,7 +116,7 @@ static long init_record(struct dbCommon *pcommon, int pass) } recGblInitConstantLink(&prec->siml, DBF_USHORT, &prec->simm); - if (recGblInitConstantLink(&prec->dol, DBF_USHORT, &prec->val)) + if (recGblInitConstantLink(&prec->dol, DBF_ULONG, &prec->val)) prec->udf = FALSE; /* Initialize MASK if the user set NOBT instead */ @@ -141,8 +141,8 @@ static long init_record(struct dbCommon *pcommon, int pass) if (!prec->udf && prec->omsl == menuOmslsupervisory) { - /* Set initial B0 - BF from VAL */ - epicsUInt16 val = prec->val; + /* Set initial B0 - B1F from VAL */ + epicsUInt32 val = prec->val; epicsUInt8 *pBn = &prec->b0; int i; @@ -174,9 +174,9 @@ static long process(struct dbCommon *pcommon) if (!pact) { if (!dbLinkIsConstant(&prec->dol) && prec->omsl == menuOmslclosed_loop) { - epicsUInt16 val; + epicsUInt32 val; - if (dbGetLink(&prec->dol, DBR_USHORT, &val, 0, 0)) { + if (dbGetLink(&prec->dol, DBR_ULONG, &val, 0, 0)) { recGblSetSevr(prec, LINK_ALARM, INVALID_ALARM); goto CONTINUE; } @@ -184,11 +184,11 @@ static long process(struct dbCommon *pcommon) } else if (prec->omsl == menuOmslsupervisory) { epicsUInt8 *pBn = &prec->b0; - epicsUInt16 val = 0; - epicsUInt16 bit = 1; + epicsUInt32 val = 0; + epicsUInt32 bit = 1; int i; - /* Construct VAL from B0 - BF */ + /* Construct VAL from B0 - B1F */ for (i = 0; i < NUM_BITS; i++, bit <<= 1) if (*pBn++) val |= bit; @@ -253,7 +253,7 @@ static long special(DBADDR *paddr, int after) if (prec->omsl == menuOmslsupervisory) { /* Adjust VAL corresponding to the bit changed */ epicsUInt8 *pBn = (epicsUInt8 *) paddr->pfield; - int bit = 1 << (pBn - &prec->b0); + epicsUInt32 bit = 1 << (pBn - &prec->b0); if (*pBn) prec->val |= bit; @@ -267,9 +267,9 @@ static long special(DBADDR *paddr, int after) case SPC_RESET: /* OMSL field modified */ if (prec->omsl == menuOmslclosed_loop) { - /* Construct VAL from B0 - BF */ + /* Construct VAL from B0 - B1F */ epicsUInt8 *pBn = &prec->b0; - epicsUInt16 val = 0, bit = 1; + epicsUInt32 val = 0, bit = 1; int i; for (i = 0; i < NUM_BITS; i++, bit <<= 1) @@ -278,8 +278,8 @@ static long special(DBADDR *paddr, int after) prec->val = val; } else if (prec->omsl == menuOmslsupervisory) { - /* Set B0 - BF from VAL and post monitors */ - epicsUInt16 val = prec->val; + /* Set B0 - B1F from VAL and post monitors */ + epicsUInt32 val = prec->val; epicsUInt8 *pBn = &prec->b0; int i; diff --git a/src/std/rec/mbboDirectRecord.dbd b/src/std/rec/mbboDirectRecord.dbd index ad57dc02c..08a5ff96c 100644 --- a/src/std/rec/mbboDirectRecord.dbd +++ b/src/std/rec/mbboDirectRecord.dbd @@ -8,7 +8,7 @@ #************************************************************************* recordtype(mbboDirect) { include "dbCommon.dbd" - field(VAL,DBF_USHORT) { + field(VAL,DBF_LONG) { prompt("Word") promptgroup("50 - Output") asl(ASL0) @@ -62,7 +62,7 @@ recordtype(mbboDirect) { special(SPC_NOMOD) interest(1) } - field(MLST,DBF_ULONG) { + field(MLST,DBF_LONG) { prompt("Last Value Monitored") special(SPC_NOMOD) interest(3) @@ -99,7 +99,7 @@ recordtype(mbboDirect) { interest(2) menu(menuIvoa) } - field(IVOV,DBF_USHORT) { + field(IVOV,DBF_LONG) { prompt("INVALID output value") promptgroup("50 - Output") interest(2) @@ -216,4 +216,116 @@ recordtype(mbboDirect) { pp(TRUE) interest(1) } + field(B10,DBF_UCHAR) { + prompt("Bit 16") + promptgroup("53 - Output 10-17") + special(SPC_MOD) + pp(TRUE) + interest(1) + } + field(B11,DBF_UCHAR) { + prompt("Bit 17") + promptgroup("53 - Output 10-17") + special(SPC_MOD) + pp(TRUE) + interest(1) + } + field(B12,DBF_UCHAR) { + prompt("Bit 18") + promptgroup("53 - Output 10-17") + special(SPC_MOD) + pp(TRUE) + interest(1) + } + field(B13,DBF_UCHAR) { + prompt("Bit 19") + promptgroup("53 - Output 10-17") + special(SPC_MOD) + pp(TRUE) + interest(1) + } + field(B14,DBF_UCHAR) { + prompt("Bit 20") + promptgroup("53 - Output 10-17") + special(SPC_MOD) + pp(TRUE) + interest(1) + } + field(B15,DBF_UCHAR) { + prompt("Bit 21") + promptgroup("53 - Output 10-17") + special(SPC_MOD) + pp(TRUE) + interest(1) + } + field(B16,DBF_UCHAR) { + prompt("Bit 22") + promptgroup("53 - Output 10-17") + special(SPC_MOD) + pp(TRUE) + interest(1) + } + field(B17,DBF_UCHAR) { + prompt("Bit 23") + promptgroup("53 - Output 10-17") + special(SPC_MOD) + pp(TRUE) + interest(1) + } + field(B18,DBF_UCHAR) { + prompt("Bit 24") + promptgroup("54 - Output 18-1F") + special(SPC_MOD) + pp(TRUE) + interest(1) + } + field(B19,DBF_UCHAR) { + prompt("Bit 25") + promptgroup("54 - Output 18-1F") + special(SPC_MOD) + pp(TRUE) + interest(1) + } + field(B1A,DBF_UCHAR) { + prompt("Bit 26") + promptgroup("54 - Output 18-1F") + special(SPC_MOD) + pp(TRUE) + interest(1) + } + field(B1B,DBF_UCHAR) { + prompt("Bit 27") + promptgroup("54 - Output 18-1F") + special(SPC_MOD) + pp(TRUE) + interest(1) + } + field(B1C,DBF_UCHAR) { + prompt("Bit 28") + promptgroup("54 - Output 18-1F") + special(SPC_MOD) + pp(TRUE) + interest(1) + } + field(B1D,DBF_UCHAR) { + prompt("Bit 29") + promptgroup("54 - Output 18-1F") + special(SPC_MOD) + pp(TRUE) + interest(1) + } + field(B1E,DBF_UCHAR) { + prompt("Bit 30") + promptgroup("54 - Output 18-1F") + special(SPC_MOD) + pp(TRUE) + interest(1) + } + field(B1F,DBF_UCHAR) { + prompt("Bit 31") + promptgroup("54 - Output 18-1F") + special(SPC_MOD) + pp(TRUE) + interest(1) + } }