- Fixed bug with ECB not stopping when no beam

- Fixed synchronisation issues
- Fixed hsitogram memory writing from nxscript
- Started module for writing SICS interfaces in Tcl
- Fixed a bug in scan, which allowed to corrupt files
- Fixed memory problems in napi5
This commit is contained in:
cvs
2003-05-23 15:06:47 +00:00
parent 3231e3e630
commit f3853c20f0
28 changed files with 422 additions and 98 deletions

View File

@ -52,6 +52,7 @@
#include "servlog.h"
#include "macro.h"
#include "interface.h"
#include "motor.h"
#include "obdes.h"
/* M.Z. */
@ -354,7 +355,14 @@ extern char *SkipSpace(char *pPtr);
pTest = pDum->pDescriptor->GetInterface(pDum,ENVIRINTERFACE);
if(pDriv && !pTest)
{
fVal = pDriv->GetValue(pDum,pServ->dummyCon);
if(strcmp(pDum->pDescriptor->name,"Motor") == 0)
{
MotorGetSoftPosition((pMotor)pDum,pServ->dummyCon,&fVal);
}
else
{
fVal = pDriv->GetValue(pDum,pServ->dummyCon);
}
if(fVal > -990.)
{
fprintf(fd,"run %s %f\n",pCurrent->pName, fVal);

View File

@ -1,3 +1,3 @@
275
279
NEVER, EVER modify or delete this file
You'll risk eternal damnation and a reincarnation as a cockroach!|n

View File

@ -150,6 +150,13 @@ static int ECBGetStatus(struct __COUNTER *self, float *fControl){
assert(pPriv);
/*
This can happen after a stop
*/
if(pPriv->state == IDLE){
return HWIdle;
}
/*
read status bit
*/
@ -159,15 +166,8 @@ static int ECBGetStatus(struct __COUNTER *self, float *fControl){
pPriv->state = IDLE;
return HWFault;
}
if(out.d == 0){
result = HWIdle;
pPriv->state = IDLE;
} else {
result = HWBusy;
}
/*
check beam status
read beam status
*/
status = check4Beam(self,&beam);
if(status != 1){
@ -175,16 +175,35 @@ static int ECBGetStatus(struct __COUNTER *self, float *fControl){
return HWFault;
}
beam &= 1;
if(result == HWBusy && pPriv->state == COUNT && beam == 0){
/*
sophisticated logic in order to keep track of the various states
the thing can be in. Complicated by the fact that the status becomes
idle (out.d = 0) when the measurement is paused due to the lack of
beam.
*/
if(pPriv->state == COUNT && beam == 1){
ECBPause(self);
pPriv->state = NOBEAM;
SetStatus(eOutOfBeam);
result = HWNoBeam;
}
if(result == HWBusy && pPriv->state == NOBEAM && beam == 1){
if(pPriv->state == NOBEAM && beam == 0){
ECBContinue(self);
pPriv->state = COUNT;
SetStatus(eCounting);
return HWBusy;
}
if(pPriv->state == NOBEAM && beam == 1){
return HWNoBeam;
}
if(out.d == 0 && pPriv->state == COUNT){
result = HWIdle;
pPriv->state = IDLE;
} else {
result = HWBusy;
}
/*
select which scaler to read

View File

@ -148,7 +148,7 @@
} else {
SCWrite(pCon,"ERROR: mbank value not found!",eError);
}
if(var2)
if(mbank==1)
{
fTimeBin = GetHistTimeBin(self->pHistogram2,&iLength);
}
@ -161,7 +161,7 @@
} else {
SCWrite(pCon,"ERROR: lbank value not found!",eError);
}
if(var1)
if(lbank==1)
{
fTimeBin = GetHistTimeBin(self->pHistogram1,&iLength);
}

View File

@ -183,7 +183,7 @@ int setFMDataPointer(HistInt *lData, int mytimeBins, int bank)
/* the first set is the medium bank */
masterData = dataPtr = lData;
if (bank==1){
if (bank==2){
if(medium)
{
mediumData = masterData;
@ -194,7 +194,7 @@ int setFMDataPointer(HistInt *lData, int mytimeBins, int bank)
}
}
/* the next set is the upper bank */
if (bank==2){
if (bank==1){
if(upper)
{
upperData = masterData;

View File

@ -6,7 +6,7 @@
# Markus Zolliker, March 2003
#--------------------------------------------------------------------------
# the following line only for fortified version
DFORTIFY=-DFORTIFY
#DFORTIFY=-DFORTIFY
#==========================================================================
CC = cc

View File

@ -679,6 +679,12 @@
assert(self);
return self->pDriv->GetMonitor(self->pDriv,i,pCon);
}
/*-----------------------------------------------------------------------*/
void HistDirty(pHistMem self)
{
assert(self);
updateHMData(self->pDriv->data);
}
/*-------------------------------------------------------------------------*/
const float *GetHistTimeBin(pHistMem self, int *iLength)
{
@ -711,15 +717,6 @@
return StartDevice(GetExecutor(),"HistogramMemory", self->pDes, self,
pCon, self->pDriv->fCountPreset);
}
/*-------------------------------------------------------------------------*/
int HistDoEnd(pHistMem self, SConnection *pCon)
{
assert(self);
assert(self->pCall);
/* send a COUNTEND event */
InvokeCallBack(self->pCall,COUNTEND,NULL);
}
/*-----------------------------------------------------------------------*/
int HistBlockCount(pHistMem self, SConnection *pCon)
{
@ -1180,30 +1177,6 @@ static int checkHMEnd(pHistMem self, char *text){
{
return 0;
}
}
/* COUNTEND signal*/
else if(strcmp(argv[1],"countend") == 0)
{
if(SCMatchRights(pCon,self->iAccess))
{
if(IsCounting(pServ->pExecutor))
{
SCWrite(pCon,"WARNING: HM is counting!",eWarning);
return 1;
}
iRet = HistDoEnd(self,pCon);
if(iRet == 1)
{
SCSendOK(pCon);
}
return iRet;
}
else
{
SCWrite(pCon,
"ERROR: you are not privileged for attempted operation",eError);
return 0;
}
}
/* forced count, for the case several hm need to be started */
else if(strcmp(argv[1],"countf") == 0)

View File

@ -1,6 +1,6 @@
/*-----------------------------------------------------------------------
This is a data handling class for histogram memory data.
For more information see hmdata.tex
For more information see hmdata.tex.
copyright: see file COPYRIGHT

View File

@ -12,7 +12,7 @@ SOBJ = network.o ifile.o conman.o SCinter.o splitter.o passwd.o \
macro.o ofac.o obpar.o obdes.o drive.o status.o intserv.o \
devexec.o mumo.o mumoconf.o selector.o selvar.o fupa.o lld.o \
lld_blob.o buffer.o strrepl.o ruli.o lin2ang.o fomerge.o\
script.o o2t.o alias.o napi45.o nxdata.o stringdict.o sdynar.o\
script.o o2t.o alias.o napi.o nxdata.o stringdict.o sdynar.o\
histmem.o histdriv.o histsim.o sinqhmdriv.o interface.o callback.o \
event.o emon.o evcontroller.o evdriver.o simev.o perfmon.o \
danu.o itc4driv.o itc4.o nxdict.o nxsans.o varlog.o stptok.o nread.o \
@ -28,7 +28,8 @@ SOBJ = network.o ifile.o conman.o SCinter.o splitter.o passwd.o \
hmcontrol.o userscan.o slsmagnet.o rs232controller.o lomax.o \
polterwrite.o fourlib.o motreg.o motreglist.o anticollider.o \
s_rnge.o sig_die.o gpibcontroller.o $(NIOBJ) ecb.o ecbdriv.o \
ecbcounter.o hmdata.o tdchm.o nxscript.o A1931.o frame.o
ecbcounter.o hmdata.o tdchm.o nxscript.o A1931.o frame.o \
tclintimpl.o
MOTOROBJ = motor.o el734driv.o simdriv.o el734dc.o pipiezo.o pimotor.o
COUNTEROBJ = countdriv.o simcter.o counter.o

View File

@ -6,8 +6,8 @@
# Markus Zolliker, March 2003
#==========================================================================
# the following lines only for fortified version
DFORTIFY=-DFORTIFY
FORTIFYOBJ=strdup.o fortify.o
#DFORTIFY=-DFORTIFY
#FORTIFYOBJ=strdup.o fortify.o
#==========================================================================
# assign if the National Instrument GPIB driver is available
#NI= -DHAVENI
@ -29,7 +29,7 @@ HDFROOT=/data/lnslib
CC = cc
CFLAGS = -I$(HDFROOT)/include $(DFORTIFY) -DHDF4 -DHDF5 -I$(SRC)hardsup -g \
-std1 -warnprotos
-std1 -warnprotos
BINTARGET = bin
EXTRA=
LIBS = -L$(HDFROOT)/lib -Lhardsup -lhlib -Lmatrix -lmatrix -Ltecs \

View File

@ -6,7 +6,7 @@
# Markus Zolliker, March 2003
#--------------------------------------------------------------------------
# the following line only for fortified version
DFORTIFY=-DFORTIFY -I$(SRC)..
#DFORTIFY=-DFORTIFY -I$(SRC)..
#==========================================================================
CC = cc

View File

@ -175,6 +175,8 @@
fputs(pBueffel,fd);
sprintf(pBueffel,"%s InterruptMode %f\n",name,ObVal(self->ParArray,INT));
fputs(pBueffel,fd);
sprintf(pBueffel,"%s precision %f\n",name,ObVal(self->ParArray,PREC));
fputs(pBueffel,fd);
sprintf(pBueffel,"%s AccessCode %f\n",name,ObVal(self->ParArray,USRIGHTS));
fputs(pBueffel,fd);
return 1;

3
napi.c
View File

@ -23,12 +23,13 @@
----------------------------------------------------------------------------*/
static const char* rscid = "$Id: napi.c,v 1.6 2003/02/07 15:20:20 cvs Exp $"; /* Revision interted by CVS */
static const char* rscid = "$Id: napi.c,v 1.7 2003/05/23 15:06:47 cvs Exp $"; /* Revision interted by CVS */
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <time.h>
#include "fortify.h"
#include "napi.h"
/*

View File

@ -2,6 +2,7 @@
#include <assert.h>
#include <string.h>
#include <time.h>
#include "fortify.h"
#include "napi.h"
typedef struct {

20
napi5.c
View File

@ -26,6 +26,7 @@
#include <assert.h>
#include <string.h>
#include <time.h>
#include "fortify.h"
typedef struct __NexusFile5 {
struct iStack5 {
@ -322,7 +323,14 @@
}
/* release memory */
NXI5KillDir (pFile);
if(pFile->iCurrentLGG != NULL){
free(pFile->iCurrentLGG);
}
if(pFile->iCurrentLD != NULL){
free(pFile->iCurrentLD);
}
free (pFile);
H5garbage_collect();
*fid = NULL;
return NX_OK;
}
@ -476,6 +484,9 @@
pFile->iStack5[pFile->iStackPtr].iVref=pFile->iCurrentG;
strcpy(pFile->iStack5[pFile->iStackPtr].irefn,name);
pFile->iAtt5.iCurrentIDX=0;
if(pFile->iCurrentLGG != NULL){
free(pFile->iCurrentLGG);
}
pFile->iCurrentLGG = strdup(name);
NXI5KillDir (pFile);
return NX_OK;
@ -766,6 +777,9 @@
pFile->iCurrentS=0;
return NX_ERROR;
}
if(pFile->iCurrentLD != NULL){
free(pFile->iCurrentLD);
}
pFile->iCurrentLD = strdup(name);
return NX_OK;
}
@ -1018,6 +1032,7 @@
/* int iRet; */
herr_t status;
int size_type;
char buffer[1024];
pFile = NXI5assert (fid);
if (pFile->iCurrentG == 0) { /* root level, can not link here */
@ -1030,9 +1045,10 @@
strcpy(sLink->iTag5,pFile->name_ref);
} else {
/* group link */
strcat(pFile->iCurrentLGG, sLink->iTag5);
strcpy(buffer,pFile->iCurrentLGG);
strcat(buffer, sLink->iTag5);
strcpy(sLink->iTag5,"/");
strcat(sLink->iTag5,pFile->iCurrentLGG);
strcat(sLink->iTag5,buffer);
}
if (size_type>0)
{

View File

@ -35,6 +35,7 @@
#include <string.h>
#include <time.h>
#include <mfhdf.h>
#include "fortify.h"
#include "lld.h"
#include "../napi.h"
#include "stringdict.h"

View File

@ -286,7 +286,6 @@ static void putHistogramMemory(SConnection *pCon, SicsInterp *pSics,
}
timeBin = GetHistTimeBin(mem,&timeLength);
if(timeLength > 2){
length *= timeLength;
sprintf(dummy,"%d",timeLength);
status = NXDupdate(self->dictHandle,"timedim",dummy);
if(status == 0) {
@ -315,30 +314,36 @@ static void putHistogramMemory(SConnection *pCon, SicsInterp *pSics,
}
}
/*
now get some memory
*/
iData = (HistInt *)malloc(length*sizeof(HistInt));
if(!iData){
SCWrite(pCon,"ERROR: out of memory for reading histogram memory",
eError);
return;
}
/*
read HM
*/
if(subset){
status = GetHistogramDirect(mem,pCon,0,start,length,iData,
iData = (HistInt *)malloc(length*sizeof(HistInt));
if(!iData){
SCWrite(pCon,"ERROR: out of memory for reading histogram memory",
eError);
return;
}
memset(iData,0,length*sizeof(HistInt));
status = GetHistogramDirect(mem,pCon,0,start,start+length,iData,
length*sizeof(HistInt));
}else{
/*
status = GetHistogram(mem,pCon,0,start,length,iData,
length*sizeof(HistInt));
*/
iData = GetHistogramPointer(mem,pCon);
if(iData == NULL){
status = 0;
} else {
status = 1;
}
}
if(!status){
SCWrite(pCon,"ERROR: failed to read histogram memory",eError);
free(iData);
if(subset){
free(iData);
}
return;
}
@ -351,7 +356,9 @@ static void putHistogramMemory(SConnection *pCon, SicsInterp *pSics,
SCWrite(pCon,buffer,eError);
}
free(iData);
if(subset){
free(iData);
}
SCSendOK(pCon);
return;

3
ofac.c
View File

@ -112,6 +112,7 @@
#include "ecb.h"
#include "nxscript.h"
#include "frame.h"
#include "tclintimpl.h"
/*----------------------- Server options creation -------------------------*/
static int IFServerOption(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[])
@ -299,6 +300,7 @@
AddCommand(pInter,"MakeECB",MakeECB,NULL,NULL);
AddCommand(pInter,"MakeNXScript",MakeNXScript,NULL,NULL);
AddCommand(pInter,"MakePSDFrame",MakeFrameFunc,NULL,NULL);
AddCommand(pInter,"MakeTclInt",MakeTclInt,NULL,NULL);
}
/*---------------------------------------------------------------------------*/
static void KillIniCommands(SicsInterp *pSics)
@ -363,6 +365,7 @@
RemoveCommand(pSics,"MakeECB");
RemoveCommand(pSics,"MakeNXScript");
RemoveCommand(pSics,"MakePSDFrame");
RemoveCommand(pSics,"MakeTclInt");
}

49
scan.c
View File

@ -573,7 +573,8 @@ extern void SNXFormatTime(char *pBuffer, int iLen);
if(self->iActive)
{
SCWrite(pCon,"ERROR: cannot change parameters while scan is running",eError);
SCWrite(pCon,"ERROR: cannot change parameters while scan is running",
eError);
return 0;
}
@ -1000,8 +1001,8 @@ int StoreScanCounts(pScanData self, char *data)
}
return status;
}
/*---------------------------------------------------------------------------*/
static int CollectScanData(pScanData self, int iPoint)
/*------------------------------------------------------------------------*/
static int CollectScanDataIntern(pScanData self, int iPoint, int jochenFlag)
{
pVarEntry pVar = NULL;
void *pDings;
@ -1028,7 +1029,15 @@ int StoreScanCounts(pScanData self, char *data)
pVar = (pVarEntry)pDings;
if(pVar)
{
fVal = pVar->pInter->GetValue(pVar->pObject,self->pCon);
if(jochenFlag == 1 &&
strcmp(pVar->pObject->pDescriptor->name, "Motor") == 0)
{
MotorGetSoftPosition((pMotor)pVar->pObject,self->pCon,&fVal);
}
else
{
fVal = pVar->pInter->GetValue(pVar->pObject,self->pCon);
}
pVar->fData[iPoint] = fVal;
sprintf(pItem,"%-10.10s",pVar->Name);
strcat(pHead,pItem);
@ -1136,6 +1145,16 @@ int StoreScanCounts(pScanData self, char *data)
self->iCounts++;
return 1;
}
/*---------------------------------------------------------------------------*/
static int CollectScanData(pScanData self, int iPoint)
{
return CollectScanDataIntern(self,iPoint,0);
}
/*--------------------------------------------------------------------------*/
static int CollectScanDataJochen(pScanData self, int iPoint)
{
return CollectScanDataIntern(self,iPoint,1);
}
/*------------------------------------------------------------------------*/
static int ScanDrive(pScanData self, int iPoint)
{
@ -1309,6 +1328,14 @@ int StoreScanCounts(pScanData self, char *data)
self->pSics = NULL;
return 0;
}
if(self->iActive != 0)
{
SCWrite(pCon,"ERROR: another scan is still running",eError);
self->pCon = NULL;
self->pSics = NULL;
return 0;
}
self->iNP = iNP;
self->iMode = iMode;
self->fPreset = fPreset;
@ -1396,6 +1423,13 @@ int StoreScanCounts(pScanData self, char *data)
SCWrite(self->pCon,"ERROR: Invalid counter mode given",eError);
return 0;
}
if(self->iActive != 0)
{
SCWrite(pCon,"ERROR: another scan is still running",eError);
self->pCon = NULL;
self->pSics = NULL;
return 0;
}
HeaderFunc = self->WriteHeader;
self->WriteHeader = DummyWrite;
@ -2281,6 +2315,13 @@ int StoreScanCounts(pScanData self, char *data)
SCSendOK(pCon);
return 1;
}
else if(strcmp(argv[2],"soft") == 0)
{
ResetScanFunctions(self);
self->CollectScanData = CollectScanDataJochen;
SCSendOK(pCon);
return 1;
}
else
{
sprintf(pBueffel,"ERROR: option %s not recognized by configure",

View File

@ -1,3 +1,7 @@
# naff was here , best wishes
# naff was here , best wishes
# naff was here , best wishes
run anticollision 77.769997
yfactor 1.420000
yfactor setAccess 1
xfactor 0.715000
@ -88,6 +92,7 @@ om SoftUpperLim 134.000000
om Fixed -1.000000
om InterruptMode 0.000000
om AccessCode 2.000000
run om 103.500000
# Motor stt
stt sign 1.000000
stt SoftZero 0.000000
@ -96,6 +101,7 @@ stt SoftUpperLim 113.000000
stt Fixed -1.000000
stt InterruptMode 0.000000
stt AccessCode 2.000000
run stt 120.000000
# Motor ch
ch sign 1.000000
ch SoftZero 0.000000
@ -104,6 +110,7 @@ ch SoftUpperLim 190.000000
ch Fixed -1.000000
ch InterruptMode 0.000000
ch AccessCode 1.000000
run ch 180.000000
# Motor ph
ph sign 1.000000
ph SoftZero 0.000000
@ -112,6 +119,7 @@ ph SoftUpperLim 360.000000
ph Fixed -1.000000
ph InterruptMode 0.000000
ph AccessCode 2.000000
run ph 360.000000
# Motor dg3
dg3 sign 1.000000
dg3 SoftZero 0.000000
@ -120,6 +128,7 @@ dg3 SoftUpperLim 40.000000
dg3 Fixed -1.000000
dg3 InterruptMode 0.000000
dg3 AccessCode 2.000000
run dg3 25.000000
# Motor dg2
dg2 sign 1.000000
dg2 SoftZero 0.000000
@ -128,6 +137,7 @@ dg2 SoftUpperLim 40.000000
dg2 Fixed -1.000000
dg2 InterruptMode 0.000000
dg2 AccessCode 2.000000
run dg2 25.000000
# Motor dg1
dg1 sign 1.000000
dg1 SoftZero 0.000000
@ -136,6 +146,7 @@ dg1 SoftUpperLim 40.000000
dg1 Fixed -1.000000
dg1 InterruptMode 0.000000
dg1 AccessCode 2.000000
run dg1 25.000000
# Motor muca
muca sign 1.000000
muca SoftZero 0.000000
@ -144,6 +155,7 @@ muca SoftUpperLim 36.000000
muca Fixed -1.000000
muca InterruptMode 0.000000
muca AccessCode 2.000000
run muca 3.000000
# Motor phi
phi sign 1.000000
phi SoftZero 0.000000
@ -152,6 +164,7 @@ phi SoftUpperLim 360.000000
phi Fixed -1.000000
phi InterruptMode 0.000000
phi AccessCode 2.000000
run phi 360.000000
# Motor chi
chi sign 1.000000
chi SoftZero 0.000000
@ -160,6 +173,7 @@ chi SoftUpperLim 190.000000
chi Fixed -1.000000
chi InterruptMode 0.000000
chi AccessCode 1.000000
run chi 180.000000
# Motor omega
omega sign 1.000000
omega SoftZero 0.000000
@ -168,6 +182,7 @@ omega SoftUpperLim 134.000000
omega Fixed -1.000000
omega InterruptMode 0.000000
omega AccessCode 2.000000
run omega 103.500000
# Motor twotheta
twotheta sign 1.000000
twotheta SoftZero 0.000000
@ -176,7 +191,8 @@ twotheta SoftUpperLim 113.000000
twotheta Fixed -1.000000
twotheta InterruptMode 0.000000
twotheta AccessCode 2.000000
lastscancommand cscan a4 10. .1 10 5
run twotheta 120.000000
lastscancommand cscan som .85 .05 16 1
lastscancommand setAccess 2
sample_mur 0.000000
sample_mur setAccess 2
@ -188,17 +204,20 @@ phone UNKNOWN
phone setAccess 2
adress UNKNOWN
adress setAccess 2
run o2t 130.000000
run lambda 5.321338
# Counter counter
counter SetPreset 1000.000000
counter SetMode Timer
counter SetPreset 1.000000
counter SetMode Monitor
# Motor som
som sign 1.000000
som SoftZero 0.000000
som SoftLowerLim -360.000000
som SoftUpperLim 360.000000
som SoftZero -20.000000
som SoftLowerLim -340.000000
som SoftUpperLim 380.000000
som Fixed -1.000000
som InterruptMode 0.000000
som AccessCode 2.000000
run som 120.000000
# Motor sax
sax sign 1.000000
sax SoftZero 0.000000
@ -207,6 +226,9 @@ sax SoftUpperLim 30.000000
sax Fixed -1.000000
sax InterruptMode 0.000000
sax AccessCode 2.000000
run sax 30.000000
run lumbda 0.000000
run nvs 0.000000
# Motor tilt
tilt sign 1.000000
tilt SoftZero 0.000000
@ -215,6 +237,7 @@ tilt SoftUpperLim 15.000000
tilt Fixed -1.000000
tilt InterruptMode 0.000000
tilt AccessCode 0.000000
run tilt 15.000000
#----- MultiMotor st
st recovernampos henry d1r 5. d1l -5. d1t 0.
#----- MultiMotor sampletable
@ -227,6 +250,7 @@ detectorrotation SoftUpperLim 20.000000
detectorrotation Fixed -1.000000
detectorrotation InterruptMode 0.000000
detectorrotation AccessCode 2.000000
run detectorrotation 20.000000
# Motor detectory
detectory sign 1.000000
detectory SoftZero 0.000000
@ -235,6 +259,7 @@ detectory SoftUpperLim 20.000000
detectory Fixed -1.000000
detectory InterruptMode 0.000000
detectory AccessCode 2.000000
run detectory 20.000000
# Motor detectorx
detectorx sign 1.000000
detectorx SoftZero 0.000000
@ -243,6 +268,7 @@ detectorx SoftUpperLim 20.000000
detectorx Fixed -1.000000
detectorx InterruptMode 0.000000
detectorx AccessCode 2.000000
run detectorx 20.000000
# Motor beamstopy
beamstopy sign 1.000000
beamstopy SoftZero 0.000000
@ -251,6 +277,7 @@ beamstopy SoftUpperLim 20.000000
beamstopy Fixed -1.000000
beamstopy InterruptMode 0.000000
beamstopy AccessCode 2.000000
run beamstopy 20.000000
# Motor beamstopx
beamstopx sign 1.000000
beamstopx SoftZero 0.000000
@ -259,6 +286,7 @@ beamstopx SoftUpperLim 20.000000
beamstopx Fixed -1.000000
beamstopx InterruptMode 0.000000
beamstopx AccessCode 2.000000
run beamstopx 20.000000
# Motor d2t
d2t sign 1.000000
d2t SoftZero 0.000000
@ -267,6 +295,7 @@ d2t SoftUpperLim 20.000000
d2t Fixed -1.000000
d2t InterruptMode 0.000000
d2t AccessCode 2.000000
run d2t 20.000000
# Motor d2l
d2l sign 1.000000
d2l SoftZero 0.000000
@ -275,6 +304,7 @@ d2l SoftUpperLim 20.000000
d2l Fixed -1.000000
d2l InterruptMode 0.000000
d2l AccessCode 2.000000
run d2l 20.000000
# Motor d2r
d2r sign 1.000000
d2r SoftZero 0.000000
@ -283,6 +313,7 @@ d2r SoftUpperLim 20.000000
d2r Fixed -1.000000
d2r InterruptMode 0.000000
d2r AccessCode 2.000000
run d2r 20.000000
# Motor d1t
d1t sign 1.000000
d1t SoftZero 0.000000
@ -291,6 +322,7 @@ d1t SoftUpperLim 20.000000
d1t Fixed -1.000000
d1t InterruptMode 0.000000
d1t AccessCode 2.000000
run d1t 20.000000
# Motor d1l
d1l sign 1.000000
d1l SoftZero 0.000000
@ -299,6 +331,7 @@ d1l SoftUpperLim 20.000000
d1l Fixed -1.000000
d1l InterruptMode 0.000000
d1l AccessCode 2.000000
run d1l 20.000000
# Motor d1r
d1r sign 1.000000
d1r SoftZero 0.000000
@ -307,6 +340,7 @@ d1r SoftUpperLim 20.000000
d1r Fixed -1.000000
d1r InterruptMode 0.000000
d1r AccessCode 2.000000
run d1r 20.000000
# Motor monochi
monochi sign 1.000000
monochi SoftZero 0.000000
@ -315,6 +349,7 @@ monochi SoftUpperLim 30.000000
monochi Fixed -1.000000
monochi InterruptMode 0.000000
monochi AccessCode 2.000000
run monochi 30.000000
# Motor monophi
monophi sign 1.000000
monophi SoftZero 0.000000
@ -323,6 +358,7 @@ monophi SoftUpperLim 30.000000
monophi Fixed -1.000000
monophi InterruptMode 0.000000
monophi AccessCode 2.000000
run monophi 30.000000
# Motor monoy
monoy sign 1.000000
monoy SoftZero 0.000000
@ -331,6 +367,7 @@ monoy SoftUpperLim 30.000000
monoy Fixed -1.000000
monoy InterruptMode 0.000000
monoy AccessCode 2.000000
run monoy 30.000000
# Motor monox
monox sign 1.000000
monox SoftZero 0.000000
@ -339,6 +376,7 @@ monox SoftUpperLim 30.000000
monox Fixed -1.000000
monox InterruptMode 0.000000
monox AccessCode 2.000000
run monox 30.000000
# Motor tasse
tasse sign 1.000000
tasse SoftZero 0.000000
@ -347,6 +385,7 @@ tasse SoftUpperLim 130.000000
tasse Fixed -1.000000
tasse InterruptMode 0.000000
tasse AccessCode 2.000000
run tasse 130.000000
# Motor sdm
sdm sign 1.000000
sdm SoftZero 0.000000
@ -355,6 +394,7 @@ sdm SoftUpperLim 50.000000
sdm Fixed -1.000000
sdm InterruptMode 0.000000
sdm AccessCode 2.000000
run sdm 27.500000
# Motor sgu
sgu sign 1.000000
sgu SoftZero 0.000000
@ -363,6 +403,7 @@ sgu SoftUpperLim 20.000000
sgu Fixed -1.000000
sgu InterruptMode 0.000000
sgu AccessCode 2.000000
run sgu 20.000000
# Motor sgl
sgl sign 1.000000
sgl SoftZero 0.000000
@ -371,6 +412,7 @@ sgl SoftUpperLim 20.000000
sgl Fixed -1.000000
sgl InterruptMode 0.000000
sgl AccessCode 2.000000
run sgl 20.000000
# Motor mgu
mgu sign 1.000000
mgu SoftZero 0.000000
@ -379,6 +421,7 @@ mgu SoftUpperLim 50.000000
mgu Fixed -1.000000
mgu InterruptMode 0.000000
mgu AccessCode 2.000000
run mgu 50.000000
# Motor stu
stu sign 1.000000
stu SoftZero 0.000000
@ -387,6 +430,7 @@ stu SoftUpperLim 30.000000
stu Fixed -1.000000
stu InterruptMode 0.000000
stu AccessCode 2.000000
run stu 30.000000
# Motor stl
stl sign 1.000000
stl SoftZero 0.000000
@ -395,6 +439,7 @@ stl SoftUpperLim 30.000000
stl Fixed -1.000000
stl InterruptMode 0.000000
stl AccessCode 2.000000
run stl 30.000000
# Motor mtu
mtu sign 1.000000
mtu SoftZero 0.000000
@ -403,6 +448,7 @@ mtu SoftUpperLim 30.000000
mtu Fixed -1.000000
mtu InterruptMode 0.000000
mtu AccessCode 2.000000
run mtu 30.000000
# Motor mtl
mtl sign 1.000000
mtl SoftZero 0.000000
@ -411,6 +457,7 @@ mtl SoftUpperLim 30.000000
mtl Fixed -1.000000
mtl InterruptMode 0.000000
mtl AccessCode 2.000000
run mtl 30.000000
# Motor a6
a6 sign 1.000000
a6 SoftZero 0.000000
@ -419,6 +466,7 @@ a6 SoftUpperLim 30.000000
a6 Fixed -1.000000
a6 InterruptMode 0.000000
a6 AccessCode 2.000000
run a6 30.000000
# Motor a5
a5 sign 1.000000
a5 SoftZero 0.000000
@ -427,6 +475,7 @@ a5 SoftUpperLim 30.000000
a5 Fixed -1.000000
a5 InterruptMode 0.000000
a5 AccessCode 2.000000
run a5 30.000000
# Motor a4
a4 sign 1.000000
a4 SoftZero 0.000000
@ -435,14 +484,16 @@ a4 SoftUpperLim 130.000000
a4 Fixed -1.000000
a4 InterruptMode 0.000000
a4 AccessCode 2.000000
run a4 130.000000
# Motor a3
a3 sign 1.000000
a3 SoftZero 0.000000
a3 SoftLowerLim -360.000000
a3 SoftUpperLim 360.000000
a3 SoftZero -20.000000
a3 SoftLowerLim -340.000000
a3 SoftUpperLim 380.000000
a3 Fixed -1.000000
a3 InterruptMode 0.000000
a3 AccessCode 2.000000
run a3 120.000000
# Motor a2
a2 sign 1.000000
a2 SoftZero 0.000000
@ -451,6 +502,7 @@ a2 SoftUpperLim 137.000000
a2 Fixed -1.000000
a2 InterruptMode 0.000000
a2 AccessCode 2.000000
run a2 105.000000
# Motor a1
a1 sign 1.000000
a1 SoftZero 0.000000
@ -459,6 +511,7 @@ a1 SoftUpperLim 120.000000
a1 Fixed -1.000000
a1 InterruptMode 0.000000
a1 AccessCode 2.000000
run a1 52.500000
user Uwe Filges
user setAccess 2
sample D20 30K SNP Okt 2001 GS
@ -467,3 +520,4 @@ title endtest called with 23.000000 :Driving:
title setAccess 2
starttime 2002-08-07 08:09:45
starttime setAccess 2
Success

View File

@ -260,6 +260,7 @@ static float FAILRATE;
{
self->lCounts[i] = (long)rand();
}
self->lCounts[1] = self->fPreset;
return OKOK;
}
@ -272,6 +273,7 @@ static float FAILRATE;
{
self->lCounts[i] = (long)rand();
}
self->lCounts[1] = self->fPreset;
return OKOK;
}
/*-------------------------------------------------------------------------*/

View File

@ -151,7 +151,7 @@
Dbg_mask = 0;
Dbg_lev0 = 0;
Dbg_lev1 = 0;
Dbg_lev1 = 1;
Dbg_lev2 = 0;
Dbg_lev3 = 0;
Cfgn_done = 0; /* Force a configuration before we can do anything. */

View File

@ -221,6 +221,7 @@
{
extraDetectors = 0;
}
pInternal->extraDetector = extraDetectors;
@ -488,7 +489,7 @@ pCon);
{
SinqHMDriv *pInternal;
pICountable pCountInt = NULL;
int status, iMode, nHist;
int status, iMode, nHist, length;
char pError[132];
assert(self);
@ -514,8 +515,12 @@ pCon);
self->data->nTimeChan;
status = SINQHMZero(pInternal->pMaster,-1,-1,-1);
}else{
length = getHMDataLength(self->data);
if(pInternal->extraDetector > 0 && isInTOFMode(self->data) ) {
length += pInternal->extraDetector*getNoOfTimebins(self->data);
}
status = SINQHMZero(pInternal->pMaster,-1,0,
getHMDataLength(self->data));
length);
}
/*
status = SINQHMZero(pInternal->pMaster,-1,-1,-1);

View File

@ -152,7 +152,7 @@ int MakeSync(SConnection *pCon, SicsInterp *pSics, void *pData,
int Synchronize(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[])
{
char pBueffel[1024];
char pBueffel[2048];
char pRead[80];
int test,i;
SConnection *internalCon = NULL;

156
tclintimpl.c Normal file
View File

@ -0,0 +1,156 @@
/* -------------------------------------------------------------------------
This class allows for the implementation off SICS internal interfaces
through Tcl scripts. Additionally, helper functions for supporting such
scripts are provided.
This is the first implementation which only supports saving additional
data into status files. This is the object decriptor interface.
copyright: see file COPYRIGHT
Mark Koennecke, May 2003
------------------------------------------------------------------------*/
#include <stdio.h>
#include <assert.h>
#include <tcl.h>
#include "fortify.h"
#include "splitter.h"
#include "tclintimpl.h"
/*================== our data structure ===================================*/
typedef struct {
pObjectDescriptor pDes;
char *saveScript;
FILE *fd;
} tclInt, *pTclInt;
/*======================= interface functions ============================*/
static int TclSaveStatus(void *pData, char *name, FILE *fd){
pTclInt self = NULL;
char pBuffer[1024];
self = (pTclInt)pData;
assert(self);
if(self->saveScript == NULL){
return 1;
}
if(strlen(self->saveScript) + strlen(name) + 2 >= 1023){
fprintf(fd,"#ERROR: arguments to long for save scripting");
return 1;
}
strcpy(pBuffer,self->saveScript);
strcat(pBuffer," ");
strcat(pBuffer,name);
self->fd = fd;
Tcl_Eval(InterpGetTcl(pServ->pSics),pBuffer);
self->fd = NULL;
return 1;
}
/*======================== data structure creation and deletion ==========*/
static pTclInt MakeTclIntData(void){
pTclInt pNew = NULL;
pNew = (pTclInt)malloc(sizeof(tclInt));
if(pNew == NULL){
return NULL;
}
memset(pNew,0,sizeof(tclInt));
pNew->pDes = CreateDescriptor("SICS Interfaces in Tcl");
pNew->pDes->SaveStatus = TclSaveStatus;
if(!pNew->pDes){
free(pNew);
return NULL;
}
return pNew;
}
/*------------------------------------------------------------------------*/
static void KillTclInt(void *pData){
pTclInt self = NULL;
self = (pTclInt)pData;
if(self == NULL){
return;
}
if(self->pDes != NULL){
DeleteDescriptor(self->pDes);
}
if(self->saveScript != NULL){
free(self->saveScript);
}
free(self);
}
/*=============== interpreter interface + helper functions =============*/
int MakeTclInt(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[]){
pTclInt pNew = NULL;
char pBuffer[132];
int iRet;
if(argc < 2) {
SCWrite(pCon,"ERROR: I need a name argument for the script interface",
eError);
return 0;
}
pNew = MakeTclIntData();
if(pNew == NULL){
SCWrite(pCon,"ERROR: no memory to create SICS script interface",
eError);
return 0;
}
iRet = AddCommand(pSics,argv[1],TclIntAction,KillTclInt,(void *)pNew);
if(!iRet){
sprintf(pBuffer,"ERROR: duplicate command %s not created",argv[1]);
SCWrite(pCon,pBuffer,eError);
return 0;
}
return 1;
}
/*--------------------------------------------------------------------*/
int TclIntAction(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[]){
pTclInt self = NULL;
char pBuffer[1024];
self = (pTclInt)pData;
assert(self);
if(argc < 2){
sprintf(pBuffer,"ERROR: %s expects at least one argument!", argv[0]);
SCWrite(pCon,pBuffer,eError);
return 0;
}
strtolower(argv[1]);
if(strcmp(argv[1],"savescript") == 0){
if(argc < 3){
SCWrite(pCon,"ERROR: missing argument to savescript",eError);
return 0;
}
if(self->saveScript != NULL){
free(self->saveScript);
self->saveScript = NULL;
}
self->saveScript = strdup(argv[2]);
SCSendOK(pCon);
return 1;
} else if(strcmp(argv[1],"backup") == 0){
Arg2Text(argc-2, &argv[2],pBuffer,1023);
if(self->fd != NULL){
fprintf(self->fd,"%s\n",pBuffer);
}
SCSendOK(pCon);
return 1;
} else {
sprintf(pBuffer,"ERROR: keyword %s to %s not recognized",
argv[1],argv[0]);
SCWrite(pCon,pBuffer,eError);
return 0;
}
return 1;
}

26
tclintimpl.h Normal file
View File

@ -0,0 +1,26 @@
/* -------------------------------------------------------------------------
This class allows for the implementation off SICS internal interfaces
through Tcl scripts. Additionally, helper functions for supporting such
scripts are provided.
This is the first implementation which only supports saving additional
data into status files. This is the object decriptor interface.
copyright: see file COPYRIGHT
Mark Koennecke, May 2003
------------------------------------------------------------------------*/
#ifndef TCLINTIMPL
#define TCLINTIMPL
#include "sics.h"
int MakeTclInt(SConnection *pCon,SicsInterp *pSics, void *pData,
int argc, char *argv[]);
int TclIntAction(SConnection *pCon,SicsInterp *pSics, void *pData,
int argc, char *argv[]);
#endif

16
tdchm.c
View File

@ -258,7 +258,7 @@ static int TDCHalt(pHistDriver self){
/*=====================================================================*/
static int TDCCountStatus(pHistDriver self, SConnection *pCon){
pTdc tdc = NULL;
int status;
int tdcstatus, status;
float fControl;
assert(self);
@ -273,9 +273,17 @@ static int TDCCountStatus(pHistDriver self, SConnection *pCon){
or to do some sort of progress report. So it has to have an associated
counter in order to stop it at the end.
*/
if(status != HWBusy){
status = disableTdc(tdc);
if(status != 1){
/*
This is no proper fix. The proper fix would be to keep the state
in the private data structure as well and disbale to TDC
on HWNoBeam and enable the TDC again if the
beam comes on. However, this is done in hardware at SANS-II. So we
leave it for now.
*/
if(status == HWIdle || status == HWFault){
tdcstatus = disableTdc(tdc);
if(tdcstatus != 1){
tdc->errorCode = COMMERROR;
return HWFault;
}

View File

@ -5,8 +5,8 @@
# Markus Zolliker, March 2003
#--------------------------------------------------------------------------
# the following lines only for fortified version
DFORTIFY=-DFORTIFY -I$(SRC)..
FORTIFYOBJ=../strdup.o ../fortify.o
#DFORTIFY=-DFORTIFY -I$(SRC)..
#FORTIFYOBJ=../strdup.o ../fortify.o
#==========================================================================