In monitor mode the multicounter should stop when the monitor is idle
unless one of the other counters is in fault, nobeam or paused. In timer mode the multicounter should stop when all the counters are idle unless one of the other counters is in fault, nobeam or paused. r3627 | ffr | 2012-07-06 07:49:07 +1000 (Fri, 06 Jul 2012) | 5 lines
This commit is contained in:
committed by
Douglas Clowes
parent
540aaccc48
commit
db8c6d6004
@@ -108,11 +108,18 @@ static int MMCCStart(void *pData, SConnection *pCon)
|
|||||||
}
|
}
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
static int MMCCStatus(void *pData, SConnection *pCon){
|
static int MMCCStatus(void *pData, SConnection *pCon){
|
||||||
int status, slaveStatus, i, controlMonitor;
|
int status, ctrStatus, i, controlMonitor;
|
||||||
pCounter pCountController = NULL;
|
pCounter pCountController = NULL, pSlaveCounter = NULL;
|
||||||
pCounter pCount = NULL;
|
pCounter pCount = NULL;
|
||||||
pMultiCounter self = NULL;
|
pMultiCounter self = NULL;
|
||||||
pDummy pDum = NULL;
|
pDummy pDum = NULL;
|
||||||
|
enum {
|
||||||
|
eIdle,
|
||||||
|
eBusy,
|
||||||
|
ePause,
|
||||||
|
eNoBeam,
|
||||||
|
eFault
|
||||||
|
} statusLevel;
|
||||||
|
|
||||||
pCount = (pCounter)pData;
|
pCount = (pCounter)pData;
|
||||||
if(pCount != NULL){
|
if(pCount != NULL){
|
||||||
@@ -127,18 +134,38 @@ static int MMCCStatus(void *pData, SConnection *pCon){
|
|||||||
|
|
||||||
controlMonitor = GetControlMonitor((pCounter)pCount);
|
controlMonitor = GetControlMonitor((pCounter)pCount);
|
||||||
pCountController = (pCounter)self->slaveData[controlMonitor];
|
pCountController = (pCounter)self->slaveData[controlMonitor];
|
||||||
if ( pCountController->pDriv->eMode == ePreset ) {
|
|
||||||
status = self->slaves[controlMonitor]->CheckCountStatus(pCountController,pCon);
|
/* counter states = HWIdle, HWBusy, HWPause, HWNoBeam, HWFault */
|
||||||
} else {
|
|
||||||
status = HWIdle;
|
status = HWIdle;
|
||||||
for(i = 0; i < self->nSlaves; i++){
|
statusLevel = eIdle;
|
||||||
slaveStatus = self->slaves[i]->CheckCountStatus(pCountController,pCon);
|
for (i = 0; i < self->nSlaves; i++) {
|
||||||
if (slaveStatus == HWFault) {
|
pSlaveCounter = (pCounter)self->slaveData[i];
|
||||||
|
ctrStatus = self->slaves[i]->CheckCountStatus(pSlaveCounter,pCon);
|
||||||
|
if (statusLevel >= eFault)
|
||||||
|
continue;
|
||||||
|
switch (ctrStatus) {
|
||||||
|
case HWFault:
|
||||||
|
statusLevel = eFault;
|
||||||
status = HWFault;
|
status = HWFault;
|
||||||
break;
|
break;
|
||||||
} else if (slaveStatus != HWIdle) {
|
case HWNoBeam:
|
||||||
status = slaveStatus;
|
if (statusLevel < eNoBeam)
|
||||||
|
statusLevel = eNoBeam;
|
||||||
|
status = HWNoBeam;
|
||||||
break;
|
break;
|
||||||
|
case HWPause:
|
||||||
|
if (statusLevel < ePause)
|
||||||
|
statusLevel = ePause;
|
||||||
|
status = HWPause;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if ( pCountController->pDriv->eMode == ePreset && i == controlMonitor && ctrStatus == HWIdle) {
|
||||||
|
statusLevel = eBusy; /* Allow transition to HWPause or higher */
|
||||||
|
status = HWIdle;
|
||||||
|
} else if (statusLevel < eBusy && ctrStatus != HWIdle) {
|
||||||
|
/* ffr: We expect !HWIdle means HWBusy, if not the existing code should handle the exception */
|
||||||
|
statusLevel = eBusy;
|
||||||
|
status = ctrStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user