EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: Re: Differences in DBR_xxx constants between dbAccess.h and cadef.h
From: [email protected] (Tim Mooney)
To: [email protected]
Date: Tue, 15 Dec 1998 11:43:54 -0600
re...,

> I'm working on an system of saving record values on an IOC onto a
> battery-backed memory board, so that the most recent values can be
> automatically restored on IOC reboot.  I'm using Channel Access to place
> monitors on the records whose value I want to save (#include cadef.h), and
> run-time database access (#include dbAccess.h) to restore the values as
> early as I can in the reboot process, using dbPutField.
> 
> Everything works fine, except that garbage values were getting written to my
> records on reboot.  I've tracked this down to differences in the way the
> dbAccess.h/dbFldTypes.h and cadef.h/db_access.h define the DBR_xxx
> constants - DBR_DOUBLE under channel access is 6, but under run-time
> database access it's 8.  Here's the table for the common types:
> 
>                db   ca
>   DBR_STRING   0    0
>   DBR_CHAR     1    4
>   DBR_UCHAR    2   n/a
>   DBR_SHORT    3    1
>   DBR_USHORT   4   n/a
>   DBR_LONG     5    5
>   DBR_ULONG    6   n/a
>   DBR_FLOAT    7    2
>   DBR_DOUBLE   8    6
>   DBR_ENUM     9    3
> 
> I've worked around this for now by breaking my code up into separate
> modules, one for run-time database access and another for channel access,
> but I was wondering - is there a historical reason for the two being
> different, or have they just accidentally diverged over time?  And there's
> the answer I usually suspect, of course - I did something hideously and
> embarassingly wrong the last time I rebuilt our EPICS base (we're using
> R.3.13.0.beta12, btw).

By the way, there's some well-tested code that solves part of your problem,
as well as one or two problems you haven't mentioned but probably have or will
run into.  Bob Dalesio wrote save_restore.c and dbrestore.c, which use CA to
get data and dbStaticLib to restore it during iocInit.  Some of us have fixed
minor problems in this code, and the result has been working well for years.
I hesitate to spend bandwitdh blasting the source world-wide, but I'm sending
you a copy privately.

It may be worth mentioning also that some fields *must* be restored before record
initialization (e.g., so device support can correctly initialize hardware), and
some must be restored after (e.g., because record initialization will blindly
overwrite them).  Thus, for some fields, you really have to use static database
access.

Tim Mooney ([email protected]) (630)252-5417
Beamline Controls & Data Acquisition Group
Advanced Photon Source, Argonne National Lab



Navigate by Date:
Prev: Differences in DBR_xxx constants between dbAccess.h and cadef.h John A. Priller
Next: R3.13.1 john sinclair
Index: 1994  1995  1996  1997  <19981999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Differences in DBR_xxx constants between dbAccess.h and cadef.h John A. Priller
Next: R3.13.1 john sinclair
Index: 1994  1995  1996  1997  <19981999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·