SICS-486: When in timer mode only stop the multicounter when all of the slaves are

idle or at the first slave which reports a fault.
NOTE: If slave[0] == pause and slave[1] == fault then the multicounter will pause and then
possibly fail if slave[1] is still in fault when slave[0] continues.

r3626 | ffr | 2012-07-02 09:38:29 +1000 (Mon, 02 Jul 2012) | 5 lines
This commit is contained in:
Ferdi Franceschini
2012-07-02 09:38:29 +10:00
committed by Douglas Clowes
parent 683e73b4e0
commit 540aaccc48

View File

@@ -108,7 +108,7 @@ static int MMCCStart(void *pData, SConnection *pCon)
}
/*-------------------------------------------------------------------------*/
static int MMCCStatus(void *pData, SConnection *pCon){
int status,i, controlMonitor;
int status, slaveStatus, i, controlMonitor;
pCounter pCountController = NULL;
pCounter pCount = NULL;
pMultiCounter self = NULL;
@@ -127,7 +127,21 @@ static int MMCCStatus(void *pData, SConnection *pCon){
controlMonitor = GetControlMonitor((pCounter)pCount);
pCountController = (pCounter)self->slaveData[controlMonitor];
status = self->slaves[controlMonitor]->CheckCountStatus(pCountController,pCon);
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;
}
}
}
if(status == HWIdle || status == HWFault){
/*
stop counting on slaves when finished or when an error