mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 16:20:03 +02:00
Jungfraumaster (#518)
* set jungfrau master only from client * added tests, fixed a bug in ctb and moench (infinite recursion) that will never happen atm
This commit is contained in:
parent
01696ca89b
commit
809b0bdeb8
@ -89,6 +89,7 @@ This document describes the differences between v7.0.0 and v6.x.x
|
|||||||
- rx udp socket refactored (maybe resolves getting stuck?)remove check for eiger header and isntead checks for malformed packets for every detector
|
- rx udp socket refactored (maybe resolves getting stuck?)remove check for eiger header and isntead checks for malformed packets for every detector
|
||||||
- jungfrau sw trigger , blocking trigger
|
- jungfrau sw trigger , blocking trigger
|
||||||
-help should not create a new object
|
-help should not create a new object
|
||||||
|
- jungfrau master
|
||||||
- g2 parallel command
|
- g2 parallel command
|
||||||
|
|
||||||
2. Resolved Issues
|
2. Resolved Issues
|
||||||
|
@ -1479,8 +1479,8 @@ class Detector(CppDetectorApi):
|
|||||||
@element
|
@element
|
||||||
def master(self):
|
def master(self):
|
||||||
"""
|
"""
|
||||||
[Eiger][Gotthard2] Sets (half) module to master and other(s) to slaves.\n
|
[Eiger][Gotthard2][Jungfrau] Sets (half) module to master and other(s) to slaves.\n
|
||||||
[Gotthard][Gotthard2][Mythen3][Eiger] Gets if the current (half) module is master.
|
[Gotthard][Gotthard2][Mythen3][Eiger][Jungfrau] Gets if the current (half) module is master.
|
||||||
"""
|
"""
|
||||||
return self.getMaster()
|
return self.getMaster()
|
||||||
|
|
||||||
|
@ -2412,7 +2412,7 @@ int calculateDataBytes() { return dataBytes; }
|
|||||||
|
|
||||||
int getTotalNumberOfChannels() {
|
int getTotalNumberOfChannels() {
|
||||||
int nchanx = 0, nchany = 0;
|
int nchanx = 0, nchany = 0;
|
||||||
getTotalNumberOfChannels(&nchanx, &nchany);
|
getNumberOfChannels(&nchanx, &nchany);
|
||||||
return nchanx * nchany;
|
return nchanx * nchany;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,6 +228,8 @@
|
|||||||
#define CONTROL_DDR3_MEM_RST_MSK (0x00000001 << CONTROL_DDR3_MEM_RST_OFST) // only PHY, not DDR3 PLL ,Not used in software
|
#define CONTROL_DDR3_MEM_RST_MSK (0x00000001 << CONTROL_DDR3_MEM_RST_OFST) // only PHY, not DDR3 PLL ,Not used in software
|
||||||
#define CONTROL_ACQ_FIFO_CLR_OFST (14)
|
#define CONTROL_ACQ_FIFO_CLR_OFST (14)
|
||||||
#define CONTROL_ACQ_FIFO_CLR_MSK (0x00000001 << CONTROL_ACQ_FIFO_CLR_OFST)
|
#define CONTROL_ACQ_FIFO_CLR_MSK (0x00000001 << CONTROL_ACQ_FIFO_CLR_OFST)
|
||||||
|
#define CONTROL_MASTER_OFST (15)
|
||||||
|
#define CONTROL_MASTER_MSK (0x00000001 << CONTROL_MASTER_OFST)
|
||||||
#define CONTROL_STORAGE_CELL_NUM_OFST (16)
|
#define CONTROL_STORAGE_CELL_NUM_OFST (16)
|
||||||
#define CONTROL_STORAGE_CELL_NUM_MSK (0x0000000F << CONTROL_STORAGE_CELL_NUM_OFST)
|
#define CONTROL_STORAGE_CELL_NUM_MSK (0x0000000F << CONTROL_STORAGE_CELL_NUM_OFST)
|
||||||
#define CONTROL_RX_ADDTNL_ENDPTS_NUM_OFST (20)
|
#define CONTROL_RX_ADDTNL_ENDPTS_NUM_OFST (20)
|
||||||
|
Binary file not shown.
@ -763,6 +763,15 @@ int readConfigFile() {
|
|||||||
setChipVersion(version);
|
setChipVersion(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// other commands
|
||||||
|
else {
|
||||||
|
sprintf(initErrorMessage,
|
||||||
|
"Could not scan command from on-board server "
|
||||||
|
"config file. Line:[%s].\n",
|
||||||
|
line);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
memset(line, 0, LZ);
|
memset(line, 0, LZ);
|
||||||
}
|
}
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
@ -1335,6 +1344,42 @@ int setHighVoltage(int val) {
|
|||||||
|
|
||||||
/* parameters - timing, extsig */
|
/* parameters - timing, extsig */
|
||||||
|
|
||||||
|
int setMaster(enum MASTERINDEX m) {
|
||||||
|
char *master_names[] = {MASTER_NAMES};
|
||||||
|
LOG(logINFOBLUE, ("Setting up as %s in (%s server)\n", master_names[m],
|
||||||
|
(isControlServer ? "control" : "stop")));
|
||||||
|
int retval = -1;
|
||||||
|
switch (m) {
|
||||||
|
case OW_MASTER:
|
||||||
|
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_MASTER_MSK);
|
||||||
|
isMaster(&retval);
|
||||||
|
if (retval != 1) {
|
||||||
|
LOG(logERROR, ("Could not set master\n"));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OW_SLAVE:
|
||||||
|
bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_MASTER_MSK);
|
||||||
|
isMaster(&retval);
|
||||||
|
if (retval != 0) {
|
||||||
|
LOG(logERROR, ("Could not set slave\n"));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LOG(logERROR, ("Cannot reset to hardware settings from client. Restart "
|
||||||
|
"detector server.\n"));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int isMaster(int *retval) {
|
||||||
|
*retval =
|
||||||
|
((bus_r(CONTROL_REG) & CONTROL_MASTER_MSK) >> CONTROL_MASTER_OFST);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
void setTiming(enum timingMode arg) {
|
void setTiming(enum timingMode arg) {
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
case AUTO_TIMING:
|
case AUTO_TIMING:
|
||||||
|
@ -67,6 +67,9 @@ enum DACINDEX {
|
|||||||
420 /* J_VREF_COMP */ \
|
420 /* J_VREF_COMP */ \
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE };
|
||||||
|
#define MASTER_NAMES "hardware", "master", "slave"
|
||||||
|
|
||||||
#define NUMSETTINGS (2)
|
#define NUMSETTINGS (2)
|
||||||
#define NSPECIALDACS (3)
|
#define NSPECIALDACS (3)
|
||||||
#define SPECIALDACINDEX {J_VREF_PRECH, J_VREF_DS, J_VREF_COMP};
|
#define SPECIALDACINDEX {J_VREF_PRECH, J_VREF_DS, J_VREF_COMP};
|
||||||
|
@ -2043,7 +2043,7 @@ int calculateDataBytes() { return dataBytes; }
|
|||||||
|
|
||||||
int getTotalNumberOfChannels() {
|
int getTotalNumberOfChannels() {
|
||||||
int nchanx = 0, nchany = 0;
|
int nchanx = 0, nchany = 0;
|
||||||
getTotalNumberOfChannels(&nchanx, &nchany);
|
getNumberOfChannels(&nchanx, &nchany);
|
||||||
return nchanx * nchany;
|
return nchanx * nchany;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,7 +385,7 @@ int getADC(enum ADCINDEX ind);
|
|||||||
int setHighVoltage(int val);
|
int setHighVoltage(int val);
|
||||||
|
|
||||||
// parameters - timing, extsig
|
// parameters - timing, extsig
|
||||||
#if defined(EIGERD) || defined(GOTTHARD2D)
|
#if defined(EIGERD) || defined(GOTTHARD2D) || defined(JUNGFRAUD)
|
||||||
int setMaster(enum MASTERINDEX m);
|
int setMaster(enum MASTERINDEX m);
|
||||||
#endif
|
#endif
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
@ -393,7 +393,7 @@ int setTop(enum TOPINDEX t);
|
|||||||
int isTop(int *retval);
|
int isTop(int *retval);
|
||||||
#endif
|
#endif
|
||||||
#if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD) || \
|
#if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD) || \
|
||||||
defined(GOTTHARD2D)
|
defined(GOTTHARD2D) || defined(JUNGFRAUD)
|
||||||
int isMaster(int *retval);
|
int isMaster(int *retval);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -215,8 +215,7 @@ int main(int argc, char *argv[]) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
#if (defined(MYTHEN3D) || defined(GOTTHARDD) || defined(GOTTHARD2D)) && \
|
#if !defined(VIRTUAL) && !defined(EIGERD)
|
||||||
!defined(VIRTUAL)
|
|
||||||
LOG(logERROR, ("Cannot set master via the detector server for this "
|
LOG(logERROR, ("Cannot set master via the detector server for this "
|
||||||
"detector\n"));
|
"detector\n"));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -1884,7 +1884,8 @@ int acquire(int blocking, int file_des) {
|
|||||||
uint64_t sourcemac = getDetectorMAC();
|
uint64_t sourcemac = getDetectorMAC();
|
||||||
char src_mac[MAC_ADDRESS_SIZE];
|
char src_mac[MAC_ADDRESS_SIZE];
|
||||||
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac);
|
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac);
|
||||||
sprintf(mess,
|
sprintf(
|
||||||
|
mess,
|
||||||
"Invalid udp source mac address for this detector. Must be "
|
"Invalid udp source mac address for this detector. Must be "
|
||||||
"same as hardware detector mac address %s\n",
|
"same as hardware detector mac address %s\n",
|
||||||
src_mac);
|
src_mac);
|
||||||
@ -1895,7 +1896,8 @@ int acquire(int blocking, int file_des) {
|
|||||||
uint32_t sourceip = getDetectorIP();
|
uint32_t sourceip = getDetectorIP();
|
||||||
char src_ip[INET_ADDRSTRLEN];
|
char src_ip[INET_ADDRSTRLEN];
|
||||||
getIpAddressinString(src_ip, sourceip);
|
getIpAddressinString(src_ip, sourceip);
|
||||||
sprintf(mess,
|
sprintf(
|
||||||
|
mess,
|
||||||
"Invalid udp source ip address for this detector. Must be "
|
"Invalid udp source ip address for this detector. Must be "
|
||||||
"same "
|
"same "
|
||||||
"as hardware detector ip address %s in 1G readout mode \n",
|
"as hardware detector ip address %s in 1G readout mode \n",
|
||||||
@ -8234,7 +8236,7 @@ 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)
|
!defined(GOTTHARD2D) && !defined(JUNGFRAUD)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
ret = isMaster(&retval);
|
ret = isMaster(&retval);
|
||||||
@ -8255,7 +8257,7 @@ int set_master(int file_des) {
|
|||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
LOG(logDEBUG1, ("Setting master: %u\n", (int)arg));
|
LOG(logDEBUG1, ("Setting master: %u\n", (int)arg));
|
||||||
|
|
||||||
#if !defined(EIGERD) && !defined(GOTTHARD2D)
|
#if !defined(EIGERD) && !defined(GOTTHARD2D) && !defined(JUNGFRAUD)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
|
@ -1298,9 +1298,10 @@ class CmdProxy {
|
|||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID_GET(
|
INTEGER_COMMAND_VEC_ID_GET(
|
||||||
master, getMaster, setMaster, StringTo<int>,
|
master, getMaster, setMaster, StringTo<int>,
|
||||||
"[0, 1]\n\t[Eiger][Gotthard2] Sets (half) module to master and "
|
"[0, 1]\n\t[Eiger][Gotthard2][Jungfrau] Sets (half) module to master "
|
||||||
"other(s) to slaves.\n\t[Gotthard][Gotthard2][Mythen3][Eiger] "
|
"and other(s) to "
|
||||||
"Gets if the current (half) module is master.");
|
"slaves.\n\t[Gotthard][Gotthard2][Mythen3][Eiger][Jungfrau] Gets if "
|
||||||
|
"the current (half) module is master.");
|
||||||
|
|
||||||
/* acquisition parameters */
|
/* acquisition parameters */
|
||||||
|
|
||||||
|
@ -584,9 +584,11 @@ TEST_CASE("master", "[.cmd]") {
|
|||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER || det_type == defs::MYTHEN3 ||
|
if (det_type == defs::EIGER || det_type == defs::MYTHEN3 ||
|
||||||
det_type == defs::GOTTHARD || det_type == defs::GOTTHARD2) {
|
det_type == defs::GOTTHARD || det_type == defs::GOTTHARD2 ||
|
||||||
|
det_type == defs::JUNGFRAU) {
|
||||||
REQUIRE_NOTHROW(proxy.Call("master", {}, -1, GET));
|
REQUIRE_NOTHROW(proxy.Call("master", {}, -1, GET));
|
||||||
if (det_type == defs::EIGER || det_type == defs::GOTTHARD2) {
|
if (det_type == defs::EIGER || det_type == defs::GOTTHARD2 ||
|
||||||
|
det_type == defs::JUNGFRAU) {
|
||||||
// get previous master
|
// get previous master
|
||||||
int prevMaster = 0;
|
int prevMaster = 0;
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user