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

Subject: RE: Multiple asyn ports inside asynPortDriver class
From: Mark Rivers via Tech-talk <tech-talk at aps.anl.gov>
To: Abdalla Ahmad <Abdalla.Ahmad at sesame.org.jo>, "tech-talk at aps.anl.gov" <Tech-talk at aps.anl.gov>
Date: Tue, 12 Nov 2024 19:19:00 +0000

Hi Abdalla,

 

  • Thanks for the info this is really helpful. Since drvUser is a void pointer, it allows to have my own driver interface as a struct right?

 

Yes, that is correct.

 

  • Also, I looked into asynUser definition, what is the difference between drvUser, userData and userPvt? Should I care about the latter two?

 

 

userData is available for you to use.  It is used in some existing drivers.  Here are some examples:

 

./motor-7-3/motorApp/MotorSrc/devMotorAsyn.c:    pasynUser->userData = pmsg;

./motor-7-3/motorApp/MotorSrc/devMotorAsyn.c:    motorAsynMessage *pmsg = pasynUser->userData;

./mca-7-9/mcaApp/mcaSrc/devMcaAsyn.c:    pasynUser->userData = pmsg;

./mca-7-9/mcaApp/mcaSrc/devMcaAsyn.c:    mcaAsynMessage *pmsg = pasynUser->userData;

./scaler-4-0/scalerApp/src/devScalerAsyn.c:    pasynUser->userData = pmsg;

./scaler-4-0/scalerApp/src/devScalerAsyn.c:    scalerAsynMessage *pmsg = pasynUser->userData;

./asyn-4-44-2/asyn/asynRecord/asynRecord.c:    callbackMessage *pmsg = (callbackMessage *)pasynUser->userData;

./Galil/3-6/GalilSup/src/GalilController.cpp:        pasynUser->userData = epicsStrDup(charstr);

 

userPvt is also used in some drivers.  Here are some examples:

 

./motor-7-3/modules/motorOmsAsyn/omsAsynApp/src/omsMAXnet.cpp:    pasynUserSerial->userPvt = this;

./motor-7-3/motorApp/MotorSrc/devMotorAsyn.c:    pasynUser->userPvt = pPvt;

./stream-2-8-24/src/AsynDriverInterface.cc:        static_cast<AsynDriverInterface*>(pasynUser->userPvt)->handleRequest();

./tpmac-3-11dls5/pmacApp/pmacAsynIPPortSrc/pmacAsynIPPort.c:    (*pPmacPvt)->pasynUser->userPvt = *pPmacPvt;

./scaler-4-0/scalerApp/src/devScalerAsyn.c:        pasynUser->userPvt = pPvt;

 

Mark

 

From: Abdalla Ahmad <Abdalla.Ahmad at sesame.org.jo>
Sent: Monday, November 11, 2024 3:59 AM
To: Mark Rivers <rivers at cars.uchicago.edu>; tech-talk at aps.anl.gov
Subject: RE: Multiple asyn ports inside asynPortDriver class

 

Hello Mark

 

Thanks for the info this is really helpful. Since drvUser is a void pointer, it allows to have my own driver interface as a struct right? Also, I looked into asynUser definition, what is the difference between drvUser, userData and userPvt? Should I care about the latter two?

 

Thanks.

Abdalla.

 

From: Mark Rivers <rivers at cars.uchicago.edu>
Sent: Sunday, November 10, 2024 10:41 PM
To: Abdalla Ahmad <Abdalla.Ahmad at sesame.org.jo>; tech-talk at aps.anl.gov
Subject: Re: Multiple asyn ports inside asynPortDriver class

 

Hi Abdalla,

 

  • I have another question, right now I am relying on asyn’s address as the register’s address on the device but I think the driver could be designed in a better way, can you give pointers on how to parse asyn parameter strings and create corresponding asyn parameters?

I recently wrote a driver for the SIS3153, which is a USB to VME interface card.  It allows access to VME bus registers from a Linux machine over USB with no CPU card in the VME crate.

 

I was faced with a similar decision as you: do I use the asyn "addr" field to specify the VME address, or do I encode it in the drvParams part of the link INP or OUT field?

 

I decided to use the drvParams field for 2 reasons:

  • Each time an address is used in the addr field asynManager allocates resources for that specific address.  asynReport will report on each address.  This gets unwieldy if there are hundreds or thousand of addresses.
  • asynManager treats the addr field as a signed integer, and negative numbers are not allowed except for -1.  For VME addresses this is a problem, because addresses from 0x80000000 and larger will be negative if interpreted as signed integers.

I adopted the following convention for the drvParams field:

field(INP,  "@asyn($(PORT), 0)ADDRESS_MODE VME_ADDRESS")
field(OUT,  "@asyn($(PORT), 0)ADDRESS_MODE VME_ADDRESS")

 

For example:

field(INP,  "@asyn($(PORT), 0)A32D16 0xB0000028")

 

My SIS3153 driver is based on asynPortDriver.  It implements the drvUserCreate method to parse the drvParams field.

 

That routine converts the VME_ADDRESS field into an integer, and puts a pointer to that integer in the pasynUser->drvUser field.  It removes the VME_ADDRESS from the drvParams string, and passes the remainder of the string (ADDRESS_MODE) to the base class asynPortDriver::drvUserCreate.  That base class parses the ADDRESS_MODE because those are defined as the port driver parameters.

 

The driver constructor does not set the ASYN_MULTIDEVICE flag in the constructor, so asynPortDriver and asynManager treat the driver as only supporting addr=0.

 

The writeInt32 and readInt32 methods get the VME address to use as follows:

 

    addr = *(int *)pasynUser->drvUser;

Let me know if you have any questions.

 

Mark

 

 


From: Abdalla Ahmad <Abdalla.Ahmad at sesame.org.jo>
Sent: Sunday, November 10, 2024 1:22 AM
To: Mark Rivers <rivers at cars.uchicago.edu>; tech-talk at aps.anl.gov <Tech-talk at aps.anl.gov>
Subject: RE: Multiple asyn ports inside asynPortDriver class

 

It seemed to be an issue with the device itself, the device’s own software produced the same timeout behavior on continuous TCP requests. I have another question, right now I am relying on asyn’s address as the register’s address on the device but I think the driver could be designed in a better way, can you give pointers on how to parse asyn parameter strings and create corresponding asyn parameters?

 

Thanks!

Abdalla.

 

From: Mark Rivers <rivers at cars.uchicago.edu>
Sent: Thursday, November 7, 2024 4:30 PM
To: tech-talk at aps.anl.gov; Abdalla Ahmad <Abdalla.Ahmad at sesame.org.jo>
Subject: Re: Multiple asyn ports inside asynPortDriver class

 

Hi Abdallah,

 

UDP and TCP use the same port number, not just the same IP address and physical port?  I don't think I have run into that before, so I can't see whether it has been tested with asyn.  You can turn on asynTrace on each port, and send them to different files to see if there are issues.

 

Mark

 


From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Abdalla Ahmad via Tech-talk <tech-talk at aps.anl.gov>
Sent: Thursday, November 7, 2024 6:14 AM
To:
tech-talk at aps.anl.gov <Tech-talk at aps.anl.gov>
Subject: Multiple asyn ports inside asynPortDriver class

 

Hi

 

I am writing an EPICS driver for an Ethernet-based device in which the control interface is split between TCP and UDP layers of the same port number (i.e., registers IO is through UDP while waveforms is through TCP). I have to create two asyn ports using drvAsynIPPortConfigure function, so my question is are there any consideration regarding this approach? Because I am noticing some timeout issues, most likely from the device’s side, so I want to narrow the issue as much as I can. Thanks in advance.

 

Best Regards,

Abdalla Al-Dalleh

Control Engineer

SESAME

P.O. Box 7, Allan 19252, Jordan
Tel: +96253511348 , ext. 265

Fax: +96253511423

Email : abdalla.ahmad at sesame.org.jo
Website: www.sesame.org.jo

 


References:
Multiple asyn ports inside asynPortDriver class Abdalla Ahmad via Tech-talk
Re: Multiple asyn ports inside asynPortDriver class Mark Rivers via Tech-talk
RE: Multiple asyn ports inside asynPortDriver class Abdalla Ahmad via Tech-talk
Re: Multiple asyn ports inside asynPortDriver class Mark Rivers via Tech-talk
RE: Multiple asyn ports inside asynPortDriver class Abdalla Ahmad via Tech-talk

Navigate by Date:
Prev: Re: [EXTERNAL] Phoebus settings.ini - Path to predefined Colors and Fonts Kasemir, Kay via Tech-talk
Next: Help with motorNewport config Jesse Hopkins via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  <20242025 
Navigate by Thread:
Prev: Re: Multiple asyn ports inside asynPortDriver class Jure Varlec via Tech-talk
Next: Asyn device support does not reconnect Miroslaw Dach via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  <20242025 
ANJ, 12 Nov 2024 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions ·
· Download · Search · IRMIS · Talk · Documents · Links · Licensing ·