mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
wip, removed extra virutal server binaries for eiger, --ignore-config for command line
This commit is contained in:
parent
89edf58f41
commit
219318a52e
@ -16,91 +16,31 @@ include_directories(
|
||||
../../slsSupportLib/include
|
||||
)
|
||||
|
||||
add_executable(eigerDetectorServerMaster_virtual
|
||||
add_executable(eigerDetectorServer_virtual
|
||||
${src}
|
||||
)
|
||||
|
||||
target_include_directories(eigerDetectorServerMaster_virtual
|
||||
target_include_directories(eigerDetectorServer_virtual
|
||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
target_compile_definitions(eigerDetectorServerMaster_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
|
||||
target_compile_definitions(eigerDetectorServer_virtual
|
||||
PUBLIC EIGERD PCCOMPILE STOP_SERVER
|
||||
PUBLIC VIRTUAL #VIRTUAL_9M
|
||||
)
|
||||
|
||||
target_link_libraries(eigerDetectorServerSlaveBottom_virtual
|
||||
target_link_libraries(eigerDetectorServer_virtual
|
||||
PUBLIC pthread rt slsProjectCSettings
|
||||
)
|
||||
|
||||
set_target_properties(eigerDetectorServerSlaveBottom_virtual PROPERTIES
|
||||
set_target_properties(eigerDetectorServer_virtual PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
|
||||
install(TARGETS eigerDetectorServerSlaveBottom_virtual
|
||||
install(TARGETS eigerDetectorServer_virtual
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
|
||||
|
||||
|
||||
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)
|
||||
|
@ -26,6 +26,7 @@ extern int updateFlag;
|
||||
extern udpStruct udpDetails[MAX_UDP_DESTINATION];
|
||||
extern int numUdpDestinations;
|
||||
extern const enum detectorType myDetectorType;
|
||||
extern int ignoreConfigFileFlag;
|
||||
|
||||
// Global variable from communication_funcs.c
|
||||
extern int isControlServer;
|
||||
@ -381,20 +382,9 @@ void initStopServer() {
|
||||
}
|
||||
}
|
||||
|
||||
void setVirtualDefaultModuleConfigurations() {
|
||||
void checkVirtual9MFlag() {
|
||||
LOG(logINFORED, ("updating virtual\n"));
|
||||
#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
|
||||
normal = 0;
|
||||
#else
|
||||
@ -404,13 +394,17 @@ void setVirtualDefaultModuleConfigurations() {
|
||||
}
|
||||
|
||||
int updateModuleConfiguration() {
|
||||
#ifdef VIRTUAL
|
||||
setVirtualDefaultModuleConfigurations();
|
||||
#else
|
||||
if (getModuleConfiguration(&master, &top, &normal) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
checkVirtual9MFlag();
|
||||
#endif
|
||||
if (isControlServer) {
|
||||
LOG(logINFOBLUE,
|
||||
("Module: %s %s %s\n", (top ? "TOP" : "BOTTOM"),
|
||||
(master ? "MASTER" : "SLAVE"), (normal ? "NORMAL" : "SPECIAL")));
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -430,21 +424,17 @@ int getModuleConfiguration(int *m, int *t, int *n) {
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
if (isControlServer) {
|
||||
LOG(logINFOBLUE,
|
||||
("Module: %s %s %s\n", (*t ? "TOP" : "BOTTOM"),
|
||||
(*m ? "MASTER" : "SLAVE"), (*n ? "NORMAL" : "SPECIAL")));
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int readConfigFile() {
|
||||
|
||||
if (initError == FAIL) {
|
||||
return initError;
|
||||
}
|
||||
master = -1;
|
||||
top = -1;
|
||||
|
||||
if (ignoreConfigFileFlag) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
const int fileNameSize = 128;
|
||||
char fname[fileNameSize];
|
||||
@ -1472,6 +1462,7 @@ int setHighVoltage(int val) {
|
||||
/* parameters - timing, extsig */
|
||||
|
||||
int setMaster(int m) {
|
||||
LOG(logINFO, ("Setting up as %s\n", (m == 1 ? "Master" : "Slave")));
|
||||
#ifdef VIRTUAL
|
||||
master = m;
|
||||
#else
|
||||
|
@ -28,6 +28,7 @@ extern int updateFlag;
|
||||
extern int checkModuleFlag;
|
||||
extern udpStruct udpDetails[MAX_UDP_DESTINATION];
|
||||
extern const enum detectorType myDetectorType;
|
||||
extern int ignoreConfigFileFlag;
|
||||
|
||||
// Global variable from communication_funcs.c
|
||||
extern int isControlServer;
|
||||
@ -69,6 +70,7 @@ int64_t burstPeriodReg = 0;
|
||||
int filterResistor = 0;
|
||||
int cdsGain = 0;
|
||||
int detPos[2] = {};
|
||||
int master = 1;
|
||||
|
||||
int isInitCheckDone() { return initCheckDone; }
|
||||
|
||||
@ -600,6 +602,10 @@ int readConfigFile() {
|
||||
return initError;
|
||||
}
|
||||
|
||||
if (ignoreConfigFileFlag) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
// require a sleep before and after the rst dac signal
|
||||
usleep(INITIAL_STARTUP_WAIT);
|
||||
|
||||
@ -1442,6 +1448,11 @@ int setHighVoltage(int val) {
|
||||
|
||||
/* parameters - timing */
|
||||
|
||||
int isMaster(int *retval) {
|
||||
*retval = master;
|
||||
return OK;
|
||||
}
|
||||
|
||||
void updatingRegisters() {
|
||||
LOG(logINFO, ("\tUpdating registers\n"));
|
||||
// burst
|
||||
@ -1921,9 +1932,16 @@ int checkDetectorType() {
|
||||
return -2;
|
||||
}
|
||||
|
||||
if ((abs(type - TYPE_GOTTHARD2_MODULE_VAL) > TYPE_TOLERANCE) &&
|
||||
(abs(type - TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL) > TYPE_TOLERANCE) &&
|
||||
(abs(type - TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL) > TYPE_TOLERANCE)) {
|
||||
if (abs(type - TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL) <= TYPE_TOLERANCE) {
|
||||
LOG(logINFOBLUE, ("MASTER 25um Module\n"));
|
||||
} 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,
|
||||
("Wrong Module attached! Expected %d, %d or %d for Gotthard2, got "
|
||||
"%d\n",
|
||||
|
@ -25,6 +25,7 @@ extern int debugflag;
|
||||
extern int updateFlag;
|
||||
extern udpStruct udpDetails[MAX_UDP_DESTINATION];
|
||||
extern const enum detectorType myDetectorType;
|
||||
extern int ignoreConfigFileFlag;
|
||||
|
||||
// Variables that will be exported
|
||||
int phaseShift = DEFAULT_PHASE_SHIFT;
|
||||
@ -624,6 +625,11 @@ void setGbitReadout() {
|
||||
}
|
||||
|
||||
int readConfigFile() {
|
||||
|
||||
if (ignoreConfigFileFlag) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
const int fileNameSize = 128;
|
||||
char fname[fileNameSize];
|
||||
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
|
||||
|
@ -28,6 +28,7 @@ extern int updateFlag;
|
||||
extern udpStruct udpDetails[MAX_UDP_DESTINATION];
|
||||
extern int numUdpDestinations;
|
||||
extern const enum detectorType myDetectorType;
|
||||
extern int ignoreConfigFileFlag;
|
||||
|
||||
// Global variable from communication_funcs.c
|
||||
extern int isControlServer;
|
||||
@ -643,6 +644,10 @@ int readConfigFile() {
|
||||
return initError;
|
||||
}
|
||||
|
||||
if (ignoreConfigFileFlag) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
const int fileNameSize = 128;
|
||||
char fname[fileNameSize];
|
||||
if (getAbsPath(fname, fileNameSize, CONFIG_FILE) == FAIL) {
|
||||
|
@ -113,7 +113,7 @@ void initStopServer();
|
||||
int updateModuleConfiguration();
|
||||
int getModuleConfiguration(int *m, int *t, int *n);
|
||||
#ifdef VIRTUAL
|
||||
void setVirtualDefaultModuleConfigurations();
|
||||
void checkVirtual9MFlag();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -369,7 +369,8 @@ int setHighVoltage(int val);
|
||||
#ifdef EIGERD
|
||||
int setMaster(int m);
|
||||
#endif
|
||||
#if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD)
|
||||
#if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD) || \
|
||||
defined(GOTTHARD2D)
|
||||
int isMaster(int *retval);
|
||||
#endif
|
||||
|
||||
|
@ -26,6 +26,7 @@ extern int sockfd;
|
||||
extern int debugflag;
|
||||
extern int updateFlag;
|
||||
extern int checkModuleFlag;
|
||||
extern int ignoreConfigFileFlag;
|
||||
|
||||
// Global variables from slsDetectorFunctionList
|
||||
#ifdef GOTTHARDD
|
||||
@ -48,6 +49,7 @@ int main(int argc, char *argv[]) {
|
||||
updateFlag = 0;
|
||||
checkModuleFlag = 1;
|
||||
int version = 0;
|
||||
ignoreConfigFileFlag = 0;
|
||||
|
||||
// help message
|
||||
char helpMessage[MAX_STR_LENGTH];
|
||||
@ -58,15 +60,18 @@ 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-g, --nomodule : [Mythen3][Gotthard2] Generic or No "
|
||||
"Module mode. Skips detector type checks. \n"
|
||||
"\t-g, --nomodule : [Mythen3][Gotthard2] \n"
|
||||
"\t 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-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 "
|
||||
"by "
|
||||
"control server \n\n",
|
||||
"by control server \n\n",
|
||||
argv[0]);
|
||||
|
||||
// parse command line for config
|
||||
@ -80,6 +85,7 @@ int main(int argc, char *argv[]) {
|
||||
{"nomodule", no_argument, NULL, 'g'}, // generic
|
||||
{"devel", no_argument, NULL, 'd'},
|
||||
{"update", no_argument, NULL, 'u'},
|
||||
{"ignore-config", no_argument, NULL, 'i'},
|
||||
{"stopserver", no_argument, NULL, 's'},
|
||||
{NULL, 0, NULL, 0}};
|
||||
|
||||
@ -89,7 +95,7 @@ int main(int argc, char *argv[]) {
|
||||
int c = 0;
|
||||
|
||||
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
|
||||
if (c == -1)
|
||||
@ -160,6 +166,17 @@ int main(int argc, char *argv[]) {
|
||||
isControlServer = 0;
|
||||
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':
|
||||
printf("%s", helpMessage);
|
||||
exit(EXIT_SUCCESS);
|
||||
|
@ -54,6 +54,7 @@ int sockfd = 0;
|
||||
int debugflag = 0;
|
||||
int updateFlag = 0;
|
||||
int checkModuleFlag = 1;
|
||||
int ignoreConfigFileFlag = 0;
|
||||
|
||||
udpStruct udpDetails[MAX_UDP_DESTINATION];
|
||||
int numUdpDestinations = 1;
|
||||
@ -8194,7 +8195,8 @@ int get_master(int file_des) {
|
||||
|
||||
LOG(logDEBUG1, ("Getting master\n"));
|
||||
|
||||
#if !defined(MYTHEN3D) && !defined(EIGERD) && !defined(GOTTHARDD)
|
||||
#if !defined(MYTHEN3D) && !defined(EIGERD) && !defined(GOTTHARDD) && \
|
||||
!defined(GOTTHARD2D)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
ret = isMaster(&retval);
|
||||
|
Loading…
x
Reference in New Issue
Block a user