mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 05:17:13 +02:00
wip
This commit is contained in:
@ -457,64 +457,63 @@ typedef struct {
|
||||
} __attribute__((packed));
|
||||
|
||||
struct currentSrcParameters {
|
||||
int enable;
|
||||
int fix;
|
||||
int normal;
|
||||
uint64_t select;
|
||||
int enable_;
|
||||
int fix_;
|
||||
int normal_;
|
||||
uint64_t select_;
|
||||
|
||||
/** [Gotthard2][Jungfrau] disable */
|
||||
currentSrcParameters() : enable(0), fix(-1), normal(-1), select(0) {}
|
||||
currentSrcParameters()
|
||||
: enable_(0), fix_(-1), normal_(-1), select_(0) {}
|
||||
|
||||
/** [Gotthard2] enable or disable */
|
||||
explicit currentSrcParameters(bool ena)
|
||||
: enable(static_cast<int>(ena)), fix(-1), normal(-1), select(0) {}
|
||||
explicit currentSrcParameters(bool enable)
|
||||
: enable_(static_cast<int>(enable)), fix_(-1), normal_(-1),
|
||||
select_(0) {}
|
||||
|
||||
/** [Jungfrau](chipv1.0) enable current src with fix or no fix,
|
||||
* selectColumn is 0 to 63 columns only */
|
||||
currentSrcParameters(bool fixCurrent, uint64_t selectColumn)
|
||||
: enable(1), fix(static_cast<int>(fixCurrent)), normal(-1),
|
||||
select(selectColumn) {}
|
||||
* select is 0 to 63 columns only */
|
||||
currentSrcParameters(bool fix, uint64_t select)
|
||||
: enable_(1), fix_(static_cast<int>(fix)), normal_(-1),
|
||||
select_(select) {}
|
||||
|
||||
/** [Jungfrau](chipv1.1) enable current src, fixCurrent[fix|no fix],
|
||||
* selectColumn is a mask of 63 bits (muliple columns can be selected
|
||||
* simultaneously, normalCurrent [normal|low] */
|
||||
currentSrcParameters(bool fixCurrent, uint64_t selectColumn,
|
||||
bool normalCurrent)
|
||||
: enable(1), fix(static_cast<int>(fixCurrent)),
|
||||
normal(static_cast<int>(normalCurrent)), select(selectColumn) {}
|
||||
/** [Jungfrau](chipv1.1) enable current src, fix[fix|no fix],
|
||||
* select is a mask of 63 bits (muliple columns can be selected
|
||||
* simultaneously, normal [normal|low] */
|
||||
currentSrcParameters(bool fix, uint64_t select, bool normal)
|
||||
: enable_(1), fix_(static_cast<int>(fix)),
|
||||
normal_(static_cast<int>(normal)), select_(select) {}
|
||||
|
||||
bool operator==(const currentSrcParameters &other) const {
|
||||
return ((enable == other.enable) && (fix == other.fix) &&
|
||||
(normal == other.normal) && (select == other.select));
|
||||
return ((enable_ == other.enable_) && (fix_ == other.fix_) &&
|
||||
(normal_ == other.normal_) && (select_ == other.select_));
|
||||
}
|
||||
} __attribute__((packed));
|
||||
|
||||
struct udpDestination {
|
||||
int entry;
|
||||
uint32_t ip{};
|
||||
uint32_t ip2{};
|
||||
uint64_t mac{};
|
||||
uint64_t mac2{};
|
||||
int port{};
|
||||
int port2{};
|
||||
udpDestination();
|
||||
uint32_t entry_{};
|
||||
uint32_t port_{};
|
||||
uint32_t port2_{};
|
||||
uint32_t ip_{};
|
||||
uint32_t ip2_{};
|
||||
uint64_t mac_{};
|
||||
uint64_t mac2_{};
|
||||
udpDestination() {}
|
||||
udpDestination(uint32_t entry, uint32_t port, uint32_t ip, uint64_t mac)
|
||||
: entry_(entry), port_(port), ip_(ip), mac_(mac) {}
|
||||
udpDestination(uint32_t entry, uint32_t port, uint32_t ip, uint64_t mac,
|
||||
uint32_t port2)
|
||||
: entry_(entry), port_(port), port2_(port2), ip_(ip), mac_(mac) {}
|
||||
udpDestination(uint32_t entry, uint32_t port, uint32_t ip, uint64_t mac,
|
||||
uint32_t port2, uint32_t ip2, uint64_t mac2)
|
||||
: entry_(entry), port_(port), port2_(port2), ip_(ip), ip2_(ip2),
|
||||
mac_(mac), mac2_(mac2) {}
|
||||
|
||||
bool operator==(const udpDestination &other) const {
|
||||
return ((entry == other.entry) && (ip == other.ip) &&
|
||||
(ip2 == other.ip2) && (mac == other.mac) &&
|
||||
(mac2 == other.mac2) && (port == other.port) &&
|
||||
(port2 == other.port2));
|
||||
}
|
||||
udpDestination operator=(const udpDestination &other) const {
|
||||
if (this == &other)
|
||||
return *this;
|
||||
entry = other.entry;
|
||||
ip = other.ip;
|
||||
ip2 = other.ip2;
|
||||
mac = other.mac;
|
||||
mac2 = other.mac2;
|
||||
port = other.port;
|
||||
port2 = other.port2;
|
||||
return *this;
|
||||
return ((entry_ == other.entry_) && (port_ == other.port_) &&
|
||||
(port2_ == other.port2_) && (ip_ == other.ip_) &&
|
||||
(ip2_ == other.ip2_) && (mac_ == other.mac_) &&
|
||||
(mac2_ == other.mac2_));
|
||||
}
|
||||
} __attribute__((packed));
|
||||
|
||||
|
@ -245,6 +245,8 @@ enum detFuncs {
|
||||
F_GET_DBIT_PIPELINE,
|
||||
F_GET_MODULE_ID,
|
||||
F_SET_MODULE_ID,
|
||||
F_GET_DEST_UDP_LIST,
|
||||
F_SET_DEST_UDP_LIST,
|
||||
|
||||
NUM_DET_FUNCTIONS,
|
||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
|
||||
@ -597,6 +599,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
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 NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
||||
|
@ -116,25 +116,25 @@ std::ostream &operator<<(std::ostream &os,
|
||||
|
||||
std::string ToString(const slsDetectorDefs::currentSrcParameters &r) {
|
||||
std::ostringstream oss;
|
||||
if (r.fix < -1 || r.fix > 1 || r.normal < -1 || r.normal > 1) {
|
||||
if (r.fix_ < -1 || r.fix_ > 1 || r.normal_ < -1 || r.normal_ > 1) {
|
||||
throw sls::RuntimeError(
|
||||
"Invalid current source parameters. Cannot print.");
|
||||
}
|
||||
oss << '[';
|
||||
if (r.enable) {
|
||||
if (r.enable_) {
|
||||
oss << "enabled";
|
||||
// [jungfrau]
|
||||
if (r.fix != -1) {
|
||||
oss << (r.fix == 1 ? ", fix" : ", nofix");
|
||||
if (r.fix_ != -1) {
|
||||
oss << (r.fix_ == 1 ? ", fix" : ", nofix");
|
||||
}
|
||||
// [jungfrau chip v1.1]
|
||||
if (r.normal != -1) {
|
||||
oss << ", " << ToStringHex(r.select, 16);
|
||||
oss << (r.normal == 1 ? ", normal" : ", low");
|
||||
if (r.normal_ != -1) {
|
||||
oss << ", " << ToStringHex(r.select_, 16);
|
||||
oss << (r.normal_ == 1 ? ", normal" : ", low");
|
||||
}
|
||||
// [jungfrau chip v1.0]
|
||||
else {
|
||||
oss << ", " << r.select;
|
||||
oss << ", " << r.select_;
|
||||
}
|
||||
} else {
|
||||
oss << "disabled";
|
||||
@ -151,18 +151,18 @@ std::ostream &operator<<(std::ostream &os,
|
||||
std::string ToString(const slsDetectorDefs::udpDestination &r) {
|
||||
std::ostringstream oss;
|
||||
oss << '[' << std::endl
|
||||
<< "entry " << r.entry << std::endl
|
||||
<< "ip " << IpAddr(r.ip) << std::endl
|
||||
<< "mac " << MacAddr(r.mac) << std::endl
|
||||
<< "port " << r.port << std::endl;
|
||||
if (r.port2 != 0) {
|
||||
oss << "port2 " << r.port2 << std::endl;
|
||||
<< "entry " << r.entry_ << std::endl
|
||||
<< "ip " << IpAddr(r.ip_) << std::endl
|
||||
<< "mac " << MacAddr(r.mac_) << std::endl
|
||||
<< "port " << r.port_ << std::endl;
|
||||
if (r.port2_ != 0) {
|
||||
oss << "port2 " << r.port2_ << std::endl;
|
||||
}
|
||||
if (r.ip2 != 0) {
|
||||
oss << "ip2 " << IpAddr(r.ip2) << std::endl;
|
||||
if (r.ip2_ != 0) {
|
||||
oss << "ip2 " << IpAddr(r.ip2_) << std::endl;
|
||||
}
|
||||
if (r.mac2 != 0) {
|
||||
oss << "mac2 " << MacAddr(r.mac2) << std::endl;
|
||||
if (r.mac2_ != 0) {
|
||||
oss << "mac2 " << MacAddr(r.mac2_) << std::endl;
|
||||
}
|
||||
oss << ']';
|
||||
return oss.str();
|
||||
|
Reference in New Issue
Block a user