- Added another check to prevent unending counts

This commit is contained in:
koennecke
2007-10-16 09:22:03 +00:00
parent c7c561b723
commit c5687d0483

View File

@ -161,6 +161,22 @@ static int ECBContinue(struct __COUNTER *self){
return OKOK; return OKOK;
} }
/*=======================================================================*/
static int ECBHalt(struct __COUNTER *self){
int status;
pECBCounter pPriv = NULL;
assert(self);
pPriv = (pECBCounter)self->pData;
assert(pPriv);
pPriv->state = IDLE;
if((status = stopScalers(pPriv)) <= 0){
self->iErrorCode = status;
return HWFault;
}
return OKOK;
}
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
static int ECBGetStatus(struct __COUNTER *self, float *fControl){ static int ECBGetStatus(struct __COUNTER *self, float *fControl){
pECBCounter pPriv = (pECBCounter)self->pData; pECBCounter pPriv = (pECBCounter)self->pData;
@ -225,7 +241,6 @@ static int ECBGetStatus(struct __COUNTER *self, float *fControl){
result = HWBusy; result = HWBusy;
} }
/* /*
select which scaler to read select which scaler to read
*/ */
@ -238,6 +253,9 @@ static int ECBGetStatus(struct __COUNTER *self, float *fControl){
*fControl = (float)count; *fControl = (float)count;
} }
if(*fControl > self->fPreset){
ECBHalt(self);
}
return result; return result;
} }
/*=====================================================================*/ /*=====================================================================*/
@ -352,22 +370,6 @@ static int ECBStart(struct __COUNTER *self){
return OKOK; return OKOK;
} }
/*=======================================================================*/ /*=======================================================================*/
static int ECBHalt(struct __COUNTER *self){
int status;
pECBCounter pPriv = NULL;
assert(self);
pPriv = (pECBCounter)self->pData;
assert(pPriv);
pPriv->state = IDLE;
if((status = stopScalers(pPriv)) <= 0){
self->iErrorCode = status;
return HWFault;
}
return OKOK;
}
/*=======================================================================*/
static int ECBTransfer(struct __COUNTER *self){ static int ECBTransfer(struct __COUNTER *self){
int status, count, i; int status, count, i;
pECBCounter pPriv = NULL; pECBCounter pPriv = NULL;