diff --git a/motorApp/MotorSrc/Makefile b/motorApp/MotorSrc/Makefile index 90e94a5c..f42de89b 100644 --- a/motorApp/MotorSrc/Makefile +++ b/motorApp/MotorSrc/Makefile @@ -24,6 +24,7 @@ motor_SRCS += devMotorAsyn.c motor_SRCS += paramLib.c motor_SRCS += motorUtil.cc motorUtilAux.cc +motor_LIBS += asyn motor_LIBS += $(EPICS_BASE_IOC_LIBS) include $(TOP)/configure/RULES diff --git a/motorApp/MotorSrc/devMotorAsyn.c b/motorApp/MotorSrc/devMotorAsyn.c index f3888ca5..4e80c5ec 100644 --- a/motorApp/MotorSrc/devMotorAsyn.c +++ b/motorApp/MotorSrc/devMotorAsyn.c @@ -189,6 +189,22 @@ static long init_record(struct motorRecord * pmr ) pmr->name,pPvt->pasynUser->errorMessage); } + /* Initiate calls to get the initial motor parameters + Have to do it the long-winded way, because before iocInit, none of the + locks or scan queues are initialised, so calls to scanOnce(), + dbScanLock() etc will fail. */ + pasynUser = pasynManager->duplicateAsynUser(pPvt->pasynUser, asynCallback, 0); + pasynUser->reason = motorStatus; + pPvt->pasynInt32->read(pPvt->asynInt32Pvt, pasynUser, + &pPvt->status); + pasynUser->reason = motorPosition; + pPvt->pasynInt32->read(pPvt->asynInt32Pvt, pasynUser, + &pPvt->position); + pasynUser->reason = motorEncoderPosition; + pPvt->pasynInt32->read(pPvt->asynInt32Pvt, pasynUser, + &pPvt->encoder_position); + pasynManager->freeAsynUser(pasynUser); + /* Send the motor resolution to the driver. This should be done in the record * in the future */ resolution = pmr->mres; @@ -382,7 +398,6 @@ static void asynCallback(asynUser *pasynUser) motorAsynPvt *pPvt = (motorAsynPvt *)pasynUser->userPvt; motorRecord *pmr = pPvt->pmr; motorAsynMessage *pmsg = pasynUser->userData; - rset *prset = (rset *)pmr->rset; int status; asynPrint(pasynUser, ASYN_TRACE_FLOW, @@ -401,9 +416,7 @@ static void asynCallback(asynUser *pasynUser) pasynUser->reason = motorEncoderPosition; pPvt->pasynInt32->read(pPvt->asynInt32Pvt, pasynUser, &pPvt->encoder_position); - dbScanLock((dbCommon *)pmr); - (*prset->process)(pmr); - dbScanUnlock((dbCommon *)pmr); + scanOnce(pmr); break; default: diff --git a/motorApp/MotorSrc/drvMotorAsyn.c b/motorApp/MotorSrc/drvMotorAsyn.c index 71119c18..fc6642a9 100644 --- a/motorApp/MotorSrc/drvMotorAsyn.c +++ b/motorApp/MotorSrc/drvMotorAsyn.c @@ -513,12 +513,13 @@ static void intCallback(void *axisPvt, unsigned int nChanged, { drvmotorAxisPvt *pAxis = (drvmotorAxisPvt *)axisPvt; drvmotorPvt *pPvt = pAxis->pPvt; - int addr, reason; + int addr; + unsigned int reason; ELLLIST *pclientList; interruptNode *pnode; int ivalue; double dvalue; - int i, bit_num; + unsigned int i, bit_num; epicsInt32 changedmask = 0; /* We are called back with an array of things that have changed.