g+
g+ Communities
Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013 
<== Date ==> <== Thread ==>

Subject: Using subArray
From: Michael Abbott <michael.abbott@diamond.ac.uk>
To: tech-talk@aps.anl.gov
Date: Sun, 27 Nov 2005 12:24:20 +0000 (GMT)
I am writing device support for a subArray record so that I can read small slices from a very large array provided by a device. The device in question has limited memory, and so I cannot afford more than one copy of this array in memory, namely the copy in the device driver itself. My plan is to read the data like this:

	record(subArray, "SA")
	{
	    field(DTYP, "My driver")
	    field(INP,  "my driver's arguments")
	    field(MALM, "1024")
	    field(FTVL, "LONG")
	}

	$ caput SA.NELM 1024
	$ caput SA.INDX 1024000
	$ caput SA.PROC 0
	$ caget SA

Unfortunately there is one very interesting and annoying fly in the ointment. In subArrayRecord.c:readValue we see the following two lines of code:

	if (psa->indx >= psa->malm)
	    psa->indx = psa->malm - 1;

Ooops. Most unhelpful!

This stupid code means that MALM, which is used to allocate the storage used by the subArray record, also determines the maximum index into the device array. I think this is missing the point of a subArray; it certainly gets in my way.

Now, it turns out I am lucky: malm is used to allocate storage *before* it calls my init_record, so I can fake malm back to the value I want to to be. However, this is hardly very satisfactory, and is going to have a mildly embarassing side effect: get_{graphic,control}_double will return bogus values for the upper limit on nelm.

Any thoughts on this?
Replies:
Re: Using subArray Noboru Yamamoto
Re: Using subArray Carl Lionberger

Navigate by Date:
Prev: Re: virtual circuit disconnect Benjamin Franksen
Next: environmental variables Xu HuiJuan
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013 
Navigate by Thread:
Prev: Re: virtual circuit disconnect Benjamin Franksen
Next: Re: Using subArray Noboru Yamamoto
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICSv4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·