- Fixed a bug relating to the control variable in countserse.c It was used
to control the counter and internally to maintain count progress. This has now been fixed. - Due to improper state handling multi counter failed when called both from the count task and the sttus testing. This is now resolved.
This commit is contained in:
15
countersec.c
15
countersec.c
@ -177,10 +177,23 @@ static int SecCtrCheckStatus(void *pData, SConnection *pCon)
|
|||||||
ReleaseHdbValue(&v);
|
ReleaseHdbValue(&v);
|
||||||
|
|
||||||
|
|
||||||
node = GetHipadabaNode(self->pDes->parNode,"control");
|
if(self->getMode(self) == eTimer){
|
||||||
|
node = GetHipadabaNode(self->pDes->parNode,"time");
|
||||||
assert(node != NULL);
|
assert(node != NULL);
|
||||||
GetHipadabaPar(node,&v,pCon);
|
GetHipadabaPar(node,&v,pCon);
|
||||||
fControl = v.v.doubleValue;
|
fControl = v.v.doubleValue;
|
||||||
|
} else {
|
||||||
|
node = GetHipadabaNode(self->pDes->parNode,"values");
|
||||||
|
assert(node != NULL);
|
||||||
|
/*
|
||||||
|
The 1 below is only correct for PSI where only the first
|
||||||
|
monitor can be the control monitor. Elsewhere this must be the
|
||||||
|
control monitor channel
|
||||||
|
*/
|
||||||
|
fControl = v.v.intArray[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
node = GetHipadabaNode(self->pDes->parNode,"preset");
|
node = GetHipadabaNode(self->pDes->parNode,"preset");
|
||||||
assert(node != NULL);
|
assert(node != NULL);
|
||||||
GetHipadabaPar(node,&v,pCon);
|
GetHipadabaPar(node,&v,pCon);
|
||||||
|
@ -31,6 +31,14 @@
|
|||||||
|
|
||||||
#define MAXSLAVE 16
|
#define MAXSLAVE 16
|
||||||
#define NOCOUNTERS -2727
|
#define NOCOUNTERS -2727
|
||||||
|
|
||||||
|
/*
|
||||||
|
checkSlaves codes
|
||||||
|
*/
|
||||||
|
#define WAITMASTER 100
|
||||||
|
#define WAITSLAVE 200
|
||||||
|
#define FINISHED 300
|
||||||
|
|
||||||
/*=============== code for the driver ======================================*/
|
/*=============== code for the driver ======================================*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void *slaveData[MAXSLAVE];
|
void *slaveData[MAXSLAVE];
|
||||||
@ -107,7 +115,7 @@ static int MMCCStart(void *pData, SConnection * pCon)
|
|||||||
pCount->isUpToDate = 0;
|
pCount->isUpToDate = 0;
|
||||||
pCount->tStart = time(NULL);
|
pCount->tStart = time(NULL);
|
||||||
InvokeCallBack(pCount->pCall, COUNTSTART, pCon);
|
InvokeCallBack(pCount->pCall, COUNTSTART, pCon);
|
||||||
self->checkSlaves = 0;
|
self->checkSlaves = WAITMASTER;
|
||||||
return OKOK;
|
return OKOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +140,7 @@ static int MMCCStatus(void *pData, SConnection * pCon)
|
|||||||
return HWFault;
|
return HWFault;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(self->checkSlaves == 0) {
|
if(self->checkSlaves == WAITMASTER) {
|
||||||
status = self->slaves[0]->CheckCountStatus(self->slaveData[0], pCon);
|
status = self->slaves[0]->CheckCountStatus(self->slaveData[0], pCon);
|
||||||
if (status == HWIdle || status == HWFault) {
|
if (status == HWIdle || status == HWFault) {
|
||||||
/*
|
/*
|
||||||
@ -141,11 +149,11 @@ static int MMCCStatus(void *pData, SConnection * pCon)
|
|||||||
*/
|
*/
|
||||||
MMCCHalt(pData);
|
MMCCHalt(pData);
|
||||||
ReleaseCountLock(pCount->pCountInt);
|
ReleaseCountLock(pCount->pCountInt);
|
||||||
self->checkSlaves = 1;
|
self->checkSlaves = WAITSLAVE;
|
||||||
status = HWBusy;
|
status = HWBusy;
|
||||||
}
|
}
|
||||||
pCount->pDriv->fLastCurrent = GetControlValue(self->slaveData[0]);
|
pCount->pDriv->fLastCurrent = GetControlValue(self->slaveData[0]);
|
||||||
} else {
|
} else if(self->checkSlaves == WAITSLAVE) {
|
||||||
/*
|
/*
|
||||||
* wait for the detectors to report finish too. Otherwise, with the second
|
* wait for the detectors to report finish too. Otherwise, with the second
|
||||||
* generation HM data may not be fully transferred.
|
* generation HM data may not be fully transferred.
|
||||||
@ -172,7 +180,9 @@ static int MMCCStatus(void *pData, SConnection * pCon)
|
|||||||
}
|
}
|
||||||
status = HWIdle;
|
status = HWIdle;
|
||||||
InvokeCallBack(pCount->pCall, COUNTEND, pCon);
|
InvokeCallBack(pCount->pCall, COUNTEND, pCon);
|
||||||
self->checkSlaves = 0;
|
self->checkSlaves = FINISHED;
|
||||||
|
} else if(self->checkSlaves == FINISHED){
|
||||||
|
status = HWIdle;
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@ -530,6 +540,7 @@ int MakeMultiCounter(SConnection * pCon, SicsInterp * pSics,
|
|||||||
self->slaveData[self->nSlaves] = pCom->pData;
|
self->slaveData[self->nSlaves] = pCom->pData;
|
||||||
self->nSlaves++;
|
self->nSlaves++;
|
||||||
}
|
}
|
||||||
|
self->checkSlaves = FINISHED;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
now install our action command and we are done
|
now install our action command and we are done
|
||||||
|
Reference in New Issue
Block a user