Experimental Physics and Industrial Control System
Hi Emmanuel,
It's probably even much simpler than that.
As you found out, dbpf() is part of the *runtime database access
library*, which works only at runtime (properly locking the record to
avoid interfering with the regular processing of records). As the locks
are set up during IOCinit, using dbpf() at database load time will fail.
If you want to change field values of records before IOCinit, nothing
keeps you from setting the additional fields in the plain regular
fashion from a db file that gets instantiated in a later call to
dbLoadRecords(). It is perfectly legal to have the same record appear in
more than one instantiation step. (It might not be explicitly mentioned
in the doc that this is legal, but I learned that many installations use
this feature.)
Let me give you an example:
You may load a record in first.db like this:
record(ai,"record1") {
field(DOL,".5")
}
and then overwrite/add fields in second.db (which is loaded further down):
record(ai,"record2") {
...
}
record(ai,"record1") {
field(DOL,"300")
field(FLNK,"record2")
}
Most simple, obvious, straightforward, exactly what you want.
On-line adding and deleting records (after IOCinit) is not an easy thing
to do and not supported at the moment. It has been on wish lists for a
while and might get implemented in the next major version of EPICS. Call
again in two years ... ;-)
Cheers,
Ralph
Allison, Stephanie wrote:
Hi,
So, immediately in the block/template instanciate(record2), I
insert dbpf("record1.FLNK","record2").
Part of our IOC startup is to restore values before iocInit using static database utilities. I don't know of any iocsh entries for dbStatic routines. You can write a little utility that does something like this:
#include "dbAccess.h"
#include "dbStaticLib.h"
#include "errlog.h"
long dbpfStatic(char *pname,char *pvalue) {
DBENTRY dbentry;
int status;
if (!pdbbase) {
errlogPrintf("dbpfStatic: No database loaded\n");
return -1;
}
dbInitEntry(pdbbase, &dbentry);
if (!(status = dbFindRecord(&dbentry, pname)))
status = dbPutString(&dbentry, pvalue);
dbFinishEntry(&dbentry);
return status;
}
Stephanie Allison
- Replies:
- Re: dbpf before iocInit... Emmanuel Mayssat
- Re: dbpf before iocInit... Benjamin Franksen
- References:
- RE: dbpf before iocInit... Allison, Stephanie
- Navigate by Date:
- Prev:
Re: PCI CAMAC Highway Driver? Noboru Yamamoto
- Next:
RE: PCI CAMAC Highway Driver? Graham S Cross
- 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
2020
2021
2022
2023
2024
2025
- Navigate by Thread:
- Prev:
RE: dbpf before iocInit... Allison, Stephanie
- Next:
Re: dbpf before iocInit... Emmanuel Mayssat
- 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
2020
2021
2022
2023
2024
2025