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  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020 
<== Date ==> <== Thread ==>

Subject: RE: Access to records from subroutines during iocInit
From: "Allison, Stephanie" <saa@slac.stanford.edu>
To: Rod Nussbaumer <bomr@triumf.ca>, "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Thu, 13 Jan 2011 10:47:49 -0800
Hi Rod,

The INIT (INAM) subroutine is called during the database record initialization part of iocInit:
http://www.aps.anl.gov/epics/base/R3-14/12-docs/AppDevGuide/node8.html#SECTION00840000000000000000
The INAM routine is only meant to be used to allocate memory and any other resources or system initialization needed by the processing (SNAM) subroutine.  

The IOC is not yet ready for ANY record processing so your dbPutField fails.

Instead, you need to process during the initial processing part of iocInit (aka when PINI=YES processing is done) which comes a little later.  This processing will still be done before any EDM client connects to the waveform so should meet your requirement.  So move the dbPutField to the processing subroutine and set PINI=YES.  I assume SCAN=Passive so it'll only process once.

Stephanie Allison

> -----Original Message-----
> From: tech-talk-bounces@aps.anl.gov [mailto:tech-talk-bounces@aps.anl.gov] On Behalf
> Of Rod Nussbaumer
> Sent: Thursday, January 13, 2011 9:27 AM
> To: tech-talk@aps.anl.gov
> Subject: Access to records from subroutines during iocInit
> 
> Hi All.
> 
> I have a question/problem, which may simply be me trying to work outside
> the expected norms. It involves writing to records during IOC
> initialization. I will give a summary of the situation:
> 
> A subroutine record has on one of its inputs, a link to a waveform
> record. During the INIT subroutine, I call dbGetPdbAddrFromLink() to
> locate the waveform record, as well as call dbGetNelements() to find the
> size of the respective waveform record. This seems to work.
> My intention is to initialize the waveform record with data
> algorithmically created. I do this by creating an array, and calling
> dbPutField(), using the value saved from the earlier call to
> dbGetPdbAddrFromLink(). This results in the following:
> 
> A call to 'assert(dbLockIsInitialized)'
>      by thread '_main_' failed in ../dbLock.c line 239.
> EPICS Release EPICS R3.14.11 $R3-14-11$ $2009/08/28 18:47:36$.
> Local time is 2011-01-13 09:05:45.332489000 PST
> Please E-mail this message to the author or to tech-talk@aps.anl.gov
> Calling epicsThreadSuspendSelf()
> 
> If I perform the same actions within the PROC subroutine of the
> subroutine record, it seems to work as I expected it to. So, if this is
> not a bug, is there a proper way to accomplish what I am attempting?
> There are no other records referencing or linked to the waveform record.
> Its data is used purely for visualization purposes in an EDM X-Y Graph.
> 
> Thanks for listening.
> 
> Rod Nussbaumer
> ISAC Controls, TRIUMF
> Vancouver, Canada.
> 



Replies:
Re: Access to records from subroutines during iocInit Rod Nussbaumer
References:
Access to records from subroutines during iocInit Rod Nussbaumer

Navigate by Date:
Prev: Re: large arrays native element count wrong with Channel Access in EPICS 3.14.12 Ernest L. Williams Jr.
Next: Re: large arrays native element count wrong with Channel Access in EPICS 3.14.12 Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020 
Navigate by Thread:
Prev: Access to records from subroutines during iocInit Rod Nussbaumer
Next: Re: Access to records from subroutines during iocInit Rod Nussbaumer
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·