mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-05 01:20:41 +02:00
setmoduleid removed, moduleId changed to moduleIndex in client to minimize confusion
This commit is contained in:
parent
49e40ae8f2
commit
c8ea0c8ede
@ -73,9 +73,6 @@ void init_det(py::module &m) {
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getModuleId,
|
||||
py::arg() = Positions{})
|
||||
.def("setModuleId",
|
||||
(void (Detector::*)(int, sls::Positions)) & Detector::setModuleId,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getReceiverVersion",
|
||||
(Result<int64_t>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getReceiverVersion,
|
||||
|
Binary file not shown.
Binary file not shown.
@ -303,7 +303,7 @@ void initControlServer() {
|
||||
LOG(logINFOBLUE, ("Configuring Control server\n"));
|
||||
if (!updateFlag && initError == OK) {
|
||||
#ifndef VIRTUAL
|
||||
int detid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
||||
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
||||
#else
|
||||
getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
||||
#endif
|
||||
@ -342,7 +342,7 @@ void initControlServer() {
|
||||
LOG(logDEBUG1, ("Control server: FEB Initialization done\n"));
|
||||
Beb_SetTopVariable(top);
|
||||
Beb_Beb();
|
||||
Beb_SetModuleId(detid);
|
||||
Beb_SetModuleId(modid);
|
||||
LOG(logDEBUG1, ("Control server: BEB Initialization done\n"));
|
||||
#endif
|
||||
// also reads config file and deactivates
|
||||
|
Binary file not shown.
@ -288,16 +288,13 @@ u_int32_t getDetectorNumber() {
|
||||
}
|
||||
|
||||
int getModuleId(int *ret, char *mess) {
|
||||
return getModuleIdInFile(ret, mess, ID_FILE);
|
||||
return ((bus_r(MOD_ID_REG) & ~MOD_ID_MSK) >> MOD_ID_OFST);
|
||||
}
|
||||
|
||||
void setModuleId(int *ret, char *mess, int arg) {
|
||||
*ret = setModuleIdInFile(mess, arg, ID_FILE);
|
||||
if (*ret == FAIL) {
|
||||
return;
|
||||
}
|
||||
void setModuleId(int modid) {
|
||||
LOG(logINFOBLUE, ("Setting module id in fpga: %d\n", modid))
|
||||
bus_w(MOD_ID_REG, bus_r(MOD_ID_REG) & ~MOD_ID_MSK);
|
||||
bus_w(MOD_ID_REG, bus_r(MOD_ID_REG) | ((arg << MOD_ID_OFST) & MOD_ID_MSK));
|
||||
bus_w(MOD_ID_REG, bus_r(MOD_ID_REG) | ((modid << MOD_ID_OFST) & MOD_ID_MSK));
|
||||
}
|
||||
|
||||
u_int64_t getDetectorMAC() {
|
||||
@ -422,10 +419,6 @@ void setupDetector() {
|
||||
sharedMemory_setStatus(IDLE);
|
||||
setupUDPCommParameters();
|
||||
#endif
|
||||
getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
||||
if (initError == FAIL) {
|
||||
return;
|
||||
}
|
||||
// pll defines
|
||||
ALTERA_PLL_C10_SetDefines(REG_OFFSET, BASE_READOUT_PLL, BASE_SYSTEM_PLL,
|
||||
PLL_RESET_REG, PLL_RESET_READOUT_MSK,
|
||||
@ -483,6 +476,14 @@ void setupDetector() {
|
||||
if (readConfigFile() == FAIL) {
|
||||
return;
|
||||
}
|
||||
|
||||
// set module id in register
|
||||
int modid = getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
||||
if (initError == FAIL) {
|
||||
return;
|
||||
}
|
||||
setModuleId(modid);
|
||||
|
||||
setBurstMode(DEFAULT_BURST_MODE);
|
||||
setFilterResistor(DEFAULT_FILTER_RESISTOR);
|
||||
setCDSGain(DEFAILT_CDS_GAIN);
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -444,6 +444,14 @@ void setupDetector() {
|
||||
setASICDefaults();
|
||||
setADIFDefaults();
|
||||
|
||||
// set module id in register
|
||||
getModuleIdInFile(&initError, initErrorMessage, ID_FILE);
|
||||
if (initError == FAIL) {
|
||||
return;
|
||||
}
|
||||
// until firmware is done
|
||||
// setModuleId(modid);
|
||||
|
||||
// set trigger flow for m3 (for all timing modes)
|
||||
bus_w(FLOW_TRIGGER_REG, bus_r(FLOW_TRIGGER_REG) | FLOW_TRIGGER_MSK);
|
||||
|
||||
|
@ -97,7 +97,7 @@ u_int32_t getDetectorNumber();
|
||||
int getModuleId(int *ret, char *mess);
|
||||
#endif
|
||||
#ifdef GOTTHARD2D
|
||||
void setModuleId(int *ret, char *mess, int arg);
|
||||
void setModuleId(int modid);
|
||||
#endif
|
||||
u_int64_t getDetectorMAC();
|
||||
u_int32_t getDetectorIP();
|
||||
|
@ -268,7 +268,6 @@ int get_adc_pipeline(int);
|
||||
int set_dbit_pipeline(int);
|
||||
int get_dbit_pipeline(int);
|
||||
int get_module_id(int);
|
||||
int set_module_id(int);
|
||||
int get_dest_udp_list(int);
|
||||
int set_dest_udp_list(int);
|
||||
int get_num_dest_list(int);
|
||||
|
@ -404,7 +404,6 @@ void function_table() {
|
||||
flist[F_SET_DBIT_PIPELINE] = &set_dbit_pipeline;
|
||||
flist[F_GET_DBIT_PIPELINE] = &get_dbit_pipeline;
|
||||
flist[F_GET_MODULE_ID] = &get_module_id;
|
||||
flist[F_SET_MODULE_ID] = &set_module_id;
|
||||
flist[F_GET_DEST_UDP_LIST] = &get_dest_udp_list;
|
||||
flist[F_SET_DEST_UDP_LIST] = &set_dest_udp_list;
|
||||
flist[F_GET_NUM_DEST_UDP] = &get_num_dest_list;
|
||||
@ -9029,34 +9028,6 @@ int get_module_id(int file_des) {
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_module_id(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int arg = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
LOG(logDEBUG1, ("Setting module id to 0x%x\n", arg));
|
||||
|
||||
#ifndef GOTTHARD2D
|
||||
functionNotImplemented();
|
||||
#else
|
||||
if (arg > 0xFFFF) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not set module id. Max value: 0x%x\n", 0xFFFF);
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
setModuleId(&ret, mess, arg);
|
||||
if (ret != FAIL) {
|
||||
int retval = getModuleId(&ret, mess);
|
||||
LOG(logDEBUG1, ("retval module id: %d\n", retval));
|
||||
validate(&ret, mess, arg, retval, "set module id", DEC);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
}
|
||||
|
||||
int get_dest_udp_list(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
|
@ -81,13 +81,9 @@ class Detector {
|
||||
/* [Jungfrau][Gotthard][Mythen3][Gotthard2][CTB][Moench] */
|
||||
Result<int64_t> getSerialNumber(Positions pos = {}) const;
|
||||
|
||||
/** [Eiger][Gotthard2][Mythen3] */
|
||||
/** [Eiger][Gotthard2][Mythen3] 6 bit value (ideally unique) that is streamed out in the UDP header of the detector.*/
|
||||
Result<int> getModuleId(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard2] 6 bit value (ideally unique) that is "
|
||||
"streamed out1 in the UDP header of the detector. */
|
||||
void setModuleId(const int value, Positions pos = {});
|
||||
|
||||
Result<int64_t> getReceiverVersion(Positions pos = {}) const;
|
||||
|
||||
/** Options: EIGER, JUNGFRAU, GOTTHARD, MOENCH, MYTHEN3, GOTTHARD2,
|
||||
|
@ -1203,11 +1203,10 @@ class CmdProxy {
|
||||
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][CTB][Moench]"
|
||||
"Serial number of detector.");
|
||||
|
||||
INTEGER_COMMAND_HEX(
|
||||
moduleid, getModuleId, setModuleId, StringTo<int>,
|
||||
"[value]\n\t[Gotthard2][Eiger][Mythen3] 16 bit value (ideally unique) "
|
||||
"that is streamed out in the UDP header of the detector. "
|
||||
"\n\t[Gotthard2] Can set it too.");
|
||||
GET_COMMAND_HEX(
|
||||
moduleid, getModuleId,
|
||||
"\n\t[Gotthard2][Eiger][Mythen3] 16 bit value (ideally unique) "
|
||||
"that is streamed out in the UDP header of the detector. Picked up from a file on the module.");
|
||||
|
||||
GET_COMMAND(type, getDetectorType,
|
||||
"\n\tReturns detector type. Can be Eiger, Jungfrau, Gotthard, "
|
||||
|
@ -123,10 +123,6 @@ Result<int> Detector::getModuleId(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getModuleId, pos);
|
||||
}
|
||||
|
||||
void Detector::setModuleId(const int value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setModuleId, pos, value);
|
||||
}
|
||||
|
||||
Result<int64_t> Detector::getReceiverVersion(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getReceiverSoftwareVersion, pos);
|
||||
}
|
||||
|
@ -25,8 +25,8 @@
|
||||
namespace sls {
|
||||
|
||||
// creating new shm
|
||||
Module::Module(detectorType type, int det_id, int module_id, bool verify)
|
||||
: moduleId(module_id), shm(det_id, module_id) {
|
||||
Module::Module(detectorType type, int det_id, int module_index, bool verify)
|
||||
: moduleIndex(module_index), shm(det_id, module_index) {
|
||||
|
||||
// ensure shared memory was not created before
|
||||
if (shm.IsExisting()) {
|
||||
@ -40,8 +40,8 @@ Module::Module(detectorType type, int det_id, int module_id, bool verify)
|
||||
}
|
||||
|
||||
// opening existing shm
|
||||
Module::Module(int det_id, int module_id, bool verify)
|
||||
: moduleId(module_id), shm(det_id, module_id) {
|
||||
Module::Module(int det_id, int module_index, bool verify)
|
||||
: moduleIndex(module_index), shm(det_id, module_index) {
|
||||
|
||||
// getDetectorType From shm will check if existing
|
||||
detectorType type = getDetectorTypeFromShm(det_id, verify);
|
||||
@ -96,10 +96,6 @@ int64_t Module::getSerialNumber() const {
|
||||
|
||||
int Module::getModuleId() const { return sendToDetector<int>(F_GET_MODULE_ID); }
|
||||
|
||||
void Module::setModuleId(const int value) {
|
||||
return sendToDetector(F_SET_MODULE_ID, value, nullptr);
|
||||
}
|
||||
|
||||
int64_t Module::getReceiverSoftwareVersion() const {
|
||||
if (shm()->useReceiverFlag) {
|
||||
return sendToReceiver<int64_t>(F_GET_RECEIVER_VERSION);
|
||||
@ -142,7 +138,7 @@ slsDetectorDefs::xy Module::getNumberOfChannels() const {
|
||||
|
||||
void Module::updateNumberOfDetector(slsDetectorDefs::xy det) {
|
||||
shm()->numberOfDetector = det;
|
||||
int args[2] = {shm()->numberOfDetector.y, moduleId};
|
||||
int args[2] = {shm()->numberOfDetector.y, moduleIndex};
|
||||
sendToDetector(F_SET_POSITION, args, nullptr);
|
||||
}
|
||||
|
||||
@ -823,13 +819,13 @@ std::vector<uint64_t> Module::getNumMissingPackets() const {
|
||||
auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
|
||||
client.Send(F_GET_NUM_MISSING_PACKETS);
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
throw RuntimeError("Receiver " + std::to_string(moduleId) +
|
||||
throw RuntimeError("Receiver " + std::to_string(moduleIndex) +
|
||||
" returned error: " + client.readErrorMessage());
|
||||
} else {
|
||||
auto nports = client.Receive<int>();
|
||||
std::vector<uint64_t> retval(nports);
|
||||
client.Receive(retval);
|
||||
LOG(logDEBUG1) << "Missing packets of Receiver" << moduleId << ": "
|
||||
LOG(logDEBUG1) << "Missing packets of Receiver" << moduleIndex << ": "
|
||||
<< sls::ToString(retval);
|
||||
return retval;
|
||||
}
|
||||
@ -997,7 +993,7 @@ void Module::setDestinationUDPIP(const IpAddr ip) {
|
||||
if (shm()->useReceiverFlag) {
|
||||
sls::MacAddr retval(0LU);
|
||||
sendToReceiver(F_SET_RECEIVER_UDP_IP, ip, retval);
|
||||
LOG(logINFO) << "Setting destination udp mac of detector " << moduleId
|
||||
LOG(logINFO) << "Setting destination udp mac of detector " << moduleIndex
|
||||
<< " to " << retval;
|
||||
sendToDetector(F_SET_DEST_UDP_MAC, retval, nullptr);
|
||||
}
|
||||
@ -1017,7 +1013,7 @@ void Module::setDestinationUDPIP2(const IpAddr ip) {
|
||||
if (shm()->useReceiverFlag) {
|
||||
sls::MacAddr retval(0LU);
|
||||
sendToReceiver(F_SET_RECEIVER_UDP_IP2, ip, retval);
|
||||
LOG(logINFO) << "Setting destination udp mac2 of detector " << moduleId
|
||||
LOG(logINFO) << "Setting destination udp mac2 of detector " << moduleIndex
|
||||
<< " to " << retval;
|
||||
sendToDetector(F_SET_DEST_UDP_MAC2, retval, nullptr);
|
||||
}
|
||||
@ -1075,7 +1071,7 @@ void Module::validateUDPConfiguration() {
|
||||
|
||||
std::string Module::printReceiverConfiguration() {
|
||||
std::ostringstream os;
|
||||
os << "\n\nDetector " << moduleId << "\nReceiver Hostname:\t"
|
||||
os << "\n\nDetector " << moduleIndex << "\nReceiver Hostname:\t"
|
||||
<< getReceiverHostname();
|
||||
|
||||
if (shm()->myDetectorType == JUNGFRAU) {
|
||||
@ -1189,7 +1185,7 @@ void Module::setReceiverHostname(const std::string &receiverIP) {
|
||||
retval.detType = shm()->myDetectorType;
|
||||
retval.numberOfDetector.x = shm()->numberOfDetector.x;
|
||||
retval.numberOfDetector.y = shm()->numberOfDetector.y;
|
||||
retval.moduleId = moduleId;
|
||||
retval.moduleIndex = moduleIndex;
|
||||
memset(retval.hostname, 0, sizeof(retval.hostname));
|
||||
strcpy_safe(retval.hostname, shm()->hostname);
|
||||
|
||||
@ -1199,13 +1195,13 @@ void Module::setReceiverHostname(const std::string &receiverIP) {
|
||||
if (retval.udp_dstmac == 0 && retvals[0] != 0) {
|
||||
LOG(logINFO) << "Setting destination udp mac of "
|
||||
"detector "
|
||||
<< moduleId << " to " << retvals[0];
|
||||
<< moduleIndex << " to " << retvals[0];
|
||||
sendToDetector(F_SET_DEST_UDP_MAC, retvals[0], nullptr);
|
||||
}
|
||||
if (retval.udp_dstmac2 == 0 && retvals[1] != 0) {
|
||||
LOG(logINFO) << "Setting destination udp mac2 of "
|
||||
"detector "
|
||||
<< moduleId << " to " << retvals[1];
|
||||
<< moduleIndex << " to " << retvals[1];
|
||||
sendToDetector(F_SET_DEST_UDP_MAC2, retvals[1], nullptr);
|
||||
}
|
||||
|
||||
@ -1521,7 +1517,7 @@ void Module::sendReceiverRateCorrections(const std::vector<int64_t> &t) {
|
||||
receiver.Send(static_cast<int>(t.size()));
|
||||
receiver.Send(t);
|
||||
if (receiver.Receive<int>() == FAIL) {
|
||||
throw RuntimeError("Receiver " + std::to_string(moduleId) +
|
||||
throw RuntimeError("Receiver " + std::to_string(moduleIndex) +
|
||||
" returned error: " + receiver.readErrorMessage());
|
||||
}
|
||||
}
|
||||
@ -1786,7 +1782,7 @@ void Module::sendVetoPhoton(const int chipIndex,
|
||||
client.Send(gainIndices);
|
||||
client.Send(values);
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
throw RuntimeError("Detector " + std::to_string(moduleId) +
|
||||
throw RuntimeError("Detector " + std::to_string(moduleIndex) +
|
||||
" returned error: " + client.readErrorMessage());
|
||||
}
|
||||
}
|
||||
@ -1798,7 +1794,7 @@ void Module::getVetoPhoton(const int chipIndex,
|
||||
client.Send(F_GET_VETO_PHOTON);
|
||||
client.Send(chipIndex);
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
throw RuntimeError("Detector " + std::to_string(moduleId) +
|
||||
throw RuntimeError("Detector " + std::to_string(moduleIndex) +
|
||||
" returned error: " + client.readErrorMessage());
|
||||
}
|
||||
|
||||
@ -2033,7 +2029,7 @@ void Module::getBadChannels(const std::string &fname) const {
|
||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||
client.Send(F_GET_BAD_CHANNELS);
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
throw RuntimeError("Detector " + std::to_string(moduleId) +
|
||||
throw RuntimeError("Detector " + std::to_string(moduleIndex) +
|
||||
" returned error: " + client.readErrorMessage());
|
||||
}
|
||||
// receive badchannels
|
||||
@ -2090,7 +2086,7 @@ void Module::setBadChannels(const std::string &fname) {
|
||||
client.Send(badchannels);
|
||||
}
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
throw RuntimeError("Detector " + std::to_string(moduleId) +
|
||||
throw RuntimeError("Detector " + std::to_string(moduleIndex) +
|
||||
" returned error: " + client.readErrorMessage());
|
||||
}
|
||||
}
|
||||
@ -2404,7 +2400,7 @@ std::map<std::string, std::string> Module::getAdditionalJsonHeader() const {
|
||||
auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
|
||||
client.Send(F_GET_ADDITIONAL_JSON_HEADER);
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
throw RuntimeError("Receiver " + std::to_string(moduleId) +
|
||||
throw RuntimeError("Receiver " + std::to_string(moduleIndex) +
|
||||
" returned error: " + client.readErrorMessage());
|
||||
} else {
|
||||
auto size = client.Receive<int>();
|
||||
@ -2453,7 +2449,7 @@ void Module::setAdditionalJsonHeader(
|
||||
client.Send(&buff[0], buff.size());
|
||||
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
throw RuntimeError("Receiver " + std::to_string(moduleId) +
|
||||
throw RuntimeError("Receiver " + std::to_string(moduleIndex) +
|
||||
" returned error: " + client.readErrorMessage());
|
||||
}
|
||||
}
|
||||
@ -3007,7 +3003,7 @@ slsDetectorDefs::detectorType Module::getDetectorTypeFromShm(int det_id,
|
||||
shm.OpenSharedMemory();
|
||||
if (verify && shm()->shmversion != SLS_SHMVERSION) {
|
||||
std::ostringstream ss;
|
||||
ss << "Single shared memory (" << det_id << "-" << moduleId
|
||||
ss << "Single shared memory (" << det_id << "-" << moduleIndex
|
||||
<< ":)version mismatch (expected 0x" << std::hex << SLS_SHMVERSION
|
||||
<< " but got 0x" << shm()->shmversion << ")" << std::dec
|
||||
<< ". Clear Shared memory to continue.";
|
||||
@ -3018,7 +3014,7 @@ slsDetectorDefs::detectorType Module::getDetectorTypeFromShm(int det_id,
|
||||
}
|
||||
|
||||
void Module::initSharedMemory(detectorType type, int det_id, bool verify) {
|
||||
shm = SharedMemory<sharedSlsDetector>(det_id, moduleId);
|
||||
shm = SharedMemory<sharedSlsDetector>(det_id, moduleIndex);
|
||||
if (!shm.IsExisting()) {
|
||||
shm.CreateSharedMemory();
|
||||
initializeDetectorStructure(type);
|
||||
@ -3026,7 +3022,7 @@ void Module::initSharedMemory(detectorType type, int det_id, bool verify) {
|
||||
shm.OpenSharedMemory();
|
||||
if (verify && shm()->shmversion != SLS_SHMVERSION) {
|
||||
std::ostringstream ss;
|
||||
ss << "Single shared memory (" << det_id << "-" << moduleId
|
||||
ss << "Single shared memory (" << det_id << "-" << moduleIndex
|
||||
<< ":) version mismatch (expected 0x" << std::hex
|
||||
<< SLS_SHMVERSION << " but got 0x" << shm()->shmversion << ")"
|
||||
<< std::dec << ". Clear Shared memory to continue.";
|
||||
@ -3048,7 +3044,7 @@ void Module::initializeDetectorStructure(detectorType type) {
|
||||
shm()->rxTCPPort = DEFAULT_PORTNO + 2;
|
||||
shm()->useReceiverFlag = false;
|
||||
shm()->zmqport = DEFAULT_ZMQ_CL_PORTNO +
|
||||
(moduleId * ((shm()->myDetectorType == EIGER) ? 2 : 1));
|
||||
(moduleIndex * ((shm()->myDetectorType == EIGER) ? 2 : 1));
|
||||
shm()->zmqip = IpAddr{};
|
||||
shm()->numUDPInterfaces = 1;
|
||||
shm()->stoppedFlag = false;
|
||||
@ -3161,7 +3157,7 @@ void Module::setModule(sls_detector_module &module, bool trimbits) {
|
||||
client.Send(F_SET_MODULE);
|
||||
sendModule(&module, client);
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
throw RuntimeError("Detector " + std::to_string(moduleId) +
|
||||
throw RuntimeError("Detector " + std::to_string(moduleIndex) +
|
||||
" returned error: " + client.readErrorMessage());
|
||||
}
|
||||
}
|
||||
@ -3174,7 +3170,7 @@ void Module::updateReceiverStreamingIP() {
|
||||
if (ip == 0) {
|
||||
ip = HostnameToIp(shm()->rxHostname);
|
||||
}
|
||||
LOG(logINFO) << "Setting default receiver " << moduleId
|
||||
LOG(logINFO) << "Setting default receiver " << moduleIndex
|
||||
<< " streaming zmq ip to " << ip;
|
||||
}
|
||||
setReceiverStreamingIP(ip);
|
||||
@ -3412,20 +3408,20 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
|
||||
uint64_t filesize = buffer.size();
|
||||
// send program from memory to detector
|
||||
LOG(logINFO) << "Sending programming binary (from pof) to detector "
|
||||
<< moduleId << " (" << shm()->hostname << ")";
|
||||
<< moduleIndex << " (" << shm()->hostname << ")";
|
||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||
client.Send(F_PROGRAM_FPGA);
|
||||
client.Send(filesize);
|
||||
// error in detector at opening file pointer to flash
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
std::ostringstream os;
|
||||
os << "Detector " << moduleId << " (" << shm()->hostname << ")"
|
||||
os << "Detector " << moduleIndex << " (" << shm()->hostname << ")"
|
||||
<< " returned error: " << client.readErrorMessage();
|
||||
throw RuntimeError(os.str());
|
||||
}
|
||||
|
||||
// erasing flash
|
||||
LOG(logINFO) << "Erasing Flash for detector " << moduleId << " ("
|
||||
LOG(logINFO) << "Erasing Flash for detector " << moduleIndex << " ("
|
||||
<< shm()->hostname << ")";
|
||||
printf("%d%%\r", 0);
|
||||
std::cout << std::flush;
|
||||
@ -3443,7 +3439,7 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
|
||||
std::cout << std::flush;
|
||||
}
|
||||
printf("\n");
|
||||
LOG(logINFO) << "Writing to Flash to detector " << moduleId << " ("
|
||||
LOG(logINFO) << "Writing to Flash to detector " << moduleIndex << " ("
|
||||
<< shm()->hostname << ")";
|
||||
printf("%d%%\r", 0);
|
||||
std::cout << std::flush;
|
||||
@ -3464,7 +3460,7 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
std::cout << '\n';
|
||||
std::ostringstream os;
|
||||
os << "Detector " << moduleId << " (" << shm()->hostname << ")"
|
||||
os << "Detector " << moduleIndex << " (" << shm()->hostname << ")"
|
||||
<< " returned error: " << client.readErrorMessage();
|
||||
throw RuntimeError(os.str());
|
||||
}
|
||||
@ -3483,7 +3479,7 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
|
||||
// fpga has picked up from flash successfully
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
std::ostringstream os;
|
||||
os << "Detector " << moduleId << " (" << shm()->hostname << ")"
|
||||
os << "Detector " << moduleIndex << " (" << shm()->hostname << ")"
|
||||
<< " returned error: " << client.readErrorMessage();
|
||||
throw RuntimeError(os.str());
|
||||
}
|
||||
@ -3494,7 +3490,7 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
|
||||
|
||||
void Module::programFPGAviaNios(std::vector<char> buffer) {
|
||||
LOG(logINFO) << "Sending programming binary (from rbf) to detector "
|
||||
<< moduleId << " (" << shm()->hostname << ")";
|
||||
<< moduleIndex << " (" << shm()->hostname << ")";
|
||||
|
||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||
client.Send(F_PROGRAM_FPGA);
|
||||
@ -3502,14 +3498,14 @@ void Module::programFPGAviaNios(std::vector<char> buffer) {
|
||||
client.Send(filesize);
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
std::ostringstream os;
|
||||
os << "Detector " << moduleId << " (" << shm()->hostname << ")"
|
||||
os << "Detector " << moduleIndex << " (" << shm()->hostname << ")"
|
||||
<< " returned error: " << client.readErrorMessage();
|
||||
throw RuntimeError(os.str());
|
||||
}
|
||||
client.Send(buffer);
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
std::ostringstream os;
|
||||
os << "Detector " << moduleId << " (" << shm()->hostname << ")"
|
||||
os << "Detector " << moduleIndex << " (" << shm()->hostname << ")"
|
||||
<< " returned error: " << client.readErrorMessage();
|
||||
throw RuntimeError(os.str());
|
||||
}
|
||||
|
@ -66,12 +66,12 @@ class Module : public virtual slsDetectorDefs {
|
||||
|
||||
/** creating new shared memory
|
||||
verify is if shared memory version matches existing one */
|
||||
explicit Module(detectorType type, int det_id = 0, int module_id = 0,
|
||||
explicit Module(detectorType type, int det_id = 0, int module_index = 0,
|
||||
bool verify = true);
|
||||
|
||||
/** opening existing shared memory
|
||||
verify is if shared memory version matches existing one */
|
||||
explicit Module(int det_id = 0, int module_id = 0, bool verify = true);
|
||||
explicit Module(int det_id = 0, int module_index = 0, bool verify = true);
|
||||
|
||||
virtual ~Module();
|
||||
|
||||
@ -91,7 +91,6 @@ class Module : public virtual slsDetectorDefs {
|
||||
int64_t getDetectorServerVersion() const;
|
||||
int64_t getSerialNumber() const;
|
||||
int getModuleId() const;
|
||||
void setModuleId(const int value);
|
||||
int64_t getReceiverSoftwareVersion() const;
|
||||
static detectorType getTypeFromDetector(const std::string &hostname,
|
||||
int cport = DEFAULT_PORTNO);
|
||||
@ -747,7 +746,7 @@ class Module : public virtual slsDetectorDefs {
|
||||
void programFPGAviaBlackfin(std::vector<char> buffer);
|
||||
void programFPGAviaNios(std::vector<char> buffer);
|
||||
|
||||
const int moduleId;
|
||||
const int moduleIndex;
|
||||
mutable sls::SharedMemory<sharedSlsDetector> shm{0, 0};
|
||||
};
|
||||
|
||||
|
@ -337,7 +337,7 @@ int ClientInterface::setup_receiver(Interface &socket) {
|
||||
int msize[2] = {arg.numberOfDetector.x, arg.numberOfDetector.y};
|
||||
impl()->setDetectorSize(msize);
|
||||
}
|
||||
impl()->setModulePositionId(arg.moduleId);
|
||||
impl()->setModulePositionId(arg.moduleIndex);
|
||||
impl()->setDetectorHostname(arg.hostname);
|
||||
|
||||
// udp setup
|
||||
|
@ -500,7 +500,7 @@ typedef struct {
|
||||
struct rxParameters {
|
||||
detectorType detType{GENERIC};
|
||||
xy numberOfDetector;
|
||||
int moduleId{0};
|
||||
int moduleIndex{0};
|
||||
char hostname[MAX_STR_LENGTH];
|
||||
int udpInterfaces{1};
|
||||
int udp_dstport{0};
|
||||
|
@ -244,7 +244,6 @@ enum detFuncs {
|
||||
F_SET_DBIT_PIPELINE,
|
||||
F_GET_DBIT_PIPELINE,
|
||||
F_GET_MODULE_ID,
|
||||
F_SET_MODULE_ID,
|
||||
F_GET_DEST_UDP_LIST,
|
||||
F_SET_DEST_UDP_LIST,
|
||||
F_GET_NUM_DEST_UDP,
|
||||
@ -602,7 +601,6 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_SET_DBIT_PIPELINE: return "F_SET_DBIT_PIPELINE";
|
||||
case F_GET_DBIT_PIPELINE: return "F_GET_DBIT_PIPELINE";
|
||||
case F_GET_MODULE_ID: return "F_GET_MODULE_ID";
|
||||
case F_SET_MODULE_ID: return "F_SET_MODULE_ID";
|
||||
case F_GET_DEST_UDP_LIST: return "F_GET_DEST_UDP_LIST";
|
||||
case F_SET_DEST_UDP_LIST: return "F_SET_DEST_UDP_LIST";
|
||||
case F_GET_NUM_DEST_UDP: return "F_GET_NUM_DEST_UDP";
|
||||
|
@ -28,7 +28,7 @@ std::string ToString(const slsDetectorDefs::rxParameters &r) {
|
||||
oss << '[' << "detType:" << r.detType << std::endl
|
||||
<< "numberOfDetector.x:" << r.numberOfDetector.x << std::endl
|
||||
<< "numberOfDetector.y:" << r.numberOfDetector.y << std::endl
|
||||
<< "moduleId:" << r.moduleId << std::endl
|
||||
<< "moduleIndex:" << r.moduleIndex << std::endl
|
||||
<< "hostname:" << r.hostname << std::endl
|
||||
<< "udpInterfaces:" << r.udpInterfaces << std::endl
|
||||
<< "udp_dstport:" << r.udp_dstport << std::endl
|
||||
|
Loading…
x
Reference in New Issue
Block a user