diff --git a/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c b/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c index e7c178583..25aac87da 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c +++ b/slsDetectorSoftware/gotthardDetectorServer/firmware_funcs.c @@ -295,7 +295,7 @@ int setDAQRegister() //depended on pcb rev int tokenTiming = TOKEN_TIMING_REV2; - if(bus_r(PCB_REV_REG)==1) + if((bus_r(PCB_REV_REG)&BOARD_REVISION_MASK)==1) tokenTiming= TOKEN_TIMING_REV1; diff --git a/slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServer b/slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServer index 1dd9324b8..7a0c6be9a 100755 Binary files a/slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServer and b/slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServer differ diff --git a/slsDetectorSoftware/gotthardDetectorServer/registers_g.h b/slsDetectorSoftware/gotthardDetectorServer/registers_g.h index 4332e754d..9ae04a39b 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/registers_g.h +++ b/slsDetectorSoftware/gotthardDetectorServer/registers_g.h @@ -134,6 +134,14 @@ #define SHIFTMOD 2 #define SHIFTFIFO 9 +/** for PCB_REV_REG */ +#define DETECTOR_TYPE_MASK 0xF0000 +#define DETECTOR_TYPE_OFFSET 16 +#define BOARD_REVISION_MASK 0xFFFF +#define MOENCH_MODULE 2 + + + /* for control register */ #define START_ACQ_BIT 0x00000001 diff --git a/slsDetectorSoftware/gotthardDetectorServer/server.c b/slsDetectorSoftware/gotthardDetectorServer/server.c index 686f35bc5..7ac3303cc 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/server.c +++ b/slsDetectorSoftware/gotthardDetectorServer/server.c @@ -35,6 +35,8 @@ int main(int argc, char *argv[]) } } + + if (argc==1) { portno = DEFAULT_PORTNO; sprintf(cmd,"%s %d &",argv[0],DEFAULT_PORTNO+1); diff --git a/slsDetectorSoftware/gotthardDetectorServer/server_funcs.c b/slsDetectorSoftware/gotthardDetectorServer/server_funcs.c index 242461bf8..54c8c8270 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/server_funcs.c +++ b/slsDetectorSoftware/gotthardDetectorServer/server_funcs.c @@ -52,19 +52,28 @@ char mess[1000]; int digitalTestBit = 0; - + + +void check_detector_type(){ + if (((bus_r(PCB_REV_REG) & DETECTOR_TYPE_MASK)>> DETECTOR_TYPE_OFFSET) == MOENCH_MODULE){ + printf("This is a MOENCH detector. Exiting Gotthard Server.\n"); + exit(-1); + } +} + + int init_detector( int b) { -#ifndef PICASSOD + printf("This is a GOTTHARD detector with %d chips per module\n", NCHIP); -#else - printf("This is a PICASSO detector with %d chips per module\n", NCHIP); -#endif if (mapCSP0()==FAIL) { printf("Could not map memory\n"); - exit(1); + exit(-1); } + //check if it is really gotthard + check_detector_type(); + //testFpga(); if (b) { #ifdef MCB_FUNCS diff --git a/slsDetectorSoftware/gotthardDetectorServer/server_funcs.h b/slsDetectorSoftware/gotthardDetectorServer/server_funcs.h index 7dc8da6ea..282028ee4 100755 --- a/slsDetectorSoftware/gotthardDetectorServer/server_funcs.h +++ b/slsDetectorSoftware/gotthardDetectorServer/server_funcs.h @@ -23,7 +23,7 @@ int sockfd; int function_table(); int decode_function(int); - +void check_detector_type(); int init_detector(int); int M_nofunc(int);