From 61a1356bc354b6a6ccbb1bd0a659e6f4fa5740ab Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 11 Apr 2013 12:44:19 +0000 Subject: [PATCH] moench server first draft git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@509 951219d9-93cf-4727-9268-0efd64621fa3 --- .../commonFiles/sls_detector_defs.h | 3 +- .../gotthardDetectorServer/server_funcs.c | 3 +- .../moenchDetectorServer/Makefile | 4 +- .../moenchDetectorServer/Makefile.virtual | 2 +- .../moenchDetectorServer/mcb_funcs.c | 1 - .../moenchDetectorServer/server_defs.h | 6 +-- .../moenchDetectorServer/server_funcs.c | 37 ++++++++++++------- .../slsDetector/slsDetectorBase.h | 6 ++- 8 files changed, 38 insertions(+), 24 deletions(-) diff --git a/slsDetectorSoftware/commonFiles/sls_detector_defs.h b/slsDetectorSoftware/commonFiles/sls_detector_defs.h index f1551acec..cb9148834 100755 --- a/slsDetectorSoftware/commonFiles/sls_detector_defs.h +++ b/slsDetectorSoftware/commonFiles/sls_detector_defs.h @@ -172,7 +172,8 @@ enum detectorType { EIGER, /**< eiger */ GOTTHARD, /**< gotthard */ PICASSO, /**< picasso */ - AGIPD /**< agipd */ + AGIPD, /**< agipd */ + MOENCH /**< moench */ }; /* /\** */ diff --git a/slsDetectorSoftware/gotthardDetectorServer/server_funcs.c b/slsDetectorSoftware/gotthardDetectorServer/server_funcs.c index 4a01e2d1d..242461bf8 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/server_funcs.c +++ b/slsDetectorSoftware/gotthardDetectorServer/server_funcs.c @@ -26,12 +26,13 @@ const enum detectorType myDetectorType=GOTTHARD; const enum detectorType myDetectorType=EIGER; #elif PICASSOD const enum detectorType myDetectorType=PICASSO; +#elif MOENCHD +const enum detectorType myDetectorType=MOENCH; #else const enum detectorType myDetectorType=GENERIC; #endif - extern int nModX; extern int nModY; extern int dataBytes; diff --git a/slsDetectorSoftware/moenchDetectorServer/Makefile b/slsDetectorSoftware/moenchDetectorServer/Makefile index 75d6800cd..b067de322 100755 --- a/slsDetectorSoftware/moenchDetectorServer/Makefile +++ b/slsDetectorSoftware/moenchDetectorServer/Makefile @@ -6,10 +6,10 @@ CROSS = bfin-uclinux- CC = $(CROSS)gcc -CFLAGS += -Wall -DMCB_FUNCS -DDACS_INT -DDEBUG #-DVERBOSE #-DVERYVERBOSE #-DVIRTUAL #-DDACS_INT_CSERVER +CFLAGS += -Wall -DMOENCHD -DMCB_FUNCS -DDACS_INT -DDEBUG #-DVERBOSE #-DVERYVERBOSE #-DVIRTUAL #-DDACS_INT_CSERVER -PROGS= gotthardDetectorServer +PROGS= moenchDetectorServer INSTDIR= /tftpboot INSTMODE= 0777 diff --git a/slsDetectorSoftware/moenchDetectorServer/Makefile.virtual b/slsDetectorSoftware/moenchDetectorServer/Makefile.virtual index 9eef2f616..289901ae0 100755 --- a/slsDetectorSoftware/moenchDetectorServer/Makefile.virtual +++ b/slsDetectorSoftware/moenchDetectorServer/Makefile.virtual @@ -2,7 +2,7 @@ DESTDIR ?= ./ CC = gcc -CFLAGS += -Wall -DMCB_FUNCS -DDACS_INT -DDEBUG -DVIRTUAL +CFLAGS += -Wall -DMOENCH -DMCB_FUNCS -DDACS_INT -DDEBUG -DVIRTUAL PROGS= $(DESTDIR)/gotthardVirtualServer diff --git a/slsDetectorSoftware/moenchDetectorServer/mcb_funcs.c b/slsDetectorSoftware/moenchDetectorServer/mcb_funcs.c index e9352359f..d05db2a71 100755 --- a/slsDetectorSoftware/moenchDetectorServer/mcb_funcs.c +++ b/slsDetectorSoftware/moenchDetectorServer/mcb_funcs.c @@ -26,7 +26,6 @@ const int nChans=NCHAN; const int nChips=NCHIP; const int nDacs=NDAC; const int nAdcs=NADC; -const enum detectorType myDetectorType=GOTTHARD; enum detectorSettings thisSettings; int sChan, sChip, sMod, sDac, sAdc; diff --git a/slsDetectorSoftware/moenchDetectorServer/server_defs.h b/slsDetectorSoftware/moenchDetectorServer/server_defs.h index 05ed31b4a..5298cb5f5 100755 --- a/slsDetectorSoftware/moenchDetectorServer/server_defs.h +++ b/slsDetectorSoftware/moenchDetectorServer/server_defs.h @@ -8,13 +8,13 @@ // Hardware definitions -#define NCHAN 128 -#define NCHIP 10 +#define NCHAN 160*160 +#define NCHIP 1 #define NMAXMODX 1 #define NMAXMODY 1 #define NMAXMOD NMAXMODX*NMAXMODY #define NDAC 8 -#define NADC 5 +#define NADC 1 #define NCHANS NCHAN*NCHIP*NMAXMOD #define NDACS NDAC*NMAXMOD diff --git a/slsDetectorSoftware/moenchDetectorServer/server_funcs.c b/slsDetectorSoftware/moenchDetectorServer/server_funcs.c index bba9c94e3..8c05d20ce 100755 --- a/slsDetectorSoftware/moenchDetectorServer/server_funcs.c +++ b/slsDetectorSoftware/moenchDetectorServer/server_funcs.c @@ -9,7 +9,7 @@ #include "mcb_funcs.h" #include "trimming_funcs.h" #include "registers_g.h" -#include "svnInfoGotthard.h" +#include "svnInfoMoench.h" #define FIFO_DATA_REG_OFF 0x50<<11 #define CONTROL_REG 0x24<<11 @@ -17,12 +17,23 @@ int (*flist[256])(int); -#ifdef MCB_FUNCS -extern const enum detectorType myDetectorType; -#endif -#ifndef MCB_FUNCS + +//defined in the detector specific file +#ifdef MYTHEND +const enum detectorType myDetectorType=MYTHEN; +#elif GOTTHARDD const enum detectorType myDetectorType=GOTTHARD; +#elif EIGERD +const enum detectorType myDetectorType=EIGER; +#elif PICASSOD +const enum detectorType myDetectorType=PICASSO; +#elif MOENCHD +const enum detectorType myDetectorType=MOENCH; +#else +const enum detectorType myDetectorType=GENERIC; #endif + + extern int nModX; extern int nModY; extern int dataBytes; @@ -46,7 +57,7 @@ int digitalTestBit = 0; int init_detector( int b) { #ifndef PICASSOD - printf("This is a GOTTHARD detector with %d chips per module\n", NCHIP); + printf("This is a MOENCH detector with %d chips per module\n", NCHIP); #else printf("This is a PICASSO detector with %d chips per module\n", NCHIP); #endif @@ -63,7 +74,7 @@ int init_detector( int b) { #endif testFpga(); testRAM(); - //gotthard specific + //moench specific setPhaseShiftOnce(); prepareADC(); @@ -1569,7 +1580,7 @@ int get_threshold_energy(int file_des) { int n; int imod; - strcpy(mess,"cannot set threshold for gotthard"); + strcpy(mess,"cannot set threshold for moench"); n = receiveDataOnly(file_des,&imod,sizeof(imod)); if (n < 0) @@ -1590,7 +1601,7 @@ int set_threshold_energy(int file_des) { int arg[3]; int n; - strcpy(mess,"cannot set threshold for gotthard"); + strcpy(mess,"cannot set threshold for moench"); n = receiveDataOnly(file_des,&arg,sizeof(arg)); if (n < 0) @@ -2053,7 +2064,7 @@ int set_timer(int file_des) { retval=setGates(tns); break; case PROBES_NUMBER: - sprintf(mess,"can't set timer for gotthard\n"); + sprintf(mess,"can't set timer for moench\n"); ret=FAIL; break; case CYCLES_NUMBER: @@ -2317,7 +2328,7 @@ int set_speed(int file_des) { receiveDataOnly(file_des,&arg,sizeof(arg)); receiveDataOnly(file_des,&val,sizeof(val)); - sprintf(mess,"can't set speed variable for gotthard\n"); + sprintf(mess,"can't set speed variable for moench\n"); sendDataOnly(file_des,&ret,sizeof(ret)); @@ -2337,7 +2348,7 @@ int set_readout_flags(int file_des) { receiveDataOnly(file_des,&arg,sizeof(arg)); - sprintf(mess,"can't set readout flags for gotthard\n"); + sprintf(mess,"can't set readout flags for moench\n"); sendDataOnly(file_des,&ret,sizeof(ret)); sendDataOnly(file_des,mess,sizeof(mess)); @@ -2355,7 +2366,7 @@ int execute_trimming(int file_des) { int ret=FAIL; enum trimMode mode; - sprintf(mess,"can't set execute trimming for gotthard\n"); + sprintf(mess,"can't set execute trimming for moench\n"); receiveDataOnly(file_des,&mode,sizeof(mode)); receiveDataOnly(file_des,arg,sizeof(arg)); diff --git a/slsDetectorSoftware/slsDetector/slsDetectorBase.h b/slsDetectorSoftware/slsDetector/slsDetectorBase.h index ebcdb60a2..7fc1badde 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorBase.h +++ b/slsDetectorSoftware/slsDetector/slsDetectorBase.h @@ -477,7 +477,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef /** returns detector type string from detector type index \param t string can be Mythen, Pilatus, Eiger, Gotthard, Agipd, Unknown - \returns MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, GENERIC + \returns MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, MÖNCH, GENERIC */ static string getDetectorType(detectorType t){\ switch (t) {\ @@ -486,12 +486,13 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef case EIGER: return string("Eiger"); \ case GOTTHARD: return string("Gotthard"); \ case AGIPD: return string("Agipd"); \ + case MOENCH: return string("Mönch"); \ default: return string("Unknown"); \ }}; /** returns detector type index from detector type string \param type can be MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, GENERIC - \returns Mythen, Pilatus, Eiger, Gotthard, Agipd, Unknown + \returns Mythen, Pilatus, Eiger, Gotthard, Agipd, Mönch, Unknown */ static detectorType getDetectorType(string const type){\ if (type=="Mythen") return MYTHEN;\ @@ -499,6 +500,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef if (type=="Eiger") return EIGER; \ if (type=="Gotthard") return GOTTHARD; \ if (type=="Agipd") return AGIPD; \ + if (type=="Mönch") return MOENCH; \ return GENERIC;};