From 78aaedf243c879d24e5c6cbe76d93452289ba274 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 29 May 2013 13:50:41 +0000 Subject: [PATCH] servers, setupdetector git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@588 951219d9-93cf-4727-9268-0efd64621fa3 --- .../eigerDetectorServer/Makefile | 5 +++ .../slsDetectorFunctionList.c | 39 ++++++++++++++++++- .../slsDetectorFunctionList.c | 26 ++++++++++++- .../slsDetectorFunctionList.h | 3 +- .../slsDetectorServer_funcs.c | 14 ++++--- 5 files changed, 79 insertions(+), 8 deletions(-) diff --git a/slsDetectorSoftware/eigerDetectorServer/Makefile b/slsDetectorSoftware/eigerDetectorServer/Makefile index 2a7ca3948..b015b71b6 100644 --- a/slsDetectorSoftware/eigerDetectorServer/Makefile +++ b/slsDetectorSoftware/eigerDetectorServer/Makefile @@ -13,6 +13,11 @@ OBJS = $(SRC_CLNT:.cpp=.o) all: clean $(PROGS) +pc: clean pccompile $(PROGS) + +pccompile: +CC := gcc + boot: $(OBJS) $(PROGS): diff --git a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c index 1faf31007..cc96bc827 100644 --- a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c @@ -36,7 +36,19 @@ int nModBoard; extern int dataBytes; -int initializeDetector(){ +/** temporary */ +u_int32_t CSP0BASE; +int mapCSP0(void) { + CSP0BASE = (u_int32_t)malloc(0xFFFFFFF); + printf("memory allocated\n"); + printf("CSPOBASE is 0x%x \n",CSP0BASE); + printf("CSPOBASE=from %08x to %x\n",CSP0BASE,CSP0BASE+0xFFFFFFF); + return OK; +} + + + +int initializeDetectorStructure(){ int imod; int n=getNModBoard(X)*getNModBoard(Y); @@ -82,6 +94,31 @@ int initializeDetector(){ + + + + +int setupDetector(){ + //testFpga(); + //testRAM(); + + //setSettings(GET_SETTINGS,-1); + //setFrames(1); + //setTrains(1); + //setExposureTime(1e6); + //setPeriod(1e9); + //setDelay(0); + //setGates(0); + + //setTiming(GET_EXTERNAL_COMMUNICATION_MODE); + //setMaster(GET_MASTER); + //setSynchronization(GET_SYNCHRONIZATION_MODE); + return OK; +} + + + + int setNMod(int nm, enum dimension dim){ return 1; } diff --git a/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.c b/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.c index 5cf0f9f9a..d1c06cae9 100644 --- a/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.c @@ -36,7 +36,7 @@ int nModBoard; extern int dataBytes; -int initializeDetector(){ +int initializeDetectorStructure(){ int imod; int n=getNModBoard(X)*getNModBoard(Y); @@ -82,6 +82,30 @@ int initializeDetector(){ + + + +int setupDetector(){ + //testFpga(); + //testRAM(); + + //setSettings(GET_SETTINGS,-1); + //setFrames(1); + //setTrains(1); + //setExposureTime(1e6); + //setPeriod(1e9); + //setDelay(0); + //setGates(0); + + //setTiming(GET_EXTERNAL_COMMUNICATION_MODE); + //setMaster(GET_MASTER); + //setSynchronization(GET_SYNCHRONIZATION_MODE); + return OK; +} + + + + int setNMod(int nm, enum dimension dim){ return 1; } diff --git a/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h b/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h index a5a7aecd2..98844779d 100644 --- a/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h +++ b/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h @@ -33,7 +33,8 @@ Here are the definitions, but the actual implementation should be done for each int mapCSP0(void); -int initializeDetector(); +int initializeDetectorStructure(); +int setupDetector(); int setNMod(int nm, enum dimension dim); int getNModBoard(enum dimension arg); diff --git a/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c b/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c index 7f0131c9e..4c802a422 100755 --- a/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c +++ b/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c @@ -52,16 +52,17 @@ int init_detector(int b) { printf("This is a VIRTUAL detector\n"); #endif #ifdef SLS_DETECTOR_FUNCTION_LIST - //mapCSP0(); + mapCSP0(); #endif //only for control server if(b){ #ifdef SLS_DETECTOR_FUNCTION_LIST - initializeDetector(); + + initializeDetectorStructure(); + setupDetector(); + /* all these should also be included in setupDetector */ //testFpga(); //testRAM(); - - //Initialization //setSettings(GET_SETTINGS,-1); //setFrames(1); //setTrains(1); @@ -69,7 +70,6 @@ int init_detector(int b) { //setPeriod(1e9); //setDelay(0); //setGates(0); - //setTiming(GET_EXTERNAL_COMMUNICATION_MODE); //setMaster(GET_MASTER); //setSynchronization(GET_SYNCHRONIZATION_MODE); @@ -91,7 +91,9 @@ int decode_function(int file_des) { #endif n = receiveDataOnly(file_des,&fnum,sizeof(fnum)); if (n <= 0) { +#ifdef VERBOSE printf("ERROR reading from socket %d, %d %d\n", n, fnum, file_des); +#endif return FAIL; } #ifdef VERBOSE @@ -102,6 +104,8 @@ int decode_function(int file_des) { #ifdef VERBOSE printf( "calling function fnum = %d %x\n",fnum,flist[fnum]); #endif + printf( "calling function fnum = %x %x\n",fnum,(unsigned int)flist[fnum]); + if (fnum<0 || fnum>255) fnum=255; ret=(*flist[fnum])(file_des);