EPICS Controls 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  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: I/O Intr scanning
From: Mark Rivers <[email protected]>
To: "'Vishnu Patel'" <[email protected]>, "[email protected]" <[email protected]>
Date: Mon, 11 Mar 2013 15:18:37 +0000
Hi Vishnu,

In order to use I/O Intr scanning your asyn driver must do the callbacks to device support.

If your driver is written in C using the standard asyn interfaces then you must to the following.  In your drivers initialization routine you need to do this

    status = pasynInt32Base->initialize(pPvt->portName,&pPvt->int32);
    pasynManager->registerInterruptSource(portName, &pPvt->int32,
                                          &pPvt->int32InterruptPvt);

The first line registers the asynInt32 interface, which you must already be doing.  The second line tells asynManager that your driver can do interrupts (callbacks) on the asynInt32 interface.

When your driver wants to do callbacks, typically because it has read new data in an interrupt or polling function, it does the following:

        pasynManager->interruptStart(pPvt->int32InterruptPvt, &pclientList);
        pnode = (interruptNode *)ellFirst(pclientList);
        while (pnode) {
            asynInt32Interrupt *pint32Interrupt = pnode->drvPvt;
            addr = pint32Interrupt->addr;
            reason = pint32Interrupt->pasynUser->reason;
            if (reason == ip330Data) {
                pint32Interrupt->callback(pint32Interrupt->userPvt,
                                          pint32Interrupt->pasynUser,
                                          pPvt->correctedData[addr]);
            }
            pnode = (interruptNode *)ellNext(&pnode->node);
        }
        pasynManager->interruptEnd(pPvt->int32InterruptPvt);

In this case I am checking that the pasynUser->reason field in the pasynUser from the request for callbacks in device support is the correct one for this asynInt32 parameter.

Note that if you write your driver using the asynPortDriver C++ class it is much simpler.  In your constructor you do something like the following:

testAsynPortDriver::testAsynPortDriver(const char *portName, int maxPoints)
   : asynPortDriver(portName,
                    1, /* maxAddr */
                    (int)NUM_SCOPE_PARAMS,
                    asynInt32Mask | asynFloat64Mask | asynFloat64ArrayMask | asynEnumMask | asynDrvUserMask, /* Interface mask */
                    asynInt32Mask | asynFloat64Mask | asynFloat64ArrayMask | asynEnumMask,  /* Interrupt mask */

The last line above is a bit mask of all the interfaces that this driver is telling asynManager it can do callbacks on.  The base class takes care of calling pasynManager->registerInterruptSource for each of these interfaces.

In your driver you do the following to set the value of a parameter and do callbacks to any registered client:
        setIntegerParam(P_NumChannels, numChannels);
        setDoubleParam(P_MeanValue, meanValue);
        callParamCallbacks();

callParamCallbacks() will take care of the pasynManager->interruptStart, pint32Interrupt->callback(), etc. that you have to do manually in the C code.

Mark



From: [email protected] [mailto:[email protected]] On Behalf Of Vishnu Patel
Sent: Monday, March 11, 2013 9:10 AM
To: [email protected]
Subject: I/O Intr scanning

Hello,
      I am developing EPICS driver for reading and writing port.
It is working fine with SCAN is not set to I/O Intr. If i set SCAN to .1 second.... 1 second etc.. I is working fine.

But if i set SCAN = I/O Intr 

and monitor with >>camonitor PORT_READ it gives out put 

PORT_READ       <undefined> 0 UDF INVALID

and even is changing port value doesn't read value.

The .db file content of longin record is as below

record (longin,"PORT_READ")
{
        field(DESC, "New Variable")
        field(DTYP, "asynInt32")
        field(INP, "@asyn($(PORT),0) read")
        field(SCAN, "I/O Intr")
}


I would like to know how to configure interrupt as it is working perfect with if SCAN sets to different value then  I/O Intr.

Here "read" i am using as asyn reason in driver for reading.


Thanks
Vishnu





Catch India as it happens with the Rediff News App. To download it for FREE, click here


References:
I/O Intr scanning Vishnu Patel

Navigate by Date:
Prev: Re: gethostbyname and getaddrinfo - multiple DNS entries for a hostname Andrew Johnson
Next: RE: gethostbyname and getaddrinfo - multiple DNS entries for a hostname Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: I/O Intr scanning Vishnu Patel
Next: Save and Restore parameters Julio Calvo
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·