Hi Joao,
Perhaps I spoke too soon. It seems like it might work to replace this in asynPortDriver.
pasynManager->getAddr(pInterrupt->pasynUser, &address);
with this
this->getAddress(pInterrupt->pasynUser, &address);
Why don’t you try that and see if it works? If asynPortDriver::getAddress has not been overridden then this should not affect the existing behavior.
Mark
Hi Joao,
Ø
In those cases, the IOC will get the address from
"pasynManager->getAddr()", and not from getAddress(), which breaks the program.
Ø
(for ex. in paramList::octetCallback())
The callbacks are traversing a linked list of clients that have registered for callbacks. This is typically asyn device support, but it is not limited to that. That linked list is created outside of asynPortDriver
by asynManager when each client registers for callbacks. For example, this is the abbreviated code in devAsynInt32.c
pasynUser = pasynManager->createAsynUser(processCallback, 0);
pPvt->pasynUser = pasynUser;
status = pasynEpicsUtils->parseLink(pasynUser, plink,
&pPvt->portName, &pPvt->addr, &pPvt->userParam);
status = pasynManager->connectDevice(pasynUser, pPvt->portName, pPvt->addr);
status = pPvt->pint32->registerInterruptUser(
pPvt->int32Pvt,pPvt->pasynUser,
pPvt->interruptCallback,pPvt,&pPvt->registrarPvt);
So that pPvt->pasynUser has been connected to a particular port and address, typically specified in the OUT in INP link in the record. The asynPortDriver callback functions are retrieving the address stored in
that pasynUser in the linked list node via pasynManager->get_addr().
pnode = (interruptNode *)ellFirst(pclientList);
while (pnode) {
asynInt32Interrupt *pInterrupt = (asynInt32Interrupt *) pnode->drvPvt;
pasynManager->getAddr(pInterrupt->pasynUser, &address);
/* If this is not a multi-device then address is -1, change to 0 */
if (address == -1) address = 0;
if ((command == pInterrupt->pasynUser->reason) &&
(address == addr)) {
I don’t see how it could have access to the address that your getAddress() method is generating?
Mark
Sorry to bother you, I have a question regarding the usage of this function:
I have a use case where it is useful to override
asynPortDriver::getAddress() to get a custom reason and address.
These values are chosen previously by
drvUserCreate(), and stored in pasynUser->drvUser and pasynUser->reason.
This seems to work well for gets and puts, but not when a callback for for a "I/O Intr" record is executed.
In those cases, the IOC will get the address from
"pasynManager->getAddr()", and not from getAddress(), which breaks the program.
(for ex. in paramList::octetCallback())
Is there a way to make the callbacks also use the custom
asynPortDriver::getAddress() value?