mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-07 10:30:41 +02:00
configuing master from command lineg
This commit is contained in:
parent
5869c25658
commit
5566cfd24f
@ -433,16 +433,21 @@ void initControlServer() {
|
||||
}
|
||||
|
||||
void initStopServer() {
|
||||
|
||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||
if (mapCSP0() == FAIL) {
|
||||
LOG(logERROR,
|
||||
("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n"));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (!updateFlag && initError == OK) {
|
||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||
if (mapCSP0() == FAIL) {
|
||||
initError = FAIL;
|
||||
strcpy(initErrorMessage,
|
||||
"Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
|
||||
LOG(logERROR, (initErrorMessage));
|
||||
initCheckDone = 1;
|
||||
return;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
sharedMemory_setStop(0);
|
||||
sharedMemory_setStop(0);
|
||||
#endif
|
||||
}
|
||||
initCheckDone = 1;
|
||||
}
|
||||
|
||||
/* set up detector */
|
||||
|
@ -18,7 +18,7 @@
|
||||
const unsigned int Feb_Control_leftAddress = 0x100;
|
||||
const unsigned int Feb_Control_rightAddress = 0x200;
|
||||
|
||||
int Feb_Control_master = 0;
|
||||
int Feb_Control_master = -1;
|
||||
int Feb_Control_normal = 0;
|
||||
int Feb_Control_activated = 1;
|
||||
|
||||
@ -50,17 +50,16 @@ double ratemax = -1;
|
||||
// setup
|
||||
void Feb_Control_activate(int activate) { Feb_Control_activated = activate; }
|
||||
|
||||
void Feb_Control_FebControl() {
|
||||
Feb_Control_staticBits = Feb_Control_acquireNReadoutMode =
|
||||
Feb_Control_triggerMode = Feb_Control_externalEnableMode =
|
||||
Feb_Control_subFrameMode = 0;
|
||||
int Feb_Control_FebControl(int normal) {
|
||||
Feb_Control_staticBits = 0;
|
||||
Feb_Control_acquireNReadoutMode = 0;
|
||||
Feb_Control_triggerMode = 0;
|
||||
Feb_Control_externalEnableMode = 0;
|
||||
Feb_Control_subFrameMode = 0;
|
||||
Feb_Control_trimbit_size = 263680;
|
||||
Feb_Control_last_downloaded_trimbits =
|
||||
malloc(Feb_Control_trimbit_size * sizeof(int));
|
||||
}
|
||||
|
||||
int Feb_Control_Init(int master, int normal) {
|
||||
Feb_Control_master = master;
|
||||
Feb_Control_normal = normal;
|
||||
Feb_Interface_SetAddress(Feb_Control_rightAddress, Feb_Control_leftAddress);
|
||||
if (Feb_Control_activated) {
|
||||
@ -1532,12 +1531,13 @@ int Feb_Control_SetMaster(enum MASTERINDEX ind) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Feb_Control_SetMasterEffects(int master) {
|
||||
int Feb_Control_SetMasterEffects(int master, int controlServer) {
|
||||
int prevMaster = Feb_Control_master;
|
||||
|
||||
Feb_Control_master = master;
|
||||
// change in master for 9m
|
||||
if (prevMaster != Feb_Control_master && !Feb_Control_normal) {
|
||||
if (controlServer && prevMaster != Feb_Control_master &&
|
||||
!Feb_Control_normal) {
|
||||
if (prevMaster) {
|
||||
Feb_Control_CloseSerialCommunication();
|
||||
}
|
||||
|
@ -7,8 +7,7 @@
|
||||
|
||||
// setup
|
||||
void Feb_Control_activate(int activate);
|
||||
void Feb_Control_FebControl();
|
||||
int Feb_Control_Init(int master, int normal);
|
||||
int Feb_Control_FebControl(int normal);
|
||||
int Feb_Control_OpenSerialCommunication();
|
||||
void Feb_Control_CloseSerialCommunication();
|
||||
int Feb_Control_CheckSetup();
|
||||
@ -87,7 +86,7 @@ int Feb_Control_SetInterruptSubframe(int val);
|
||||
int Feb_Control_GetInterruptSubframe();
|
||||
int Feb_Control_SetTop(enum TOPINDEX ind, int left, int right);
|
||||
int Feb_Control_SetMaster(enum MASTERINDEX ind);
|
||||
int Feb_Control_SetMasterEffects(int master);
|
||||
int Feb_Control_SetMasterEffects(int master, int controlServer);
|
||||
int Feb_Control_SetQuad(int val);
|
||||
int Feb_Control_SetChipSignalsToTrimQuad(int enable);
|
||||
int Feb_Control_SetReadNRows(int value);
|
||||
|
@ -231,6 +231,23 @@ int getModuleId(int *ret, char *mess) {
|
||||
return getModuleIdInFile(ret, mess, ID_FILE);
|
||||
}
|
||||
|
||||
int updateModuleId() {
|
||||
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
||||
if (initError == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
eiger_virtual_module_id = modid;
|
||||
#else
|
||||
if (Beb_SetModuleId(modid) == FAIL) {
|
||||
initError = FAIL;
|
||||
strcpy(initErrorMessage, ("Could not get module id from the file"));
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
u_int64_t getDetectorMAC() {
|
||||
char mac[255] = "";
|
||||
u_int64_t res = 0;
|
||||
@ -310,21 +327,14 @@ u_int32_t getDetectorIP() {
|
||||
void initControlServer() {
|
||||
LOG(logINFOBLUE, ("Configuring Control server\n"));
|
||||
if (!updateFlag && initError == OK) {
|
||||
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
||||
#ifdef VIRTUAL
|
||||
eiger_virtual_module_id = modid;
|
||||
#endif
|
||||
if (initError == FAIL) {
|
||||
if (updateModuleConfiguration() == FAIL) {
|
||||
initCheckDone = 1;
|
||||
return;
|
||||
}
|
||||
if (updateModuleConfiguration() == FAIL)
|
||||
return;
|
||||
#ifndef VIRTUAL
|
||||
sharedMemory_lockLocalLink();
|
||||
Feb_Interface_FebInterface();
|
||||
Feb_Control_FebControl();
|
||||
// same addresses for top and bottom
|
||||
if (!Feb_Control_Init(master, normal)) {
|
||||
if (!Feb_Control_FebControl(normal)) {
|
||||
initError = FAIL;
|
||||
sprintf(initErrorMessage, "Could not intitalize feb control\n");
|
||||
LOG(logERROR, (initErrorMessage));
|
||||
@ -332,24 +342,11 @@ void initControlServer() {
|
||||
sharedMemory_unlockLocalLink();
|
||||
return;
|
||||
}
|
||||
// master of 9M, check high voltage serial communication to blackfin
|
||||
if (master && !normal) {
|
||||
if (!Feb_Control_OpenSerialCommunication()) {
|
||||
initError = FAIL;
|
||||
sprintf(
|
||||
initErrorMessage,
|
||||
"Could not intitalize feb control serial communication\n");
|
||||
LOG(logERROR, (initErrorMessage));
|
||||
initCheckDone = 1;
|
||||
sharedMemory_unlockLocalLink();
|
||||
return;
|
||||
}
|
||||
}
|
||||
Feb_Control_SetMasterEffects(master, isControlServer);
|
||||
sharedMemory_unlockLocalLink();
|
||||
LOG(logDEBUG1, ("Control server: FEB Initialization done\n"));
|
||||
Beb_SetTopVariable(top);
|
||||
Beb_Beb();
|
||||
Beb_SetModuleId(modid);
|
||||
LOG(logDEBUG1, ("Control server: BEB Initialization done\n"));
|
||||
#endif
|
||||
// also reads config file and deactivates
|
||||
@ -359,32 +356,54 @@ void initControlServer() {
|
||||
}
|
||||
|
||||
void initStopServer() {
|
||||
// wait a few s (control server is setting top/master from config file)
|
||||
usleep(WAIT_STOP_SERVER_START);
|
||||
LOG(logINFOBLUE, ("Configuring Stop server\n"));
|
||||
if (updateModuleConfiguration() == FAIL)
|
||||
return;
|
||||
|
||||
if (!updateFlag && initError == OK) {
|
||||
// wait a few s (control server is setting top/master from config file/
|
||||
// command line)
|
||||
usleep(WAIT_STOP_SERVER_START);
|
||||
LOG(logINFOBLUE, ("Configuring Stop server\n"));
|
||||
if (updateModuleConfiguration() == FAIL) {
|
||||
initCheckDone = 1;
|
||||
return;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
sharedMemory_setStop(0);
|
||||
// get top/master in virtual
|
||||
if (readConfigFile() == FAIL) {
|
||||
return;
|
||||
}
|
||||
sharedMemory_setStop(0);
|
||||
// force top or master if in config file
|
||||
if (readConfigFile() == FAIL) {
|
||||
initCheckDone = 1;
|
||||
return;
|
||||
}
|
||||
// force top or master if in command line
|
||||
if (checkCommandLineConfiguration() == FAIL) {
|
||||
initCheckDone = 1;
|
||||
return;
|
||||
}
|
||||
#else
|
||||
// control server read config file and already set up master/top
|
||||
sharedMemory_lockLocalLink();
|
||||
Feb_Interface_FebInterface();
|
||||
Feb_Control_FebControl();
|
||||
// same addresses for top and bottom
|
||||
Feb_Control_Init(master, normal);
|
||||
sharedMemory_unlockLocalLink();
|
||||
LOG(logDEBUG1, ("Stop server: FEB Initialization done\n"));
|
||||
// control server read config file and already set up master/top
|
||||
sharedMemory_lockLocalLink();
|
||||
Feb_Interface_FebInterface();
|
||||
if (!Feb_Control_FebControl(normal)) {
|
||||
initError = FAIL;
|
||||
sprintf(initErrorMessage, "Could not intitalize feb control\n");
|
||||
LOG(logERROR, (initErrorMessage));
|
||||
initCheckDone = 1;
|
||||
sharedMemory_unlockLocalLink();
|
||||
return;
|
||||
}
|
||||
Feb_Control_SetMasterEffects(master, isControlServer);
|
||||
sharedMemory_unlockLocalLink();
|
||||
LOG(logDEBUG1, ("Stop server: FEB Initialization done\n"));
|
||||
Beb_SetTopVariable(top);
|
||||
Beb_Beb();
|
||||
LOG(logDEBUG1, ("Control server: BEB Initialization done\n"));
|
||||
#endif
|
||||
// client first connect (from shm) will activate
|
||||
if (setActivate(0) == FAIL) {
|
||||
LOG(logERROR, ("Could not deactivate in stop server\n"));
|
||||
// client first connect (from shm) will activate
|
||||
if (setActivate(0) == FAIL) {
|
||||
initError = FAIL;
|
||||
strcpy(initErrorMessage, "Could not deactivate\n");
|
||||
LOG(logERROR, (initErrorMessage));
|
||||
}
|
||||
}
|
||||
initCheckDone = 1;
|
||||
}
|
||||
|
||||
void checkVirtual9MFlag() {
|
||||
@ -495,52 +514,28 @@ int readConfigFile() {
|
||||
|
||||
// top command
|
||||
if (!strncmp(line, "top", strlen("top"))) {
|
||||
int t = -1;
|
||||
// cannot scan values
|
||||
if (sscanf(line, "%s %d", command, &top) != 2) {
|
||||
if (sscanf(line, "%s %d", command, &t) != 2) {
|
||||
sprintf(initErrorMessage,
|
||||
"Could not scan top commands from on-board server "
|
||||
"config file. Line:[%s].\n",
|
||||
line);
|
||||
break;
|
||||
}
|
||||
#ifndef VIRTUAL
|
||||
enum TOPINDEX ind = (top == 1 ? OW_TOP : OW_BOTTOM);
|
||||
if (!Beb_SetTop(ind)) {
|
||||
sprintf(
|
||||
initErrorMessage,
|
||||
"Could not overwrite top to %d in Beb from on-board server "
|
||||
"config file. Line:[%s].\n",
|
||||
top, line);
|
||||
break;
|
||||
}
|
||||
sharedMemory_lockLocalLink();
|
||||
if (!Feb_Control_SetTop(ind, 1, 1)) {
|
||||
sprintf(
|
||||
initErrorMessage,
|
||||
"Could not overwrite top to %d in Feb from on-board server "
|
||||
"config file. Line:[%s].\n",
|
||||
top, line);
|
||||
sharedMemory_unlockLocalLink();
|
||||
break;
|
||||
}
|
||||
sharedMemory_unlockLocalLink();
|
||||
// validate change
|
||||
int actual_top = -1, temp = -1, temp2 = -1;
|
||||
if (Beb_GetModuleConfiguration(&temp, &actual_top, &temp2) ==
|
||||
FAIL) {
|
||||
if (t != 0 && t != 1) {
|
||||
sprintf(initErrorMessage,
|
||||
"Could not get module configuration. Failed to load "
|
||||
"config file in server. Line:[%s].\n",
|
||||
"Invalid top argument from on-board server "
|
||||
"config file. Line:[%s].\n",
|
||||
line);
|
||||
break;
|
||||
}
|
||||
if (actual_top != top) {
|
||||
sprintf(initErrorMessage, "Could not set top to %d. Read %d\n",
|
||||
top, actual_top);
|
||||
if (setTop(t == 1 ? OW_TOP : OW_BOTTOM) == FAIL) {
|
||||
sprintf(initErrorMessage,
|
||||
"Could not set top from config file. Line:[%s].\n",
|
||||
line);
|
||||
break;
|
||||
}
|
||||
Beb_SetTopVariable(top);
|
||||
#endif
|
||||
}
|
||||
|
||||
// master command
|
||||
@ -561,7 +556,7 @@ int readConfigFile() {
|
||||
line);
|
||||
break;
|
||||
}
|
||||
if (setMaster(m) == FAIL) {
|
||||
if (setMaster(m == 1 ? OW_MASTER : OW_SLAVE) == FAIL) {
|
||||
sprintf(initErrorMessage,
|
||||
"Could not set master from config file. Line:[%s].\n",
|
||||
line);
|
||||
@ -603,59 +598,21 @@ void resetToHardwareSettings() {
|
||||
// top not set in config file
|
||||
if (top == -1) {
|
||||
LOG(logINFO, ("Resetting Top to hardware settings\n"));
|
||||
if (!Beb_SetTop(TOP_HARDWARE)) {
|
||||
if (setTop(TOP_HARDWARE) == FAIL) {
|
||||
initError = FAIL;
|
||||
strcpy(initErrorMessage,
|
||||
"Could not reset Top flag to Beb hardware settings.\n");
|
||||
"Could not reset Top flag to hardware settings.\n");
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
return;
|
||||
}
|
||||
sharedMemory_lockLocalLink();
|
||||
if (!Feb_Control_SetTop(TOP_HARDWARE, 1, 1)) {
|
||||
initError = FAIL;
|
||||
strcpy(initErrorMessage,
|
||||
"Could not reset Top flag to Feb hardware settings.\n");
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
sharedMemory_unlockLocalLink();
|
||||
return;
|
||||
}
|
||||
sharedMemory_unlockLocalLink();
|
||||
int temp = -1, temp2 = -1;
|
||||
if (Beb_GetModuleConfiguration(&temp, &top, &temp2) == FAIL) {
|
||||
initError = FAIL;
|
||||
strcpy(initErrorMessage, "Could not get module configuration after "
|
||||
"resetting top to hardware settings.\n");
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
return;
|
||||
}
|
||||
Beb_SetTopVariable(top);
|
||||
}
|
||||
// master not set in config file
|
||||
if (master == -1) {
|
||||
LOG(logINFO, ("Resetting Master to hardware settings\n"));
|
||||
if (!Beb_SetMaster(MASTER_HARDWARE)) {
|
||||
if (setMaster(MASTER_HARDWARE) == FAIL) {
|
||||
initError = FAIL;
|
||||
strcpy(initErrorMessage,
|
||||
"Could not reset Master flag to Beb hardware settings.\n");
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
return;
|
||||
}
|
||||
sharedMemory_lockLocalLink();
|
||||
if (!Feb_Control_SetMaster(MASTER_HARDWARE)) {
|
||||
initError = FAIL;
|
||||
strcpy(initErrorMessage,
|
||||
"Could not reset Master flag to Feb hardware settings.\n");
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
sharedMemory_unlockLocalLink();
|
||||
return;
|
||||
}
|
||||
sharedMemory_unlockLocalLink();
|
||||
int temp = -1, temp2 = -1;
|
||||
if (Beb_GetModuleConfiguration(&temp, &top, &temp2) == FAIL) {
|
||||
initError = FAIL;
|
||||
strcpy(initErrorMessage,
|
||||
"Could not get module configuration after "
|
||||
"resetting master to hardware settings.\n");
|
||||
"Could not reset Master flag to hardware settings.\n");
|
||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||
return;
|
||||
}
|
||||
@ -663,7 +620,35 @@ void resetToHardwareSettings() {
|
||||
#endif
|
||||
}
|
||||
|
||||
int checkCommandLineConfiguration() {}
|
||||
int checkCommandLineConfiguration() {
|
||||
int masterCommandLine = -1;
|
||||
int topCommandLine = -1;
|
||||
|
||||
if (masterCommandLine != -1) {
|
||||
LOG(logINFO, ("Setting %s from Command Line\n",
|
||||
(masterCommandLine == 1 ? "Master" : "Slave")));
|
||||
if (setMaster(masterCommandLine == 1 ? OW_MASTER : OW_SLAVE) == FAIL) {
|
||||
initError = FAIL;
|
||||
sprintf(initErrorMessage, "Could not set %s from command line.\n",
|
||||
(masterCommandLine == 1 ? "Master" : "Slave"));
|
||||
LOG(logERROR, (initErrorMessage));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
if (topCommandLine != -1) {
|
||||
LOG(logINFO, ("Setting %s from Command Line\n",
|
||||
(topCommandLine == 1 ? "Top" : "Bottom")));
|
||||
if (setTop(topCommandLine == 1 ? OW_TOP : OW_BOTTOM) == FAIL) {
|
||||
initError = FAIL;
|
||||
sprintf(initErrorMessage, "Could not set %s from command line.\n",
|
||||
(topCommandLine == 1 ? "Top" : "Bottom"));
|
||||
LOG(logERROR, (initErrorMessage));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* set up detector */
|
||||
|
||||
@ -698,15 +683,29 @@ void allocateDetectorStructureMemory() {
|
||||
}
|
||||
|
||||
void setupDetector() {
|
||||
|
||||
allocateDetectorStructureMemory();
|
||||
|
||||
// force top or master if in config file
|
||||
if (readConfigFile() == FAIL)
|
||||
return;
|
||||
// force top or master if in command line
|
||||
if (checkCommandLineConfiguration() == FAIL)
|
||||
return;
|
||||
|
||||
LOG(logINFOBLUE,
|
||||
("Module: %s %s %s\n", (top ? "TOP" : "BOTTOM"),
|
||||
(master ? "MASTER" : "SLAVE"), (normal ? "NORMAL" : "SPECIAL")));
|
||||
|
||||
if (updateModuleId() == FAIL)
|
||||
return;
|
||||
|
||||
LOG(logINFOBLUE, ("Setting Default Parameters\n"));
|
||||
resetToDefaultDacs(0);
|
||||
#ifdef VIRTUAL
|
||||
sharedMemory_setStatus(IDLE);
|
||||
setupUDPCommParameters();
|
||||
#endif
|
||||
|
||||
LOG(logINFOBLUE, ("Setting Default Parameters\n"));
|
||||
// setting default measurement parameters
|
||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||
setExpTime(DEFAULT_EXPTIME);
|
||||
@ -746,14 +745,6 @@ void setupDetector() {
|
||||
}
|
||||
sharedMemory_unlockLocalLink();
|
||||
#endif
|
||||
// force top or master if in config file
|
||||
if (readConfigFile() == FAIL) {
|
||||
return;
|
||||
}
|
||||
LOG(logINFOBLUE,
|
||||
("Module: %s %s %s\n", (top ? "TOP" : "BOTTOM"),
|
||||
(master ? "MASTER" : "SLAVE"), (normal ? "NORMAL" : "SPECIAL")));
|
||||
|
||||
if (setNumberofDestinations(numUdpDestinations) == FAIL) {
|
||||
initError = FAIL;
|
||||
strcpy(initErrorMessage, "Could not set number of udp destinations\n");
|
||||
@ -1477,30 +1468,41 @@ int setHighVoltage(int val) {
|
||||
|
||||
/* parameters - timing, extsig */
|
||||
|
||||
int setMaster(int m) {
|
||||
LOG(logINFOBLUE, ("Setting up as %s\n", (m == 1 ? "Master" : "Slave")));
|
||||
int setMaster(enum MASTERINDEX m) {
|
||||
char *master_names[] = {MASTER_NAMES};
|
||||
LOG(logINFOBLUE, ("Setting up as %s\n", master_names[m]));
|
||||
#ifdef VIRTUAL
|
||||
master = m;
|
||||
switch (m) {
|
||||
case OW_MASTER:
|
||||
master = 1;
|
||||
break;
|
||||
case OW_SLAVE:
|
||||
master = 0;
|
||||
break;
|
||||
default:
|
||||
// hardware settings (do nothing)
|
||||
break;
|
||||
}
|
||||
#else
|
||||
if(!Beb_SetMaster((m == 1 ? OW_MASTER : OW_SLAVE)) {
|
||||
if (!Beb_SetMaster(m)) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
sharedMemory_lockLocalLink();
|
||||
if (!Feb_Control_SetMaster((m == 1 ? OW_MASTER : OW_SLAVE))) {
|
||||
if (!Feb_Control_SetMaster(m)) {
|
||||
sharedMemory_unlockLocalLink();
|
||||
return FAIL;
|
||||
}
|
||||
sharedMemory_unlockLocalLink();
|
||||
|
||||
// set master variable
|
||||
// get and update master variable
|
||||
if (isMaster(master) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// feb variable and hv comms (9m)
|
||||
sharedMemory_lockLocalLink();
|
||||
if (Feb_Control_SetMasterEffects(master) == FAIL) {
|
||||
if (Feb_Control_SetMasterEffects(master, isControlServer) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
sharedMemory_unlockLocalLink();
|
||||
@ -1523,6 +1525,58 @@ int isMaster(int *retval) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int setTop(int t) {
|
||||
char *top_names[] = {TOP_NAMES};
|
||||
LOG(logINFOBLUE, ("Setting up as %s\n", top_names[t]));
|
||||
#ifdef VIRTUAL
|
||||
switch (t) {
|
||||
case OW_TOP:
|
||||
top = 1;
|
||||
break;
|
||||
case OW_BOTTOM:
|
||||
top = 0;
|
||||
break;
|
||||
default:
|
||||
// hardware settings (do nothing)
|
||||
break;
|
||||
}
|
||||
#else
|
||||
if (!Beb_SetTop(t)) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
sharedMemory_lockLocalLink();
|
||||
if (!Feb_Control_SetTop(t)) {
|
||||
sharedMemory_unlockLocalLink();
|
||||
return FAIL;
|
||||
}
|
||||
sharedMemory_unlockLocalLink();
|
||||
|
||||
// get and update top variable
|
||||
if (isTop(top) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
Beb_SetTopVariable(top);
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
||||
int isTop(int *retval) {
|
||||
int m = -1, t = -1, n = -1;
|
||||
if (getModuleConfiguration(&m, &t, &n) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
if (t != top) {
|
||||
LOG(logERROR,
|
||||
("top value retrieved %d and local value %d do not match\n", top,
|
||||
t));
|
||||
return FAIL;
|
||||
}
|
||||
*retval = t;
|
||||
return OK;
|
||||
}
|
||||
|
||||
void setTiming(enum timingMode arg) {
|
||||
int ret = 0;
|
||||
switch (arg) {
|
||||
|
@ -35,6 +35,9 @@ extern int isControlServer;
|
||||
extern void getMacAddressinString(char *cmac, int size, uint64_t mac);
|
||||
extern void getIpAddressinString(char *cip, uint32_t ip);
|
||||
|
||||
// Variables that will be exported
|
||||
int masterCommandLine = -1;
|
||||
|
||||
int initError = OK;
|
||||
int initCheckDone = 0;
|
||||
char initErrorMessage[MAX_STR_LENGTH];
|
||||
@ -297,6 +300,18 @@ void setModuleId(int modid) {
|
||||
bus_r(MOD_ID_REG) | ((modid << MOD_ID_OFST) & MOD_ID_MSK));
|
||||
}
|
||||
|
||||
int updateModuleId() {
|
||||
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
||||
if (initError == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
virtual_moduleid = modid;
|
||||
#endif
|
||||
setModuleId(modid);
|
||||
return OK;
|
||||
}
|
||||
|
||||
u_int64_t getDetectorMAC() {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
@ -360,16 +375,26 @@ void initControlServer() {
|
||||
}
|
||||
|
||||
void initStopServer() {
|
||||
|
||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||
if (mapCSP0() == FAIL) {
|
||||
LOG(logERROR,
|
||||
("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n"));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (!updateFlag && initError == OK) {
|
||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||
LOG(logINFOBLUE, ("Configuring Stop server\n"));
|
||||
if (mapCSP0() == FAIL) {
|
||||
initError = FAIL;
|
||||
strcpy(initErrorMessage,
|
||||
"Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
|
||||
LOG(logERROR, (initErrorMessage));
|
||||
initCheckDone = 1;
|
||||
return;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
sharedMemory_setStop(0);
|
||||
sharedMemory_setStop(0);
|
||||
if (checkCommandLineConfiguration() == FAIL) {
|
||||
initCheckDone = 1;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
initCheckDone = 1;
|
||||
}
|
||||
|
||||
/* set up detector */
|
||||
@ -477,20 +502,18 @@ void setupDetector() {
|
||||
setPhase(READOUT_C1, DEFAULT_CLK1_PHASE_DEG, 1);
|
||||
setDBITPipeline(DEFAULT_DBIT_PIPELINE);
|
||||
|
||||
// master for virtual
|
||||
if (checkCommandLineConfiguration() == FAIL)
|
||||
return;
|
||||
|
||||
// also sets default dac and on chip dac values
|
||||
if (readConfigFile() == FAIL) {
|
||||
return;
|
||||
}
|
||||
|
||||
// set module id in register
|
||||
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
||||
#ifdef VIRTUAL
|
||||
virtual_moduleid = modid;
|
||||
#endif
|
||||
if (initError == FAIL) {
|
||||
if (updateModuleId() == FAIL) {
|
||||
return;
|
||||
}
|
||||
setModuleId(modid);
|
||||
|
||||
setBurstMode(DEFAULT_BURST_MODE);
|
||||
setFilterResistor(DEFAULT_FILTER_RESISTOR);
|
||||
@ -930,6 +953,21 @@ int readConfigFile() {
|
||||
return initError;
|
||||
}
|
||||
|
||||
int checkCommandLineConfiguration() {
|
||||
if (masterCommandLine != -1) {
|
||||
#ifdef VIRTUAL
|
||||
master = masterCommandLine;
|
||||
#else
|
||||
initError = FAIL;
|
||||
strcpy(initErrorMessage,
|
||||
"Cannot set Master from command line for this detector. "
|
||||
"Should have been caught before!\n");
|
||||
return FAIL;
|
||||
#endif
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* firmware functions (resets) */
|
||||
|
||||
void cleanFifos() {
|
||||
|
@ -29,6 +29,7 @@ extern int ignoreConfigFileFlag;
|
||||
|
||||
// Variables that will be exported
|
||||
int phaseShift = DEFAULT_PHASE_SHIFT;
|
||||
int masterCommandLine = -1;
|
||||
|
||||
// Global variable from communication_funcs.c
|
||||
extern int isControlServer;
|
||||
@ -360,16 +361,28 @@ void initControlServer() {
|
||||
}
|
||||
|
||||
void initStopServer() {
|
||||
if (mapCSP0() == FAIL) {
|
||||
LOG(logERROR,
|
||||
("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n"));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (!updateFlag && initError == OK) {
|
||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||
LOG(logINFOBLUE, ("Configuring Stop server\n"));
|
||||
if (mapCSP0() == FAIL) {
|
||||
initError = FAIL;
|
||||
strcpy(initErrorMessage,
|
||||
"Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
|
||||
LOG(logERROR, (initErrorMessage));
|
||||
initCheckDone = 1;
|
||||
return;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
sharedMemory_setStop(0);
|
||||
sharedMemory_setStop(0);
|
||||
#endif
|
||||
// to get master from file
|
||||
readConfigFile();
|
||||
// to get master from file
|
||||
if (readConfigFile() == FAIL ||
|
||||
checkCommandLineConfiguration() == FAIL) {
|
||||
initCheckDone = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
initCheckDone = 1;
|
||||
}
|
||||
|
||||
/* set up detector */
|
||||
@ -422,6 +435,13 @@ void setupDetector() {
|
||||
setROI(rois); // set adcsyncreg, daqreg, chipofinterestreg, cleanfifos,
|
||||
setGbitReadout();
|
||||
|
||||
// no config file or not first time server
|
||||
if (readConfigFile() == FAIL)
|
||||
return;
|
||||
|
||||
if (checkCommandLineConfiguration() == FAIL)
|
||||
return;
|
||||
|
||||
// master, slave (25um)
|
||||
setMasterSlaveConfiguration();
|
||||
|
||||
@ -626,6 +646,10 @@ void setGbitReadout() {
|
||||
|
||||
int readConfigFile() {
|
||||
|
||||
if (initError == FAIL) {
|
||||
return initError;
|
||||
}
|
||||
|
||||
if (ignoreConfigFileFlag) {
|
||||
return OK;
|
||||
}
|
||||
@ -653,7 +677,6 @@ int readConfigFile() {
|
||||
memset(key, 0, keySize);
|
||||
char value[keySize];
|
||||
memset(value, 0, keySize);
|
||||
int scan = OK;
|
||||
|
||||
// keep reading a line
|
||||
while (fgets(line, lineSize, fd)) {
|
||||
@ -673,19 +696,22 @@ int readConfigFile() {
|
||||
master = 0;
|
||||
LOG(logINFOBLUE, ("\tSlave or No Master\n"));
|
||||
} else {
|
||||
LOG(logERROR,
|
||||
("\tCould not scan masterflags %s value from config file\n",
|
||||
value));
|
||||
scan = FAIL;
|
||||
break;
|
||||
initError = FAIL;
|
||||
sprintf(
|
||||
initErrorMessage,
|
||||
"Could not scan masterflags %s value from config file\n",
|
||||
value);
|
||||
LOG(logERROR, (initErrorMessage))
|
||||
fclose(fd);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// not first server since detector power on
|
||||
if (!detectorFirstServer) {
|
||||
LOG(logINFOBLUE, ("\tServer has been started up before. "
|
||||
"Ignoring rest of config file\n"));
|
||||
LOG(logWARNING, ("\tServer has been started up before. "
|
||||
"Ignoring rest of config file\n"));
|
||||
fclose(fd);
|
||||
return FAIL;
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
@ -694,11 +720,14 @@ int readConfigFile() {
|
||||
// convert value to int
|
||||
int ival = 0;
|
||||
if (sscanf(value, "%d", &ival) <= 0) {
|
||||
LOG(logERROR, ("\tCould not scan parameter %s value %s from "
|
||||
"config file\n",
|
||||
key, value));
|
||||
scan = FAIL;
|
||||
break;
|
||||
initError = FAIL;
|
||||
sprintf(initErrorMessage,
|
||||
"Could not scan parameter %s value %s from "
|
||||
"config file\n",
|
||||
key, value);
|
||||
LOG(logERROR, (initErrorMessage))
|
||||
fclose(fd);
|
||||
return FAIL;
|
||||
}
|
||||
// set value
|
||||
if (!strcasecmp(key, "masterdefaultdelay"))
|
||||
@ -716,16 +745,16 @@ int readConfigFile() {
|
||||
else if (!strcasecmp(key, "startacqdelay"))
|
||||
startacqdelay = ival;
|
||||
else {
|
||||
LOG(logERROR,
|
||||
("\tCould not scan parameter %s from config file\n", key));
|
||||
scan = FAIL;
|
||||
break;
|
||||
initError = FAIL;
|
||||
sprintf(initErrorMessage,
|
||||
"Could not scan parameter %s from config file\n", key);
|
||||
LOG(logERROR, (initErrorMessage))
|
||||
fclose(fd);
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(fd);
|
||||
if (scan == FAIL)
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
LOG(logINFOBLUE,
|
||||
("\tmasterdefaultdelay:%d\n"
|
||||
@ -740,13 +769,24 @@ int readConfigFile() {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int checkCommandLineConfiguration() {
|
||||
if (masterCommandLine != -1) {
|
||||
#ifdef VIRTUAL
|
||||
master = masterCommandLine;
|
||||
#else
|
||||
initError = FAIL;
|
||||
strcpy(initErrorMessage,
|
||||
"Cannot set Master from command line for this detector. "
|
||||
"Should have been caught before!\n");
|
||||
return FAIL;
|
||||
#endif
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
void setMasterSlaveConfiguration() {
|
||||
LOG(logINFO, ("Reading Master Slave Configuration\n"));
|
||||
|
||||
// no config file or not first time server
|
||||
if (readConfigFile() == FAIL)
|
||||
return;
|
||||
|
||||
// master configuration
|
||||
if (master) {
|
||||
// master default delay set, so reset delay
|
||||
|
@ -393,19 +393,25 @@ void initControlServer() {
|
||||
}
|
||||
|
||||
void initStopServer() {
|
||||
|
||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||
if (mapCSP0() == FAIL) {
|
||||
LOG(logERROR,
|
||||
("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n"));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (!updateFlag && initError == OK) {
|
||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||
LOG(logINFOBLUE, ("Configuring Stop server\n"));
|
||||
if (mapCSP0() == FAIL) {
|
||||
initError = FAIL;
|
||||
strcpy(initErrorMessage,
|
||||
"Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
|
||||
LOG(logERROR, (initErrorMessage));
|
||||
initCheckDone = 1;
|
||||
return;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
sharedMemory_setStop(0);
|
||||
// temp threshold and reset event (read by stop server)
|
||||
setThresholdTemperature(DEFAULT_TMP_THRSHLD);
|
||||
setTemperatureEvent(0);
|
||||
sharedMemory_setStop(0);
|
||||
// temp threshold and reset event (read by stop server)
|
||||
setThresholdTemperature(DEFAULT_TMP_THRSHLD);
|
||||
setTemperatureEvent(0);
|
||||
#endif
|
||||
}
|
||||
initCheckDone = 1;
|
||||
}
|
||||
|
||||
/* set up detector */
|
||||
|
@ -436,16 +436,22 @@ void initControlServer() {
|
||||
}
|
||||
|
||||
void initStopServer() {
|
||||
|
||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||
if (mapCSP0() == FAIL) {
|
||||
LOG(logERROR,
|
||||
("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n"));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (!updateFlag && initError == OK) {
|
||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||
LOG(logINFOBLUE, ("Configuring Stop server\n"));
|
||||
if (mapCSP0() == FAIL) {
|
||||
initError = FAIL;
|
||||
strcpy(initErrorMessage,
|
||||
"Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
|
||||
LOG(logERROR, (initErrorMessage));
|
||||
initCheckDone = 1;
|
||||
return;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
sharedMemory_setStop(0);
|
||||
sharedMemory_setStop(0);
|
||||
#endif
|
||||
}
|
||||
initCheckDone = 1;
|
||||
}
|
||||
|
||||
/* set up detector */
|
||||
|
@ -35,6 +35,9 @@ extern int isControlServer;
|
||||
extern void getMacAddressinString(char *cmac, int size, uint64_t mac);
|
||||
extern void getIpAddressinString(char *cip, uint32_t ip);
|
||||
|
||||
// Variables that will be exported
|
||||
int masterCommandLine = -1;
|
||||
|
||||
int initError = OK;
|
||||
int initCheckDone = 0;
|
||||
char initErrorMessage[MAX_STR_LENGTH];
|
||||
@ -289,6 +292,18 @@ void setModuleId(int modid) {
|
||||
bus_r(MOD_ID_REG) | ((modid << MOD_ID_OFST) & MOD_ID_MSK));
|
||||
}
|
||||
|
||||
int updateModuleId() {
|
||||
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
||||
if (initError == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
virtual_moduleid = modid;
|
||||
#endif
|
||||
setModuleId(modid);
|
||||
return OK;
|
||||
}
|
||||
|
||||
u_int64_t getDetectorMAC() {
|
||||
#ifdef VIRTUAL
|
||||
return 0;
|
||||
@ -352,16 +367,26 @@ void initControlServer() {
|
||||
}
|
||||
|
||||
void initStopServer() {
|
||||
|
||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||
if (mapCSP0() == FAIL) {
|
||||
LOG(logERROR,
|
||||
("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n"));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (!updateFlag && initError == OK) {
|
||||
usleep(CTRL_SRVR_INIT_TIME_US);
|
||||
LOG(logINFOBLUE, ("Configuring Stop server\n"));
|
||||
if (mapCSP0() == FAIL) {
|
||||
initError = FAIL;
|
||||
strcpy(initErrorMessage,
|
||||
"Stop Server: Map Fail. Dangerous to continue. Goodbye!\n");
|
||||
LOG(logERROR, (initErrorMessage));
|
||||
initCheckDone = 1;
|
||||
return;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
sharedMemory_setStop(0);
|
||||
sharedMemory_setStop(0);
|
||||
if (checkCommandLineConfiguration() == FAIL) {
|
||||
initCheckDone = 1;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
initCheckDone = 1;
|
||||
}
|
||||
|
||||
/* set up detector */
|
||||
@ -407,6 +432,12 @@ void setupDetector() {
|
||||
|
||||
allocateDetectorStructureMemory();
|
||||
|
||||
if (checkCommandLineConfiguration() == FAIL)
|
||||
return;
|
||||
|
||||
if (updateModuleId() == FAIL)
|
||||
return;
|
||||
|
||||
clkDivider[READOUT_C0] = DEFAULT_READOUT_C0;
|
||||
clkDivider[READOUT_C1] = DEFAULT_READOUT_C1;
|
||||
clkDivider[SYSTEM_C0] = DEFAULT_SYSTEM_C0;
|
||||
@ -447,16 +478,6 @@ void setupDetector() {
|
||||
setASICDefaults();
|
||||
setADIFDefaults();
|
||||
|
||||
// set module id in register
|
||||
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
||||
#ifdef VIRTUAL
|
||||
virtual_moduleid = modid;
|
||||
#endif
|
||||
if (initError == FAIL) {
|
||||
return;
|
||||
}
|
||||
setModuleId(modid);
|
||||
|
||||
// set trigger flow for m3 (for all timing modes)
|
||||
bus_w(FLOW_TRIGGER_REG, bus_r(FLOW_TRIGGER_REG) | FLOW_TRIGGER_MSK);
|
||||
|
||||
@ -480,10 +501,6 @@ void setupDetector() {
|
||||
setInitialExtSignals();
|
||||
// 10G UDP
|
||||
enableTenGigabitEthernet(1);
|
||||
getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
||||
if (initError == FAIL) {
|
||||
return;
|
||||
}
|
||||
setSettings(DEFAULT_SETTINGS);
|
||||
|
||||
// check module type attached if not in debug mode
|
||||
@ -700,6 +717,22 @@ void setADIFDefaults() {
|
||||
ADIF_ADDTNL_OFST_MSK)));
|
||||
}
|
||||
|
||||
int checkCommandLineConfiguration() {
|
||||
if (masterCommandLine != -1) {
|
||||
#ifdef VIRTUAL
|
||||
bus_w(SYSTEM_STATUS_REG,
|
||||
bus_r(SYSTEM_STATUS_REG) & ~SYSTEM_STATUS_SLV_BRD_DTCT_MSK);
|
||||
#else
|
||||
initError = FAIL;
|
||||
strcpy(initErrorMessage,
|
||||
"Cannot set Master from command line for this detector. "
|
||||
"Should have been caught before!\n");
|
||||
return FAIL;
|
||||
#endif
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* firmware functions (resets) */
|
||||
|
||||
void cleanFifos() {
|
||||
|
@ -97,6 +97,9 @@ u_int32_t getDetectorNumber();
|
||||
#if defined(GOTTHARD2D) || defined(EIGERD) || defined(MYTHEN3D)
|
||||
int getModuleId(int *ret, char *mess);
|
||||
#endif
|
||||
#if defined(EIGERD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||
int updateModuleId();
|
||||
#endif
|
||||
#if defined(GOTTHARD2D) || defined(MYTHEN3D)
|
||||
void setModuleId(int modid);
|
||||
#endif
|
||||
@ -141,6 +144,10 @@ void setADIFDefaults();
|
||||
#if defined(GOTTHARD2D) || defined(EIGERD) || defined(JUNGFRAUD)
|
||||
int readConfigFile();
|
||||
#endif
|
||||
#if defined(GOTTHARDD) || defined(GOTTHARD2D) || defined(EIGERD) || \
|
||||
defined(MYTHEN3D)
|
||||
int checkCommandLineConfiguration();
|
||||
#endif
|
||||
#ifdef EIGERD
|
||||
void resetToHardwareSettings();
|
||||
#endif
|
||||
@ -367,7 +374,9 @@ int setHighVoltage(int val);
|
||||
|
||||
// parameters - timing, extsig
|
||||
#ifdef EIGERD
|
||||
int setMaster(int m);
|
||||
int setMaster(enum MASTERINDEX m);
|
||||
int setTop(int t);
|
||||
int isTop(int *retval);
|
||||
#endif
|
||||
#if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD) || \
|
||||
defined(GOTTHARD2D)
|
||||
|
@ -199,7 +199,11 @@ int main(int argc, char *argv[]) {
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
#if defined(GOTTHARDD) || defined(GOTTHARD2D) || defined(EIGERD) || \
|
||||
#if (defined(MYTHEN3D) || defined(GOTTHARD2D)) && !defined(VIRTUAL)
|
||||
LOG(logERROR, ("Cannot set master via the detector server for this "
|
||||
"detector\n"));
|
||||
exit(EXIT_FAILURE);
|
||||
#elif defined(GOTTHARDD) || defined(GOTTHARD2D) || defined(EIGERD) || \
|
||||
defined(MYTHEN3D)
|
||||
if (sscanf(optarg, "%d", &masterCommandLine) != 1) {
|
||||
LOG(logERROR, ("Cannot scan master argument\n%s", helpMessage));
|
||||
|
@ -3979,29 +3979,26 @@ int check_version(int file_des) {
|
||||
return printSocketReadError();
|
||||
|
||||
// check software- firmware compatibility and basic tests
|
||||
if (isControlServer) {
|
||||
LOG(logDEBUG1, ("Checking software-firmware compatibility and basic "
|
||||
"test result\n"));
|
||||
LOG(logDEBUG1, ("Checking software-firmware compatibility and basic "
|
||||
"test result\n"));
|
||||
|
||||
// check if firmware check is done
|
||||
// check if firmware check is done
|
||||
if (!isInitCheckDone()) {
|
||||
usleep(3 * 1000 * 1000);
|
||||
if (!isInitCheckDone()) {
|
||||
usleep(3 * 1000 * 1000);
|
||||
if (!isInitCheckDone()) {
|
||||
ret = FAIL;
|
||||
strcpy(mess, "Firmware Software Compatibility Check (Server "
|
||||
"Initialization) "
|
||||
"still not done done in server. Unexpected.\n");
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
ret = FAIL;
|
||||
strcpy(mess, "Server Initialization still not done done in server. Unexpected.\n");
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
// check firmware check result
|
||||
if (ret == OK) {
|
||||
char *firmware_message = NULL;
|
||||
if (getInitResult(&firmware_message) == FAIL) {
|
||||
ret = FAIL;
|
||||
strcpy(mess, firmware_message);
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
|
||||
// check firmware check result
|
||||
if (ret == OK) {
|
||||
char *firmware_message = NULL;
|
||||
if (getInitResult(&firmware_message) == FAIL) {
|
||||
ret = FAIL;
|
||||
strcpy(mess, firmware_message);
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
|
||||
@ -8228,7 +8225,7 @@ int set_master(int file_des) {
|
||||
sprintf(mess, "Could not set master. Invalid argument %d.\n", arg);
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
ret = setMaster(arg);
|
||||
ret = setMaster(arg == 1 ? OW_MASTER : OW_SLAVE);
|
||||
if (ret == FAIL) {
|
||||
strcpy(mess, "Could not set master\n");
|
||||
LOG(logERROR, (mess));
|
||||
|
Loading…
x
Reference in New Issue
Block a user