mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 23:10:02 +02:00
WIP
This commit is contained in:
parent
159b0a0367
commit
301073e60b
@ -45,6 +45,7 @@ char initErrorMessage[MAX_STR_LENGTH];
|
||||
pthread_t pthread_virtual_tid;
|
||||
int virtual_status = 0;
|
||||
int virtual_stop = 0;
|
||||
uint64_t virtual_pattern[MAX_PATTERN_LENGTH];
|
||||
#endif
|
||||
|
||||
// 1g readout
|
||||
@ -484,6 +485,7 @@ void setupDetector() {
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
}
|
||||
memset(virtual_pattern, 0, sizeof(virtual_pattern));
|
||||
#endif
|
||||
|
||||
ALTERA_PLL_ResetPLLAndReconfiguration();
|
||||
@ -1900,19 +1902,6 @@ uint64_t writePatternIOControl(uint64_t word) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
uint64_t writePatternClkControl(uint64_t word) {
|
||||
if ((int64_t)word != -1) {
|
||||
LOG(logINFO,
|
||||
("Setting Pattern Clock Control: 0x%llx\n", (long long int)word));
|
||||
set64BitReg(word, PATTERN_IO_CLK_CNTRL_LSB_REG,
|
||||
PATTERN_IO_CLK_CNTRL_MSB_REG);
|
||||
}
|
||||
uint64_t retval =
|
||||
get64BitReg(PATTERN_IO_CLK_CNTRL_LSB_REG, PATTERN_IO_CLK_CNTRL_MSB_REG);
|
||||
LOG(logDEBUG1, (" Clock Control retval: 0x%llx\n", (long long int)retval));
|
||||
return retval;
|
||||
}
|
||||
|
||||
uint64_t readPatternWord(int addr) {
|
||||
// error (handled in tcp)
|
||||
if (addr < 0 || addr >= MAX_PATTERN_LENGTH) {
|
||||
@ -1939,7 +1928,9 @@ uint64_t readPatternWord(int addr) {
|
||||
uint64_t retval = get64BitReg(PATTERN_OUT_LSB_REG, PATTERN_OUT_MSB_REG);
|
||||
LOG(logDEBUG1,
|
||||
(" Word(addr:0x%x) retval: 0x%llx\n", addr, (long long int)retval));
|
||||
|
||||
#ifdef VIRTUAL
|
||||
retval = virtual_pattern[addr];
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -1973,6 +1964,9 @@ uint64_t writePatternWord(int addr, uint64_t word) {
|
||||
|
||||
// unset write strobe
|
||||
bus_w(reg, bus_r(reg) & (~PATTERN_CNTRL_WR_MSK));
|
||||
#ifdef VIRTUAL
|
||||
virtual_pattern[addr] = word;
|
||||
#endif
|
||||
|
||||
return word;
|
||||
// return readPatternWord(addr); // will start executing the pattern
|
||||
|
@ -273,7 +273,6 @@ patword 0x010f 0x0008599f0008503a
|
||||
patword 0x0110 0x0008599f0008503a
|
||||
patword 0x0111 0x0008599f0008503a
|
||||
patioctrl 0x8f0effff6dbffdbf
|
||||
patclkctrl 0x0000000000000000
|
||||
patlimits 0x0000 0x0110
|
||||
patloop0 0x00be 0x00ef
|
||||
patnloop0 199
|
||||
|
@ -43,6 +43,7 @@ char initErrorMessage[MAX_STR_LENGTH];
|
||||
pthread_t pthread_virtual_tid;
|
||||
int virtual_status = 0;
|
||||
int virtual_stop = 0;
|
||||
uint64_t virtual_pattern[MAX_PATTERN_LENGTH];
|
||||
#endif
|
||||
|
||||
// 1g readout
|
||||
@ -490,6 +491,7 @@ void setupDetector() {
|
||||
if (isControlServer) {
|
||||
ComVirtual_setStatus(virtual_status);
|
||||
}
|
||||
memset(virtual_pattern, 0, sizeof(virtual_pattern));
|
||||
#endif
|
||||
|
||||
ALTERA_PLL_ResetPLLAndReconfiguration();
|
||||
@ -1574,19 +1576,6 @@ uint64_t writePatternIOControl(uint64_t word) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
uint64_t writePatternClkControl(uint64_t word) {
|
||||
if ((int64_t)word != -1) {
|
||||
LOG(logINFO,
|
||||
("Setting Pattern Clock Control: 0x%llx\n", (long long int)word));
|
||||
set64BitReg(word, PATTERN_IO_CLK_CNTRL_LSB_REG,
|
||||
PATTERN_IO_CLK_CNTRL_MSB_REG);
|
||||
}
|
||||
uint64_t retval =
|
||||
get64BitReg(PATTERN_IO_CLK_CNTRL_LSB_REG, PATTERN_IO_CLK_CNTRL_MSB_REG);
|
||||
LOG(logDEBUG1, (" Clock Control retval: 0x%llx\n", (long long int)retval));
|
||||
return retval;
|
||||
}
|
||||
|
||||
uint64_t readPatternWord(int addr) {
|
||||
// error (handled in tcp)
|
||||
if (addr < 0 || addr >= MAX_PATTERN_LENGTH) {
|
||||
@ -1613,7 +1602,9 @@ uint64_t readPatternWord(int addr) {
|
||||
uint64_t retval = get64BitReg(PATTERN_OUT_LSB_REG, PATTERN_OUT_MSB_REG);
|
||||
LOG(logDEBUG1,
|
||||
(" Word(addr:0x%x) retval: 0x%llx\n", addr, (long long int)retval));
|
||||
|
||||
#ifdef VIRTUAL
|
||||
retval = virtual_pattern[addr];
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -1647,7 +1638,9 @@ uint64_t writePatternWord(int addr, uint64_t word) {
|
||||
|
||||
// unset write strobe
|
||||
bus_w(reg, bus_r(reg) & (~PATTERN_CNTRL_WR_MSK));
|
||||
|
||||
#ifdef VIRTUAL
|
||||
virtual_pattern[addr] = word;
|
||||
#endif
|
||||
return word;
|
||||
// return readPatternWord(addr); // will start executing the pattern
|
||||
}
|
||||
|
@ -9,8 +9,6 @@ int default_writePatternWord(char *line, uint32_t addr, uint64_t word);
|
||||
|
||||
int default_writePatternIOControl(char *line, uint64_t arg);
|
||||
|
||||
int default_writePatternClkControl(char *line, uint64_t arg);
|
||||
|
||||
int default_setPatternLoopLimits(char *line, uint32_t startAddr,
|
||||
uint32_t stopAddr);
|
||||
|
||||
|
@ -403,7 +403,6 @@ void setPipeline(enum CLKINDEX ind, int val);
|
||||
int getPipeline(enum CLKINDEX ind);
|
||||
// patterns
|
||||
uint64_t writePatternIOControl(uint64_t word);
|
||||
uint64_t writePatternClkControl(uint64_t word);
|
||||
uint64_t readPatternWord(int addr);
|
||||
uint64_t writePatternWord(int addr, uint64_t word);
|
||||
int setPatternWaitAddress(int level, int addr);
|
||||
|
@ -90,7 +90,6 @@ int calibrate_pedestal(int);
|
||||
int enable_ten_giga(int);
|
||||
int set_all_trimbits(int);
|
||||
int set_pattern_io_control(int);
|
||||
int set_pattern_clock_control(int);
|
||||
int set_pattern_word(int);
|
||||
int set_pattern_loop_addresses(int);
|
||||
int set_pattern_loop_cycles(int);
|
||||
|
@ -10,7 +10,6 @@ extern char initErrorMessage[MAX_STR_LENGTH];
|
||||
extern int initError;
|
||||
|
||||
extern uint64_t writePatternIOControl(uint64_t word);
|
||||
extern uint64_t writePatternClkControl(uint64_t word);
|
||||
extern uint64_t writePatternWord(int addr, uint64_t word);
|
||||
extern int setPatternWaitAddress(int level, int addr);
|
||||
extern uint64_t setPatternWaitTime(int level, uint64_t t);
|
||||
@ -125,28 +124,6 @@ int loadDefaultPattern(char *fname) {
|
||||
}
|
||||
}
|
||||
|
||||
// patclkctrl
|
||||
if (!strncmp(line, "patclkctrl", strlen("patclkctrl"))) {
|
||||
uint64_t arg = 0;
|
||||
|
||||
// cannot scan values
|
||||
#ifdef VIRTUAL
|
||||
if (sscanf(line, "%s 0x%lx", command, &arg) != 2) {
|
||||
#else
|
||||
if (sscanf(line, "%s 0x%llx", command, &arg) != 2) {
|
||||
#endif
|
||||
sprintf(initErrorMessage,
|
||||
"Could not scan patclkctrl arguments from default "
|
||||
"pattern file. Line:[%s].\n",
|
||||
line);
|
||||
break;
|
||||
}
|
||||
|
||||
if (default_writePatternClkControl(line, arg) == FAIL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// patlimits
|
||||
if (!strncmp(line, "patlimits", strlen("patlimits"))) {
|
||||
uint32_t startAddr = 0;
|
||||
@ -342,25 +319,6 @@ int default_writePatternIOControl(char *line, uint64_t arg) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int default_writePatternClkControl(char *line, uint64_t arg) {
|
||||
uint64_t retval = writePatternClkControl(arg);
|
||||
if (retval != arg) {
|
||||
#ifdef VIRTUAL
|
||||
sprintf(initErrorMessage,
|
||||
"Could not set patclkctrl from default pattern "
|
||||
"file. Set 0x%lx, read 0x%lx. Line:[%s]\n",
|
||||
arg, retval, line);
|
||||
#else
|
||||
sprintf(initErrorMessage,
|
||||
"Could not set patclkctrl from default pattern "
|
||||
"file. Set 0x%llx, read 0x%llx. Line:[%s]\n",
|
||||
arg, retval, line);
|
||||
#endif
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int default_setPatternLoopLimits(char *line, uint32_t startAddr,
|
||||
uint32_t stopAddr) {
|
||||
// validations
|
||||
|
@ -204,7 +204,6 @@ void function_table() {
|
||||
flist[F_ENABLE_TEN_GIGA] = &enable_ten_giga;
|
||||
flist[F_SET_ALL_TRIMBITS] = &set_all_trimbits;
|
||||
flist[F_SET_PATTERN_IO_CONTROL] = &set_pattern_io_control;
|
||||
flist[F_SET_PATTERN_CLOCK_CONTROL] = &set_pattern_clock_control;
|
||||
flist[F_SET_PATTERN_WORD] = &set_pattern_word;
|
||||
flist[F_SET_PATTERN_LOOP_ADDRESSES] = &set_pattern_loop_addresses;
|
||||
flist[F_SET_PATTERN_LOOP_CYCLES] = &set_pattern_loop_cycles;
|
||||
@ -2882,29 +2881,6 @@ int set_pattern_io_control(int file_des) {
|
||||
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_pattern_clock_control(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
uint64_t arg = -1;
|
||||
uint64_t retval = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
|
||||
functionNotImplemented();
|
||||
#else
|
||||
LOG(logDEBUG1,
|
||||
("Setting Pattern Clock Control to 0x%llx\n", (long long int)arg));
|
||||
if (((int64_t)arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
|
||||
retval = writePatternClkControl(arg);
|
||||
LOG(logDEBUG1,
|
||||
("Pattern Clock Control retval: 0x%llx\n", (long long int)retval));
|
||||
validate64(arg, retval, "Pattern Clock Control", HEX);
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_pattern_word(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
@ -7365,7 +7341,6 @@ int set_pattern(int file_des) {
|
||||
uint64_t patwords[MAX_PATTERN_LENGTH];
|
||||
memset(patwords, 0, sizeof(patwords));
|
||||
uint64_t patioctrl = 0;
|
||||
uint64_t patclkctrl = 0;
|
||||
int patlimits[2] = {0, 0};
|
||||
int patloop[6] = {0, 0, 0, 0, 0, 0};
|
||||
int patnloop[3] = {0, 0, 0};
|
||||
@ -7375,8 +7350,6 @@ int set_pattern(int file_des) {
|
||||
return printSocketReadError();
|
||||
if (receiveData(file_des, &patioctrl, sizeof(patioctrl), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
if (receiveData(file_des, &patclkctrl, sizeof(patclkctrl), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
if (receiveData(file_des, patlimits, sizeof(patlimits), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
if (receiveData(file_des, patloop, sizeof(patloop), INT32) < 0)
|
||||
@ -7409,10 +7382,6 @@ int set_pattern(int file_des) {
|
||||
retval64 = writePatternIOControl(patioctrl);
|
||||
validate64(patioctrl, retval64, "Pattern IO Control", HEX);
|
||||
}
|
||||
if (ret == OK) {
|
||||
retval64 = writePatternClkControl(patclkctrl);
|
||||
validate64(patclkctrl, retval64, "Pattern Clock Control", HEX);
|
||||
}
|
||||
#endif
|
||||
if (ret == OK) {
|
||||
numLoops = -1;
|
||||
|
@ -1195,12 +1195,6 @@ class Detector {
|
||||
/** [CTB][Moench] */
|
||||
void setPatternIOControl(uint64_t word, Positions pos = {});
|
||||
|
||||
/** [CTB][Moench] */
|
||||
Result<uint64_t> getPatternClockControl(Positions pos = {}) const;
|
||||
|
||||
/** [CTB][Moench] */
|
||||
void setPatternClockControl(uint64_t word, Positions pos = {});
|
||||
|
||||
/** [CTB][Moench][Mythen3] same as executing for ctb and moench */
|
||||
Result<uint64_t> getPatternWord(int addr, Positions pos = {});
|
||||
|
||||
|
@ -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);
|
||||
|
@ -60,13 +60,13 @@ TEST_CASE("patioctrl", "[.cmd][.new]") {
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patioctrl", {"0x0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patioctrl 0x0\n");
|
||||
proxy.Call("patioctrl", {"0xaadf0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patioctrl 0x00000000000aadf0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patioctrl", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patioctrl 0x0\n");
|
||||
REQUIRE(oss.str() == "patioctrl 0x00000000000aadf0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternIOControl(prev_val[i], {i});
|
||||
@ -76,36 +76,6 @@ TEST_CASE("patioctrl", "[.cmd][.new]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patclkctrl", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
|
||||
auto prev_val = det.getPatternClockControl();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patclkctrl", {"0xc15004808d0a21a4"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patclkctrl 0xc15004808d0a21a4\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patclkctrl", {"0x0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patclkctrl 0x0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patclkctrl", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patclkctrl 0x0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternClockControl(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patclkctrl", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patword", "[.cmd][.new]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@ -114,7 +84,7 @@ TEST_CASE("patword", "[.cmd][.new]") {
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
int addr = 0x23;
|
||||
std::string saddr = sls::ToStringHex(addr);
|
||||
std::string saddr = sls::ToStringHex(addr, 4);
|
||||
auto prev_val = det.getPatternWord(addr);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@ -124,13 +94,15 @@ TEST_CASE("patword", "[.cmd][.new]") {
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patword", {saddr, "0x0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patword [" + saddr + ", 0x0]\n");
|
||||
proxy.Call("patword", {saddr, "0xaadf0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() ==
|
||||
"patword [" + saddr + ", 0x00000000000aadf0]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patword", {saddr}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patword 0x0\n");
|
||||
REQUIRE(oss.str() ==
|
||||
"patword [" + saddr + ", 0x00000000000aadf0]\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternWord(addr, prev_val[i], {i});
|
||||
@ -151,12 +123,12 @@ TEST_CASE("patlimits", "[.cmd][.new]") {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patlimits", {"0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patlimits [0x20, 0x5c]\n");
|
||||
REQUIRE(oss.str() == "patlimits [0x0020, 0x005c]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patlimits", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patlimits [0x20, 0x5c]\n");
|
||||
REQUIRE(oss.str() == "patlimits [0x0020, 0x005c]\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopAddresses(-1, prev_val[i][0], prev_val[i][1],
|
||||
@ -178,12 +150,12 @@ TEST_CASE("patloop0", "[.cmd][.new]") {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop0", {"0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patloop0 [0x20, 0x5c]\n");
|
||||
REQUIRE(oss.str() == "patloop0 [0x0020, 0x005c]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop0", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patloop0 [0x20, 0x5c]\n");
|
||||
REQUIRE(oss.str() == "patloop0 [0x0020, 0x005c]\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopAddresses(0, prev_val[i][0], prev_val[i][1], {i});
|
||||
@ -204,12 +176,12 @@ TEST_CASE("patloop1", "[.cmd][.new]") {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop1", {"0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patloop1 [0x20, 0x5c]\n");
|
||||
REQUIRE(oss.str() == "patloop1 [0x0020, 0x005c]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop1", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patloop1 [0x20, 0x5c]\n");
|
||||
REQUIRE(oss.str() == "patloop1 [0x0020, 0x005c]\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopAddresses(1, prev_val[i][0], prev_val[i][1], {i});
|
||||
@ -230,12 +202,12 @@ TEST_CASE("patloop2", "[.cmd][.new]") {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop2", {"0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patloop2 [0x20, 0x5c]\n");
|
||||
REQUIRE(oss.str() == "patloop2 [0x0020, 0x005c]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop2", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patloop2 [0x20, 0x5c]\n");
|
||||
REQUIRE(oss.str() == "patloop2 [0x0020, 0x005c]\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopAddresses(2, prev_val[i][0], prev_val[i][1], {i});
|
||||
@ -334,12 +306,12 @@ TEST_CASE("patwait0", "[.cmd][.new]") {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait0", {"0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwait0 0x5c\n");
|
||||
REQUIRE(oss.str() == "patwait0 0x005c\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait0", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwait0 0x5c\n");
|
||||
REQUIRE(oss.str() == "patwait0 0x005c\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternWaitAddr(0, prev_val[i], {i});
|
||||
@ -360,12 +332,12 @@ TEST_CASE("patwait1", "[.cmd][.new]") {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait1", {"0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwait1 0x5c\n");
|
||||
REQUIRE(oss.str() == "patwait1 0x005c\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait1", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwait1 0x5c\n");
|
||||
REQUIRE(oss.str() == "patwait1 0x005c\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternWaitAddr(1, prev_val[i], {i});
|
||||
@ -386,12 +358,12 @@ TEST_CASE("patwait2", "[.cmd][.new]") {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait2", {"0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwait2 0x5c\n");
|
||||
REQUIRE(oss.str() == "patwait2 0x005c\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait2", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwait2 0x5c\n");
|
||||
REQUIRE(oss.str() == "patwait2 0x005c\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternWaitAddr(2, prev_val[i], {i});
|
||||
|
@ -444,7 +444,6 @@ typedef struct {
|
||||
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];
|
||||
|
@ -73,7 +73,6 @@ enum detFuncs {
|
||||
F_ENABLE_TEN_GIGA,
|
||||
F_SET_ALL_TRIMBITS,
|
||||
F_SET_PATTERN_IO_CONTROL,
|
||||
F_SET_PATTERN_CLOCK_CONTROL,
|
||||
F_SET_PATTERN_WORD,
|
||||
F_SET_PATTERN_LOOP_ADDRESSES,
|
||||
F_SET_PATTERN_LOOP_CYCLES,
|
||||
@ -373,7 +372,6 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_ENABLE_TEN_GIGA: return "F_ENABLE_TEN_GIGA";
|
||||
case F_SET_ALL_TRIMBITS: return "F_SET_ALL_TRIMBITS";
|
||||
case F_SET_PATTERN_IO_CONTROL: return "F_SET_PATTERN_IO_CONTROL";
|
||||
case F_SET_PATTERN_CLOCK_CONTROL: return "F_SET_PATTERN_CLOCK_CONTROL";
|
||||
case F_SET_PATTERN_WORD: return "F_SET_PATTERN_WORD";
|
||||
case F_SET_PATTERN_LOOP_ADDRESSES: return "F_SET_PATTERN_LOOP_ADDRESSES";
|
||||
case F_SET_PATTERN_LOOP_CYCLES: return "F_SET_PATTERN_LOOP_CYCLES";
|
||||
|
@ -76,7 +76,6 @@ std::string ToString(const slsDetectorDefs::patternParameters &r) {
|
||||
}
|
||||
}
|
||||
oss << "patioctrl " << ToStringHex(r.patioctrl, word_width) << std::endl
|
||||
<< "patclkctrl " << ToStringHex(r.patclkctrl, word_width) << std::endl
|
||||
<< "patlimits " << ToStringHex(r.patlimits[0], addr_width) << " "
|
||||
<< ToStringHex(r.patlimits[1], addr_width) << std::endl
|
||||
<< "patloop0 " << ToStringHex(r.patloop[0], addr_width) << " "
|
||||
|
Loading…
x
Reference in New Issue
Block a user