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  <20112012  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  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: How the EPICS IOC determines the link type {CA_LINK/DB_LINK/CONSTANT}
From: Andrew Johnson <[email protected]>
To: [email protected], Lana Abadie <[email protected]>
Date: Mon, 17 Oct 2011 12:56:47 -0500
Hi Lana,

On 2011-10-17 Abadie Lana wrote:
> I had a quick look at the epics base code but i could not find where the
> link type was set. What I mean is the following:
> In the dbd file, there are some record types which have some fields of type
>  INLINK/OUTLINK/FWDLINK. Depending on the cases, it can point to a constant
>  (like DOL field for instance) or to a timestamp (TSE) or to a real PV.
>  When I looked at the code, there is a notion of link type associated with
>  this type of fields and a link type can be either
>  CA_LINK/CONSTANT/DB_LINK/PV_LINK(=DB+CA_LINK). However I didn't find where
>  and how the links were set at IOC start up. I'm really interesting in
>  knowing how the IOC knows if the field points to a real PV... Thanks a lot
>  for your help

This is a bit complicated and spread over several source files; I usually have 
to go back to the source code to understand it properly every time.

When the storage for a record is allocated, all IN/OUT/FWDLINK fields are 
initialized with plink->type = CONSTANT (by dbAllocRecord() in dbStaticRun.c).

Determining whether an INLINK/OUTLINK/FWDLINK field is a CONSTANT or a PV_LINK 
takes place when dbPutString() inside src/dbStatic/dbStaticLib.c parses the 
string value being assigned to the field.  If the field name is INP or OUT it 
also has to check the DTYP field since device support determines what link 
type it expects to see.  A CONSTANT value is found by parsing the string using 
both epicsStrtod() and strtol(); if either of those routines accepts the whole 
string then it's a CONSTANT, otherwise it becomes a PV_LINK and we parse the 
string for the link options appropriate for the link direction.

The code that resolves a PV_LINK type into either a DB_LINK vs CA_LINK exists 
in two places; at iocInit time the link resolution occurs in the routine 
doResolveLinks() in src/misc/iocInit.c but if you change the link field at 
runtime it is then determined in dbPutFieldLink() inside src/db/dbAccess.c.

In both cases the code checks for CA/CP/CPP options and does a dbNameToAddr() 
to determine if the link target matches a record and field name found in this 
IOC; if found the result is a DB_LINK.  If there were CA/CP/CPP options or the 
name lookup failed this is a Channel Access link so it calls dbCaAddLink() (a 
macro from dbCa.h which expands to dbCaAddLinkCallback() in src/db/dbCa.c with 
some default arguments for the callback parameters).

Note that this code has been modified in some branches that will appear in 
future (3.15) releases, so talk to me first if you have some requirement that 
might involve changing it.

HTH,

- Andrew
-- 
Optimization is the process of taking something that works and
replacing it with something that almost works, but costs less.
-- Roger Needham

Replies:
RE: How the EPICS IOC determines the link type {CA_LINK/DB_LINK/CONSTANT} Abadie Lana
References:
EPICS Workshop Fall 2011 Dirk Zimoch
How the EPICS IOC determines the link type {CA_LINK/DB_LINK/CONSTANT} Abadie Lana

Navigate by Date:
Prev: How the EPICS IOC determines the link type {CA_LINK/DB_LINK/CONSTANT} Abadie Lana
Next: Re: Fwd: FW: EPICS driver for acqiris cPCI digitizer is available on epics.sf.net Silver
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  2021  2022  2023  2024 
Navigate by Thread:
Prev: How the EPICS IOC determines the link type {CA_LINK/DB_LINK/CONSTANT} Abadie Lana
Next: RE: How the EPICS IOC determines the link type {CA_LINK/DB_LINK/CONSTANT} Abadie Lana
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  2021  2022  2023  2024 
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 ·