From 68d6c514a9b9c0f44e53e212f88f29349037c891 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Wed, 10 Jan 2018 15:49:40 +0100 Subject: [PATCH] jungfrau server has same resetfpga, programfpga and debug mode as developer branch, eiger server has effects from debug flag, but not compiled --- .../slsDetectorFunctionList.c | 2 +- .../jungfrauDetectorServer/gitInfo.txt | 14 +++++++------- .../jungfrauDetectorServer/gitInfoJungfrau.h | 10 +++++----- .../slsDetectorFunctionList.c | 12 +++++++++--- .../slsDetectorFunctionList.h | 2 +- .../slsDetectorServer/slsDetectorServer.c | 13 +++++++++++-- .../slsDetectorServer_funcs.c | 19 ++++++++++++++----- .../slsDetectorServer_funcs.h | 2 +- 8 files changed, 49 insertions(+), 25 deletions(-) diff --git a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c index be09db5b5..49de345af 100644 --- a/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorSoftware/eigerDetectorServer/slsDetectorFunctionList.c @@ -68,7 +68,7 @@ int normal = 0; /* basic tests */ -void checkFirmwareCompatibility(){ +void checkFirmwareCompatibility(int flag){ uint32_t ipadd = getDetectorIP(); uint64_t macadd = getDetectorMAC(); int64_t fwversion = getDetectorId(DETECTOR_FIRMWARE_VERSION); diff --git a/slsDetectorSoftware/jungfrauDetectorServer/gitInfo.txt b/slsDetectorSoftware/jungfrauDetectorServer/gitInfo.txt index d904ed28b..ae7f83f2c 100644 --- a/slsDetectorSoftware/jungfrauDetectorServer/gitInfo.txt +++ b/slsDetectorSoftware/jungfrauDetectorServer/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/slsDetectorSoftware/jungfrauDetectorServer -URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git -Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git -Repsitory UUID: 3c1eb747d1930d6d38030a5a607f72d3b58a7a21 -Revision: 90 -Branch: 3.0 +URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git +Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git +Repsitory UUID: 669033597145b4eae2e94f620a4dd50a2fa50231 +Revision: 95 +Branch: jungfrauchanges Last Changed Author: Dhanya_Maliakal -Last Changed Rev: 1549 -Last Changed Date: 2017-10-25 16:48:35.000000002 +0200 ./RegisterDefs.h +Last Changed Rev: 3331 +Last Changed Date: 2017-12-20 16:57:32.000000002 +0100 ./RegisterDefs.h diff --git a/slsDetectorSoftware/jungfrauDetectorServer/gitInfoJungfrau.h b/slsDetectorSoftware/jungfrauDetectorServer/gitInfoJungfrau.h index cc7c81cf7..5d5676c0a 100644 --- a/slsDetectorSoftware/jungfrauDetectorServer/gitInfoJungfrau.h +++ b/slsDetectorSoftware/jungfrauDetectorServer/gitInfoJungfrau.h @@ -1,6 +1,6 @@ -#define GITURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git" -#define GITREPUUID "3c1eb747d1930d6d38030a5a607f72d3b58a7a21" +#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git" +#define GITREPUUID "669033597145b4eae2e94f620a4dd50a2fa50231" #define GITAUTH "Dhanya_Maliakal" -#define GITREV 0x1549 -#define GITDATE 0x20171025 -#define GITBRANCH "blabla" +#define GITREV 0x3331 +#define GITDATE 0x20171220 +#define GITBRANCH "jungfrauchanges" diff --git a/slsDetectorSoftware/jungfrauDetectorServer/slsDetectorFunctionList.c b/slsDetectorSoftware/jungfrauDetectorServer/slsDetectorFunctionList.c index e05096ee1..49b120121 100644 --- a/slsDetectorSoftware/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorSoftware/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -25,11 +25,17 @@ int32_t clkPhase[2] = {0, 0}; /* basic tests */ -void checkFirmwareCompatibility() { +void checkFirmwareCompatibility(int flag) { defineGPIOpins(); resetFPGA(); - if ((mapCSP0() == FAIL) || (checkType() == FAIL) || (testFpga() == FAIL) || (testBus() == FAIL)) { + if (mapCSP0() == FAIL) { + cprintf(BG_RED, "Dangerous to continue. Goodbye!\n"); + exit(EXIT_FAILURE); + } + + // does check only if flag is 0 (by default), set by command line + if ((!flag) && ((checkType() == FAIL) || (testFpga() == FAIL) || (testBus() == FAIL))) { cprintf(BG_RED, "Dangerous to continue. Goodbye!\n"); exit(EXIT_FAILURE); } @@ -254,7 +260,7 @@ u_int32_t getDetectorIP(){ /* initialization */ void initControlServer(){ - + clkPhase[0] = 0; clkPhase[1] = 0; setupDetector(); printf("\n"); } diff --git a/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h b/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h index ee3e16d94..b0ab9e2c7 100644 --- a/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h +++ b/slsDetectorSoftware/slsDetectorServer/slsDetectorFunctionList.h @@ -17,7 +17,7 @@ Here are the definitions, but the actual implementation should be done for each // basic tests -void checkFirmwareCompatibility(); +void checkFirmwareCompatibility(int flag); #ifdef JUNGFRAUD int checkType(); u_int32_t testFpga(void); diff --git a/slsDetectorSoftware/slsDetectorServer/slsDetectorServer.c b/slsDetectorSoftware/slsDetectorServer/slsDetectorServer.c index 4a59e28c1..8e1157980 100755 --- a/slsDetectorSoftware/slsDetectorServer/slsDetectorServer.c +++ b/slsDetectorSoftware/slsDetectorServer/slsDetectorServer.c @@ -10,7 +10,7 @@ #include #include #include - +#include extern int sockfd; @@ -23,11 +23,19 @@ int main(int argc, char *argv[]){ int portno, b; int retval=OK; int sd, fd; + int debugflag = 0; // if socket crash, ignores SISPIPE, prevents global signal handler // subsequent read/write to socket gives error - must handle locally signal(SIGPIPE, SIG_IGN); + // circumvent the basic tests + if(argc > 1) { + if(!strcasecmp(argv[1],"-debug")){ + debugflag = 1; + argc=1; + } + } #ifdef STOP_SERVER char cmd[100]; @@ -40,9 +48,10 @@ int main(int argc, char *argv[]){ "********************************************************\n\n" , portno); b=1; - basictests(); + basictests(debugflag); #ifdef STOP_SERVER sprintf(cmd,"%s %d &",argv[0],DEFAULT_PORTNO+1); + //cprintf(BLUE,"cmd:%s\n", cmd); system(cmd); #endif } else { diff --git a/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c b/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c index 653c1d785..dcb91b293 100755 --- a/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c +++ b/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.c @@ -37,7 +37,8 @@ int sockfd; // (updated in slsDetectorServer) as extern int (*flist[NUM_DET_FUNCTIONS])(int); char mess[MAX_STR_LENGTH]; int dataBytes = 10; - +int isControlServer = 0; +int debugflag = 0; /* initialization functions */ @@ -46,9 +47,10 @@ int printSocketReadError() { return FAIL; } -void basictests() { +void basictests(int flag) { + debugflag = flag; #ifdef SLS_DETECTOR_FUNCTION_LIST - checkFirmwareCompatibility(); + checkFirmwareCompatibility(debugflag); #endif } @@ -59,8 +61,10 @@ void init_detector(int controlserver) { #endif #ifdef SLS_DETECTOR_FUNCTION_LIST - if (controlserver) + if (controlserver) { + isControlServer = 1; initControlServer(); + } else initStopServer(); #endif strcpy(mess,"dummy message"); @@ -4601,6 +4605,9 @@ int program_fpga(int file_des) { #ifdef VERY_VERBOSE printf("Done with program receiving command\n"); #endif + if (isControlServer) + basictests(debugflag); + init_detector(isControlServer); } #endif if (ret==OK) @@ -4646,7 +4653,9 @@ int reset_fpga(int file_des) { } #ifdef SLS_DETECTOR_FUNCTION_LIST else { - initControlServer(); + if (isControlServer) + basictests(debugflag); + initControlServer(isControlServer); ret = FORCE_UPDATE; } #endif diff --git a/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.h b/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.h index 68cba7e0c..e98feb57f 100755 --- a/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.h +++ b/slsDetectorSoftware/slsDetectorServer/slsDetectorServer_funcs.h @@ -6,7 +6,7 @@ // initialization functions int printSocketReadError(); -void basictests(); +void basictests(int); void init_detector(int); int decode_function(int); const char* getFunctionName(enum detFuncs func);