EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: Re: newbie string q
From: Marty Kraimer <[email protected]>
To: Ian A Smith <[email protected]>
Cc: [email protected]
Date: Thu, 26 Jul 2001 08:20:44 -0500
Ian A Smith wrote:
> 
> I would like to write a string to the FLNK field of a stringout record
> from my stringout device support.  How can this be done?.  The link will
> be connected to the INP of a stringin record.

It is not possible to directly modify link fields from record/device support
because of race
conditions related to lock sets. Only dbPutField, which must NOT be called from
record/device support, dynamically changes links. 

A solution to your problem is to use a general purpose callback to issue the
dbPutField. Here is some skeleton code that will do it.

typedef struct myPvt {
    CALLBACK callback;
    struct dbAddr addr;
    char destString[100];
    ...
}myPvt;

static void myCallbackFunc(CALLBACK *pcallback)
{
    stringoutRecord *precord;
    myPvt *pmyPvt;

    callbackGetUser(precord,pcallback);
    pmyPvt = (myPvt *)precord->dpvt;
    dbPutField(&pmyPvt->addr,DBR_STRING,pmyPvt->destString,1);
}

The init_record device support routine would contain something like:

static long init_record(stringoutRecord *precord)
{
    myPvt *pmyPvt;
    char pvname[100];
    long status;

    pmyPvt = (myPvt *)dbCalloc(1,sizeof(myPvt));
    callbackSetCallback(myCallbackFunc,&pmyPvt->callback);
    callbackSetUser(precord,&pmyPvt->callback);
    precord->dpvt = pmyPvt;
    sprintf(pvname,"%s.FLNK",precord->name);
    status = dbNameToAddr(pvname,&pxxxPvt->addr);
    if(status) { ERROR THAT SHOULD NOT HAPPEN}
    ...
    return(0);
}

When you want to write the string to the FLNK just say

    callbackRequest(&pmyPvt->callback);

You have to decide how to give a value to destString.

Marty Kraimer


References:
newbie string q Ian A Smith

Navigate by Date:
Prev: newbie string q Ian A Smith
Next: Retrieve network connection info through EPICS ? Brian McAllister
Index: 1994  1995  1996  1997  1998  1999  2000  <20012002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: newbie string q Ian A Smith
Next: Retrieve network connection info through EPICS ? Brian McAllister
Index: 1994  1995  1996  1997  1998  1999  2000  <20012002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·