This commit is contained in:
2020-06-22 09:33:09 +02:00
parent da2ce03e1d
commit 801f2c4559
11 changed files with 323 additions and 58 deletions

View File

@ -44,6 +44,9 @@ std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::ROI &roi);
std::string ToString(const slsDetectorDefs::rxParameters &r);
std::ostream &operator<<(std::ostream &os,
const slsDetectorDefs::rxParameters &r);
std::string ToString(const slsDetectorDefs::patternParameters &r);
std::ostream &operator<<(std::ostream &os,
const slsDetectorDefs::patternParameters &r);
const std::string &ToString(const std::string &s);
/** Convert std::chrono::duration with specified output unit */

View File

@ -61,6 +61,8 @@
#define MAX_STR_LENGTH 1000
#define SHORT_STR_LENGTH 20
#define MAX_PATTERN_LENGTH 0x2000
#define DEFAULT_STREAMING_TIMER_IN_MS 200
#define NUM_RX_THREAD_IDS 8
@ -437,6 +439,18 @@ typedef struct {
int64_t gateDelay3Ns{0};
int gates{0};
} __attribute__((packed));
/** pattern structure */
struct patternParameters {
uint64_t word[MAX_PATTERN_LENGTH];
uint64_t patioctrl;
uint64_t patclkctrl;
uint32_t patlimits[2];
uint32_t patloop[6];
uint32_t patnloop[3];
uint32_t patwait[3];
uint64_t patwaittime[3];
} __attribute__((packed));
#endif
#ifdef __cplusplus

View File

@ -201,6 +201,7 @@ enum detFuncs {
F_GET_GATE_DELAY_ALL_GATES,
F_GET_VETO,
F_SET_VETO,
F_SET_PATTERN,
NUM_DET_FUNCTIONS,
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
@ -500,6 +501,7 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_GET_GATE_DELAY_ALL_GATES: return "F_GET_GATE_DELAY_ALL_GATES";
case F_GET_VETO: return "F_GET_VETO";
case F_SET_VETO: return "F_SET_VETO";
case F_SET_PATTERN: return "F_SET_PATTERN";
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";

View File

@ -64,6 +64,43 @@ std::ostream &operator<<(std::ostream &os,
return os << ToString(r);
}
std::string ToString(const slsDetectorDefs::patternParameters &r) {
std::ostringstream oss;
oss << '[' << std::endl;
for (int i = 0; i < MAX_PATTERN_LENGTH; ++i) {
if (r.word[i] != 0) {
oss << "patword 0x" << std::hex << i << " 0x" << std::hex
<< r.word[i] << std::endl;
}
}
oss << "patioctrl 0x" << std::hex << r.patioctrl << std::endl
<< "patclkctrl 0x" << r.patclkctrl << std::endl
<< "patlimits 0x" << r.patlimits[0] << " 0x" << r.patlimits[1]
<< std::endl
<< "patloop0 0x" << r.patloop[0] << " 0x" << r.patloop[1] << std::endl
<< "patnloop0 " << std::dec << r.patnloop[0] << std::hex << std::endl
<< "patloop1 0x" << r.patloop[2] << " 0x" << r.patloop[3] << std::endl
<< "patnloop1 " << std::dec << r.patnloop[1] << std::hex << std::endl
<< "patloop2 0x" << r.patloop[4] << " 0x" << r.patloop[5] << std::endl
<< "patnloop2 " << std::dec << r.patnloop[2] << std::hex << std::endl
<< "patwait0 0x" << r.patwait[0] << std::endl
<< "patwaittime0 " << std::dec << r.patwaittime[0] << std::hex
<< std::endl
<< "patwait1 0x" << r.patwait[1] << std::endl
<< "patwaittime1 " << std::dec << r.patwaittime[1] << std::hex
<< std::endl
<< "patwait1 0x" << r.patwait[1] << std::endl
<< "patwaittime2 " << std::dec << r.patwaittime[2] << std::hex
<< std::endl
<< ']';
return oss.str();
}
std::ostream &operator<<(std::ostream &os,
const slsDetectorDefs::patternParameters &r) {
return os << ToString(r);
}
std::string ToString(const defs::runStatus s) {
switch (s) {
case defs::ERROR: