update mode to skip firmware checks and setupDetector, kernel check added to m3and g2

This commit is contained in:
maliakal_d 2020-09-08 15:08:45 +02:00
parent 8e49a114db
commit 20a959bf61
12 changed files with 125 additions and 52 deletions

View File

@ -23,6 +23,7 @@
// Global variable from slsDetectorServer_funcs // Global variable from slsDetectorServer_funcs
extern int debugflag; extern int debugflag;
extern int updateFlag;
extern udpStruct udpDetails; extern udpStruct udpDetails;
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
@ -105,7 +106,8 @@ void basictests() {
} }
// does check only if flag is 0 (by default), set by command line // does check only if flag is 0 (by default), set by command line
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) || if ((!debugflag) && (!updateFlag) &&
((checkType() == FAIL) || (testFpga() == FAIL) ||
(testBus() == FAIL))) { (testBus() == FAIL))) {
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. " strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
"Dangerous to continue.\n"); "Dangerous to continue.\n");
@ -145,7 +147,7 @@ void basictests() {
(long long int)client_sw_apiversion)); (long long int)client_sw_apiversion));
// return if flag is not zero, debug mode // return if flag is not zero, debug mode
if (debugflag) { if (debugflag || updateFlag) {
return; return;
} }
@ -417,7 +419,7 @@ uint32_t getDetectorIP() {
/* initialization */ /* initialization */
void initControlServer() { void initControlServer() {
if (initError == OK) { if (!updateFlag && initError == OK) {
setupDetector(); setupDetector();
} }
initCheckDone = 1; initCheckDone = 1;

View File

@ -20,6 +20,7 @@
// Global variable from slsDetectorServer_funcs // Global variable from slsDetectorServer_funcs
extern int debugflag; extern int debugflag;
extern int updateFlag;
extern udpStruct udpDetails; extern udpStruct udpDetails;
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
@ -140,7 +141,7 @@ void basictests() {
return; return;
#endif #endif
// return if debugflag is not zero, debug mode // return if debugflag is not zero, debug mode
if (debugflag) { if (debugflag || updateFlag) {
return; return;
} }
@ -319,7 +320,7 @@ u_int32_t getDetectorIP() {
void initControlServer() { void initControlServer() {
LOG(logINFOBLUE, ("Configuring Control server\n")); LOG(logINFOBLUE, ("Configuring Control server\n"));
if (initError == OK) { if (!updateFlag && initError == OK) {
readDetectorNumber(); readDetectorNumber();
getModuleConfiguration(); getModuleConfiguration();
#ifndef VIRTUAL #ifndef VIRTUAL

View File

@ -22,6 +22,7 @@
// Global variable from slsDetectorServer_funcs // Global variable from slsDetectorServer_funcs
extern int debugflag; extern int debugflag;
extern int updateFlag;
extern int checkModuleFlag; extern int checkModuleFlag;
extern udpStruct udpDetails; extern udpStruct udpDetails;
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
@ -92,8 +93,9 @@ void basictests() {
return; return;
} }
// does check only if flag is 0 (by default), set by command line // does check only if flag is 0 (by default), set by command line
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) || if ((!debugflag) && (!updateFlag) &&
(testBus() == FAIL))) { ((checkKernelVersion() == FAIL) || (checkType() == FAIL) ||
(testFpga() == FAIL) || (testBus() == FAIL))) {
sprintf(initErrorMessage, sprintf(initErrorMessage,
"Could not pass basic tests of FPGA and bus. Dangerous to " "Could not pass basic tests of FPGA and bus. Dangerous to "
"continue. (Firmware version:0x%llx) \n", "continue. (Firmware version:0x%llx) \n",
@ -131,7 +133,7 @@ void basictests() {
(long long int)client_sw_apiversion)); (long long int)client_sw_apiversion));
// return if flag is not zero, debug mode // return if flag is not zero, debug mode
if (debugflag) { if (debugflag || updateFlag) {
return; return;
} }
@ -175,6 +177,25 @@ void basictests() {
#endif #endif
} }
int checkKernelVersion() {
#ifdef VIRTUAL
return OK;
#endif
char output[256];
memset(output, 0, 256);
FILE *sysFile = popen("uname -a | cut -d ' ' -f5-10", "r");
fgets(output, sizeof(output), sysFile);
pclose(sysFile);
if (strstr(output, KERNEL_DATE_VRSN) == NULL) {
LOG(logERROR, ("Kernel Version Incompatible! Expected: %s, Got: %s\n",
KERNEL_DATE_VRSN, output));
return FAIL;
}
LOG(logINFO, ("Kernel Version Compatible: %s\n", output));
return OK;
}
int checkType() { int checkType() {
#ifdef VIRTUAL #ifdef VIRTUAL
return OK; return OK;
@ -326,7 +347,7 @@ u_int32_t getDetectorIP() {
/* initialization */ /* initialization */
void initControlServer() { void initControlServer() {
if (initError == OK) { if (!updateFlag && initError == OK) {
setupDetector(); setupDetector();
} }
initCheckDone = 1; initCheckDone = 1;

View File

@ -2,6 +2,7 @@
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#define REQRD_FRMWRE_VRSN (0x200707) #define REQRD_FRMWRE_VRSN (0x200707)
#define KERNEL_DATE_VRSN "Wed May 20 13:58:38 CEST 2020"
#define CTRL_SRVR_INIT_TIME_US (300 * 1000) #define CTRL_SRVR_INIT_TIME_US (300 * 1000)

View File

@ -18,6 +18,9 @@
#include <time.h> #include <time.h>
#endif #endif
// Global variable from slsDetectorServer_funcs
extern int debugflag;
extern int updateFlag;
extern udpStruct udpDetails; extern udpStruct udpDetails;
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
@ -91,7 +94,8 @@ void basictests() {
} }
// does check only if flag is 0 (by default), set by command line // does check only if flag is 0 (by default), set by command line
if (((checkType() == FAIL) || (testFpga() == FAIL) || if ((!debugflag) && (!updateFlag) &&
((checkType() == FAIL) || (testFpga() == FAIL) ||
(testBus() == FAIL))) { (testBus() == FAIL))) {
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. " strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
"Dangerous to continue.\n"); "Dangerous to continue.\n");
@ -125,7 +129,9 @@ void basictests() {
(long long int)fwversion, (long long int)swversion, (long long int)fwversion, (long long int)swversion,
(long long int)client_sw_apiversion)); (long long int)client_sw_apiversion));
if (!debugflag || updateFlag) {
LOG(logINFO, ("Basic Tests - success\n")); LOG(logINFO, ("Basic Tests - success\n"));
}
#endif #endif
} }
@ -343,7 +349,7 @@ u_int32_t getBoardRevision() {
/* initialization */ /* initialization */
void initControlServer() { void initControlServer() {
if (initError == OK) { if (!updateFlag && initError == OK) {
setupDetector(); setupDetector();
} }
initCheckDone = 1; initCheckDone = 1;

View File

@ -22,6 +22,7 @@
// Global variable from slsDetectorServer_funcs // Global variable from slsDetectorServer_funcs
extern int debugflag; extern int debugflag;
extern int updateFlag;
extern udpStruct udpDetails; extern udpStruct udpDetails;
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
@ -77,7 +78,8 @@ void basictests() {
} }
// does check only if flag is 0 (by default), set by command line // does check only if flag is 0 (by default), set by command line
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) || if ((!debugflag) && (!updateFlag) &&
((checkType() == FAIL) || (testFpga() == FAIL) ||
(testBus() == FAIL))) { (testBus() == FAIL))) {
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. " strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
"Dangerous to continue.\n"); "Dangerous to continue.\n");
@ -119,7 +121,7 @@ void basictests() {
(long long int)client_sw_apiversion)); (long long int)client_sw_apiversion));
// return if flag is not zero, debug mode // return if flag is not zero, debug mode
if (debugflag) { if (debugflag || updateFlag) {
return; return;
} }
@ -347,7 +349,7 @@ u_int32_t getDetectorIP() {
/* initialization */ /* initialization */
void initControlServer() { void initControlServer() {
if (initError == OK) { if (!updateFlag && initError == OK) {
setupDetector(); setupDetector();
} }
initCheckDone = 1; initCheckDone = 1;

View File

@ -21,6 +21,7 @@
// Global variable from slsDetectorServer_funcs // Global variable from slsDetectorServer_funcs
extern int debugflag; extern int debugflag;
extern int updateFlag;
extern udpStruct udpDetails; extern udpStruct udpDetails;
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
@ -101,7 +102,8 @@ void basictests() {
} }
// does check only if flag is 0 (by default), set by command line // does check only if flag is 0 (by default), set by command line
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) || if ((!debugflag) && (!updateFlag) &&
((checkType() == FAIL) || (testFpga() == FAIL) ||
(testBus() == FAIL))) { (testBus() == FAIL))) {
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. " strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
"Dangerous to continue.\n"); "Dangerous to continue.\n");
@ -141,7 +143,7 @@ void basictests() {
(long long int)client_sw_apiversion)); (long long int)client_sw_apiversion));
// return if flag is not zero, debug mode // return if flag is not zero, debug mode
if (debugflag) { if (debugflag || updateFlag) {
return; return;
} }
@ -413,7 +415,7 @@ uint32_t getDetectorIP() {
/* initialization */ /* initialization */
void initControlServer() { void initControlServer() {
if (initError == OK) { if (!updateFlag && initError == OK) {
setupDetector(); setupDetector();
} }
initCheckDone = 1; initCheckDone = 1;

View File

@ -21,6 +21,7 @@
// Global variable from slsDetectorServer_funcs // Global variable from slsDetectorServer_funcs
extern int debugflag; extern int debugflag;
extern int updateFlag;
extern int checkModuleFlag; extern int checkModuleFlag;
extern udpStruct udpDetails; extern udpStruct udpDetails;
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
@ -80,8 +81,9 @@ void basictests() {
return; return;
} }
// does check only if flag is 0 (by default), set by command line // does check only if flag is 0 (by default), set by command line
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) || if ((!debugflag) && (!updateFlag) &&
(testBus() == FAIL))) { ((checkKernelVersion() == FAIL) || (checkType() == FAIL) ||
(testFpga() == FAIL) || (testBus() == FAIL))) {
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. " strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
"Dangerous to continue.\n"); "Dangerous to continue.\n");
LOG(logERROR, ("%s\n\n", initErrorMessage)); LOG(logERROR, ("%s\n\n", initErrorMessage));
@ -117,7 +119,7 @@ void basictests() {
(long long int)client_sw_apiversion)); (long long int)client_sw_apiversion));
// return if flag is not zero, debug mode // return if flag is not zero, debug mode
if (debugflag) { if (debugflag || updateFlag) {
return; return;
} }
@ -161,6 +163,25 @@ void basictests() {
#endif #endif
} }
int checkKernelVersion() {
#ifdef VIRTUAL
return OK;
#endif
char output[256];
memset(output, 0, 256);
FILE *sysFile = popen("uname -a | cut -d ' ' -f5-10", "r");
fgets(output, sizeof(output), sysFile);
pclose(sysFile);
if (strstr(output, KERNEL_DATE_VRSN) == NULL) {
LOG(logERROR, ("Kernel Version Incompatible! Expected: %s, Got: %s\n",
KERNEL_DATE_VRSN, output));
return FAIL;
}
LOG(logINFO, ("Kernel Version Compatible: %s\n", output));
return OK;
}
int checkType() { int checkType() {
#ifdef VIRTUAL #ifdef VIRTUAL
return OK; return OK;
@ -313,7 +334,7 @@ u_int32_t getDetectorIP() {
/* initialization */ /* initialization */
void initControlServer() { void initControlServer() {
if (initError == OK) { if (!updateFlag && initError == OK) {
setupDetector(); setupDetector();
} }
initCheckDone = 1; initCheckDone = 1;

View File

@ -2,6 +2,7 @@
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#define REQRD_FRMWRE_VRSN 0x190000 #define REQRD_FRMWRE_VRSN 0x190000
#define KERNEL_DATE_VRSN "Wed May 20 13:58:38 CEST 2020"
#define CTRL_SRVR_INIT_TIME_US (300 * 1000) #define CTRL_SRVR_INIT_TIME_US (300 * 1000)
@ -41,7 +42,8 @@
#define DEFAULT_SYSTEM_C0 (4) //(250000000) // run_clk, 250 MHz #define DEFAULT_SYSTEM_C0 (4) //(250000000) // run_clk, 250 MHz
#define DEFAULT_SYSTEM_C1 (8) //(125000000) // sync_clk, 125 MHz #define DEFAULT_SYSTEM_C1 (8) //(125000000) // sync_clk, 125 MHz
#define DEFAULT_SYSTEM_C2 (8) //(125000000) // str_clk, 125 MHz #define DEFAULT_SYSTEM_C2 (8) //(125000000) // str_clk, 125 MHz
#define DEFAULT_SYSTEM_C3 (5) //(200000000) // smp_clk, 200 MHz (only for timing receiver) #define DEFAULT_SYSTEM_C3 \
(5) //(200000000) // smp_clk, 200 MHz (only for timing receiver)
#define DEFAULT_ASIC_LATCHING_NUM_PULSES (10) #define DEFAULT_ASIC_LATCHING_NUM_PULSES (10)
#define DEFAULT_MSTR_OTPT_P1_NUM_PULSES (20) #define DEFAULT_MSTR_OTPT_P1_NUM_PULSES (20)
@ -110,7 +112,8 @@ enum CLKINDEX {
NUM_CLOCKS NUM_CLOCKS
}; };
#define CLK_NAMES \ #define CLK_NAMES \
"READOUT_C0", "READOUT_C1", "SYSTEM_C0", "SYSTEM_C1", "SYSTEM_C2", "SYSTEM_C3" "READOUT_C0", "READOUT_C1", "SYSTEM_C0", "SYSTEM_C1", "SYSTEM_C2", \
"SYSTEM_C3"
enum PLLINDEX { READOUT_PLL, SYSTEM_PLL }; enum PLLINDEX { READOUT_PLL, SYSTEM_PLL };
/* Struct Definitions */ /* Struct Definitions */

View File

@ -56,6 +56,9 @@ typedef struct udpStruct_s {
int isInitCheckDone(); int isInitCheckDone();
int getInitResult(char **mess); int getInitResult(char **mess);
void basictests(); void basictests();
#ifdefined(MYTHEN3D) || defined(GOTTHARD2D)
int checkKernelVersion();
#endif
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || \ #if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || \
defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D) defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
int checkType(); int checkType();

View File

@ -21,6 +21,7 @@ extern int ret;
// Global variables from slsDetectorServer_funcs // Global variables from slsDetectorServer_funcs
extern int sockfd; extern int sockfd;
extern int debugflag; extern int debugflag;
extern int updateFlag;
extern int checkModuleFlag; extern int checkModuleFlag;
// Global variables from slsDetectorFunctionList // Global variables from slsDetectorFunctionList
@ -41,6 +42,7 @@ int main(int argc, char *argv[]) {
int portno = DEFAULT_PORTNO; int portno = DEFAULT_PORTNO;
isControlServer = 1; isControlServer = 1;
debugflag = 0; debugflag = 0;
updateFlag = 0;
checkModuleFlag = 1; checkModuleFlag = 1;
int version = 0; int version = 0;
@ -54,10 +56,12 @@ int main(int argc, char *argv[]) {
"Possible arguments are:\n" "Possible arguments are:\n"
"\t-v, --version : Software version\n" "\t-v, --version : Software version\n"
"\t-p, --port <port> : TCP communication port with client. \n" "\t-p, --port <port> : TCP communication port with client. \n"
"\t-d, --devel : Developer mode. Skips firmware checks. \n"
"\t-g, --nomodule : [Mythen3][Gotthard2] Generic or No " "\t-g, --nomodule : [Mythen3][Gotthard2] Generic or No "
"Module mode. Skips detector type checks. \n" "Module mode. Skips detector type checks. \n"
"\t-f, --phaseshift <value> : [Gotthard] only. Sets phase shift. \n" "\t-f, --phaseshift <value> : [Gotthard] only. Sets phase shift. \n"
"\t-d, --devel : Developer mode. Skips firmware checks. \n"
"\t-u, --update : Update mode. Skips firmware checks and "
"initial detector setup. \n"
"\t-s, --stopserver : Stop server. Do not use as created by " "\t-s, --stopserver : Stop server. Do not use as created by "
"control server \n\n", "control server \n\n",
argv[0]); argv[0]);
@ -69,9 +73,10 @@ int main(int argc, char *argv[]) {
{"help", no_argument, NULL, 'h'}, {"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'v'},
{"port", required_argument, NULL, 'p'}, {"port", required_argument, NULL, 'p'},
{"devel", no_argument, NULL, 'd'},
{"phaseshift", required_argument, NULL, 'f'}, {"phaseshift", required_argument, NULL, 'f'},
{"nomodule", no_argument, NULL, 'g'}, // generic {"nomodule", no_argument, NULL, 'g'}, // generic
{"devel", no_argument, NULL, 'd'},
{"update", no_argument, NULL, 'u'},
{"stopserver", no_argument, NULL, 's'}, {"stopserver", no_argument, NULL, 's'},
{NULL, 0, NULL, 0}}; {NULL, 0, NULL, 0}};
@ -81,7 +86,7 @@ int main(int argc, char *argv[]) {
int c = 0; int c = 0;
while (c != -1) { while (c != -1) {
c = getopt_long(argc, argv, "hvp:df:gs", long_options, &option_index); c = getopt_long(argc, argv, "hvp:f:gdus", long_options, &option_index);
// Detect the end of the options // Detect the end of the options
if (c == -1) if (c == -1)
@ -117,11 +122,6 @@ int main(int argc, char *argv[]) {
LOG(logINFO, ("Detected port: %d\n", portno)); LOG(logINFO, ("Detected port: %d\n", portno));
break; break;
case 'd':
LOG(logINFO, ("Detected developer mode\n"));
debugflag = 1;
break;
case 'f': case 'f':
#ifndef GOTTHARDD #ifndef GOTTHARDD
LOG(logERROR, LOG(logERROR,
@ -142,6 +142,16 @@ int main(int argc, char *argv[]) {
checkModuleFlag = 0; checkModuleFlag = 0;
break; break;
case 'd':
LOG(logINFO, ("Detected developer mode\n"));
debugflag = 1;
break;
case 'u':
LOG(logINFO, ("Detected update mode\n"));
updateFlag = 1;
break;
case 's': case 's':
LOG(logINFO, ("Detected stop server\n")); LOG(logINFO, ("Detected stop server\n"));
isControlServer = 0; isControlServer = 0;

View File

@ -42,6 +42,7 @@ extern char mess[MAX_STR_LENGTH];
// Variables that will be exported // Variables that will be exported
int sockfd = 0; int sockfd = 0;
int debugflag = 0; int debugflag = 0;
int updateFlag = 0;
int checkModuleFlag = 1; int checkModuleFlag = 1;
udpStruct udpDetails = {32410, 32411, 50001, 50002, 0, 0, 0, 0, 0, 0, 0, 0}; udpStruct udpDetails = {32410, 32411, 50001, 50002, 0, 0, 0, 0, 0, 0, 0, 0};
int configured = FAIL; int configured = FAIL;