From 6ff271527bdd9887dc01741ca1735d660093550c Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Thu, 7 Sep 2017 10:30:32 +0200 Subject: [PATCH 01/10] std/rec: fix typo in mbboDirect promptgroup --- src/std/rec/mbboDirectRecord.dbd | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/std/rec/mbboDirectRecord.dbd b/src/std/rec/mbboDirectRecord.dbd index 0b4285e32..0c816ad6b 100644 --- a/src/std/rec/mbboDirectRecord.dbd +++ b/src/std/rec/mbboDirectRecord.dbd @@ -96,56 +96,56 @@ recordtype(mbboDirect) { } field(B8,DBF_UCHAR) { prompt("Bit 8") - promptgroup("52 - Output 9-F") + promptgroup("52 - Output 8-F") special(SPC_MOD) pp(TRUE) interest(1) } field(B9,DBF_UCHAR) { prompt("Bit 9") - promptgroup("52 - Output 9-F") + promptgroup("52 - Output 8-F") special(SPC_MOD) pp(TRUE) interest(1) } field(BA,DBF_UCHAR) { prompt("Bit 10") - promptgroup("52 - Output 9-F") + promptgroup("52 - Output 8-F") special(SPC_MOD) pp(TRUE) interest(1) } field(BB,DBF_UCHAR) { prompt("Bit 11") - promptgroup("52 - Output 9-F") + promptgroup("52 - Output 8-F") special(SPC_MOD) pp(TRUE) interest(1) } field(BC,DBF_UCHAR) { prompt("Bit 12") - promptgroup("52 - Output 9-F") + promptgroup("52 - Output 8-F") special(SPC_MOD) pp(TRUE) interest(1) } field(BD,DBF_UCHAR) { prompt("Bit 13") - promptgroup("52 - Output 9-F") + promptgroup("52 - Output 8-F") special(SPC_MOD) pp(TRUE) interest(1) } field(BE,DBF_UCHAR) { prompt("Bit 14") - promptgroup("52 - Output 9-F") + promptgroup("52 - Output 8-F") special(SPC_MOD) pp(TRUE) interest(1) } field(BF,DBF_UCHAR) { prompt("Bit 15") - promptgroup("52 - Output 9-F") + promptgroup("52 - Output 8-F") special(SPC_MOD) pp(TRUE) interest(1) From 4df39bb425454247f0eef1f62e7642a6a00a42da Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Thu, 7 Sep 2017 10:33:11 +0200 Subject: [PATCH 02/10] std/rec: make mbbiDirect prompts consistent with mbboDirect --- src/std/rec/mbbiDirectRecord.dbd | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/std/rec/mbbiDirectRecord.dbd b/src/std/rec/mbbiDirectRecord.dbd index 3fa3d8823..c4edcfd4e 100644 --- a/src/std/rec/mbbiDirectRecord.dbd +++ b/src/std/rec/mbbiDirectRecord.dbd @@ -124,32 +124,32 @@ recordtype(mbbiDirect) { interest(1) } field(BA,DBF_UCHAR) { - prompt("Bit A") + prompt("Bit 10") pp(TRUE) interest(1) } field(BB,DBF_UCHAR) { - prompt("Bit B") + prompt("Bit 11") pp(TRUE) interest(1) } field(BC,DBF_UCHAR) { - prompt("Bit C") + prompt("Bit 12") pp(TRUE) interest(1) } field(BD,DBF_UCHAR) { - prompt("Bit D") + prompt("Bit 13") pp(TRUE) interest(1) } field(BE,DBF_UCHAR) { - prompt("Bit E") + prompt("Bit 14") pp(TRUE) interest(1) } field(BF,DBF_UCHAR) { - prompt("Bit F") + prompt("Bit 15") pp(TRUE) interest(1) } From ab517a9392e088c1b2b8db38cafad7f65e938030 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Thu, 7 Sep 2017 10:34:12 +0200 Subject: [PATCH 03/10] std/rec: move mbboDirect bits to end (as mbbiDirect) --- src/std/rec/mbboDirectRecord.dbd | 132 +++++++++++++++---------------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/src/std/rec/mbboDirectRecord.dbd b/src/std/rec/mbboDirectRecord.dbd index 0c816ad6b..db6cc95f3 100644 --- a/src/std/rec/mbboDirectRecord.dbd +++ b/src/std/rec/mbboDirectRecord.dbd @@ -38,6 +38,72 @@ recordtype(mbboDirect) { promptgroup("50 - Output") interest(1) } + field(RVAL,DBF_ULONG) { + prompt("Raw Value") + special(SPC_NOMOD) + pp(TRUE) + } + field(ORAW,DBF_ULONG) { + prompt("Prev Raw Value") + special(SPC_NOMOD) + interest(3) + } + field(RBV,DBF_ULONG) { + prompt("Readback Value") + special(SPC_NOMOD) + } + field(ORBV,DBF_ULONG) { + prompt("Prev Readback Value") + special(SPC_NOMOD) + interest(3) + } + field(MASK,DBF_ULONG) { + prompt("Hardware Mask") + special(SPC_NOMOD) + interest(1) + } + field(MLST,DBF_ULONG) { + prompt("Last Value Monitored") + special(SPC_NOMOD) + interest(3) + } + field(SHFT,DBF_ULONG) { + prompt("Shift") + promptgroup("50 - Output") + interest(1) + } + field(SIOL,DBF_OUTLINK) { + prompt("Sim Output Specifctn") + promptgroup("90 - Simulate") + interest(1) + } + field(SIML,DBF_INLINK) { + prompt("Sim Mode Location") + promptgroup("90 - Simulate") + interest(1) + } + field(SIMM,DBF_MENU) { + prompt("Simulation Mode") + interest(1) + menu(menuYesNo) + } + field(SIMS,DBF_MENU) { + prompt("Sim mode Alarm Svrty") + promptgroup("90 - Simulate") + interest(2) + menu(menuAlarmSevr) + } + field(IVOA,DBF_MENU) { + prompt("INVALID outpt action") + promptgroup("50 - Output") + interest(2) + menu(menuIvoa) + } + field(IVOV,DBF_USHORT) { + prompt("INVALID output value") + promptgroup("50 - Output") + interest(2) + } field(B0,DBF_UCHAR) { prompt("Bit 0") promptgroup("51 - Output 0-7") @@ -150,70 +216,4 @@ recordtype(mbboDirect) { pp(TRUE) interest(1) } - field(RVAL,DBF_ULONG) { - prompt("Raw Value") - special(SPC_NOMOD) - pp(TRUE) - } - field(ORAW,DBF_ULONG) { - prompt("Prev Raw Value") - special(SPC_NOMOD) - interest(3) - } - field(RBV,DBF_ULONG) { - prompt("Readback Value") - special(SPC_NOMOD) - } - field(ORBV,DBF_ULONG) { - prompt("Prev Readback Value") - special(SPC_NOMOD) - interest(3) - } - field(MASK,DBF_ULONG) { - prompt("Hardware Mask") - special(SPC_NOMOD) - interest(1) - } - field(MLST,DBF_ULONG) { - prompt("Last Value Monitored") - special(SPC_NOMOD) - interest(3) - } - field(SHFT,DBF_ULONG) { - prompt("Shift") - promptgroup("50 - Output") - interest(1) - } - field(SIOL,DBF_OUTLINK) { - prompt("Sim Output Specifctn") - promptgroup("90 - Simulate") - interest(1) - } - field(SIML,DBF_INLINK) { - prompt("Sim Mode Location") - promptgroup("90 - Simulate") - interest(1) - } - field(SIMM,DBF_MENU) { - prompt("Simulation Mode") - interest(1) - menu(menuYesNo) - } - field(SIMS,DBF_MENU) { - prompt("Sim mode Alarm Svrty") - promptgroup("90 - Simulate") - interest(2) - menu(menuAlarmSevr) - } - field(IVOA,DBF_MENU) { - prompt("INVALID outpt action") - promptgroup("50 - Output") - interest(2) - menu(menuIvoa) - } - field(IVOV,DBF_USHORT) { - prompt("INVALID output value") - promptgroup("50 - Output") - interest(2) - } } From 7aa2ae20941b36fd6828a2d9da98e04ae3c85eb8 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Thu, 7 Sep 2017 10:35:09 +0200 Subject: [PATCH 04/10] std/rec: make SHFT field of mbboDirect USHRT (as mbbiDirect) --- src/std/rec/mbboDirectRecord.dbd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/std/rec/mbboDirectRecord.dbd b/src/std/rec/mbboDirectRecord.dbd index db6cc95f3..ad57dc02c 100644 --- a/src/std/rec/mbboDirectRecord.dbd +++ b/src/std/rec/mbboDirectRecord.dbd @@ -67,7 +67,7 @@ recordtype(mbboDirect) { special(SPC_NOMOD) interest(3) } - field(SHFT,DBF_ULONG) { + field(SHFT,DBF_USHORT) { prompt("Shift") promptgroup("50 - Output") interest(1) From d9742d52409f14b3e8cca243efcaa58fb82a9790 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Thu, 7 Sep 2017 10:44:53 +0200 Subject: [PATCH 05/10] 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) + } } From ccc8f75ec75e90d1407eded2e9010b5a861df5ce Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Thu, 7 Sep 2017 11:09:30 +0200 Subject: [PATCH 06/10] std/dev: adapt mbbiDirect/mbboDirect soft support to 32bit --- src/std/dev/devMbbiDirectSoft.c | 4 ++-- src/std/dev/devMbbiDirectSoftCallback.c | 6 +++--- src/std/dev/devMbboDirectSoft.c | 2 +- src/std/dev/devMbboDirectSoftCallback.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/std/dev/devMbbiDirectSoft.c b/src/std/dev/devMbbiDirectSoft.c index 9c929b2b6..4317ad807 100644 --- a/src/std/dev/devMbbiDirectSoft.c +++ b/src/std/dev/devMbbiDirectSoft.c @@ -47,7 +47,7 @@ epicsExportAddress(dset, devMbbiDirectSoft); static long init_record(mbbiDirectRecord *prec) { - if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val)) + if (recGblInitConstantLink(&prec->inp, DBR_LONG, &prec->val)) prec->udf = FALSE; return 0; @@ -56,7 +56,7 @@ static long init_record(mbbiDirectRecord *prec) static long readLocked(struct link *pinp, void *dummy) { mbbiDirectRecord *prec = (mbbiDirectRecord *) pinp->precord; - long status = dbGetLink(pinp, DBR_USHORT, &prec->val, 0, 0); + long status = dbGetLink(pinp, DBR_LONG, &prec->val, 0, 0); if (status) return status; diff --git a/src/std/dev/devMbbiDirectSoftCallback.c b/src/std/dev/devMbbiDirectSoftCallback.c index 93016329f..c4c83f6c2 100644 --- a/src/std/dev/devMbbiDirectSoftCallback.c +++ b/src/std/dev/devMbbiDirectSoftCallback.c @@ -41,7 +41,7 @@ typedef struct devPvt { struct { DBRstatus DBRtime - epicsUInt16 value; + epicsUInt32 value; } buffer; } devPvt; @@ -58,7 +58,7 @@ static void getCallback(processNotify *ppn, notifyGetType type) } assert(type == getFieldType); - pdevPvt->status = dbChannelGetField(ppn->chan, DBR_USHORT, + pdevPvt->status = dbChannelGetField(ppn->chan, DBR_LONG, &pdevPvt->buffer, &pdevPvt->options, &no_elements, 0); } @@ -153,7 +153,7 @@ static long init(int pass) static long init_record(mbbiDirectRecord *prec) { - if (recGblInitConstantLink(&prec->inp, DBR_ENUM, &prec->val)) + if (recGblInitConstantLink(&prec->inp, DBR_LONG, &prec->val)) prec->udf = FALSE; return 0; diff --git a/src/std/dev/devMbboDirectSoft.c b/src/std/dev/devMbboDirectSoft.c index 0c0851980..ebf63a9f8 100644 --- a/src/std/dev/devMbboDirectSoft.c +++ b/src/std/dev/devMbboDirectSoft.c @@ -21,7 +21,7 @@ static long write_mbbo(mbboDirectRecord *prec) { - dbPutLink(&prec->out, DBR_USHORT, &prec->val, 1); + dbPutLink(&prec->out, DBR_LONG, &prec->val, 1); return 0; } diff --git a/src/std/dev/devMbboDirectSoftCallback.c b/src/std/dev/devMbboDirectSoftCallback.c index e64c3d41c..98aa7bb01 100644 --- a/src/std/dev/devMbboDirectSoftCallback.c +++ b/src/std/dev/devMbboDirectSoftCallback.c @@ -29,11 +29,11 @@ static long write_mbbo(mbboDirectRecord *prec) if (prec->pact) return 0; - status = dbPutLinkAsync(plink, DBR_USHORT, &prec->val, 1); + status = dbPutLinkAsync(plink, DBR_LONG, &prec->val, 1); if (!status) prec->pact = TRUE; else if (status == S_db_noLSET) - status = dbPutLink(plink, DBR_USHORT, &prec->val, 1); + status = dbPutLink(plink, DBR_LONG, &prec->val, 1); return status; } From 3b6a4ad5a69ec38610199a281a1351c497601a7f Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Tue, 15 May 2018 15:50:55 +0200 Subject: [PATCH 07/10] doc: update release notes --- documentation/RELEASE_NOTES.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index a4a09c7da..7eb9fdcc9 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -9,6 +9,8 @@

EPICS Base Release 3.16.2

+

Changes made between 3.16.1 and 3.16.2

+ +

Record types mbbiDirect and mbboDirect extended to 32 bit

+ +

The VAL fields of mbbiDirect and mbboDirect records have +been extended from DBF_USHORT (16 bit) to DBF_LONG (32 bit). +New bit fields B10...B1F have been added.

+ +

Device support which accesses the bit fields can test if the macro +mbbiDirectRecord1BF or mbboDirectRecord1BF is +defined. Device support which only accesses RVAL needs no modification.

+

Restore use of ledlib for VxWorks command editing

The epicsReadline refactoring work described below unfortunately disabled the From c80783dfa99844c36b58d34294fd6e70691d3b2c Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Tue, 15 May 2018 16:25:23 +0200 Subject: [PATCH 08/10] std/rec: fix promptgroup labels in mbboDirect --- src/std/rec/mbboDirectRecord.dbd | 48 ++++++++++++++++---------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/std/rec/mbboDirectRecord.dbd b/src/std/rec/mbboDirectRecord.dbd index 08a5ff96c..62c6973e9 100644 --- a/src/std/rec/mbboDirectRecord.dbd +++ b/src/std/rec/mbboDirectRecord.dbd @@ -162,168 +162,168 @@ recordtype(mbboDirect) { } field(B8,DBF_UCHAR) { prompt("Bit 8") - promptgroup("52 - Output 8-F") + promptgroup("52 - Output 8-15") special(SPC_MOD) pp(TRUE) interest(1) } field(B9,DBF_UCHAR) { prompt("Bit 9") - promptgroup("52 - Output 8-F") + promptgroup("52 - Output 8-15") special(SPC_MOD) pp(TRUE) interest(1) } field(BA,DBF_UCHAR) { prompt("Bit 10") - promptgroup("52 - Output 8-F") + promptgroup("52 - Output 8-15") special(SPC_MOD) pp(TRUE) interest(1) } field(BB,DBF_UCHAR) { prompt("Bit 11") - promptgroup("52 - Output 8-F") + promptgroup("52 - Output 8-15") special(SPC_MOD) pp(TRUE) interest(1) } field(BC,DBF_UCHAR) { prompt("Bit 12") - promptgroup("52 - Output 8-F") + promptgroup("52 - Output 8-15") special(SPC_MOD) pp(TRUE) interest(1) } field(BD,DBF_UCHAR) { prompt("Bit 13") - promptgroup("52 - Output 8-F") + promptgroup("52 - Output 8-15") special(SPC_MOD) pp(TRUE) interest(1) } field(BE,DBF_UCHAR) { prompt("Bit 14") - promptgroup("52 - Output 8-F") + promptgroup("52 - Output 8-15") special(SPC_MOD) pp(TRUE) interest(1) } field(BF,DBF_UCHAR) { prompt("Bit 15") - promptgroup("52 - Output 8-F") + promptgroup("52 - Output 8-15") special(SPC_MOD) pp(TRUE) interest(1) } field(B10,DBF_UCHAR) { prompt("Bit 16") - promptgroup("53 - Output 10-17") + promptgroup("53 - Output 16-23") special(SPC_MOD) pp(TRUE) interest(1) } field(B11,DBF_UCHAR) { prompt("Bit 17") - promptgroup("53 - Output 10-17") + promptgroup("53 - Output 16-23") special(SPC_MOD) pp(TRUE) interest(1) } field(B12,DBF_UCHAR) { prompt("Bit 18") - promptgroup("53 - Output 10-17") + promptgroup("53 - Output 16-23") special(SPC_MOD) pp(TRUE) interest(1) } field(B13,DBF_UCHAR) { prompt("Bit 19") - promptgroup("53 - Output 10-17") + promptgroup("53 - Output 16-23") special(SPC_MOD) pp(TRUE) interest(1) } field(B14,DBF_UCHAR) { prompt("Bit 20") - promptgroup("53 - Output 10-17") + promptgroup("53 - Output 16-23") special(SPC_MOD) pp(TRUE) interest(1) } field(B15,DBF_UCHAR) { prompt("Bit 21") - promptgroup("53 - Output 10-17") + promptgroup("53 - Output 16-23") special(SPC_MOD) pp(TRUE) interest(1) } field(B16,DBF_UCHAR) { prompt("Bit 22") - promptgroup("53 - Output 10-17") + promptgroup("53 - Output 16-23") special(SPC_MOD) pp(TRUE) interest(1) } field(B17,DBF_UCHAR) { prompt("Bit 23") - promptgroup("53 - Output 10-17") + promptgroup("53 - Output 16-23") special(SPC_MOD) pp(TRUE) interest(1) } field(B18,DBF_UCHAR) { prompt("Bit 24") - promptgroup("54 - Output 18-1F") + promptgroup("54 - Output 24-31") special(SPC_MOD) pp(TRUE) interest(1) } field(B19,DBF_UCHAR) { prompt("Bit 25") - promptgroup("54 - Output 18-1F") + promptgroup("54 - Output 24-31") special(SPC_MOD) pp(TRUE) interest(1) } field(B1A,DBF_UCHAR) { prompt("Bit 26") - promptgroup("54 - Output 18-1F") + promptgroup("54 - Output 24-31") special(SPC_MOD) pp(TRUE) interest(1) } field(B1B,DBF_UCHAR) { prompt("Bit 27") - promptgroup("54 - Output 18-1F") + promptgroup("54 - Output 24-31") special(SPC_MOD) pp(TRUE) interest(1) } field(B1C,DBF_UCHAR) { prompt("Bit 28") - promptgroup("54 - Output 18-1F") + promptgroup("54 - Output 24-31") special(SPC_MOD) pp(TRUE) interest(1) } field(B1D,DBF_UCHAR) { prompt("Bit 29") - promptgroup("54 - Output 18-1F") + promptgroup("54 - Output 24-31") special(SPC_MOD) pp(TRUE) interest(1) } field(B1E,DBF_UCHAR) { prompt("Bit 30") - promptgroup("54 - Output 18-1F") + promptgroup("54 - Output 24-31") special(SPC_MOD) pp(TRUE) interest(1) } field(B1F,DBF_UCHAR) { prompt("Bit 31") - promptgroup("54 - Output 18-1F") + promptgroup("54 - Output 24-31") special(SPC_MOD) pp(TRUE) interest(1) From 7e293e60a6e9b92adea494403ca6159a2e910ec9 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Tue, 15 May 2018 16:54:46 +0200 Subject: [PATCH 09/10] std/dev,std/rec: treat val/sval/rval as ULONG for mbbiDirect/mbboDirect --- src/std/dev/devMbbiDirectSoft.c | 4 ++-- src/std/dev/devMbbiDirectSoftCallback.c | 4 ++-- src/std/dev/devMbbiDirectSoftRaw.c | 2 +- src/std/dev/devMbboDirectSoft.c | 2 +- src/std/dev/devMbboDirectSoftCallback.c | 4 ++-- src/std/rec/mbboDirectRecord.c | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/std/dev/devMbbiDirectSoft.c b/src/std/dev/devMbbiDirectSoft.c index 4317ad807..861952f8d 100644 --- a/src/std/dev/devMbbiDirectSoft.c +++ b/src/std/dev/devMbbiDirectSoft.c @@ -47,7 +47,7 @@ epicsExportAddress(dset, devMbbiDirectSoft); static long init_record(mbbiDirectRecord *prec) { - if (recGblInitConstantLink(&prec->inp, DBR_LONG, &prec->val)) + if (recGblInitConstantLink(&prec->inp, DBR_ULONG, &prec->val)) prec->udf = FALSE; return 0; @@ -56,7 +56,7 @@ static long init_record(mbbiDirectRecord *prec) static long readLocked(struct link *pinp, void *dummy) { mbbiDirectRecord *prec = (mbbiDirectRecord *) pinp->precord; - long status = dbGetLink(pinp, DBR_LONG, &prec->val, 0, 0); + long status = dbGetLink(pinp, DBR_ULONG, &prec->val, 0, 0); if (status) return status; diff --git a/src/std/dev/devMbbiDirectSoftCallback.c b/src/std/dev/devMbbiDirectSoftCallback.c index c4c83f6c2..d785f7386 100644 --- a/src/std/dev/devMbbiDirectSoftCallback.c +++ b/src/std/dev/devMbbiDirectSoftCallback.c @@ -58,7 +58,7 @@ static void getCallback(processNotify *ppn, notifyGetType type) } assert(type == getFieldType); - pdevPvt->status = dbChannelGetField(ppn->chan, DBR_LONG, + pdevPvt->status = dbChannelGetField(ppn->chan, DBR_ULONG, &pdevPvt->buffer, &pdevPvt->options, &no_elements, 0); } @@ -153,7 +153,7 @@ static long init(int pass) static long init_record(mbbiDirectRecord *prec) { - if (recGblInitConstantLink(&prec->inp, DBR_LONG, &prec->val)) + if (recGblInitConstantLink(&prec->inp, DBR_ULONG, &prec->val)) prec->udf = FALSE; return 0; diff --git a/src/std/dev/devMbbiDirectSoftRaw.c b/src/std/dev/devMbbiDirectSoftRaw.c index f6172cdec..98b4673fc 100644 --- a/src/std/dev/devMbbiDirectSoftRaw.c +++ b/src/std/dev/devMbbiDirectSoftRaw.c @@ -59,7 +59,7 @@ static long init_record(mbbiDirectRecord *prec) static long read_mbbi(mbbiDirectRecord *prec) { - if (!dbGetLink(&prec->inp, DBR_LONG, &prec->rval, 0, 0)) { + if (!dbGetLink(&prec->inp, DBR_ULONG, &prec->rval, 0, 0)) { prec->rval &= prec->mask; if (dbLinkIsConstant(&prec->tsel) && prec->tse == epicsTimeEventDeviceTime) diff --git a/src/std/dev/devMbboDirectSoft.c b/src/std/dev/devMbboDirectSoft.c index ebf63a9f8..75359f283 100644 --- a/src/std/dev/devMbboDirectSoft.c +++ b/src/std/dev/devMbboDirectSoft.c @@ -21,7 +21,7 @@ static long write_mbbo(mbboDirectRecord *prec) { - dbPutLink(&prec->out, DBR_LONG, &prec->val, 1); + dbPutLink(&prec->out, DBR_ULONG, &prec->val, 1); return 0; } diff --git a/src/std/dev/devMbboDirectSoftCallback.c b/src/std/dev/devMbboDirectSoftCallback.c index 98aa7bb01..6d86507ae 100644 --- a/src/std/dev/devMbboDirectSoftCallback.c +++ b/src/std/dev/devMbboDirectSoftCallback.c @@ -29,11 +29,11 @@ static long write_mbbo(mbboDirectRecord *prec) if (prec->pact) return 0; - status = dbPutLinkAsync(plink, DBR_LONG, &prec->val, 1); + status = dbPutLinkAsync(plink, DBR_ULONG, &prec->val, 1); if (!status) prec->pact = TRUE; else if (status == S_db_noLSET) - status = dbPutLink(plink, DBR_LONG, &prec->val, 1); + status = dbPutLink(plink, DBR_ULONG, &prec->val, 1); return status; } diff --git a/src/std/rec/mbboDirectRecord.c b/src/std/rec/mbboDirectRecord.c index ff0747072..eaae38326 100644 --- a/src/std/rec/mbboDirectRecord.c +++ b/src/std/rec/mbboDirectRecord.c @@ -351,7 +351,7 @@ static long writeValue(mbboDirectRecord *prec) case menuYesNoYES: recGblSetSevr(prec, SIMM_ALARM, prec->sims); - return dbPutLink(&prec->siol, DBR_USHORT, &prec->val, 1); + return dbPutLink(&prec->siol, DBR_ULONG, &prec->val, 1); default: recGblSetSevr(prec, SOFT_ALARM, INVALID_ALARM); From 498b248811cd6393b9a12d325935027bcf128e64 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Tue, 22 May 2018 14:14:10 +0200 Subject: [PATCH 10/10] std/rec/test: add test for mbbiDirect/mbboDirect (drop dysfunctional async test from original proposal) --- src/std/rec/test/Makefile | 7 ++ src/std/rec/test/mbbioDirectTest.c | 145 ++++++++++++++++++++++++++++ src/std/rec/test/mbbioDirectTest.db | 47 +++++++++ 3 files changed, 199 insertions(+) create mode 100644 src/std/rec/test/mbbioDirectTest.c create mode 100644 src/std/rec/test/mbbioDirectTest.db diff --git a/src/std/rec/test/Makefile b/src/std/rec/test/Makefile index 94afd4c01..bde69117f 100644 --- a/src/std/rec/test/Makefile +++ b/src/std/rec/test/Makefile @@ -116,6 +116,13 @@ regressTest_SRCS += regressTest_registerRecordDeviceDriver.cpp TESTFILES += $(COMMON_DIR)/regressTest.dbd ../regressArray1.db ../regressHex.db ../regressLinkMS.db TESTS += regressTest +TESTPROD_HOST += mbbioDirectTest +mbbioDirectTest_SRCS += mbbioDirectTest.c +mbbioDirectTest_SRCS += recTestIoc_registerRecordDeviceDriver.cpp +testHarness_SRCS += mbbioDirectTest.c +TESTFILES += ../mbbioDirectTest.db +TESTS += mbbioDirectTest + # epicsRunRecordTests runs all the test programs in a known working order. testHarness_SRCS += epicsRunRecordTests.c diff --git a/src/std/rec/test/mbbioDirectTest.c b/src/std/rec/test/mbbioDirectTest.c new file mode 100644 index 000000000..fb011f662 --- /dev/null +++ b/src/std/rec/test/mbbioDirectTest.c @@ -0,0 +1,145 @@ +/*************************************************************************\ +* Copyright (c) 2017 Dirk Zimoch +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +/* Theory of Operation + * + * For each of the two soft device supports (soft/raw soft/soft), + * there is a combination of mbboDirect -> val / sim -> mbbiDirect. + * + * The intermediate records are of type double (val) and long (sim) to + * check conversion from/to double. + * + * For each device support, the following is done: + * 1. The mbboDirect record is set to a specific value through the database. + * 2. The initial value is checked on both ends. + * 3. Two single bits (5 & 31) are toggled, values checked on both ends. + * 4. Sim mode is activated, one bit (0) is toggled, values are checked, + * data path (old value in val, new value in sim) is checked. + */ + +#include + +#include "dbAccess.h" +#include "errlog.h" +#include "dbStaticLib.h" +#include "dbTest.h" +#include "dbUnitTest.h" +#include "testMain.h" +#include "epicsThread.h" +#include "epicsExport.h" + +static +void testmbbioFields(const char* rec, unsigned int value) +{ + char field[40]; + unsigned int i; + + testdbGetFieldEqual(rec, DBF_ULONG, value); + for (i=0; i < 32; i++) + { + sprintf(field,"%s.B%X", rec, i); + testdbGetFieldEqual(field, DBF_ULONG, (value>>i)&1); + } +} + +static +void testmbbioRecords(unsigned int count, unsigned int value) +{ + char rec[40]; + unsigned int i; + + for (i = 1; i <= count; i++) + { + sprintf(rec, "do%d", i); + testDiag(" ### %s ###", rec); + testmbbioFields(rec, value); + sprintf(rec, "di%d", i); + testmbbioFields(rec, value); + } +} + +static +void putN(const char* pattern, unsigned int count, unsigned int value) +{ + char field[40]; + unsigned int i; + + for (i = 1; i <= count; i++) + { + sprintf(field, pattern, i); + testdbPutFieldOk(field, DBF_ULONG, value); + } +} + +static +void testN(const char* pattern, unsigned int count, unsigned int value) +{ + char field[40]; + unsigned int i; + + for (i = 1; i <= count; i++) + { + sprintf(field, pattern, i); + testdbGetFieldEqual(field, DBF_ULONG, value); + } +} + + +void recTestIoc_registerRecordDeviceDriver(struct dbBase *); + +MAIN(mbbioDirectTest) +{ + unsigned int value = 0xdeadbeef; + unsigned int simvalue = 0; + char macros [40]; + const unsigned int N = 2; + + testPlan(N*((32+1)*2*4+4+3)); + + testdbPrepare(); + + testdbReadDatabase("recTestIoc.dbd", NULL, NULL); + + recTestIoc_registerRecordDeviceDriver(pdbbase); + + sprintf(macros, "INIT=%#x", value); + testdbReadDatabase("mbbioDirectTest.db", NULL, macros); + + eltc(0); + testIocInitOk(); + eltc(1); + + testDiag("##### check initial value #####"); + testmbbioRecords(N, value); + + testDiag("##### set bit 5 #####"); + putN("do%u.B5", N, 1); + value |= (1<<5); + testN("val%d", N, value); + testmbbioRecords(N, value); + + testDiag("##### clear bit 31 (0x1f) #####"); + putN("do%u.B1F", N, 0); + value &= ~(1<<31); + testN("val%d", N, value); + testmbbioRecords(N, value); + + testDiag("##### simulation mode #####"); + dbpf("sim", "1"); + simvalue = value & ~1; + putN("do%u.B0", N, 0); + /* old value in lo* */ + testN("val%d", N, value); + /* sim value in sim* */ + testN("sim%d", N, simvalue); + testmbbioRecords(N, simvalue); + + testIocShutdownOk(); + + testdbCleanup(); + + return testDone(); +} diff --git a/src/std/rec/test/mbbioDirectTest.db b/src/std/rec/test/mbbioDirectTest.db new file mode 100644 index 000000000..ed6e09175 --- /dev/null +++ b/src/std/rec/test/mbbioDirectTest.db @@ -0,0 +1,47 @@ +record(bo, "sim") { + field(ZNAM, "off") + field(ONAM, "simulation") +} + +record(mbboDirect, "do1") { + field(DOL, "$(INIT=0)") + field(DTYP, "Soft Channel") + field(OUT, "val1 PP") + field(SIOL, "sim1 PP") + field(SIML, "sim") + field(PINI, "YES") +} +record(ao, "val1") { + field(FLNK, "di1") +} +record(longout, "sim1") { + field(FLNK, "di1") +} +record(mbbiDirect, "di1") { + field(DTYP, "Soft Channel") + field(INP, "val1") + field(SIOL, "sim1 PP") + field(SIML, "sim") +} + + +record(mbboDirect, "do2") { + field(DOL, "$(INIT=0)") + field(DTYP, "Raw Soft Channel") + field(OUT, "val2 PP") + field(SIOL, "sim2 PP") + field(SIML, "sim") + field(PINI, "YES") +} +record(ao, "val2") { + field(FLNK, "di2") +} +record(longout, "sim2") { + field(FLNK, "di2") +} +record(mbbiDirect, "di2") { + field(DTYP, "Raw Soft Channel") + field(INP, "val2") + field(SIML, "sim") + field(SIOL, "sim2") +}