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:
Ferdi Franceschini
2012-07-06 07:49:07 +10:00
committed by Douglas Clowes
parent 540aaccc48
commit db8c6d6004

View File

@@ -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,20 +134,40 @@ 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; statusLevel = eIdle;
for(i = 0; i < self->nSlaves; i++){ for (i = 0; i < self->nSlaves; i++) {
slaveStatus = self->slaves[i]->CheckCountStatus(pCountController,pCon); pSlaveCounter = (pCounter)self->slaveData[i];
if (slaveStatus == HWFault) { ctrStatus = self->slaves[i]->CheckCountStatus(pSlaveCounter,pCon);
status = HWFault; if (statusLevel >= eFault)
break; continue;
} else if (slaveStatus != HWIdle) { switch (ctrStatus) {
status = slaveStatus; case HWFault:
break; 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){ if(status == HWIdle || status == HWFault){
/* /*