Skip to content

Commit

Permalink
Merge pull request #4 from mark0n/v4.33
Browse files Browse the repository at this point in the history
V4.33
  • Loading branch information
dchabot authored Feb 12, 2018
2 parents 5d0b0c0 + f179c8b commit a437ff3
Show file tree
Hide file tree
Showing 81 changed files with 32,868 additions and 2,542 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ ifneq ($(EPICS_LIBCOM_ONLY),YES)
DIRS += testOutputReadbackApp
testOutputReadbackApp_DEPEND_DIRS = asyn
iocBoot_DEPEND_DIRS += testOutputReadbackApp
DIRS += testOutputCallbackApp
testOutputCallbackApp_DEPEND_DIRS = asyn
iocBoot_DEPEND_DIRS += testOutputCallbackApp
DIRS += testUsbtmcApp
testUsbtmcApp_DEPEND_DIRS = asyn
iocBoot_DEPEND_DIRS += testUsbtmcApp
Expand Down
2 changes: 1 addition & 1 deletion asyn/asynDriver/asynDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/* Version number names similar to those provide by base
* These macros are always numeric */
#define ASYN_VERSION 4
#define ASYN_REVISION 32
#define ASYN_REVISION 33
#define ASYN_MODIFICATION 0

#ifdef __cplusplus
Expand Down
44 changes: 34 additions & 10 deletions asyn/asynDriver/asynManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ struct device {
int addr;
};

typedef enum portConnectStatus {
portConnectSuccess,
portConnectDevice,
portConnectFindInterface,
portConnectDriver
} portConnectStatus;

struct port {
ELLNODE node; /*For asynBase.asynPortList*/
char *portName;
Expand All @@ -197,6 +204,8 @@ struct port {
int attributes;
/* The following are for autoConnect*/
asynUser *pasynUser;
double secondsBetweenPortConnect;
portConnectStatus previousConnectStatus;
/* The following are for asynLockPortNotify */
asynLockPortNotify *pasynLockPortNotify;
void *lockPortNotifyPvt;
Expand All @@ -216,8 +225,7 @@ struct port {
epicsTimeStamp timeStamp;
timeStampCallback timeStampSource;
void *timeStampPvt;
double secondsBetweenPortConnect;
};
};

typedef struct queueLockPortPvt {
epicsEventId queueLockPortEvent;
Expand Down Expand Up @@ -452,6 +460,18 @@ static void tracePvtFree(tracePvt *ptracePvt)
free(ptracePvt->traceBuffer);
}

static void reportConnectStatus(port *pport, portConnectStatus status, const char *fmt, ...)
{
va_list args;

if (pport->previousConnectStatus != status) {
pport->previousConnectStatus = status;
va_start(args, fmt);
pasynTrace->vprint(pport->pasynUser, ASYN_TRACE_ERROR, fmt, args);
va_end(args);
}
}

static void asynInit(void)
{
int i;
Expand Down Expand Up @@ -716,14 +736,14 @@ static void connectAttempt(dpCommon *pdpCommon)
addr = (pdevice ? pdevice->addr : -1);
status = pasynManager->connectDevice(pasynUser,pport->portName,addr);
if(status!=asynSuccess) {
asynPrint(pasynUser,ASYN_TRACE_ERROR,
reportConnectStatus(pport, portConnectDevice,
"%s %d autoConnect connectDevice failed.\n",
pport->portName,addr);
return;
}
pasynInterface = pasynManager->findInterface(pasynUser,asynCommonType,TRUE);
if(!pasynInterface) {
asynPrint(pasynUser,ASYN_TRACE_ERROR,
reportConnectStatus(pport, portConnectFindInterface,
"%s %d autoConnect findInterface for asynCommon failed.\n",
pport->portName,addr);
goto disconnect;
Expand All @@ -738,16 +758,19 @@ static void connectAttempt(dpCommon *pdpCommon)
epicsMutexMustLock(pport->synchronousLock);
status = pasynCommon->connect(drvPvt,pasynUser);
epicsMutexUnlock(pport->synchronousLock);
}
if(status!=asynSuccess) {
asynPrint(pasynUser,ASYN_TRACE_ERROR,
"%s %s %d autoConnect could not connect\n",
pasynUser->errorMessage,pport->portName,addr);
if (status != asynSuccess) {
reportConnectStatus(pport, portConnectDriver,
"%s %d autoConnect could not connect\n", pport->portName, addr);
} else {
reportConnectStatus(pport, portConnectSuccess,
"%s %d port is now connected\n",
pport->portName, addr);
}
}
disconnect:
status = pasynManager->disconnect(pasynUser);
if(status!=asynSuccess) {
asynPrint(pasynUser,ASYN_TRACE_ERROR,
asynPrint(pasynUser, ASYN_TRACE_ERROR,
"%s %d autoConnect disconnect failed.\n",
pport->portName,addr);
}
Expand Down Expand Up @@ -1954,6 +1977,7 @@ static asynStatus registerPort(const char *portName,
pport->timeStampSource = defaultTimeStampSource;
dpCommonInit(pport,0,autoConnect);
pport->pasynUser = createAsynUser(0,0);
pport->previousConnectStatus = portConnectSuccess;
pport->queueLockPortTimeout = DEFAULT_QUEUE_LOCK_PORT_TIMEOUT;
ellInit(&pport->deviceList);
ellInit(&pport->interfaceList);
Expand Down
2 changes: 1 addition & 1 deletion asyn/asynPortClient/asynPortClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class epicsShareClass asynUInt32DigitalClient : public asynPortClient {
asynUInt32DigitalClient(const char *portName, int addr, const char *drvInfo, double timeout=DEFAULT_TIMEOUT)
: asynPortClient(portName, addr, asynUInt32DigitalType, drvInfo, timeout) {
pInterface_ = (asynUInt32Digital *)pasynInterface_->pinterface;
if (pasynInt32SyncIO->connect(portName, addr, &pasynUserSyncIO_, drvInfo))
if (pasynUInt32DigitalSyncIO->connect(portName, addr, &pasynUserSyncIO_, drvInfo))
throw std::runtime_error(std::string("pasynInt32SyncIO->connect failed"));
};
/** Destructor for asynInt32Client class. Disconnects from port, frees resources. */
Expand Down
3 changes: 0 additions & 3 deletions asyn/asynPortDriver/asynPortDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ class paramList {
};

/** Constructor for paramList class.
* \param[in] nValues Number of parameters in the list.
* \param[in] pPort Pointer to asynPortDriver port for this paramList. */
paramList::paramList(asynPortDriver *pPort)
: pasynPortDriver(pPort)
Expand Down Expand Up @@ -3231,8 +3230,6 @@ static asynDrvUser ifaceDrvUser = {
Often it is 1 (which is the minimum), but some drivers, for example a
16-channel D/A or A/D would support values > 1.
This controls the number of parameter tables that are created.
* \param[in] paramTableSize The number of parameters that this driver supports.
This controls the size of the parameter tables.
* \param[in] interfaceMask Bit mask defining the asyn interfaces that this driver supports.
The bit mask values are defined in asynPortDriver.h, e.g. asynInt32Mask.
* \param[in] interruptMask Bit mask definining the asyn interfaces that can generate interrupts (callbacks).
Expand Down
Loading

0 comments on commit a437ff3

Please sign in to comment.