EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: monitors on array variables
From: Mark Rivers via Tech-talk <tech-talk at aps.anl.gov>
To: Michael Davidsaver <mdavidsaver at gmail.com>, "Siddons, David" <siddons at bnl.gov>
Cc: EPICS Tech-Talk <tech-talk at aps.anl.gov>
Date: Wed, 18 Mar 2020 17:45:38 +0000
> db_post_events() must be called with whatever address is in DBADDR::pfield
> which by default in this case is '&val' but this can be changed in the
> cvt_dbaddr callback.  Indeed waveformRecord used to do this.


This is cvt_dbaddr from mcaRecord.c.  Note that it sets paddr->pfield to bptr if the fieldIndex is VAL.


static long cvt_dbaddr(struct dbAddr *paddr)
{
    mcaRecord *pmca=(mcaRecord *)paddr->precord;
    int fieldIndex = dbGetFieldIndex(paddr);

    if (fieldIndex == mcaRecordVAL) {
        paddr->pfield = (void *)(pmca->bptr);
    } else if (fieldIndex == mcaRecordBG) {
        paddr->pfield = (void *)(pmca->pbg);
    }
    paddr->no_elements = pmca->nmax;
    paddr->field_type = pmca->ftvl;
    if (pmca->ftvl==0)  paddr->field_size = MAX_STRING_SIZE;
    else paddr->field_size = sizeofTypes[pmca->ftvl];
    paddr->dbr_field_type = pmca->ftvl;
    return(0);
}

Pete, what does your cvt_dbaddr look like?

Mark



________________________________
From: Michael Davidsaver <mdavidsaver at gmail.com>
Sent: Wednesday, March 18, 2020 11:54 AM
To: Mark Rivers; Siddons, David
Cc: EPICS Tech-Talk
Subject: Re: monitors on array variables

On 3/18/20 9:47 AM, Mark Rivers wrote:
>> by analogy waveformRecord has
>>> db_post_events(prec, &prec->val, monitor_mask);
>> note 'val' not 'bptr'.
>
>
> The mca record has worked with no changes in 3.14, 3.15, and 7.0.3 with these lines:
>
>
> mcaRecord.dbd:
> recordtype(mca) {
>         include "dbCommon.dbd"
>         field(VERS,DBF_DOUBLE) {
>                 prompt("Code Version")
>                 special(SPC_NOMOD)
>                 initial("1")
>         }
>         field(VAL,DBF_NOACCESS) {
>                 prompt("Value")
>                 special(SPC_DBADDR)
>                 pp(TRUE)
>                 size(4)
>                 extra("void *val")
>         }
>         field(BPTR,DBF_NOACCESS) {
>                 prompt("Buffer Pointer")
>                 special(SPC_NOMOD)
>                 interest(4)
>                 size(4)
>                 extra("void *bptr")
>         }
>
> mcaRecord.c:
>     if (MARKED(M_VAL)) db_post_events(pmca,pmca->bptr,monitor_mask);
>
> So it is posting monitors on the bptr field, not the val field, and it seems to work fine.
>
>
> It looks like Pete is doing what the mca record does, but it is not working.  Why?

Ah, there is a second piece to the puzzle.

db_post_events() must be called with whatever address is in DBADDR::pfield
which by default in this case is '&val' but this can be changed in the
cvt_dbaddr callback.  Indeed waveformRecord used to do this.

https://github.com/epics-base/epics-base/commit/92d52cc415599b7dffa7df1f23d5ba8227fb4d3a

References:
monitors on array variables Siddons, David via Tech-talk
Re: monitors on array variables Michael Davidsaver via Tech-talk
Re: monitors on array variables Michael Davidsaver via Tech-talk

Navigate by Date:
Prev: Re: monitors on array variables Michael Davidsaver via Tech-talk
Next: Re: monitors on array variables Siddons, David via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: monitors on array variables Michael Davidsaver via Tech-talk
Next: Re: monitors on array variables Siddons, David via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 18 Mar 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·