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){
|
||||
int status, slaveStatus, i, controlMonitor;
|
||||
pCounter pCountController = NULL;
|
||||
int status, ctrStatus, i, controlMonitor;
|
||||
pCounter pCountController = NULL, pSlaveCounter = NULL;
|
||||
pCounter pCount = NULL;
|
||||
pMultiCounter self = NULL;
|
||||
pDummy pDum = NULL;
|
||||
enum {
|
||||
eIdle,
|
||||
eBusy,
|
||||
ePause,
|
||||
eNoBeam,
|
||||
eFault
|
||||
} statusLevel;
|
||||
|
||||
pCount = (pCounter)pData;
|
||||
if(pCount != NULL){
|
||||
@@ -127,20 +134,40 @@ static int MMCCStatus(void *pData, SConnection *pCon){
|
||||
|
||||
controlMonitor = GetControlMonitor((pCounter)pCount);
|
||||
pCountController = (pCounter)self->slaveData[controlMonitor];
|
||||
if ( pCountController->pDriv->eMode == ePreset ) {
|
||||
status = self->slaves[controlMonitor]->CheckCountStatus(pCountController,pCon);
|
||||
} else {
|
||||
status = HWIdle;
|
||||
for(i = 0; i < self->nSlaves; i++){
|
||||
slaveStatus = self->slaves[i]->CheckCountStatus(pCountController,pCon);
|
||||
if (slaveStatus == HWFault) {
|
||||
status = HWFault;
|
||||
break;
|
||||
} else if (slaveStatus != HWIdle) {
|
||||
status = slaveStatus;
|
||||
break;
|
||||
|
||||
/* counter states = HWIdle, HWBusy, HWPause, HWNoBeam, HWFault */
|
||||
status = HWIdle;
|
||||
statusLevel = eIdle;
|
||||
for (i = 0; i < self->nSlaves; i++) {
|
||||
pSlaveCounter = (pCounter)self->slaveData[i];
|
||||
ctrStatus = self->slaves[i]->CheckCountStatus(pSlaveCounter,pCon);
|
||||
if (statusLevel >= eFault)
|
||||
continue;
|
||||
switch (ctrStatus) {
|
||||
case HWFault:
|
||||
statusLevel = eFault;
|
||||
status = HWFault;
|
||||
break;
|
||||
case HWNoBeam:
|
||||
if (statusLevel < eNoBeam)
|
||||
statusLevel = eNoBeam;
|
||||
status = HWNoBeam;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(status == HWIdle || status == HWFault){
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user