From ec351c5e2f995770b3fc6788b63cf76990fbb2f3 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 20 Jul 2018 23:10:34 -0500 Subject: [PATCH] Fix for lp: #1730727 Post monitors on all array-length record fields (often NORD) when their values get changed. --- documentation/RELEASE_NOTES.html | 8 +++++++ src/std/dev/devAaiSoft.c | 9 ++++++-- src/std/dev/devSASoft.c | 5 ++++- src/std/dev/devWfSoft.c | 7 ++++++- src/std/rec/aaiRecord.c | 36 +++++++++++++++++++++----------- src/std/rec/aaoRecord.c | 11 ++++++---- src/std/rec/compressRecord.c | 8 +++++-- src/std/rec/subArrayRecord.c | 18 +++++++++------- src/std/rec/waveformRecord.c | 26 ++++++++++++----------- 9 files changed, 86 insertions(+), 42 deletions(-) diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 59cd4ce182..8e902238bd 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -16,6 +16,14 @@

Changes made on the 3.15 branch since 3.15.5

+

All array records now post monitors on their array-length fields

+ +

The waveform record has been posting monitors on its NORD field since Base +3.15.0.1; we finally got around to doing the equivalent in all the other +built-in record types, which even required modifying device support in some +cases. This fixes +Launchpad bug #1730727.

+

HOWTO: Converting Wiki Record Reference to POD

Some documentation has been added to the dbdToHtml.pl script diff --git a/src/std/dev/devAaiSoft.c b/src/std/dev/devAaiSoft.c index 586483c924..4aa1f4cc30 100644 --- a/src/std/dev/devAaiSoft.c +++ b/src/std/dev/devAaiSoft.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -71,13 +71,18 @@ static long init_record(aaiRecord *prec) static long read_aai(aaiRecord *prec) { + epicsUInt32 nord = prec->nord; long nRequest = prec->nelm; dbGetLink(prec->simm == menuYesNoYES ? &prec->siol : &prec->inp, prec->ftvl, prec->bptr, 0, &nRequest); + if (nRequest > 0) { prec->nord = nRequest; - prec->udf=FALSE; + if (nord != prec->nord) + db_post_events(prec, &prec->nord, DBE_VALUE | DBE_LOG); + + prec->udf = FALSE; if (prec->tsel.type == CONSTANT && prec->tse == epicsTimeEventDeviceTime) dbGetTimeStamp(&prec->inp, &prec->time); diff --git a/src/std/dev/devSASoft.c b/src/std/dev/devSASoft.c index 6c0c876f0c..5f5d8189fd 100644 --- a/src/std/dev/devSASoft.c +++ b/src/std/dev/devSASoft.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 Lawrence Berkeley Laboratory,The Control Systems * Group, Systems Engineering Department * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -67,6 +67,7 @@ static long init_record(subArrayRecord *prec) static long read_sa(subArrayRecord *prec) { long nRequest = prec->indx + prec->nelm; + epicsUInt32 nord = prec->nord; long ecount; if (nRequest > prec->malm) @@ -89,6 +90,8 @@ static long read_sa(subArrayRecord *prec) ecount = 0; prec->nord = ecount; + if (nord != prec->nord) + db_post_events(prec, &prec->nord, DBE_VALUE | DBE_LOG); if (nRequest > 0 && prec->tsel.type == CONSTANT && diff --git a/src/std/dev/devWfSoft.c b/src/std/dev/devWfSoft.c index f1754f78e8..0d58c5f52b 100644 --- a/src/std/dev/devWfSoft.c +++ b/src/std/dev/devWfSoft.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -67,11 +67,16 @@ static long init_record(waveformRecord *prec) static long read_wf(waveformRecord *prec) { + epicsUInt32 nord = prec->nord; long nRequest = prec->nelm; dbGetLink(&prec->inp, prec->ftvl, prec->bptr, 0, &nRequest); + if (nRequest > 0) { prec->nord = nRequest; + if (nord != prec->nord) + db_post_events(prec, &prec->nord, DBE_VALUE | DBE_LOG); + if (prec->tsel.type == CONSTANT && prec->tse == epicsTimeEventDeviceTime) dbGetTimeStamp(&prec->inp, &prec->time); diff --git a/src/std/rec/aaiRecord.c b/src/std/rec/aaiRecord.c index 5b370fe4c2..088777b307 100644 --- a/src/std/rec/aaiRecord.c +++ b/src/std/rec/aaiRecord.c @@ -2,7 +2,7 @@ * Copyright (c) 2002 Southeastern Universities Research Association, as * Operator of Thomas Jefferson National Accelerator Facility. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* recAai.c */ @@ -11,7 +11,7 @@ * Original Author: Dave Barker * * C E B A F - * + * * Continuous Electron Beam Accelerator Facility * Newport News, Virginia, USA. * @@ -139,12 +139,12 @@ static long init_record(aaiRecord *prec, int pass) } return 0; } - + /* SIML must be a CONSTANT or a PV_LINK or a DB_LINK */ if (prec->siml.type == CONSTANT) { recGblInitConstantLink(&prec->siml,DBF_USHORT,&prec->simm); } - + /* must have read_aai function defined */ if (pdset->number < 5 || pdset->read_aai == NULL) { recGblRecordError(S_dev_missingSup, prec, "aai: init_record"); @@ -204,10 +204,14 @@ static long get_array_info(DBADDR *paddr, long *no_elements, long *offset) static long put_array_info(DBADDR *paddr, long nNew) { aaiRecord *prec = (aaiRecord *)paddr->precord; + epicsUInt32 nord = prec->nord; prec->nord = nNew; if (prec->nord > prec->nelm) prec->nord = prec->nelm; + + if (nord != prec->nord) + db_post_events(prec, &prec->nord, DBE_VALUE | DBE_LOG); return 0; } @@ -220,7 +224,7 @@ static long get_units(DBADDR *paddr, char *units) switch (dbGetFieldIndex(paddr)) { case indexof(VAL): if (prec->ftvl == DBF_STRING || prec->ftvl == DBF_ENUM) - break; + break; case indexof(HOPR): case indexof(LOPR): strncpy(units,prec->egu,DB_UNITS_SIZE); @@ -314,12 +318,11 @@ static void monitor(aaiRecord *prec) static long readValue(aaiRecord *prec) { - long status; struct aaidset *pdset = (struct aaidset *)prec->dset; + long status; if (prec->pact == TRUE){ - status = pdset->read_aai(prec); - return status; + return pdset->read_aai(prec); } status = dbGetLink(&prec->siml, DBR_ENUM, &prec->simm, 0, 0); @@ -327,10 +330,16 @@ static long readValue(aaiRecord *prec) return status; if (prec->simm == menuYesNoNO){ - return pdset->read_aai(prec); + epicsUInt32 nord = prec->nord; + + status = pdset->read_aai(prec); + if (nord != prec->nord) + db_post_events(prec, &prec->nord, DBE_VALUE | DBE_LOG); + return status; } - + if (prec->simm == menuYesNoYES){ + epicsUInt32 nord = prec->nord; /* Device suport is responsible for buffer which might be read-only so we may not be allowed to call dbGetLink on it. @@ -339,10 +348,13 @@ static long readValue(aaiRecord *prec) Thus call device now. */ recGblSetSevr(prec, SIMM_ALARM, prec->sims); - return pdset->read_aai(prec); + + status = pdset->read_aai(prec); + if (nord != prec->nord) + db_post_events(prec, &prec->nord, DBE_VALUE | DBE_LOG); + return status; } recGblSetSevr(prec, SOFT_ALARM, INVALID_ALARM); return -1; } - diff --git a/src/std/rec/aaoRecord.c b/src/std/rec/aaoRecord.c index 565fd28867..d2d652b5e2 100644 --- a/src/std/rec/aaoRecord.c +++ b/src/std/rec/aaoRecord.c @@ -2,7 +2,7 @@ * Copyright (c) 2002 Southeastern Universities Research Association, as * Operator of Thomas Jefferson National Accelerator Facility. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* recAao.c */ @@ -11,7 +11,7 @@ * Original Author: Dave Barker * * C E B A F - * + * * Continuous Electron Beam Accelerator Facility * Newport News, Virginia, USA. * @@ -204,10 +204,14 @@ static long get_array_info(DBADDR *paddr, long *no_elements, long *offset) static long put_array_info(DBADDR *paddr, long nNew) { aaoRecord *prec = (aaoRecord *)paddr->precord; + epicsUInt32 nord = prec->nord; prec->nord = nNew; if (prec->nord > prec->nelm) prec->nord = prec->nelm; + + if (nord != prec->nord) + db_post_events(prec, &prec->nord, DBE_VALUE | DBE_LOG); return 0; } @@ -220,7 +224,7 @@ static long get_units(DBADDR *paddr, char *units) switch (dbGetFieldIndex(paddr)) { case indexof(VAL): if (prec->ftvl == DBF_STRING || prec->ftvl == DBF_ENUM) - break; + break; case indexof(HOPR): case indexof(LOPR): strncpy(units,prec->egu,DB_UNITS_SIZE); @@ -343,4 +347,3 @@ static long writeValue(aaoRecord *prec) recGblSetSevr(prec, SOFT_ALARM, INVALID_ALARM); return -1; } - diff --git a/src/std/rec/compressRecord.c b/src/std/rec/compressRecord.c index fd99412e53..244f6f3992 100644 --- a/src/std/rec/compressRecord.c +++ b/src/std/rec/compressRecord.c @@ -4,12 +4,12 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* * Original Author: Bob Dalesio - * Date: 7-14-89 + * Date: 7-14-89 */ #include @@ -405,11 +405,15 @@ static long get_array_info(DBADDR *paddr, long *no_elements, long *offset) static long put_array_info(DBADDR *paddr, long nNew) { compressRecord *prec = (compressRecord *) paddr->precord; + epicsUInt32 nuse = prec->nuse; prec->off = (prec->off + nNew) % prec->nsam; prec->nuse += nNew; if (prec->nuse > prec->nsam) prec->nuse = prec->nsam; + + if (nuse != prec->nuse) + db_post_events(prec, &prec->nuse, DBE_VALUE | DBE_LOG); return 0; } diff --git a/src/std/rec/subArrayRecord.c b/src/std/rec/subArrayRecord.c index 197750b81b..e480e9184f 100644 --- a/src/std/rec/subArrayRecord.c +++ b/src/std/rec/subArrayRecord.c @@ -2,17 +2,17 @@ * Copyright (c) 2002 Lawrence Berkeley Laboratory,The Control Systems * Group, Systems Engineering Department * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ -/* recSubArray.c - Record Support Routines for SubArray records +/* recSubArray.c - Record Support Routines for SubArray records * * * Author: Carl Lionberger * Date: 090293 * * NOTES: - * Derived from waveform record. + * Derived from waveform record. * Modification Log: * ----------------- */ @@ -124,7 +124,7 @@ static long init_record(subArrayRecord *prec, int pass) } if (pdset->init_record) - return (*pdset->init_record)(prec); + return pdset->init_record(prec); return 0; } @@ -191,11 +191,14 @@ static long get_array_info(DBADDR *paddr, long *no_elements, long *offset) static long put_array_info(DBADDR *paddr, long nNew) { subArrayRecord *prec = (subArrayRecord *) paddr->precord; + epicsUInt32 nord = prec->nord; - if (nNew > prec->malm) - nNew = prec->malm; prec->nord = nNew; + if (prec->nord > prec->malm) + prec->nord = prec->malm; + if (nord != prec->nord) + db_post_events(prec, &prec->nord, DBE_VALUE | DBE_LOG); return 0; } @@ -208,7 +211,7 @@ static long get_units(DBADDR *paddr, char *units) switch (dbGetFieldIndex(paddr)) { case indexof(VAL): if (prec->ftvl == DBF_STRING || prec->ftvl == DBF_ENUM) - break; + break; case indexof(HOPR): case indexof(LOPR): strncpy(units,prec->egu,DB_UNITS_SIZE); @@ -318,4 +321,3 @@ static long readValue(subArrayRecord *prec) return status; } - diff --git a/src/std/rec/waveformRecord.c b/src/std/rec/waveformRecord.c index ab00a39fda..c65d07964e 100644 --- a/src/std/rec/waveformRecord.c +++ b/src/std/rec/waveformRecord.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* recWaveform.c - Record Support Routines for Waveform records */ @@ -184,12 +184,14 @@ static long get_array_info(DBADDR *paddr, long *no_elements, long *offset) static long put_array_info(DBADDR *paddr, long nNew) { waveformRecord *prec = (waveformRecord *) paddr->precord; + epicsUInt32 nord = prec->nord; prec->nord = nNew; if (prec->nord > prec->nelm) prec->nord = prec->nelm; - db_post_events(prec, &prec->nord, DBE_VALUE | DBE_LOG); + if (nord != prec->nord) + db_post_events(prec, &prec->nord, DBE_VALUE | DBE_LOG); return 0; } @@ -202,7 +204,7 @@ static long get_units(DBADDR *paddr, char *units) switch (dbGetFieldIndex(paddr)) { case indexof(VAL): if (prec->ftvl == DBF_STRING || prec->ftvl == DBF_ENUM) - break; + break; case indexof(HOPR): case indexof(LOPR): strncpy(units,prec->egu,DB_UNITS_SIZE); @@ -305,36 +307,37 @@ static void monitor(waveformRecord *prec) static long readValue(waveformRecord *prec) { - long status; struct wfdset *pdset = (struct wfdset *) prec->dset; + long status; if (prec->pact == TRUE){ - return (*pdset->read_wf)(prec); + return pdset->read_wf(prec); } - status = dbGetLink(&(prec->siml), DBR_ENUM, &(prec->simm),0,0); + status = dbGetLink(&prec->siml, DBR_ENUM, &prec->simm, 0, 0); if (status) return status; if (prec->simm == menuYesNoNO){ epicsUInt32 nord = prec->nord; - status = (*pdset->read_wf)(prec); + status = pdset->read_wf(prec); if (nord != prec->nord) db_post_events(prec, &prec->nord, DBE_VALUE | DBE_LOG); return status; } if (prec->simm == menuYesNoYES){ + epicsUInt32 nord = prec->nord; long nRequest = prec->nelm; - status = dbGetLink(&(prec->siol), prec->ftvl, prec->bptr, 0, &nRequest); - /* nord set only for db links: needed for old db_access */ + status = dbGetLink(&prec->siol, prec->ftvl, prec->bptr, 0, &nRequest); if (prec->siol.type != CONSTANT) { prec->nord = nRequest; - db_post_events(prec, &prec->nord, DBE_VALUE | DBE_LOG); + if (nord != prec->nord) + db_post_events(prec, &prec->nord, DBE_VALUE | DBE_LOG); if (status == 0) - prec->udf=FALSE; + prec->udf = FALSE; } } else { recGblSetSevr(prec, SOFT_ALARM, INVALID_ALARM); @@ -344,4 +347,3 @@ static long readValue(waveformRecord *prec) return status; } -