fix for eiger server actual detector

This commit is contained in:
maliakal_d 2022-03-16 13:16:25 +01:00
parent 7a39822813
commit e1762605e8
2 changed files with 18 additions and 16 deletions

View File

@ -1518,10 +1518,17 @@ int setMaster(enum MASTERINDEX m) {
sharedMemory_unlockLocalLink(); sharedMemory_unlockLocalLink();
} }
// get and update master variable // get and update master variable (cannot get from m, could be hardware)
if (isMaster(&master) == FAIL) { if (isMaster(&master) == FAIL) {
return FAIL; return FAIL;
} }
// verify for master and slave (not hardware)
if ((m == OW_MASTER && master == 0) || (m == OW_SLAVE && master == 1)) {
LOG(logERROR,
("could not set master/slave. Master value retrieved %d\n",
master));
return FAIL;
}
// feb variable and hv comms (9m) // feb variable and hv comms (9m)
sharedMemory_lockLocalLink(); sharedMemory_lockLocalLink();
@ -1539,12 +1546,6 @@ int isMaster(int *retval) {
if (getModuleConfiguration(&m, &t, &n) == FAIL) { if (getModuleConfiguration(&m, &t, &n) == FAIL) {
return FAIL; return FAIL;
} }
if (m != master) {
LOG(logERROR,
("master value retrieved %d and local value %d do not match\n",
master, m));
return FAIL;
}
*retval = m; *retval = m;
return OK; return OK;
} }
@ -1576,10 +1577,16 @@ int setTop(enum TOPINDEX t) {
} }
sharedMemory_unlockLocalLink(); sharedMemory_unlockLocalLink();
// get and update top variable // get and update top variable(cannot get from t, could be hardware)
if (isTop(&top) == FAIL) { if (isTop(&top) == FAIL) {
return FAIL; return FAIL;
} }
// verify for master and slave (not hardware)
if ((t == OW_TOP && top == 0) || (t == OW_BOTTOM && top == 1)) {
LOG(logERROR,
("could not set top/bottom. Top value retrieved %d\n", top));
return FAIL;
}
Beb_SetTopVariable(top); Beb_SetTopVariable(top);
#endif #endif
@ -1591,12 +1598,7 @@ int isTop(int *retval) {
if (getModuleConfiguration(&m, &t, &n) == FAIL) { if (getModuleConfiguration(&m, &t, &n) == FAIL) {
return 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; *retval = t;
return OK; return OK;
} }

View File

@ -81,9 +81,9 @@ enum NETWORKINDEX { TXN_LEFT, TXN_RIGHT, TXN_FRAME, FLOWCTRL_10G };
enum ROINDEX { E_PARALLEL, E_NON_PARALLEL }; enum ROINDEX { E_PARALLEL, E_NON_PARALLEL };
enum CLKINDEX { RUN_CLK, NUM_CLOCKS }; enum CLKINDEX { RUN_CLK, NUM_CLOCKS };
enum TOPINDEX { TOP_HARDWARE, OW_TOP, OW_BOTTOM }; enum TOPINDEX { TOP_HARDWARE, OW_TOP, OW_BOTTOM };
#define TOP_NAMES "hardware", "top", "bottom" #define TOP_NAMES "hardware_master_slave", "top", "bottom"
enum MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE }; enum MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE };
#define MASTER_NAMES "hardware", "master", "slave" #define MASTER_NAMES "hardware_top_bottom", "master", "slave"
#define CLK_NAMES "run" #define CLK_NAMES "run"