Hi Mark,
We are facing a similar issue:
Our ASYN port driver for a DAQ board is modelling the board and its
channels as a multi device, with port=board and addr=channel.
During per-record-instance initialization, the port driver must call
the low level card driver with one configuration call per channel,
using board number, channel number, and range (record's EGUL, EGUF) as
parameters.
What would be your approach for that?
Your intermediate record hack does not work nicely (in addition to
being somewhat ugly), as the parameter values would come in too late
and separately, and the addr=channel number is not contained in a
field of the "main" record.
The driver's connect() is only called once for the port, right?!
Couldn't that be complemented with a routine that is called once per
addr for multi devices, and gets the addr and maybe a pointer to the
parameter field of the link that it is being called for? (We'd be
happy to cram the necessary low level config params into the link
config, and have the driver pull it out.)
Alternatively, probably cleaner and more flexible, you could allow a
special info field for asyn driver configuration options to be added
to the record, and pass a a pointer to its string value when calling
the driver for each addr.
What do you think?
Thanks for your help,
~Ralph
On 02/02/2015 23:36, Mark Rivers wrote:
There is no direct communicaton possible between the NELM field of
the waveform record and the asyn driver. However, it is easy to do
using an intermediate longout record, for example:
record(longout,"$(P)$(R)NELM1") {
field(DOL, "$(P)$(R)Waveform1.NELM CP MS")
field(OMSL, "closed_loop")
field(DTYP, "asynInt32")
field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))WAVEFORM_NELM1")
}
record(longout,"$(P)$(R)NELM2") {
field(DOL, "$(P)$(R)Waveform2.NELM CP MS")
field(OMSL, "closed_loop")
field(DTYP, "asynInt32")
field(OUT, "@asyn($(PORT),$(ADDR),$(TIMEOUT))WAVEFORM_NELM2")
}
These longout records will process whenever the NELM fields change,
including once at iocInit.
They will send the NELM field of the appropriate waveform record to
you driver. You just need to treat the writes with 2 different
pasynUser->reason values differently. If it is the one corresponding
to WAVEFORM_NELM1 do one thing, and do something different if it is
for WAVEFORM_NELM2.
Mark