mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-18 15:57:13 +02:00
WIP
This commit is contained in:
@ -1969,15 +1969,19 @@ std::string CmdProxy::PatternWord(int action) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
auto t = det->getPatternWord(StringTo<uint64_t>(args[0]), {det_id});
|
||||
os << OutStringHex(t, 16) << '\n';
|
||||
int addr = StringTo<int>(args[0]);
|
||||
auto t = det->getPatternWord(addr, {det_id});
|
||||
os << '[' << ToStringHex(addr, 4) << ", " << OutStringHex(t, 16)
|
||||
<< "]\n";
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
det->setPatternWord(StringTo<int>(args[0]), StringTo<uint64_t>(args[1]),
|
||||
{det_id});
|
||||
os << sls::ToString(args) << '\n';
|
||||
int addr = StringTo<int>(args[0]);
|
||||
uint64_t word = StringTo<uint64_t>(args[1]);
|
||||
det->setPatternWord(addr, word, {det_id});
|
||||
os << '[' << ToStringHex(addr, 4) << ", " << ToStringHex(word, 16)
|
||||
<< "]\n";
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
@ -2028,14 +2032,16 @@ std::string CmdProxy::PatternLoopAddresses(int action) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getPatternLoopAddresses(level, {det_id});
|
||||
os << OutStringHex(t) << '\n';
|
||||
os << OutStringHex(t, 4) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
det->setPatternLoopAddresses(level, StringTo<int>(args[0]),
|
||||
StringTo<int>(args[1]), {det_id});
|
||||
os << sls::ToString(args) << '\n';
|
||||
int start = StringTo<int>(args[0]);
|
||||
int stop = StringTo<int>(args[1]);
|
||||
det->setPatternLoopAddresses(level, start, stop, {det_id});
|
||||
os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
|
||||
<< "]\n";
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
@ -2125,13 +2131,14 @@ std::string CmdProxy::PatternWaitAddress(int action) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getPatternWaitAddr(level, {det_id});
|
||||
os << OutStringHex(t) << '\n';
|
||||
os << OutStringHex(t, 4) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setPatternWaitAddr(level, StringTo<int>(args[0]), {det_id});
|
||||
os << args.front() << '\n';
|
||||
int addr = StringTo<int>(args[0]);
|
||||
det->setPatternWaitAddr(level, addr, {det_id});
|
||||
os << ToStringHex(addr, 4) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
|
@ -105,7 +105,33 @@
|
||||
return os.str(); \
|
||||
}
|
||||
|
||||
/** int or enum */
|
||||
/** int or enum hex with 16 bit width (64 bit)*/
|
||||
#define INTEGER_COMMAND_HEX_WIDTH16(CMDNAME, GETFCN, SETFCN, CONV, HLPSTR) \
|
||||
std::string CMDNAME(const int action) { \
|
||||
std::ostringstream os; \
|
||||
os << cmd << ' '; \
|
||||
if (action == slsDetectorDefs::HELP_ACTION) \
|
||||
os << HLPSTR << '\n'; \
|
||||
else if (action == slsDetectorDefs::GET_ACTION) { \
|
||||
if (args.size() != 0) { \
|
||||
WrongNumberOfParameters(0); \
|
||||
} \
|
||||
auto t = det->GETFCN({det_id}); \
|
||||
os << OutStringHex(t, 16) << '\n'; \
|
||||
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
||||
if (args.size() != 1) { \
|
||||
WrongNumberOfParameters(1); \
|
||||
} \
|
||||
auto val = CONV(args[0]); \
|
||||
det->SETFCN(val, {det_id}); \
|
||||
os << ToStringHex(val, 16) << '\n'; \
|
||||
} else { \
|
||||
throw sls::RuntimeError("Unknown action"); \
|
||||
} \
|
||||
return os.str(); \
|
||||
}
|
||||
|
||||
/** int or enum hex */
|
||||
#define INTEGER_COMMAND_HEX(CMDNAME, GETFCN, SETFCN, CONV, HLPSTR) \
|
||||
std::string CMDNAME(const int action) { \
|
||||
std::ostringstream os; \
|
||||
@ -131,7 +157,7 @@
|
||||
return os.str(); \
|
||||
}
|
||||
|
||||
/** int or enum hex val */
|
||||
/** int or enum */
|
||||
#define INTEGER_COMMAND(CMDNAME, GETFCN, SETFCN, CONV, HLPSTR) \
|
||||
std::string CMDNAME(const int action) { \
|
||||
std::ostringstream os; \
|
||||
@ -866,7 +892,6 @@ class CmdProxy {
|
||||
{"pattern", &CmdProxy::Pattern},
|
||||
{"savepattern", &CmdProxy::savepattern},
|
||||
{"patioctrl", &CmdProxy::patioctrl},
|
||||
{"patclkctrl", &CmdProxy::patclkctrl},
|
||||
{"patword", &CmdProxy::PatternWord},
|
||||
{"patlimits", &CmdProxy::PatternLoopAddresses},
|
||||
{"patloop0", &CmdProxy::PatternLoopAddresses},
|
||||
@ -2032,25 +2057,20 @@ class CmdProxy {
|
||||
"[fname]\n\t[Ctb][Moench][Mythen3] Saves pattern to file (ascii). Also "
|
||||
"executes pattern.");
|
||||
|
||||
INTEGER_COMMAND_HEX(patioctrl, getPatternIOControl, setPatternIOControl,
|
||||
StringTo<uint64_t>,
|
||||
"[64 bit mask]\n\t[Ctb][Moench] 64 bit mask "
|
||||
"defining input (0) and output (1) signals.");
|
||||
INTEGER_COMMAND_HEX_WIDTH16(patioctrl, getPatternIOControl,
|
||||
setPatternIOControl, StringTo<uint64_t>,
|
||||
"[64 bit mask]\n\t[Ctb][Moench] 64 bit mask "
|
||||
"defining input (0) and output (1) signals.");
|
||||
|
||||
INTEGER_COMMAND_HEX(patclkctrl, getPatternClockControl,
|
||||
setPatternClockControl, StringTo<uint64_t>,
|
||||
"[64 bit mask]\n\t[Ctb][Moench] 64 bit mask "
|
||||
"defining output clock enable.");
|
||||
|
||||
INTEGER_COMMAND_HEX(
|
||||
INTEGER_COMMAND_HEX_WIDTH16(
|
||||
patmask, getPatternMask, setPatternMask, StringTo<uint64_t>,
|
||||
"[64 bit mask]\n\t[Ctb][Moench][Mythen3] 64 bit mask applied to every "
|
||||
"pattern. Only these bits for each pattern will be masked against.");
|
||||
|
||||
INTEGER_COMMAND_HEX(patsetbit, getPatternBitMask, setPatternBitMask,
|
||||
StringTo<uint64_t>,
|
||||
"[64 bit mask]\n\t[Ctb][Moench][Mythen3] 64 bit values "
|
||||
"applied to the selected patmask for every pattern.");
|
||||
INTEGER_COMMAND_HEX_WIDTH16(
|
||||
patsetbit, getPatternBitMask, setPatternBitMask, StringTo<uint64_t>,
|
||||
"[64 bit mask]\n\t[Ctb][Moench][Mythen3] 64 bit values "
|
||||
"applied to the selected patmask for every pattern.");
|
||||
|
||||
EXECUTE_SET_COMMAND(patternstart, startPattern,
|
||||
"\n\t[Mythen3] Starts Pattern");
|
||||
|
@ -1590,11 +1590,10 @@ void Detector::savePattern(const std::string &fname) {
|
||||
}
|
||||
// rest of pattern file
|
||||
std::vector<std::string> commands{
|
||||
"patioctrl", "patclkctrl", "patlimits", "patloop0",
|
||||
"patnloop0", "patloop1", "patnloop1", "patloop2",
|
||||
"patnloop2", "patwait0", "patwaittime0", "patwait1",
|
||||
"patwaittime1", "patwait2", "patwaittime2", "patmask",
|
||||
"patsetbit",
|
||||
"patioctrl", "patlimits", "patloop0", "patnloop0",
|
||||
"patloop1", "patnloop1", "patloop2", "patnloop2",
|
||||
"patwait0", "patwaittime0", "patwait1", "patwaittime1",
|
||||
"patwait2", "patwaittime2", "patmask", "patsetbit",
|
||||
};
|
||||
auto det_type = getDetectorType().squash();
|
||||
if (det_type == defs::MYTHEN3) {
|
||||
@ -1616,14 +1615,6 @@ void Detector::setPatternIOControl(uint64_t word, Positions pos) {
|
||||
pimpl->Parallel(&Module::setPatternIOControl, pos, word);
|
||||
}
|
||||
|
||||
Result<uint64_t> Detector::getPatternClockControl(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getPatternClockControl, pos);
|
||||
}
|
||||
|
||||
void Detector::setPatternClockControl(uint64_t word, Positions pos) {
|
||||
pimpl->Parallel(&Module::setPatternClockControl, pos, word);
|
||||
}
|
||||
|
||||
Result<uint64_t> Detector::getPatternWord(int addr, Positions pos) {
|
||||
return pimpl->Parallel(&Module::getPatternWord, pos, addr);
|
||||
}
|
||||
|
@ -1790,12 +1790,6 @@ void Module::setPattern(const std::string &fname) {
|
||||
ToString(args));
|
||||
}
|
||||
pat.patioctrl = StringTo<uint64_t>(args[1]);
|
||||
} else if (cmd == "patclkctrl") {
|
||||
if (nargs != 1) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
}
|
||||
pat.patclkctrl = StringTo<uint64_t>(args[1]);
|
||||
} else if (cmd == "patlimits") {
|
||||
if (nargs != 2) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
@ -1867,15 +1861,6 @@ void Module::setPatternIOControl(uint64_t word) {
|
||||
sendToDetector<uint64_t>(F_SET_PATTERN_IO_CONTROL, word);
|
||||
}
|
||||
|
||||
uint64_t Module::getPatternClockControl() {
|
||||
int64_t arg = GET_FLAG;
|
||||
return sendToDetector<uint64_t>(F_SET_PATTERN_CLOCK_CONTROL, arg);
|
||||
}
|
||||
|
||||
void Module::setPatternClockControl(uint64_t word) {
|
||||
sendToDetector<uint64_t>(F_SET_PATTERN_CLOCK_CONTROL, word);
|
||||
}
|
||||
|
||||
uint64_t Module::getPatternWord(int addr) {
|
||||
uint64_t args[]{static_cast<uint64_t>(addr),
|
||||
static_cast<uint64_t>(GET_FLAG)};
|
||||
|
@ -437,8 +437,6 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setPattern(const std::string &fname);
|
||||
uint64_t getPatternIOControl();
|
||||
void setPatternIOControl(uint64_t word);
|
||||
uint64_t getPatternClockControl();
|
||||
void setPatternClockControl(uint64_t word);
|
||||
uint64_t getPatternWord(int addr);
|
||||
void setPatternWord(int addr, uint64_t word);
|
||||
std::array<int, 2> getPatternLoopAddresses(int level);
|
||||
|
Reference in New Issue
Block a user