No, the drvAsynSerialPort driver does not implement the asynInt32 interface.
It implements the asynCommon inteface here. All drivers must implement asynCommon:
It implements the asynOption interface here:
It implements the asynOctet interface here:
Those are the only interfaces that it implements.
This is a simple example driver that implements the asynInt32 interface:
Many drivers now use the asynPortDriver base class. It greatly simplifies the code required to register and implement asyn interfaces. This is the code:
This is the documentation:
This is a real driver for a simple device that implements the asynInt32 interface using asynPortDriver.
Mark
From: 高振华 <gaozh at ihep.ac.cn>
Sent: Saturday, April 12, 2025 6:39 AM
To: Mark Rivers <rivers at cars.uchicago.edu>
Cc: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>
Subject: Re: Re: write and read functions in asyn
Hi Mark,
Thanks,
Does the (* write) function in asynInt32.h inherit from the writeIt function in drvAsynSerialPort.c (when accessing a serial port)?
static asynStatus writeIt(void *drvPvt, asynUser *pasynUser, const char *data, size_t numchars,size_t *nbytesTransfered)
{
ttyController_t *tty = (ttyController_t *)drvPvt;
int thisWrite;
int nleft = numchars;
int timerStarted = 0;
asynStatus status = asynSuccess;
assert(tty);
...
Gao Zhenhua
-----原始邮件-----
发件人: "Mark Rivers" <rivers at cars.uchicago.edu>
发送时间: 2025-04-11 11:23:41 (星期五)
收件人: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>, 高振华 <gaozh at ihep.ac.cn>
主题: Re: write and read functions in asyn
Those functions are implemented by the asyn driver. asynInt32.h defines the interface, but the implementation is done in each driver.
They are analogous to C++ pure virtual functions that each derived class must implement.
Mark
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of 高振华 via Tech-talk <tech-talk at aps.anl.gov>
Sent: Thursday, April 10, 2025 8:46 PM
To: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>
Subject: write and read functions in asyn
Hi all,
I saw the prototype declarations for the write and read functions in this. h file(asyn/asyn/interfaces/asynInt32.h),
But I couldn't find the bodies of the write and read functions,
Does anyone know where it is?
typedef struct asynInt32 {
asynStatus (*write)(void *drvPvt, asynUser *pasynUser, epicsInt32 value);
asynStatus (*read)(void *drvPvt, asynUser *pasynUser, epicsInt32 *value);
asynStatus (*getBounds)(void *drvPvt, asynUser *pasynUser,
epicsInt32 *low, epicsInt32 *high);
asynStatus (*registerInterruptUser)(void *drvPvt,asynUser *pasynUser,
interruptCallbackInt32 callback, void *userPvt,
void **registrarPvt);
asynStatus (*cancelInterruptUser)(void *drvPvt, asynUser *pasynUser,
void *registrarPvt);
} asynInt32;
Thanks,
Gao Zhenhua
--
BSRF
Email:gaozh at ihep.ac.cn
祝好!
高振华
电话:010-88235426
Email:gaozh at ihep.ac.cn