diff --git a/conman.c b/conman.c index ee8ff769..43fa851f 100644 --- a/conman.c +++ b/conman.c @@ -1724,10 +1724,8 @@ int SCInvoke(SConnection * self, SicsInterp * pInter, char *pCommand) return 0; } strlcpy(pCopy->deviceID, pBueffel, SCDEVIDLEN); - /* SCAdvanceContext(self,pBueffel); */ traceCommand(ConID(self),"in:%s", pCommand); iRet = InterpExecute(pInter, pCopy, pCommand); - /* SCPopContext(self); */ SCDeleteConnection(pCopy); StatusFileTask(NULL); /* save changed parameters */ diff --git a/devexec.h b/devexec.h index f35bfe7d..c9290e2c 100644 --- a/devexec.h +++ b/devexec.h @@ -1,5 +1,5 @@ -#line 202 "devexec.w" +#line 204 "devexec.w" /*---------------------------------------------------------------------------- @@ -57,7 +57,7 @@ int StartCounter(pExeList self, SicsInterp *pSics, SConnection *pCon, int level, char *name); -#line 249 "devexec.w" +#line 251 "devexec.w" /*------------------------------------------------------------------------*/ @@ -77,8 +77,10 @@ int DevExecTask(void *pEL); void DevExecSignal(void *pEL, int iSignal, void *pSigData); + int GetDevExecInstStatus(pExeList self); -#line 251 "devexec.w" + +#line 253 "devexec.w" /* @@ -98,7 +100,7 @@ */ /*-------------------------------------------------------------------------*/ -#line 142 "devexec.w" +#line 144 "devexec.w" int StopExe(pExeList self, char *name); int StopExeWait(pExeList self); @@ -122,7 +124,7 @@ int ContinueExecution(pExeList self); -#line 269 "devexec.w" +#line 271 "devexec.w" /*-------------------------- Commands ------------------------------------*/ int DevexecAction(SConnection *pCon, SicsInterp *pSics, void *pData, @@ -164,13 +166,13 @@ /*--------------------------- Locking ---------------------------------*/ -#line 190 "devexec.w" +#line 192 "devexec.w" void LockDeviceExecutor(pExeList self); void UnlockDeviceExecutor(pExeList self); -#line 309 "devexec.w" +#line 311 "devexec.w" /* -------------------------- Executor management -------------------------*/ diff --git a/histsim.c b/histsim.c index 1813b584..3fa3e114 100644 --- a/histsim.c +++ b/histsim.c @@ -77,6 +77,7 @@ static int SimConfig(pHistDriver self, SConnection * pCon, self->pPriv = NewSIMCounter("HistoSim", fFail); } + /* configured test value */ diff --git a/multicountersec.c b/multicountersec.c index 2b4bbc1e..08fbe915 100644 --- a/multicountersec.c +++ b/multicountersec.c @@ -246,21 +246,25 @@ static int MultiSecTransfer(void *pData, SConnection * pCon) char pBueffel[132]; pCounter pCount = NULL; pHdb transfer; + SConnection *myCon; pCount = (pCounter) pData; transfer = GetHipadabaNode(pCount->objectNode,"transfer"); if(transfer != NULL){ - MacroPush(pCon); + myCon = SCCopyConnection(pCon); + MacroPush(myCon); tclStatus = Tcl_Eval(InterpGetTcl(pServ->pSics), transfer->value.v.text); if (tclStatus != TCL_OK) { snprintf(pBueffel, 131, "ERROR: TransferScript returned: %s", Tcl_GetStringResult(InterpGetTcl(pServ->pSics))); SCWrite(pCon, pBueffel, eError); MacroPop(); + SCDeleteConnection(myCon); return HWFault; } MacroPop(); + SCDeleteConnection(myCon); } return retVal; } @@ -374,34 +378,34 @@ static int areSlavesRunning(pCounter self, SConnection *pCon, int *status) assert(ccd != NULL); if(isTaskGroupRunning(pServ->pTasker,slaveID->value.v.intValue)){ - if(ccd->value.v.intValue == 1 && time(NULL) > stopTime->value.v.intValue + 100) { - SCWrite(pCon,"WARNING: CCD overrun, restarting counting...", eLogError); - self->pCountInt->Halt(self); - ReleaseCountLock(self->pCountInt); - for(i = 0; i < 100; i++){ - SicsWait(1); - if(!isTaskGroupRunning(pServ->pTasker,slaveID->value.v.intValue)){ - self->pCountInt->StartCount(self,pCon); - UpdateHipadabaPar(myStatus,MakeHdbText("run"),pCon); - UpdateHipadabaPar(stopTime,MakeHdbInt(time(NULL)),pCon); - *status = HWBusy; - return 1; - } - } - SCWrite(pCon,"ERROR: failed to stop overrun CCD",eLogError); - *status = HWFault; - return 0; - } else { - *status = HWBusy; + if(ccd->value.v.intValue == 1 && time(NULL) > stopTime->value.v.intValue + 100) { + SCWrite(pCon,"WARNING: CCD overrun, restarting counting...", eLogError); + self->pCountInt->Halt(self); + ReleaseCountLock(self->pCountInt); + for(i = 0; i < 100; i++){ + SicsWait(1); + if(!isTaskGroupRunning(pServ->pTasker,slaveID->value.v.intValue)){ + self->pCountInt->StartCount(self,pCon); UpdateHipadabaPar(myStatus,MakeHdbText("run"),pCon); + UpdateHipadabaPar(stopTime,MakeHdbInt(time(NULL)),pCon); + *status = HWBusy; return 1; - } - } else { - *status = HWIdle; - UpdateHipadabaPar(myStatus,MakeHdbText("idle"),pCon); - return 0; - } - return 1; + } + } + SCWrite(pCon,"ERROR: failed to stop overrun CCD",eLogError); + *status = HWFault; + return 0; + } else { + *status = HWBusy; + UpdateHipadabaPar(myStatus,MakeHdbText("run"),pCon); + return 1; + } +} else { + *status = HWIdle; + UpdateHipadabaPar(myStatus,MakeHdbText("idle"),pCon); + return 0; +} +return 1; } /*------------------------------------------------------------------------------------*/ static void multiEndCounting(pCounter self, SConnection *pCon) diff --git a/scriptcontext.c b/scriptcontext.c index 21aeb6d9..63fb2706 100644 --- a/scriptcontext.c +++ b/scriptcontext.c @@ -1552,6 +1552,7 @@ static int SctProcessCmd(pSICSOBJ ccmd, SConnection * con, { SctData *data = NULL; SctController *c; + time_t startTime; c = (SctController *) ccmd->pPrivate; @@ -1581,9 +1582,10 @@ static int SctProcessCmd(pSICSOBJ ccmd, SConnection * con, data->busy = 1; data->inMacro = SCinMacro(con); + startTime = time(NULL); DevQueue(c->devser, data, WritePRIO, - SctWriteHandler, SctMatch, NULL, SctDataInfo); - while (data->busy == 1) { + SctWriteHandler, SctTransactMatch, NULL, SctDataInfo); + while (data->busy == 1 && time(NULL) < startTime + 20) { TaskYield(pServ->pTasker); } SctKillData(data);