mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 19:30:03 +02:00
update mode to skip firmware checks and setupDetector, kernel check added to m3and g2
This commit is contained in:
parent
8e49a114db
commit
20a959bf61
@ -23,6 +23,7 @@
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
extern udpStruct udpDetails;
|
||||
extern const enum detectorType myDetectorType;
|
||||
|
||||
@ -105,8 +106,9 @@ void basictests() {
|
||||
}
|
||||
|
||||
// does check only if flag is 0 (by default), set by command line
|
||||
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||
(testBus() == FAIL))) {
|
||||
if ((!debugflag) && (!updateFlag) &&
|
||||
((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||
(testBus() == FAIL))) {
|
||||
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
||||
"Dangerous to continue.\n");
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
@ -145,7 +147,7 @@ void basictests() {
|
||||
(long long int)client_sw_apiversion));
|
||||
|
||||
// return if flag is not zero, debug mode
|
||||
if (debugflag) {
|
||||
if (debugflag || updateFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -417,7 +419,7 @@ uint32_t getDetectorIP() {
|
||||
/* initialization */
|
||||
|
||||
void initControlServer() {
|
||||
if (initError == OK) {
|
||||
if (!updateFlag && initError == OK) {
|
||||
setupDetector();
|
||||
}
|
||||
initCheckDone = 1;
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
extern udpStruct udpDetails;
|
||||
extern const enum detectorType myDetectorType;
|
||||
|
||||
@ -140,7 +141,7 @@ void basictests() {
|
||||
return;
|
||||
#endif
|
||||
// return if debugflag is not zero, debug mode
|
||||
if (debugflag) {
|
||||
if (debugflag || updateFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -319,7 +320,7 @@ u_int32_t getDetectorIP() {
|
||||
|
||||
void initControlServer() {
|
||||
LOG(logINFOBLUE, ("Configuring Control server\n"));
|
||||
if (initError == OK) {
|
||||
if (!updateFlag && initError == OK) {
|
||||
readDetectorNumber();
|
||||
getModuleConfiguration();
|
||||
#ifndef VIRTUAL
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
extern int checkModuleFlag;
|
||||
extern udpStruct udpDetails;
|
||||
extern const enum detectorType myDetectorType;
|
||||
@ -92,8 +93,9 @@ void basictests() {
|
||||
return;
|
||||
}
|
||||
// does check only if flag is 0 (by default), set by command line
|
||||
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||
(testBus() == FAIL))) {
|
||||
if ((!debugflag) && (!updateFlag) &&
|
||||
((checkKernelVersion() == FAIL) || (checkType() == FAIL) ||
|
||||
(testFpga() == FAIL) || (testBus() == FAIL))) {
|
||||
sprintf(initErrorMessage,
|
||||
"Could not pass basic tests of FPGA and bus. Dangerous to "
|
||||
"continue. (Firmware version:0x%llx) \n",
|
||||
@ -131,7 +133,7 @@ void basictests() {
|
||||
(long long int)client_sw_apiversion));
|
||||
|
||||
// return if flag is not zero, debug mode
|
||||
if (debugflag) {
|
||||
if (debugflag || updateFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -175,6 +177,25 @@ void basictests() {
|
||||
#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() {
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
@ -326,7 +347,7 @@ u_int32_t getDetectorIP() {
|
||||
/* initialization */
|
||||
|
||||
void initControlServer() {
|
||||
if (initError == OK) {
|
||||
if (!updateFlag && initError == OK) {
|
||||
setupDetector();
|
||||
}
|
||||
initCheckDone = 1;
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#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)
|
||||
|
||||
|
@ -18,6 +18,9 @@
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
extern udpStruct udpDetails;
|
||||
extern const enum detectorType myDetectorType;
|
||||
|
||||
@ -91,7 +94,8 @@ void basictests() {
|
||||
}
|
||||
|
||||
// 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))) {
|
||||
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
||||
"Dangerous to continue.\n");
|
||||
@ -125,7 +129,9 @@ void basictests() {
|
||||
(long long int)fwversion, (long long int)swversion,
|
||||
(long long int)client_sw_apiversion));
|
||||
|
||||
LOG(logINFO, ("Basic Tests - success\n"));
|
||||
if (!debugflag || updateFlag) {
|
||||
LOG(logINFO, ("Basic Tests - success\n"));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -343,7 +349,7 @@ u_int32_t getBoardRevision() {
|
||||
/* initialization */
|
||||
|
||||
void initControlServer() {
|
||||
if (initError == OK) {
|
||||
if (!updateFlag && initError == OK) {
|
||||
setupDetector();
|
||||
}
|
||||
initCheckDone = 1;
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
extern udpStruct udpDetails;
|
||||
extern const enum detectorType myDetectorType;
|
||||
|
||||
@ -77,8 +78,9 @@ void basictests() {
|
||||
}
|
||||
|
||||
// does check only if flag is 0 (by default), set by command line
|
||||
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||
(testBus() == FAIL))) {
|
||||
if ((!debugflag) && (!updateFlag) &&
|
||||
((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||
(testBus() == FAIL))) {
|
||||
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
||||
"Dangerous to continue.\n");
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
@ -119,7 +121,7 @@ void basictests() {
|
||||
(long long int)client_sw_apiversion));
|
||||
|
||||
// return if flag is not zero, debug mode
|
||||
if (debugflag) {
|
||||
if (debugflag || updateFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -347,7 +349,7 @@ u_int32_t getDetectorIP() {
|
||||
/* initialization */
|
||||
|
||||
void initControlServer() {
|
||||
if (initError == OK) {
|
||||
if (!updateFlag && initError == OK) {
|
||||
setupDetector();
|
||||
}
|
||||
initCheckDone = 1;
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
extern udpStruct udpDetails;
|
||||
extern const enum detectorType myDetectorType;
|
||||
|
||||
@ -101,8 +102,9 @@ void basictests() {
|
||||
}
|
||||
|
||||
// does check only if flag is 0 (by default), set by command line
|
||||
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||
(testBus() == FAIL))) {
|
||||
if ((!debugflag) && (!updateFlag) &&
|
||||
((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||
(testBus() == FAIL))) {
|
||||
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
||||
"Dangerous to continue.\n");
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
@ -141,7 +143,7 @@ void basictests() {
|
||||
(long long int)client_sw_apiversion));
|
||||
|
||||
// return if flag is not zero, debug mode
|
||||
if (debugflag) {
|
||||
if (debugflag || updateFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -413,7 +415,7 @@ uint32_t getDetectorIP() {
|
||||
/* initialization */
|
||||
|
||||
void initControlServer() {
|
||||
if (initError == OK) {
|
||||
if (!updateFlag && initError == OK) {
|
||||
setupDetector();
|
||||
}
|
||||
initCheckDone = 1;
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
// Global variable from slsDetectorServer_funcs
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
extern int checkModuleFlag;
|
||||
extern udpStruct udpDetails;
|
||||
extern const enum detectorType myDetectorType;
|
||||
@ -80,8 +81,9 @@ void basictests() {
|
||||
return;
|
||||
}
|
||||
// does check only if flag is 0 (by default), set by command line
|
||||
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||
(testBus() == FAIL))) {
|
||||
if ((!debugflag) && (!updateFlag) &&
|
||||
((checkKernelVersion() == FAIL) || (checkType() == FAIL) ||
|
||||
(testFpga() == FAIL) || (testBus() == FAIL))) {
|
||||
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
||||
"Dangerous to continue.\n");
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
@ -117,7 +119,7 @@ void basictests() {
|
||||
(long long int)client_sw_apiversion));
|
||||
|
||||
// return if flag is not zero, debug mode
|
||||
if (debugflag) {
|
||||
if (debugflag || updateFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -161,6 +163,25 @@ void basictests() {
|
||||
#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() {
|
||||
#ifdef VIRTUAL
|
||||
return OK;
|
||||
@ -313,7 +334,7 @@ u_int32_t getDetectorIP() {
|
||||
/* initialization */
|
||||
|
||||
void initControlServer() {
|
||||
if (initError == OK) {
|
||||
if (!updateFlag && initError == OK) {
|
||||
setupDetector();
|
||||
}
|
||||
initCheckDone = 1;
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#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)
|
||||
|
||||
@ -24,24 +25,25 @@
|
||||
#define MAX_EXT_SIGNALS (8)
|
||||
|
||||
/** Default Parameters */
|
||||
#define DEFAULT_PATTERN_FILE ("DefaultPattern_mythen3.txt")
|
||||
#define DEFAULT_INTERNAL_GATES (1)
|
||||
#define DEFAULT_EXTERNAL_GATES (1)
|
||||
#define DEFAULT_DYNAMIC_RANGE (32)
|
||||
#define DEFAULT_NUM_FRAMES (1)
|
||||
#define DEFAULT_NUM_CYCLES (1)
|
||||
#define DEFAULT_GATE_WIDTH (100 * 1000 * 1000) // ns
|
||||
#define DEFAULT_GATE_DELAY (0)
|
||||
#define DEFAULT_PERIOD (2 * 1000 * 1000) // ns
|
||||
#define DEFAULT_DELAY_AFTER_TRIGGER (0)
|
||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||
#define DEFAULT_READOUT_C0 (8) //(125000000) // rdo_clk, 125 MHz
|
||||
#define DEFAULT_READOUT_C1 (8) //(125000000) // rdo_x2_clk, 125 MHz
|
||||
#define DEFAULT_SYSTEM_C0 (4) //(250000000) // run_clk, 250 MHz
|
||||
#define DEFAULT_SYSTEM_C1 (8) //(125000000) // sync_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_PATTERN_FILE ("DefaultPattern_mythen3.txt")
|
||||
#define DEFAULT_INTERNAL_GATES (1)
|
||||
#define DEFAULT_EXTERNAL_GATES (1)
|
||||
#define DEFAULT_DYNAMIC_RANGE (32)
|
||||
#define DEFAULT_NUM_FRAMES (1)
|
||||
#define DEFAULT_NUM_CYCLES (1)
|
||||
#define DEFAULT_GATE_WIDTH (100 * 1000 * 1000) // ns
|
||||
#define DEFAULT_GATE_DELAY (0)
|
||||
#define DEFAULT_PERIOD (2 * 1000 * 1000) // ns
|
||||
#define DEFAULT_DELAY_AFTER_TRIGGER (0)
|
||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||
#define DEFAULT_READOUT_C0 (8) //(125000000) // rdo_clk, 125 MHz
|
||||
#define DEFAULT_READOUT_C1 (8) //(125000000) // rdo_x2_clk, 125 MHz
|
||||
#define DEFAULT_SYSTEM_C0 (4) //(250000000) // run_clk, 250 MHz
|
||||
#define DEFAULT_SYSTEM_C1 (8) //(125000000) // sync_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_ASIC_LATCHING_NUM_PULSES (10)
|
||||
#define DEFAULT_MSTR_OTPT_P1_NUM_PULSES (20)
|
||||
|
||||
@ -110,7 +112,8 @@ enum CLKINDEX {
|
||||
NUM_CLOCKS
|
||||
};
|
||||
#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 };
|
||||
|
||||
/* Struct Definitions */
|
||||
|
@ -56,6 +56,9 @@ typedef struct udpStruct_s {
|
||||
int isInitCheckDone();
|
||||
int getInitResult(char **mess);
|
||||
void basictests();
|
||||
#ifdefined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||
int checkKernelVersion();
|
||||
#endif
|
||||
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || \
|
||||
defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||
int checkType();
|
||||
|
@ -21,6 +21,7 @@ extern int ret;
|
||||
// Global variables from slsDetectorServer_funcs
|
||||
extern int sockfd;
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
extern int checkModuleFlag;
|
||||
|
||||
// Global variables from slsDetectorFunctionList
|
||||
@ -41,6 +42,7 @@ int main(int argc, char *argv[]) {
|
||||
int portno = DEFAULT_PORTNO;
|
||||
isControlServer = 1;
|
||||
debugflag = 0;
|
||||
updateFlag = 0;
|
||||
checkModuleFlag = 1;
|
||||
int version = 0;
|
||||
|
||||
@ -54,10 +56,12 @@ int main(int argc, char *argv[]) {
|
||||
"Possible arguments are:\n"
|
||||
"\t-v, --version : Software version\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 "
|
||||
"Module mode. Skips detector type checks. \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 "
|
||||
"control server \n\n",
|
||||
argv[0]);
|
||||
@ -69,9 +73,10 @@ int main(int argc, char *argv[]) {
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"version", no_argument, NULL, 'v'},
|
||||
{"port", required_argument, NULL, 'p'},
|
||||
{"devel", no_argument, NULL, 'd'},
|
||||
{"phaseshift", required_argument, NULL, 'f'},
|
||||
{"nomodule", no_argument, NULL, 'g'}, // generic
|
||||
{"devel", no_argument, NULL, 'd'},
|
||||
{"update", no_argument, NULL, 'u'},
|
||||
{"stopserver", no_argument, NULL, 's'},
|
||||
{NULL, 0, NULL, 0}};
|
||||
|
||||
@ -81,7 +86,7 @@ int main(int argc, char *argv[]) {
|
||||
int c = 0;
|
||||
|
||||
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
|
||||
if (c == -1)
|
||||
@ -117,11 +122,6 @@ int main(int argc, char *argv[]) {
|
||||
LOG(logINFO, ("Detected port: %d\n", portno));
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
LOG(logINFO, ("Detected developer mode\n"));
|
||||
debugflag = 1;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
#ifndef GOTTHARDD
|
||||
LOG(logERROR,
|
||||
@ -142,6 +142,16 @@ int main(int argc, char *argv[]) {
|
||||
checkModuleFlag = 0;
|
||||
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':
|
||||
LOG(logINFO, ("Detected stop server\n"));
|
||||
isControlServer = 0;
|
||||
|
@ -42,6 +42,7 @@ extern char mess[MAX_STR_LENGTH];
|
||||
// Variables that will be exported
|
||||
int sockfd = 0;
|
||||
int debugflag = 0;
|
||||
int updateFlag = 0;
|
||||
int checkModuleFlag = 1;
|
||||
udpStruct udpDetails = {32410, 32411, 50001, 50002, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
int configured = FAIL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user