EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: RE: asyn Array interrupts
From: "Mark Rivers" <[email protected]>
To: "Heinrich du Toit" <[email protected]>, "TechTalk EPICS" <[email protected]>
Date: Fri, 5 Oct 2007 08:16:41 -0500
Heinrich,
 
For questions of this type the best thing to do is to look at the source code in the devEpics device support.  In devAsynInt32Array.c/interruptCallbackInput you will see the following:
 
static void interruptCallbackInput(void *drvPvt, asynUser *pasynUser,
                epicsInt32 *value, size_t len)
{
    devAsynWfPvt *pPvt = (devAsynWfPvt *)drvPvt;
    waveformRecord *pwf = (waveformRecord *)pPvt->pr;
    int i;
    epicsInt32 *pint32 = (epicsInt32 *)pwf->bptr;
    asynPrintIO(pPvt->pasynUser, ASYN_TRACEIO_DEVICE,
        (char *)value, len*sizeof(epicsInt32),
        "%s devAsynInt32Array::interruptCallbackInput\n",
        pwf->name);
    if (len > pwf->nelm) len = pwf->nelm;
    for (i=0; i<len; i++) pint32[i] = value[i];
    pPvt->gotValue = 1;
    pPvt->nord = len;
    scanIoRequest(pPvt->ioScanPvt);
}
So the callback routine copies the data from the buffer provided by the driver to the buffer inside the record.  The driver is thus free to do what it pleases with the buffer after the callback.  In my drivers the driver buffer is typically allocated once when the driver is created and never freed.
 
Mark
 
 

________________________________

From: [email protected] on behalf of Heinrich du Toit
Sent: Fri 10/5/2007 1:05 AM
To: TechTalk EPICS
Subject: asyn Array interrupts



OK so I have a driver which triggers an interrupt for asynInt32Array.

I need to supply an buffer of epicsInt32[] to the interrupt callback.

Question:
Does the driver keep track of this buffer and free it at some stage?
If so when?

Or is the buffer given to the record and should the record dispose of
the buffer with a free() call when it is finished with it?

I think this is important because if I get it wrong I either get a
segfault or a memory leak :)

-Heinrich





References:
asyn Array interrupts Heinrich du Toit

Navigate by Date:
Prev: RE: longout record reading? Mark Rivers
Next: RE: Using Asyn driver or modifying devLib (or related programs) of EPICSbase for any knid of cPCI cards Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: asyn Array interrupts Heinrich du Toit
Next: longout record reading? Heinrich du Toit
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Nov 2011 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·