From d542f758b072f548d44dde2dd10ee425f83cc6a4 Mon Sep 17 00:00:00 2001 From: cvs Date: Thu, 4 Sep 2003 07:15:38 +0000 Subject: [PATCH] - Fixed putpos bug in ecbdriv.c - Improved handling of conflicting drive commands in ecbdriv.c - Better status codes after drive command - Better error handling in anticollider --- ecbdriv.c | 63 ++++++++++++++++++++++++++++----------------- makefile_linux | 2 ++ tecs/makefile_linux | 10 +++++-- 3 files changed, 49 insertions(+), 26 deletions(-) diff --git a/ecbdriv.c b/ecbdriv.c index 09bac5e..454137d 100644 --- a/ecbdriv.c +++ b/ecbdriv.c @@ -240,6 +240,7 @@ static int checkMotorResult(pECBMotDriv self, Z80_reg out){ self->errorCode = ECBINHIBIT; break; case 32: + case 96: self->errorCode = ECBRUNNING; break; case 1: @@ -252,6 +253,7 @@ static int checkMotorResult(pECBMotDriv self, Z80_reg out){ self->errorCode = ECBINUSE; break; default: + fprintf(stderr,"Unidentified ECB motor error code %d\n", out.b); self->errorCode = UNIDENTIFIED; break; } @@ -846,30 +848,6 @@ static void ECBGetError(void *pData, int *iCode, char *buffer, int bufferlen){ break; } } -/*=======================================================================*/ -static int ECBTryAndFixIt(void *pData, int iCode, float fNew){ - pECBMotDriv self = (pECBMotDriv)pData; - int result; - Z80_reg in, out; - - assert(self); - - switch(iCode){ - case ECBMANUELL: - in.d = 1 ; - ecbExecute(self->ecb,162,in,&out); - result = MOTREDO; - break; - case COMMERROR: - ecbClear(self->ecb); - result = MOTREDO; - break; - default: - result = MOTFAIL; - break; - } - return result; -} /*========================================================================*/ static int ECBHalt(void *pData){ pECBMotDriv self = (pECBMotDriv)pData; @@ -890,6 +868,42 @@ static int ECBHalt(void *pData){ return 1; } /*=======================================================================*/ +static int ECBTryAndFixIt(void *pData, int iCode, float fNew){ + pECBMotDriv self = (pECBMotDriv)pData; + int result; + Z80_reg in, out; + int i; + + assert(self); + + switch(iCode){ + case ECBMANUELL: + in.d = 1 ; + ecbExecute(self->ecb,162,in,&out); + result = MOTREDO; + break; + case ECBRUNNING: + ECBHalt(pData); + self->restart = 0; + for(i = 0; i < 7; i++){ + if(ECBGetStatus(pData) == HWIdle){ + break; + } + SicsWait(1); + } + result = MOTREDO; + break; + case COMMERROR: + ecbClear(self->ecb); + result = MOTREDO; + break; + default: + result = MOTFAIL; + break; + } + return result; +} +/*=======================================================================*/ static int ECBGetDriverPar(void *pData,char *name, float *value){ pECBMotDriv self = (pECBMotDriv)pData; ObPar *par = NULL; @@ -1019,6 +1033,7 @@ static int ECBSetDriverPar(void *pData, SConnection *pCon, char *name, SCWrite(pCon,pBueffel,eError); return status; } + return 1; } /* diff --git a/makefile_linux b/makefile_linux index 1a180fa..925c06a 100644 --- a/makefile_linux +++ b/makefile_linux @@ -8,6 +8,8 @@ include ../$(SRC)linux_def +HDFROOT=/usr/users/SANS2/src + CC = gcc CFLAGS = -I$(HDFROOT)/include -DHDF4 -DHDF5 $(NI) -I$(SRC)hardsup \ -I../$(SRC) -fwritable-strings -DCYGNUS -DNONINTF -g $(DFORTIFY) diff --git a/tecs/makefile_linux b/tecs/makefile_linux index 7244df0..e7d20d0 100644 --- a/tecs/makefile_linux +++ b/tecs/makefile_linux @@ -5,11 +5,14 @@ # Markus Zolliker, March 2003 #-------------------------------------------------------------------------- -include ../../$(SRC)linux_def +include ../../linux_def + +SICST=.. +SICS=$(SRC).. CC = gcc FC = g77 -CFLAGS = -DLINUX -g $(DFORTIFY) +CFLAGS = -DLINUX -g $(DFORTIFY) -I../.. FFLAGS = -u -fvxt -g ARFLAGS = cr @@ -20,6 +23,9 @@ ARFLAGS = cr PGPLOT =/afs/psi.ch/user/z/zolliker/pgplot/ PGLIB =$(PGPLOT)/libpgplot.a -L/usr/X11R6/lib -lX11 +# -- library for ASYNSRV +HARDSUPLIB=../hardsup/libhlib.a + # -- readline library RDLIB =-lreadline -ltermcap