|
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
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
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
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:[email protected]
祝好!
高振华
电话:010-88235426
|