wip, removed extra virutal server binaries for eiger, --ignore-config for command line

This commit is contained in:
maliakal_d 2022-02-23 17:31:46 +01:00
parent 89edf58f41
commit 219318a52e
8 changed files with 81 additions and 101 deletions

View File

@ -16,91 +16,31 @@ include_directories(
../../slsSupportLib/include ../../slsSupportLib/include
) )
add_executable(eigerDetectorServerMaster_virtual add_executable(eigerDetectorServer_virtual
${src} ${src}
) )
target_include_directories(eigerDetectorServerMaster_virtual target_include_directories(eigerDetectorServer_virtual
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
) )
target_compile_definitions(eigerDetectorServerMaster_virtual target_compile_definitions(eigerDetectorServer_virtual
PUBLIC EIGERD PCCOMPILE STOP_SERVER
PUBLIC VIRTUAL #VIRTUAL_9M
PUBLIC VIRTUAL_MASTER
)
target_link_libraries(eigerDetectorServerMaster_virtual
PUBLIC pthread rt slsProjectCSettings
)
set_target_properties(eigerDetectorServerMaster_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS eigerDetectorServerMaster_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
add_executable(eigerDetectorServerSlaveTop_virtual
${src}
)
target_include_directories(eigerDetectorServerSlaveTop_virtual
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
)
target_compile_definitions(eigerDetectorServerSlaveTop_virtual
PUBLIC EIGERD PCCOMPILE STOP_SERVER
PUBLIC VIRTUAL #VIRTUAL_9M
PUBLIC VIRTUAL_TOP
)
target_link_libraries(eigerDetectorServerSlaveTop_virtual
PUBLIC pthread rt slsProjectCSettings
)
set_target_properties(eigerDetectorServerSlaveTop_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS eigerDetectorServerSlaveTop_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
add_executable(eigerDetectorServerSlaveBottom_virtual
${src}
)
target_include_directories(eigerDetectorServerSlaveBottom_virtual
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
)
target_compile_definitions(eigerDetectorServerSlaveBottom_virtual
PUBLIC EIGERD PCCOMPILE STOP_SERVER PUBLIC EIGERD PCCOMPILE STOP_SERVER
PUBLIC VIRTUAL #VIRTUAL_9M PUBLIC VIRTUAL #VIRTUAL_9M
) )
target_link_libraries(eigerDetectorServerSlaveBottom_virtual target_link_libraries(eigerDetectorServer_virtual
PUBLIC pthread rt slsProjectCSettings PUBLIC pthread rt slsProjectCSettings
) )
set_target_properties(eigerDetectorServerSlaveBottom_virtual PROPERTIES set_target_properties(eigerDetectorServer_virtual PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
) )
install(TARGETS eigerDetectorServerSlaveBottom_virtual install(TARGETS eigerDetectorServer_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
configure_file(config_eiger.txt ${CMAKE_BINARY_DIR}/bin/config_eiger.txt COPYONLY) configure_file(config_eiger.txt ${CMAKE_BINARY_DIR}/bin/config_eiger.txt COPYONLY)
configure_file(detid_eiger.txt ${CMAKE_BINARY_DIR}/bin/detid_eiger.txt COPYONLY) configure_file(detid_eiger.txt ${CMAKE_BINARY_DIR}/bin/detid_eiger.txt COPYONLY)

View File

@ -26,6 +26,7 @@ extern int updateFlag;
extern udpStruct udpDetails[MAX_UDP_DESTINATION]; extern udpStruct udpDetails[MAX_UDP_DESTINATION];
extern int numUdpDestinations; extern int numUdpDestinations;
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
extern int ignoreConfigFileFlag;
// Global variable from communication_funcs.c // Global variable from communication_funcs.c
extern int isControlServer; extern int isControlServer;
@ -381,20 +382,9 @@ void initStopServer() {
} }
} }
void setVirtualDefaultModuleConfigurations() { void checkVirtual9MFlag() {
LOG(logINFORED, ("updating virtual\n"));
#ifdef VIRTUAL #ifdef VIRTUAL
#ifdef VIRTUAL_MASTER
master = 1;
top = 1;
#else
master = 0;
#ifdef VIRTUAL_TOP
top = 1;
#else
top = 0;
#endif
#endif
#ifdef VIRTUAL_9M #ifdef VIRTUAL_9M
normal = 0; normal = 0;
#else #else
@ -404,13 +394,17 @@ void setVirtualDefaultModuleConfigurations() {
} }
int updateModuleConfiguration() { int updateModuleConfiguration() {
#ifdef VIRTUAL
setVirtualDefaultModuleConfigurations();
#else
if (getModuleConfiguration(&master, &top, &normal) == FAIL) { if (getModuleConfiguration(&master, &top, &normal) == FAIL) {
return FAIL; return FAIL;
} }
#ifdef VIRTUAL
checkVirtual9MFlag();
#endif #endif
if (isControlServer) {
LOG(logINFOBLUE,
("Module: %s %s %s\n", (top ? "TOP" : "BOTTOM"),
(master ? "MASTER" : "SLAVE"), (normal ? "NORMAL" : "SPECIAL")));
}
return OK; return OK;
} }
@ -430,21 +424,17 @@ int getModuleConfiguration(int *m, int *t, int *n) {
return FAIL; return FAIL;
} }
#endif #endif
if (isControlServer) {
LOG(logINFOBLUE,
("Module: %s %s %s\n", (*t ? "TOP" : "BOTTOM"),
(*m ? "MASTER" : "SLAVE"), (*n ? "NORMAL" : "SPECIAL")));
}
return OK; return OK;
} }
int readConfigFile() { int readConfigFile() {
if (initError == FAIL) { if (initError == FAIL) {
return initError; return initError;
} }
master = -1;
top = -1; if (ignoreConfigFileFlag) {
return OK;
}
const int fileNameSize = 128; const int fileNameSize = 128;
char fname[fileNameSize]; char fname[fileNameSize];
@ -1472,6 +1462,7 @@ int setHighVoltage(int val) {
/* parameters - timing, extsig */ /* parameters - timing, extsig */
int setMaster(int m) { int setMaster(int m) {
LOG(logINFO, ("Setting up as %s\n", (m == 1 ? "Master" : "Slave")));
#ifdef VIRTUAL #ifdef VIRTUAL
master = m; master = m;
#else #else

View File

@ -28,6 +28,7 @@ extern int updateFlag;
extern int checkModuleFlag; extern int checkModuleFlag;
extern udpStruct udpDetails[MAX_UDP_DESTINATION]; extern udpStruct udpDetails[MAX_UDP_DESTINATION];
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
extern int ignoreConfigFileFlag;
// Global variable from communication_funcs.c // Global variable from communication_funcs.c
extern int isControlServer; extern int isControlServer;
@ -69,6 +70,7 @@ int64_t burstPeriodReg = 0;
int filterResistor = 0; int filterResistor = 0;
int cdsGain = 0; int cdsGain = 0;
int detPos[2] = {}; int detPos[2] = {};
int master = 1;
int isInitCheckDone() { return initCheckDone; } int isInitCheckDone() { return initCheckDone; }
@ -600,6 +602,10 @@ int readConfigFile() {
return initError; return initError;
} }
if (ignoreConfigFileFlag) {
return OK;
}
// require a sleep before and after the rst dac signal // require a sleep before and after the rst dac signal
usleep(INITIAL_STARTUP_WAIT); usleep(INITIAL_STARTUP_WAIT);
@ -1442,6 +1448,11 @@ int setHighVoltage(int val) {
/* parameters - timing */ /* parameters - timing */
int isMaster(int *retval) {
*retval = master;
return OK;
}
void updatingRegisters() { void updatingRegisters() {
LOG(logINFO, ("\tUpdating registers\n")); LOG(logINFO, ("\tUpdating registers\n"));
// burst // burst
@ -1921,9 +1932,16 @@ int checkDetectorType() {
return -2; return -2;
} }
if ((abs(type - TYPE_GOTTHARD2_MODULE_VAL) > TYPE_TOLERANCE) && if (abs(type - TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL) <= TYPE_TOLERANCE) {
(abs(type - TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL) > TYPE_TOLERANCE) && LOG(logINFOBLUE, ("MASTER 25um Module\n"));
(abs(type - TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL) > TYPE_TOLERANCE)) { } else if (abs(type - TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL) <=
TYPE_TOLERANCE) {
master = 0;
LOG(logINFOBLUE, ("SLAVE 25um Module\n"));
} else if (abs(type - TYPE_GOTTHARD2_MODULE_VAL) <= TYPE_TOLERANCE) {
master = 0;
LOG(logINFOBLUE, ("50um Module\n"));
} else {
LOG(logERROR, LOG(logERROR,
("Wrong Module attached! Expected %d, %d or %d for Gotthard2, got " ("Wrong Module attached! Expected %d, %d or %d for Gotthard2, got "
"%d\n", "%d\n",

View File

@ -25,6 +25,7 @@ extern int debugflag;
extern int updateFlag; extern int updateFlag;
extern udpStruct udpDetails[MAX_UDP_DESTINATION]; extern udpStruct udpDetails[MAX_UDP_DESTINATION];
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
extern int ignoreConfigFileFlag;
// Variables that will be exported // Variables that will be exported
int phaseShift = DEFAULT_PHASE_SHIFT; int phaseShift = DEFAULT_PHASE_SHIFT;
@ -624,6 +625,11 @@ void setGbitReadout() {
} }
int readConfigFile() { int readConfigFile() {
if (ignoreConfigFileFlag) {
return OK;
}
const int fileNameSize = 128; const int fileNameSize = 128;
char fname[fileNameSize]; char fname[fileNameSize];
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) { if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {

View File

@ -28,6 +28,7 @@ extern int updateFlag;
extern udpStruct udpDetails[MAX_UDP_DESTINATION]; extern udpStruct udpDetails[MAX_UDP_DESTINATION];
extern int numUdpDestinations; extern int numUdpDestinations;
extern const enum detectorType myDetectorType; extern const enum detectorType myDetectorType;
extern int ignoreConfigFileFlag;
// Global variable from communication_funcs.c // Global variable from communication_funcs.c
extern int isControlServer; extern int isControlServer;
@ -643,6 +644,10 @@ int readConfigFile() {
return initError; return initError;
} }
if (ignoreConfigFileFlag) {
return OK;
}
const int fileNameSize = 128; const int fileNameSize = 128;
char fname[fileNameSize]; char fname[fileNameSize];
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) { if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {

View File

@ -113,7 +113,7 @@ void initStopServer();
int updateModuleConfiguration(); int updateModuleConfiguration();
int getModuleConfiguration(int *m, int *t, int *n); int getModuleConfiguration(int *m, int *t, int *n);
#ifdef VIRTUAL #ifdef VIRTUAL
void setVirtualDefaultModuleConfigurations(); void checkVirtual9MFlag();
#endif #endif
#endif #endif
@ -369,7 +369,8 @@ int setHighVoltage(int val);
#ifdef EIGERD #ifdef EIGERD
int setMaster(int m); int setMaster(int m);
#endif #endif
#if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD) #if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD) || \
defined(GOTTHARD2D)
int isMaster(int *retval); int isMaster(int *retval);
#endif #endif

View File

@ -26,6 +26,7 @@ extern int sockfd;
extern int debugflag; extern int debugflag;
extern int updateFlag; extern int updateFlag;
extern int checkModuleFlag; extern int checkModuleFlag;
extern int ignoreConfigFileFlag;
// Global variables from slsDetectorFunctionList // Global variables from slsDetectorFunctionList
#ifdef GOTTHARDD #ifdef GOTTHARDD
@ -48,6 +49,7 @@ int main(int argc, char *argv[]) {
updateFlag = 0; updateFlag = 0;
checkModuleFlag = 1; checkModuleFlag = 1;
int version = 0; int version = 0;
ignoreConfigFileFlag = 0;
// help message // help message
char helpMessage[MAX_STR_LENGTH]; char helpMessage[MAX_STR_LENGTH];
@ -58,15 +60,18 @@ 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-g, --nomodule : [Mythen3][Gotthard2] Generic or No " "\t-g, --nomodule : [Mythen3][Gotthard2] \n"
"Module mode. Skips detector type checks. \n" "\t Generic or No 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-d, --devel : Developer mode. Skips firmware checks. \n"
"\t-u, --update : Update mode. Skips firmware checks and " "\t-u, --update : Update mode. Skips firmware checks and "
"initial detector setup. \n" "initial detector setup. \n"
"\t-i, --ignore-config : "
"[Virtual][Eiger][Jungfrau][Gotthard][Gotthard2] \n"
"\t Ignore config file. \n"
"\t-s, --stopserver : Stop server. Do not use as it is created " "\t-s, --stopserver : Stop server. Do not use as it is created "
"by " "by control server \n\n",
"control server \n\n",
argv[0]); argv[0]);
// parse command line for config // parse command line for config
@ -80,6 +85,7 @@ int main(int argc, char *argv[]) {
{"nomodule", no_argument, NULL, 'g'}, // generic {"nomodule", no_argument, NULL, 'g'}, // generic
{"devel", no_argument, NULL, 'd'}, {"devel", no_argument, NULL, 'd'},
{"update", no_argument, NULL, 'u'}, {"update", no_argument, NULL, 'u'},
{"ignore-config", no_argument, NULL, 'i'},
{"stopserver", no_argument, NULL, 's'}, {"stopserver", no_argument, NULL, 's'},
{NULL, 0, NULL, 0}}; {NULL, 0, NULL, 0}};
@ -89,7 +95,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:f:gdus", long_options, &option_index); c = getopt_long(argc, argv, "hvp:f:gduis", long_options, &option_index);
// Detect the end of the options // Detect the end of the options
if (c == -1) if (c == -1)
@ -160,6 +166,17 @@ int main(int argc, char *argv[]) {
isControlServer = 0; isControlServer = 0;
break; break;
case 'i':
#if defined(EIGERD) || defined(GOTTHARDD) || defined(GOTTHARD2D) || \
defined(JUNGFRAU)
LOG(logINFO, ("Ignoring config file\n"));
ignoreConfigFileFlag = 1;
#else
LOG(logERROR, ("No server config files for this detector\n"));
exit(EXIT_FAILURE);
#endif
break;
case 'h': case 'h':
printf("%s", helpMessage); printf("%s", helpMessage);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);

View File

@ -54,6 +54,7 @@ int sockfd = 0;
int debugflag = 0; int debugflag = 0;
int updateFlag = 0; int updateFlag = 0;
int checkModuleFlag = 1; int checkModuleFlag = 1;
int ignoreConfigFileFlag = 0;
udpStruct udpDetails[MAX_UDP_DESTINATION]; udpStruct udpDetails[MAX_UDP_DESTINATION];
int numUdpDestinations = 1; int numUdpDestinations = 1;
@ -8194,7 +8195,8 @@ int get_master(int file_des) {
LOG(logDEBUG1, ("Getting master\n")); LOG(logDEBUG1, ("Getting master\n"));
#if !defined(MYTHEN3D) && !defined(EIGERD) && !defined(GOTTHARDD) #if !defined(MYTHEN3D) && !defined(EIGERD) && !defined(GOTTHARDD) && \
!defined(GOTTHARD2D)
functionNotImplemented(); functionNotImplemented();
#else #else
ret = isMaster(&retval); ret = isMaster(&retval);