EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019 
<== Date ==> <== Thread ==>

Subject: R3.14 and registerRecordDeviceDriver
From: Kate Feng <feng1@bnl.gov>
To: Marty Kraimer <mrk@aps.anl.gov>, norume@aps.anl.gov, tech-talk@aps.anl.gov
Date: Mon, 23 Jun 2003 14:04:40 -0400
Hi Marty and Eric,

My wish is to  modify the registerRecordDeviceDriver.pl file
so that it will generate a xxx_registerRecordDeviceDriver.cpp
file instead of a registerRecordDeviceDriver.cpp file , where
one can derive the xxx_registerRecordDeviceDriver() function
instead of registerRecordDeviceDriver() to be called at the
startup script. In this case, 'xxx' is the name of the IOC
application (e.g. xxx_SRCS += xxx_registerRecordDeviceDriver.cpp).
This wish follows along the 3.14 OSI standard to allow
developers to link all the IOC codes into one big object
code via one makefile, except the developers have to use

xxx_registerRecordDeviceDriver(pdbbase)

instead of

registerRecordDeviceDriver(pdbbase)

in the startup script to register the record/device/driver entry
table.


My understanding is that, at this point, only Linux and RTEMS
have a dynamic loader.  My wish also gives RTEMS or Linux users
an option to dynamically load a new application code
(e.g. ld("new.obj")), which might need a new
record/device/driver support entry table registered
(e.g.  new_SRCS += new_registerRecordDeviceDriver.cpp) at run
time or even during an IOC test/development stage, which
could occur very often during a development cycle. I actually
found it handy in beamline applications.


I am simply talking about giving the applcation developers
a similar option that vxWorks environment
offered. Along the R3.14 OSI standard, it would be nice to
provide an interface for dynamic loading/registration, which
actually does not interfere with the R3.14 OSI standard.
Did'nt EPICS facilitate software interfaces for extensions
at all levels (e.g. Labview interace) ?


Enclosed is an example of a startup script and
a copy of the result running
'diff -uNr registerRecordDeviceDriver.pl.orig
registerRecordDeviceDriver.pl', just in case someone
else might find it  useful.   As a first time
Perl programmer, I probably did not write the code
as sophisticated as what an advanced Perl
programmer can do.  However, it works for my purpose.


Regards,
Kate


# useful abbreviations
ld    = cexpModuleLoad

# load library code
ld("telnetd.obj")
ld("std.obj")
ld("motor.obj")
#ld("new.obj")

#initialization
startTelnetd()
vmeUniverseInit()
devAvme9440Config(1,0x8000,0x80)
VSCSetup(1, 0x20000000, 200)
oms58Setup(1, 8, 0xa000, 190, 7, 0.2)
#new_init()

#load *.dbd and register
dbLoadDatabase("../dbd/std.dbd")
std_registerRecordDeviceDriver(pdbbase)
dbLoadDatabase("../dbd/motor.dbd")
motor_registerRecordDeviceDriver(pdbbase)
#dbLoadDatabase("../dbd/new.dbd")
#new_registerRecordDeviceDriver(pdbbase)

#load record
dbLoadRecords("../db/Acromag_16IO.db","P=Kate:,A=B1")
dbLoadRecords("../db/Jscaler.db","P=Kate:,S=scaler1,C=0")
dbLoadTemplate("../db/motor.substitutions")
dbLoadRecords("../db/scanParms.db","P=Kate:,Q=m10,SCANREC=$(P)scan1,POS=$(Q).VAL,RDBK=$(Q).RBV")
#dbLoadRecords("../db/new.db")

iocInit() 
--- registerRecordDeviceDriver.pl.orig	Mon May 12 10:56:26 2003
+++ registerRecordDeviceDriver.pl	Mon May 12 10:12:12 2003
@@ -11,6 +11,8 @@
 #*************************************************************************
 
 $file = $ARGV[0];
+$dbdname = substr($file,12,-4);
+$subname = sprintf("%s_registerRecordDeviceDriver", $dbdname);
 $numberRecordType = 0;
 $numberDeviceSupport = 0;
 $numberDriverSupport = 0;
@@ -55,6 +57,15 @@
 #include "registryDeviceSupport.h"
 #include "registryDriverSupport.h"
 #include "iocsh.h"
+
+extern "C" {
+
+struct dbBase;
+
+int $subname(struct dbBase *pdbbase);
+
+}
+
 END
 
 #definitions for recordtype
@@ -129,7 +140,7 @@
 #Now actual registration code.
 
 print << "END" ;
-int registerRecordDeviceDriver(DBBASE *pbase)
+int $subname(DBBASE *pbase)
 {
     int i;
 
@@ -193,11 +204,11 @@
 static const iocshArg *registerRecordDeviceDriverArgs[1] =
                                             {&registerRecordDeviceDriverArg0};
 static const iocshFuncDef registerRecordDeviceDriverFuncDef =
-                {"registerRecordDeviceDriver",1,registerRecordDeviceDriverArgs};
+                {"$subname",1,registerRecordDeviceDriverArgs};
 extern "C" {
 static void registerRecordDeviceDriverCallFunc(const iocshArgBuf *)
 {
-    registerRecordDeviceDriver(pdbbase);
+    $subname(pdbbase);
 }
 } //extern "C"
 

Replies:
Re: R3.14 and registerRecordDeviceDriver Kate Feng
Re: R3.14 and registerRecordDeviceDriver Dirk Zimoch

Navigate by Date:
Prev: Re: Maximum (Minimum) Value of a Set of Readback PVs Ned Arnold
Next: Re: R3.14 and registerRecordDeviceDriver Kate Feng
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019 
Navigate by Thread:
Prev: Re: Maximum (Minimum) Value of a Set of Readback PVs kuner
Next: Re: R3.14 and registerRecordDeviceDriver Kate Feng
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  <20032004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019