Skip to content

Commit

Permalink
Fix for lp: #1730727
Browse files Browse the repository at this point in the history
Post monitors on all array-length record fields (often NORD)
when their values get changed.
  • Loading branch information
anjohnson committed Jul 21, 2018
1 parent 0f21196 commit ec351c5
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 42 deletions.
8 changes: 8 additions & 0 deletions documentation/RELEASE_NOTES.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ <h2 align="center">Changes made on the 3.15 branch since 3.15.5</h2>

<!-- Insert new items immediately below here ... -->

<h3>All array records now post monitors on their array-length fields</h3>

<p>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 <a href="https://bugs.launchpad.net/epics-base/+bug/1730727">
Launchpad bug #1730727</a>.</p>

<h3>HOWTO: Converting Wiki Record Reference to POD</h3>

<p>Some documentation has been added to the <tt>dbdToHtml.pl</tt> script
Expand Down
9 changes: 7 additions & 2 deletions src/std/dev/devAaiSoft.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
\*************************************************************************/

/*
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion src/std/dev/devSASoft.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
\*************************************************************************/

/*
Expand Down Expand Up @@ -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)
Expand All @@ -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 &&
Expand Down
7 changes: 6 additions & 1 deletion src/std/dev/devWfSoft.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
\*************************************************************************/

/*
Expand Down Expand Up @@ -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);
Expand Down
36 changes: 24 additions & 12 deletions src/std/rec/aaiRecord.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand All @@ -11,7 +11,7 @@
* Original Author: Dave Barker
*
* C E B A F
*
*
* Continuous Electron Beam Accelerator Facility
* Newport News, Virginia, USA.
*
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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;
}

Expand All @@ -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);
Expand Down Expand Up @@ -314,23 +318,28 @@ 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);
if (status)
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.
Expand All @@ -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;
}

11 changes: 7 additions & 4 deletions src/std/rec/aaoRecord.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand All @@ -11,7 +11,7 @@
* Original Author: Dave Barker
*
* C E B A F
*
*
* Continuous Electron Beam Accelerator Facility
* Newport News, Virginia, USA.
*
Expand Down Expand Up @@ -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;
}

Expand All @@ -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);
Expand Down Expand Up @@ -343,4 +347,3 @@ static long writeValue(aaoRecord *prec)
recGblSetSevr(prec, SOFT_ALARM, INVALID_ALARM);
return -1;
}

8 changes: 6 additions & 2 deletions src/std/rec/compressRecord.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stddef.h>
Expand Down Expand Up @@ -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;
}

Expand Down
18 changes: 10 additions & 8 deletions src/std/rec/subArrayRecord.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
* -----------------
*/
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

Expand All @@ -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);
Expand Down Expand Up @@ -318,4 +321,3 @@ static long readValue(subArrayRecord *prec)

return status;
}

Loading

0 comments on commit ec351c5

Please sign in to comment.