- 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:
2015-04-27 14:46:39 +02:00
parent b60ce746d4
commit e8df6158ea
2 changed files with 34 additions and 10 deletions

View File

@ -31,6 +31,14 @@
#define MAXSLAVE 16
#define NOCOUNTERS -2727
/*
checkSlaves codes
*/
#define WAITMASTER 100
#define WAITSLAVE 200
#define FINISHED 300
/*=============== code for the driver ======================================*/
typedef struct {
void *slaveData[MAXSLAVE];
@ -107,7 +115,7 @@ static int MMCCStart(void *pData, SConnection * pCon)
pCount->isUpToDate = 0;
pCount->tStart = time(NULL);
InvokeCallBack(pCount->pCall, COUNTSTART, pCon);
self->checkSlaves = 0;
self->checkSlaves = WAITMASTER;
return OKOK;
}
@ -132,7 +140,7 @@ static int MMCCStatus(void *pData, SConnection * pCon)
return HWFault;
}
if(self->checkSlaves == 0) {
if(self->checkSlaves == WAITMASTER) {
status = self->slaves[0]->CheckCountStatus(self->slaveData[0], pCon);
if (status == HWIdle || status == HWFault) {
/*
@ -141,11 +149,11 @@ static int MMCCStatus(void *pData, SConnection * pCon)
*/
MMCCHalt(pData);
ReleaseCountLock(pCount->pCountInt);
self->checkSlaves = 1;
self->checkSlaves = WAITSLAVE;
status = HWBusy;
}
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
* generation HM data may not be fully transferred.
@ -172,7 +180,9 @@ static int MMCCStatus(void *pData, SConnection * pCon)
}
status = HWIdle;
InvokeCallBack(pCount->pCall, COUNTEND, pCon);
self->checkSlaves = 0;
self->checkSlaves = FINISHED;
} else if(self->checkSlaves == FINISHED){
status = HWIdle;
}
return status;
}
@ -530,6 +540,7 @@ int MakeMultiCounter(SConnection * pCon, SicsInterp * pSics,
self->slaveData[self->nSlaves] = pCom->pData;
self->nSlaves++;
}
self->checkSlaves = FINISHED;
/*
now install our action command and we are done