mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 16:20:03 +02:00
WIP
This commit is contained in:
parent
5a49182626
commit
8e771c48bd
@ -727,6 +727,8 @@ class CmdProxy {
|
|||||||
{"patwaittime0", &CmdProxy::PatternWaitTime},
|
{"patwaittime0", &CmdProxy::PatternWaitTime},
|
||||||
{"patwaittime1", &CmdProxy::PatternWaitTime},
|
{"patwaittime1", &CmdProxy::PatternWaitTime},
|
||||||
{"patwaittime2", &CmdProxy::PatternWaitTime},
|
{"patwaittime2", &CmdProxy::PatternWaitTime},
|
||||||
|
{"patmask", &CmdProxy::patmask},
|
||||||
|
{"patsetbit", &CmdProxy::patsetbit},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1253,6 +1255,12 @@ class CmdProxy {
|
|||||||
INTEGER_COMMAND_HEX(patclkctrl, getPatternClockControl, setPatternClockControl, std::stoull,
|
INTEGER_COMMAND_HEX(patclkctrl, getPatternClockControl, setPatternClockControl, std::stoull,
|
||||||
"[64 bit mask]\n\t[Ctb] 64 bit mask defining output clock enable.");
|
"[64 bit mask]\n\t[Ctb] 64 bit mask defining output clock enable.");
|
||||||
|
|
||||||
|
INTEGER_COMMAND_HEX(patmask, getPatternMask, setPatternMask, std::stoull,
|
||||||
|
"[64 bit mask]\n\t[Ctb] 64 bit mask applied to every pattern. Only these bits for each pattern will be masked against.");
|
||||||
|
|
||||||
|
INTEGER_COMMAND_HEX(patsetbit, getPatternBitMask, setPatternBitMask, std::stoull,
|
||||||
|
"[64 bit mask]\n\t[Ctb] 64 bit values applied to the selected patmask for every pattern.");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,7 +57,6 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
static std::string helpAdvanced(int action);
|
static std::string helpAdvanced(int action);
|
||||||
static std::string helpConfiguration(int action);
|
static std::string helpConfiguration(int action);
|
||||||
static std::string helpReceiver(int action);
|
static std::string helpReceiver(int action);
|
||||||
static std::string helpPattern(int action);
|
|
||||||
static std::string helpProcessor(int action);
|
static std::string helpProcessor(int action);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -82,7 +81,6 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
std::string cmdAdvanced(int narg, const char * const args[], int action, int detPos = -1);
|
std::string cmdAdvanced(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdConfiguration(int narg, const char * const args[], int action, int detPos = -1);
|
std::string cmdConfiguration(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdReceiver(int narg, const char * const args[], int action, int detPos = -1);
|
std::string cmdReceiver(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
std::string cmdPattern(int narg, const char * const args[], int action, int detPos = -1);
|
|
||||||
std::string cmdProcessor(int narg, const char * const args[], int action, int detPos = -1);
|
std::string cmdProcessor(int narg, const char * const args[], int action, int detPos = -1);
|
||||||
|
|
||||||
int numberOfCommands;
|
int numberOfCommands;
|
||||||
|
@ -978,20 +978,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdProcessor;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdProcessor;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page prototype
|
|
||||||
- <b>patmask [m]</b> sets/gets the 64 bit mask (hex) applied to every pattern. Only the bits from \c patsetbit are selected to mask for the corresponding bit value from \c m mask. Returns \c (uint64_t).
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "patmask";
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
|
||||||
++i;
|
|
||||||
|
|
||||||
/*! \page prototype
|
|
||||||
- <b>patsetbit [m]</b> selects/gets the 64 bits (hex) that the patmask will be applied to every pattern. Only the bits from \c m mask are selected to mask for the corresponding bit value from \c patmask. Returns \c (uint64_t).
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "patsetbit";
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
|
||||||
++i;
|
|
||||||
|
|
||||||
numberOfCommands = i;
|
numberOfCommands = i;
|
||||||
|
|
||||||
// #ifdef VERBOSE
|
// #ifdef VERBOSE
|
||||||
@ -2125,68 +2111,6 @@ std::string slsDetectorCommand::helpReceiver(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetectorCommand::helpPattern(int action) {
|
|
||||||
|
|
||||||
std::ostringstream os;
|
|
||||||
if (action == PUT_ACTION || action == HELP_ACTION) {
|
|
||||||
os << "patmask m \t sets the 64 bit mask (hex) applied to every pattern. Only the bits from patsetbit are selected to mask for the corresponding bit value from m mask" << std::endl;
|
|
||||||
os << "patsetbit m \t selects bits (hex) of the 64 bits that the patmask will be applied to every pattern. Only the bits from m mask are selected to mask for the corresponding bit value from patmask." << std::endl;
|
|
||||||
}
|
|
||||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
|
||||||
os << "patmask \t gets the 64 bit mask (hex) applied to every pattern." << std::endl;
|
|
||||||
os << "patsetbit \t gets 64 bit mask (hex) of the selected bits that the patmask will be applied to every pattern. " << std::endl;
|
|
||||||
|
|
||||||
}
|
|
||||||
return os.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string slsDetectorCommand::cmdPattern(int narg, const char * const args[], int action, int detPos) {
|
|
||||||
|
|
||||||
if (action == HELP_ACTION)
|
|
||||||
return helpPattern(action);
|
|
||||||
/********
|
|
||||||
|
|
||||||
Must implement set ctb functions in slsDetector and multiSlsDetector
|
|
||||||
|
|
||||||
**********/
|
|
||||||
std::string fname;
|
|
||||||
uint64_t word;
|
|
||||||
|
|
||||||
|
|
||||||
std::ostringstream os;
|
|
||||||
if (cmd == "patmask") {
|
|
||||||
if (action == PUT_ACTION) {
|
|
||||||
|
|
||||||
if (sscanf(args[1], "%lx", &word))
|
|
||||||
;
|
|
||||||
else
|
|
||||||
return std::string("Could not scan patmask argument (should be in hex) ") + std::string(args[1]);
|
|
||||||
|
|
||||||
myDet->setPatternMask(word, detPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
os << "0x" << std::setw(16) << std::setfill('0') << std::hex << myDet->getPatternMask(detPos) << std::dec;
|
|
||||||
|
|
||||||
} else if (cmd == "patsetbit") {
|
|
||||||
if (action == PUT_ACTION) {
|
|
||||||
|
|
||||||
if (sscanf(args[1], "%lx", &word))
|
|
||||||
;
|
|
||||||
else
|
|
||||||
return std::string("Could not scan patsetbit argument (should be in hex) ") + std::string(args[1]);
|
|
||||||
|
|
||||||
myDet->setPatternBitMask(word, detPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
os << "0x" << std::setw(16) << std::setfill('0') << std::hex << myDet->getPatternBitMask(detPos) << std::dec;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
return helpPattern(action);
|
|
||||||
|
|
||||||
return os.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string slsDetectorCommand::helpProcessor(int action) {
|
std::string slsDetectorCommand::helpProcessor(int action) {
|
||||||
|
@ -9,6 +9,49 @@
|
|||||||
auto GET = slsDetectorDefs::GET_ACTION;
|
auto GET = slsDetectorDefs::GET_ACTION;
|
||||||
auto PUT = slsDetectorDefs::PUT_ACTION;
|
auto PUT = slsDetectorDefs::PUT_ACTION;
|
||||||
|
|
||||||
|
|
||||||
|
TEST_CASE("patsetbit", "[.cmd][.ctb]") {
|
||||||
|
if (test::type == slsDetectorDefs::CHIPTESTBOARD) {
|
||||||
|
uint64_t val = 0;
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("patsetbit", GET, nullptr, oss));
|
||||||
|
std::string s = (oss.str()).erase (0, strlen("patsetbit "));
|
||||||
|
val = stoul(s, 0, 16);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("patsetbit 0x842f020204200dc0", PUT, nullptr, oss));
|
||||||
|
REQUIRE(oss.str() == "patsetbit 0x842f020204200dc0\n");
|
||||||
|
}
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("patsetbit " + sls::ToStringHex(val), PUT));
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(multiSlsDetectorClient("patsetbit", GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST_CASE("patmask", "[.cmd][.ctb]") {
|
||||||
|
if (test::type == slsDetectorDefs::CHIPTESTBOARD) {
|
||||||
|
uint64_t val = 0;
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("patmask", GET, nullptr, oss));
|
||||||
|
std::string s = (oss.str()).erase (0, strlen("patmask "));
|
||||||
|
val = stoul(s, 0, 16);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("patmask 0x842f020204200dc0", PUT, nullptr, oss));
|
||||||
|
REQUIRE(oss.str() == "patmask 0x842f020204200dc0\n");
|
||||||
|
}
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("patmask " + sls::ToStringHex(val), PUT));
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(multiSlsDetectorClient("patmask", GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("patwaittime", "[.cmd][.ctb]") {
|
TEST_CASE("patwaittime", "[.cmd][.ctb]") {
|
||||||
for (int loop = 0; loop < 3; ++loop) {
|
for (int loop = 0; loop < 3; ++loop) {
|
||||||
if (test::type == slsDetectorDefs::CHIPTESTBOARD) {
|
if (test::type == slsDetectorDefs::CHIPTESTBOARD) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user