mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 19:30:03 +02:00
patloops done
This commit is contained in:
parent
f73a15e786
commit
f4a0780b51
@ -118,7 +118,7 @@ ctbLoop::ctbLoop(TGGroupFrame *page, int i, sls::Detector *det) : TGHorizontalFr
|
|||||||
|
|
||||||
void ctbLoop::setNLoops() {
|
void ctbLoop::setNLoops() {
|
||||||
try{
|
try{
|
||||||
myDet->setPatternLoops(id, -1, -1, eLoopNumber->GetNumber());
|
myDet->setPatternLoopCycles(id, eLoopNumber->GetNumber());
|
||||||
} CATCH_DISPLAY ("Could not set number of pattern loops for level " + to_string(id) + ".", "ctbLoop::setNLoops")
|
} CATCH_DISPLAY ("Could not set number of pattern loops for level " + to_string(id) + ".", "ctbLoop::setNLoops")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,10 +127,12 @@ void ctbLoop::setNLoops() {
|
|||||||
void ctbLoop::update() {
|
void ctbLoop::update() {
|
||||||
try{
|
try{
|
||||||
|
|
||||||
auto loop = myDet->getPatternLoops(id).tsquash("Different values");
|
auto loop = myDet->getPatternLoopCycles(id).tsquash("Different values");
|
||||||
eLoopStartAddr->SetHexNumber(loop[0]);
|
eLoopNumber->SetNumber(loop);
|
||||||
eLoopStopAddr->SetHexNumber(loop[1]);
|
auto loopaddr = myDet->getPatternLoopAddresses(id).tsquash("Different values");
|
||||||
eLoopNumber->SetNumber(loop[2]);
|
eLoopStartAddr->SetHexNumber(loopaddr[0]);
|
||||||
|
eLoopStopAddr->SetHexNumber(loopaddr[1]);
|
||||||
|
|
||||||
|
|
||||||
} CATCH_DISPLAY ("Could not get pattern loops for level " + to_string(id) + ".", "ctbLoop::update")
|
} CATCH_DISPLAY ("Could not get pattern loops for level " + to_string(id) + ".", "ctbLoop::update")
|
||||||
}
|
}
|
||||||
@ -825,7 +827,7 @@ void ctbPattern::update() {
|
|||||||
} CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
|
} CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
|
||||||
|
|
||||||
try{
|
try{
|
||||||
auto retval = myDet->getPatternLoops(-1).tsquash("Different values");
|
auto retval = myDet->getPatternLoopAddresses(-1).tsquash("Different values");
|
||||||
eStartAddr->SetHexNumber(retval[0]);
|
eStartAddr->SetHexNumber(retval[0]);
|
||||||
eStopAddr->SetHexNumber(retval[1]);
|
eStopAddr->SetHexNumber(retval[1]);
|
||||||
} CATCH_DISPLAY ("Could not get dbit phase shift.", "ctbPattern::update")
|
} CATCH_DISPLAY ("Could not get dbit phase shift.", "ctbPattern::update")
|
||||||
|
@ -5,7 +5,7 @@ support_lib = ../../slsSupportLib/include/
|
|||||||
|
|
||||||
CROSS = bfin-uclinux-
|
CROSS = bfin-uclinux-
|
||||||
CC = $(CROSS)gcc
|
CC = $(CROSS)gcc
|
||||||
CFLAGS += -Wall -DCHIPTESTBOARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
|
CFLAGS += -Wall -DCHIPTESTBOARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||||
LDLIBS += -lm
|
LDLIBS += -lm
|
||||||
PROGS = ctbDetectorServer
|
PROGS = ctbDetectorServer
|
||||||
DESTDIR ?= bin
|
DESTDIR ?= bin
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -62,7 +62,8 @@ int set_all_trimbits(int);
|
|||||||
int set_pattern_io_control(int);
|
int set_pattern_io_control(int);
|
||||||
int set_pattern_clock_control(int);
|
int set_pattern_clock_control(int);
|
||||||
int set_pattern_word(int);
|
int set_pattern_word(int);
|
||||||
int set_pattern_loop(int);
|
int set_pattern_loop_addresses(int);
|
||||||
|
int set_pattern_loop_cycles(int);
|
||||||
int set_pattern_wait_addr(int);
|
int set_pattern_wait_addr(int);
|
||||||
int set_pattern_wait_time(int);
|
int set_pattern_wait_time(int);
|
||||||
int set_pattern_mask(int);
|
int set_pattern_mask(int);
|
||||||
|
@ -388,7 +388,7 @@ int receiveDataOnly(int file_des, void* buf,int length) {
|
|||||||
if (total_received>0)
|
if (total_received>0)
|
||||||
thisClientIP = dummyClientIP;
|
thisClientIP = dummyClientIP;
|
||||||
|
|
||||||
if (lastClientIP == thisClientIP) {
|
if (lastClientIP != thisClientIP) {
|
||||||
differentClients = 1;
|
differentClients = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -204,7 +204,8 @@ const char* getFunctionName(enum detFuncs func) {
|
|||||||
case F_SET_PATTERN_IO_CONTROL: return "F_SET_PATTERN_IO_CONTROL";
|
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_CLOCK_CONTROL: return "F_SET_PATTERN_CLOCK_CONTROL";
|
||||||
case F_SET_PATTERN_WORD: return "F_SET_PATTERN_WORD";
|
case F_SET_PATTERN_WORD: return "F_SET_PATTERN_WORD";
|
||||||
case F_SET_PATTERN_LOOP: return "F_SET_PATTERN_LOOP";
|
case F_SET_PATTERN_LOOP_ADDRESSES: return "F_SET_PATTERN_LOOP_ADDRESSES";
|
||||||
|
case F_SET_PATTERN_LOOP_CYCLES: return "F_SET_PATTERN_LOOP_CYCLES";
|
||||||
case F_SET_PATTERN_WAIT_ADDR: return "F_SET_PATTERN_WAIT_ADDR";
|
case F_SET_PATTERN_WAIT_ADDR: return "F_SET_PATTERN_WAIT_ADDR";
|
||||||
case F_SET_PATTERN_WAIT_TIME: return "F_SET_PATTERN_WAIT_TIME";
|
case F_SET_PATTERN_WAIT_TIME: return "F_SET_PATTERN_WAIT_TIME";
|
||||||
case F_SET_PATTERN_MASK: return "F_SET_PATTERN_MASK";
|
case F_SET_PATTERN_MASK: return "F_SET_PATTERN_MASK";
|
||||||
@ -332,7 +333,8 @@ void function_table() {
|
|||||||
flist[F_SET_PATTERN_IO_CONTROL] = &set_pattern_io_control;
|
flist[F_SET_PATTERN_IO_CONTROL] = &set_pattern_io_control;
|
||||||
flist[F_SET_PATTERN_CLOCK_CONTROL] = &set_pattern_clock_control;
|
flist[F_SET_PATTERN_CLOCK_CONTROL] = &set_pattern_clock_control;
|
||||||
flist[F_SET_PATTERN_WORD] = &set_pattern_word;
|
flist[F_SET_PATTERN_WORD] = &set_pattern_word;
|
||||||
flist[F_SET_PATTERN_LOOP] = &set_pattern_loop;
|
flist[F_SET_PATTERN_LOOP_ADDRESSES] = &set_pattern_loop_addresses;
|
||||||
|
flist[F_SET_PATTERN_LOOP_CYCLES] = &set_pattern_loop_cycles;
|
||||||
flist[F_SET_PATTERN_WAIT_ADDR] = &set_pattern_wait_addr;
|
flist[F_SET_PATTERN_WAIT_ADDR] = &set_pattern_wait_addr;
|
||||||
flist[F_SET_PATTERN_WAIT_TIME] = &set_pattern_wait_time;
|
flist[F_SET_PATTERN_WAIT_TIME] = &set_pattern_wait_time;
|
||||||
flist[F_SET_PATTERN_MASK] = &set_pattern_mask;
|
flist[F_SET_PATTERN_MASK] = &set_pattern_mask;
|
||||||
@ -2641,13 +2643,11 @@ int set_pattern_word(int file_des) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int set_pattern_loop_addresses(int file_des) {
|
||||||
|
|
||||||
int set_pattern_loop(int file_des) {
|
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int args[4] = {-1, -1, -1, -1};
|
int args[3] = {-1, -1, -1};
|
||||||
int retvals[3] = {-1, -1, -1};
|
int retvals[2] = {-1, -1};
|
||||||
|
|
||||||
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
@ -2657,32 +2657,28 @@ int set_pattern_loop(int file_des) {
|
|||||||
int loopLevel = args[0];
|
int loopLevel = args[0];
|
||||||
int startAddr = args[1];
|
int startAddr = args[1];
|
||||||
int stopAddr = args[2];
|
int stopAddr = args[2];
|
||||||
int numLoops = args[3];
|
FILE_LOG(logDEBUG1, ("Setting Pattern loop addresses(loopLevel:%d startAddr:0x%x stopAddr:0x%x)\n", loopLevel, startAddr, stopAddr));
|
||||||
FILE_LOG(logDEBUG1, ("Setting Pattern loops (loopLevel:%d startAddr:0x%x stopAddr:0x%x numLoops:%d)\n", loopLevel, startAddr, stopAddr, numLoops));
|
if ((startAddr == -1) || (stopAddr == -1) || (Server_VerifyLock() == OK)) {
|
||||||
if ((startAddr == -1) || (stopAddr == -1) || (numLoops == -1) || (Server_VerifyLock() == OK)) {
|
|
||||||
// valid loop level
|
// valid loop level
|
||||||
if (loopLevel < -1 || loopLevel > 2) { // loop level of -1 : complete pattern
|
if (loopLevel < -1 || loopLevel > 2) { // loop level of -1 : complete pattern
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess, "Cannot set Pattern loops. Level %d should be between -1 and 2\n",loopLevel);
|
sprintf(mess, "Cannot set Pattern loop addresses. Level %d should be between -1 and 2\n",loopLevel);
|
||||||
FILE_LOG(logERROR, (mess));
|
FILE_LOG(logERROR, (mess));
|
||||||
}
|
}
|
||||||
// valid addr for loop level 0-2
|
// valid addr for loop level 0-2
|
||||||
else if (startAddr >= MAX_PATTERN_LENGTH || stopAddr >= MAX_PATTERN_LENGTH ) {
|
else if (startAddr >= MAX_PATTERN_LENGTH || stopAddr >= MAX_PATTERN_LENGTH ) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess, "Cannot set Pattern loops. Address (start addr:0x%x and stop addr:0x%x) "
|
sprintf(mess, "Cannot set Pattern loop addresses. Address (start addr:0x%x and stop addr:0x%x) "
|
||||||
"should be less than 0x%x\n", startAddr, stopAddr, MAX_PATTERN_LENGTH);
|
"should be less than 0x%x\n", startAddr, stopAddr, MAX_PATTERN_LENGTH);
|
||||||
FILE_LOG(logERROR, (mess));
|
FILE_LOG(logERROR, (mess));
|
||||||
}
|
} else {
|
||||||
|
int numLoops = -1;
|
||||||
else {
|
|
||||||
setPatternLoop(loopLevel, &startAddr, &stopAddr, &numLoops);
|
setPatternLoop(loopLevel, &startAddr, &stopAddr, &numLoops);
|
||||||
FILE_LOG(logDEBUG1, ("Pattern Loops retval: (start:0x%x, stop:0x%x, nloop:%d)\n", startAddr, stopAddr, numLoops));
|
FILE_LOG(logDEBUG1, ("Pattern loop addresses retval: (start:0x%x, stop:0x%x)\n", startAddr, stopAddr));
|
||||||
retvals[0] = startAddr;
|
retvals[0] = startAddr;
|
||||||
retvals[1] = stopAddr;
|
retvals[1] = stopAddr;
|
||||||
retvals[2] = numLoops;
|
|
||||||
validate(args[1], startAddr, "Pattern loops' start address", HEX);
|
validate(args[1], startAddr, "Pattern loops' start address", HEX);
|
||||||
validate(args[2], stopAddr, "Pattern loops' stop address", HEX);
|
validate(args[2], stopAddr, "Pattern loops' stop address", HEX);
|
||||||
validate(args[3], numLoops, "Pattern loops' number of loops", DEC);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -2691,6 +2687,41 @@ int set_pattern_loop(int file_des) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int set_pattern_loop_cycles(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
int args[2] = {-1, -1};
|
||||||
|
int retval = -1;
|
||||||
|
|
||||||
|
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
int loopLevel = args[0];
|
||||||
|
int numLoops = args[1];
|
||||||
|
FILE_LOG(logDEBUG1, ("Setting Pattern loop cycles (loopLevel:%d numLoops:%d)\n", loopLevel, numLoops));
|
||||||
|
if ((numLoops == -1) || (Server_VerifyLock() == OK)) {
|
||||||
|
// valid loop level
|
||||||
|
if (loopLevel < 0 || loopLevel > 2) {
|
||||||
|
ret = FAIL;
|
||||||
|
sprintf(mess, "Cannot set Pattern loop cycles. Level %d should be between 0 and 2\n",loopLevel);
|
||||||
|
FILE_LOG(logERROR, (mess));
|
||||||
|
} else {
|
||||||
|
int startAddr = -1;
|
||||||
|
int stopAddr = -1;
|
||||||
|
setPatternLoop(loopLevel, &startAddr, &stopAddr, &numLoops);
|
||||||
|
retval = numLoops;
|
||||||
|
FILE_LOG(logDEBUG1, ("Pattern loop cycles retval: (ncycles:%d)\n", retval));
|
||||||
|
validate(args[1], retval, "Pattern loops' number of cycles", DEC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -714,10 +714,17 @@ class CmdProxy {
|
|||||||
{"patioctrl", &CmdProxy::patioctrl},
|
{"patioctrl", &CmdProxy::patioctrl},
|
||||||
{"patclkctrl", &CmdProxy::patclkctrl},
|
{"patclkctrl", &CmdProxy::patclkctrl},
|
||||||
{"patword", &CmdProxy::PatternWord},
|
{"patword", &CmdProxy::PatternWord},
|
||||||
|
{"patlimits", &CmdProxy::PatternLoopAddresses},
|
||||||
|
{"patloop0", &CmdProxy::PatternLoopAddresses},
|
||||||
|
{"patloop1", &CmdProxy::PatternLoopAddresses},
|
||||||
|
{"patloop2", &CmdProxy::PatternLoopAddresses},
|
||||||
|
{"patnloop0", &CmdProxy::PatternLoopCycles},
|
||||||
|
{"patnloop1", &CmdProxy::PatternLoopCycles},
|
||||||
|
{"patnloop2", &CmdProxy::PatternLoopCycles},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{"adcvpp", &CmdProxy::adcvpp},
|
{"adcvpp", &CmdProxy::adcvpp},//dac
|
||||||
{"lastclient", &CmdProxy::lastclient},
|
{"lastclient", &CmdProxy::lastclient},
|
||||||
{"lock", &CmdProxy::lock}
|
{"lock", &CmdProxy::lock}
|
||||||
};
|
};
|
||||||
@ -774,6 +781,10 @@ class CmdProxy {
|
|||||||
/* Pattern */
|
/* Pattern */
|
||||||
std::string Pattern(int action);
|
std::string Pattern(int action);
|
||||||
std::string PatternWord(int action);
|
std::string PatternWord(int action);
|
||||||
|
std::string PatternLoopAddresses(int action);
|
||||||
|
std::string PatternLoopCycles(int action);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* configuration */
|
/* configuration */
|
||||||
EXECUTE_SET_COMMAND_NOID_1ARG(config, loadConfig,
|
EXECUTE_SET_COMMAND_NOID_1ARG(config, loadConfig,
|
||||||
|
@ -1016,15 +1016,21 @@ class Detector {
|
|||||||
void setPatternWord(int addr, uint64_t word, Positions pos = {});
|
void setPatternWord(int addr, uint64_t word, Positions pos = {});
|
||||||
|
|
||||||
/**[CTB] Options: level: -1 (complete pattern) and 0-2 levels
|
/**[CTB] Options: level: -1 (complete pattern) and 0-2 levels
|
||||||
* @returns array of start address, stop address and number of loops
|
* @returns array of start address and stop address
|
||||||
*/
|
*/
|
||||||
Result<std::array<int, 3>> getPatternLoops(int level,
|
Result<std::array<int, 2>> getPatternLoopAddresses(int level,
|
||||||
Positions pos = {}) const;
|
Positions pos = {}) const;
|
||||||
|
|
||||||
/** [CTB] Options: start, stop, n : 0-2
|
/** [CTB] Options: level: -1 (complete pattern) and 0-2 levels */
|
||||||
* level: -1 (complete pattern) and 0-2 levels */
|
void setPatternLoopAddresses(int level, int start, int stop, Positions pos = {});
|
||||||
void setPatternLoops(int level, int start, int stop, int n,
|
|
||||||
Positions pos = {});
|
/**[CTB] Options: level: -1 (complete pattern) and 0-2 levels
|
||||||
|
* @returns number of loops
|
||||||
|
*/
|
||||||
|
Result<int> getPatternLoopCycles(int level, Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** [CTB] n: 0-2, level: -1 (complete pattern) and 0-2 levels */
|
||||||
|
void setPatternLoopCycles(int level, int n, Positions pos = {});
|
||||||
|
|
||||||
/* [CTB] */
|
/* [CTB] */
|
||||||
Result<int> getPatternWaitAddr(int level, Positions pos = {}) const;
|
Result<int> getPatternWaitAddr(int level, Positions pos = {}) const;
|
||||||
|
@ -1644,25 +1644,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
uint64_t setPatternWord(int addr, uint64_t word, int detPos = -1); //
|
uint64_t setPatternWord(int addr, uint64_t word, int detPos = -1); //
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the pattern or loop limits (CTB/ Moench)
|
|
||||||
* @param level -1 complete pattern, 0,1,2, loop level
|
|
||||||
* @param start start address for level 0-2, -1 gets
|
|
||||||
* @param stop stop address for level 0-2, -1 gets
|
|
||||||
* @param n number of loops for level 0-2, -1 gets
|
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
|
||||||
*/
|
|
||||||
void setPatternLoops(int level, int start = -1, int stop = -1, int n = -1,
|
|
||||||
int detPos = -1); //
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the pattern loop limits (CTB/ Moench)
|
|
||||||
* @param level -1 complete pattern, 0,1,2, loop level
|
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
|
||||||
* @returns array of start address, stop address and number of loops
|
|
||||||
*/
|
|
||||||
std::array<int, 3> getPatternLoops(int level, int detPos = -1); //
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the wait address (CTB/ Moench)
|
* Sets the wait address (CTB/ Moench)
|
||||||
* @param level 0,1,2, wait level
|
* @param level 0,1,2, wait level
|
||||||
|
@ -1620,11 +1620,19 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
* @param level -1 complete pattern, 0,1,2, loop level
|
* @param level -1 complete pattern, 0,1,2, loop level
|
||||||
* @param start start address for level 0-2, -1 gets
|
* @param start start address for level 0-2, -1 gets
|
||||||
* @param stop stop address for level 0-2, -1 gets
|
* @param stop stop address for level 0-2, -1 gets
|
||||||
* @param n number of loops for level 0-2, -1 gets
|
* @returns array of start addr and stop addr
|
||||||
* @returns array of start addr, stop addr and number of loops
|
|
||||||
*/
|
*/
|
||||||
std::array<int, 3> setPatternLoops(int level = -1, int start = -1,
|
std::array<int, 2> setPatternLoopAddresses(int level = -1, int start = -1,
|
||||||
int stop = -1, int n = -1);
|
int stop = -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the pattern or loop limits (CTB/ Moench)
|
||||||
|
* @param level -1 complete pattern, 0,1,2, loop level
|
||||||
|
* @param n number of loops for level 0-2, -1 gets
|
||||||
|
* @returns number of loops
|
||||||
|
*/
|
||||||
|
int setPatternLoopCycles(int level = -1, int n = -1);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the wait address (CTB/ Moench)
|
* Sets the wait address (CTB/ Moench)
|
||||||
|
@ -1063,4 +1063,94 @@ std::string CmdProxy::PatternWord(int action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string CmdProxy::PatternLoopAddresses(int action) {
|
||||||
|
std::ostringstream os;
|
||||||
|
os << cmd << ' ';
|
||||||
|
if (action == defs::HELP_ACTION) {
|
||||||
|
if (cmd == "patlimits") {
|
||||||
|
os << "[start addr] [stop addr] \n\t[Ctb] Limits of complete pattern." << '\n';
|
||||||
|
} else if (cmd == "patloop0") {
|
||||||
|
os << "[start addr] [stop addr] \n\t[Ctb] Limits of loop 0." << '\n';
|
||||||
|
} else if (cmd == "patloop1") {
|
||||||
|
os << "[start addr] [stop addr] \n\t[Ctb] Limits of loop 1." << '\n';
|
||||||
|
} else if (cmd == "patloop2") {
|
||||||
|
os << "[start addr] [stop addr] \n\t[Ctb] Limits of loop 2." << '\n';
|
||||||
|
} else {
|
||||||
|
throw sls::RuntimeError("Unknown command, use list to list all commands");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int level = -1;
|
||||||
|
if (cmd == "patlimits") {
|
||||||
|
level = -1;
|
||||||
|
} else if (cmd == "patloop0") {
|
||||||
|
level = 0;
|
||||||
|
} else if (cmd == "patloop1") {
|
||||||
|
level = 1;
|
||||||
|
} else if (cmd == "patloop2") {
|
||||||
|
level = 2;
|
||||||
|
} else{
|
||||||
|
throw sls::RuntimeError("Unknown command, use list to list all commands");
|
||||||
|
}
|
||||||
|
if (action == defs::GET_ACTION) {
|
||||||
|
if (args.size() != 0) {
|
||||||
|
WrongNumberOfParameters(0);
|
||||||
|
}
|
||||||
|
auto t = det->getPatternLoopAddresses(level, {det_id});
|
||||||
|
os << OutStringHex(t) << '\n';
|
||||||
|
} else if (action == defs::PUT_ACTION) {
|
||||||
|
if (args.size() != 2) {
|
||||||
|
WrongNumberOfParameters(2);
|
||||||
|
}
|
||||||
|
det->setPatternLoopAddresses(level, stoiHex(args[0]), stoiHex(args[1]), {det_id});
|
||||||
|
os << sls::ToString(args) << '\n';
|
||||||
|
} else {
|
||||||
|
throw sls::RuntimeError("Unknown action");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return os.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string CmdProxy::PatternLoopCycles(int action) {
|
||||||
|
std::ostringstream os;
|
||||||
|
os << cmd << ' ';
|
||||||
|
if (action == defs::HELP_ACTION) {
|
||||||
|
if (cmd == "patnloop0") {
|
||||||
|
os << "[n_cycles] \n\t[Ctb] Number of cycles of loop 0." << '\n';
|
||||||
|
} else if (cmd == "patnloop1") {
|
||||||
|
os << "[n_cycles] \n\t[Ctb] Number of cycles of loop 1." << '\n';
|
||||||
|
} else if (cmd == "patnloop2") {
|
||||||
|
os << "[n_cycles] \n\t[Ctb] Number of cycles of loop 2." << '\n';
|
||||||
|
} else {
|
||||||
|
throw sls::RuntimeError("Unknown command, use list to list all commands");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int level = -1;
|
||||||
|
if (cmd == "patnloop0") {
|
||||||
|
level = 0;
|
||||||
|
} else if (cmd == "patnloop1") {
|
||||||
|
level = 1;
|
||||||
|
} else if (cmd == "patnloop2") {
|
||||||
|
level = 2;
|
||||||
|
} else{
|
||||||
|
throw sls::RuntimeError("Unknown command, use list to list all commands");
|
||||||
|
}
|
||||||
|
if (action == defs::GET_ACTION) {
|
||||||
|
if (args.size() != 0) {
|
||||||
|
WrongNumberOfParameters(0);
|
||||||
|
}
|
||||||
|
auto t = det->getPatternLoopCycles(level, {det_id});
|
||||||
|
os << OutString(t) << '\n';
|
||||||
|
} else if (action == defs::PUT_ACTION) {
|
||||||
|
if (args.size() != 1) {
|
||||||
|
WrongNumberOfParameters(1);
|
||||||
|
}
|
||||||
|
det->setPatternLoopCycles(level, std::stoi(args[0]), {det_id});
|
||||||
|
os << args.front() << '\n';
|
||||||
|
} else {
|
||||||
|
throw sls::RuntimeError("Unknown action");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return os.str();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace sls
|
} // namespace sls
|
@ -1327,15 +1327,20 @@ void Detector::setPatternWord(int addr, uint64_t word, Positions pos) {
|
|||||||
pimpl->Parallel(&slsDetector::setPatternWord, pos, addr, word);
|
pimpl->Parallel(&slsDetector::setPatternWord, pos, addr, word);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<std::array<int, 3>> Detector::getPatternLoops(int level,
|
Result<std::array<int, 2>> Detector::getPatternLoopAddresses(int level, Positions pos) const {
|
||||||
Positions pos) const {
|
return pimpl->Parallel(&slsDetector::setPatternLoopAddresses, pos, level, -1, -1);
|
||||||
return pimpl->Parallel(&slsDetector::setPatternLoops, pos, level, -1, -1,
|
|
||||||
-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setPatternLoops(int level, int start, int stop, int n,
|
void Detector::setPatternLoopAddresses(int level, int start, int stop, Positions pos) {
|
||||||
Positions pos) {
|
pimpl->Parallel(&slsDetector::setPatternLoopAddresses, pos, level, start, stop);
|
||||||
pimpl->Parallel(&slsDetector::setPatternLoops, pos, level, start, stop, n);
|
}
|
||||||
|
|
||||||
|
Result<int> Detector::getPatternLoopCycles(int level, Positions pos) const {
|
||||||
|
return pimpl->Parallel(&slsDetector::setPatternLoopCycles, pos, level, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setPatternLoopCycles(int level, int n, Positions pos) {
|
||||||
|
pimpl->Parallel(&slsDetector::setPatternLoopCycles, pos, level, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getPatternWaitAddr(int level, Positions pos) const {
|
Result<int> Detector::getPatternWaitAddr(int level, Positions pos) const {
|
||||||
|
@ -2831,7 +2831,8 @@ void multiSlsDetector::savePattern(const std::string &fname) {
|
|||||||
throw RuntimeError("Could not create file to save pattern");
|
throw RuntimeError("Could not create file to save pattern");
|
||||||
}
|
}
|
||||||
// get pattern limits
|
// get pattern limits
|
||||||
auto r = getPatternLoops(-1);
|
auto r = Parallel(&slsDetector::setPatternLoopAddresses, {}, -1, -1, -1)
|
||||||
|
.tsquash("Inconsistent pattern limits");
|
||||||
// pattern words
|
// pattern words
|
||||||
for (int i = r[0]; i <= r[1]; ++i) {
|
for (int i = r[0]; i <= r[1]; ++i) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
@ -2896,28 +2897,6 @@ uint64_t multiSlsDetector::setPatternWord(int addr, uint64_t word, int detPos) {
|
|||||||
return sls::minusOneIfDifferent(r);
|
return sls::minusOneIfDifferent(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void multiSlsDetector::setPatternLoops(int level, int start, int stop, int n,
|
|
||||||
int detPos) {
|
|
||||||
// single
|
|
||||||
if (detPos >= 0) {
|
|
||||||
detectors[detPos]->setPatternLoops(level, start, stop, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
// multi
|
|
||||||
parallelCall(&slsDetector::setPatternLoops, level, start, stop, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::array<int, 3> multiSlsDetector::getPatternLoops(int level, int detPos) {
|
|
||||||
// single
|
|
||||||
if (detPos >= 0) {
|
|
||||||
return detectors[detPos]->setPatternLoops(level, -1, -1, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// multi
|
|
||||||
auto r = parallelCall(&slsDetector::setPatternLoops, level, -1, -1, -1);
|
|
||||||
return sls::minusOneIfDifferent(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
int multiSlsDetector::setPatternWaitAddr(int level, int addr, int detPos) {
|
int multiSlsDetector::setPatternWaitAddr(int level, int addr, int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
|
@ -3243,19 +3243,26 @@ uint64_t slsDetector::setPatternWord(int addr, uint64_t word) {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<int, 3> slsDetector::setPatternLoops(int level, int start, int stop,
|
std::array<int, 2> slsDetector::setPatternLoopAddresses(int level, int start, int stop) {
|
||||||
int n) {
|
int args[]{level, start, stop};
|
||||||
int args[]{level, start, stop, n};
|
std::array<int, 2> retvals{};
|
||||||
std::array<int, 3> retvals{};
|
FILE_LOG(logDEBUG1) << "Setting Pat Loop Addresses, level: " << level
|
||||||
FILE_LOG(logDEBUG1) << "Setting Pat Loops, level: " << level
|
<< ", start: " << start << ", stop: " << stop;
|
||||||
<< ", start: " << start << ", stop: " << stop
|
sendToDetector(F_SET_PATTERN_LOOP_ADDRESSES, args, retvals);
|
||||||
<< ", nloops: " << n;
|
FILE_LOG(logDEBUG1) << "Set Pat Loop Addresses: " << retvals[0] << ", " << retvals[1];
|
||||||
sendToDetector(F_SET_PATTERN_LOOP, args, retvals);
|
|
||||||
FILE_LOG(logDEBUG1) << "Set Pat Loops: " << retvals[0] << ", " << retvals[1]
|
|
||||||
<< ", " << retvals[2];
|
|
||||||
return retvals;
|
return retvals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int slsDetector::setPatternLoopCycles(int level, int n) {
|
||||||
|
int args[]{level, n};
|
||||||
|
int retval = -1;
|
||||||
|
FILE_LOG(logDEBUG1) << "Setting Pat Loop cycles, level: " << level
|
||||||
|
<< ",nloops: " << n;
|
||||||
|
sendToDetector(F_SET_PATTERN_LOOP_CYCLES, args, retval);
|
||||||
|
FILE_LOG(logDEBUG1) << "Set Pat Loop Cycles: " << retval;
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
int slsDetector::setPatternWaitAddr(int level, int addr) {
|
int slsDetector::setPatternWaitAddr(int level, int addr) {
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
int args[]{level, addr};
|
int args[]{level, addr};
|
||||||
|
@ -978,27 +978,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdProcessor;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdProcessor;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page prototype
|
|
||||||
- <b>patlimits [addr1 addr2]</b> sets/gets the start and stop limits of the pattern to be executed. hex format. Advanced!
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "patlimits";
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
|
||||||
++i;
|
|
||||||
|
|
||||||
/*! \page prototype
|
|
||||||
- <b>patloop0 [addr1 addr2]</b> sets/gets the start and stop limits of the level 0 loop. hex format. Advanced!
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "patloop0";
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
|
||||||
++i;
|
|
||||||
|
|
||||||
/*! \page prototype
|
|
||||||
- <b>patnloop0 [n]</b> sets/gets the number of cyclesof the level 0 loop (int).
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "patnloop0";
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
|
||||||
++i;
|
|
||||||
|
|
||||||
/*! \page prototype
|
/*! \page prototype
|
||||||
- <b>patwait0 [addr]</b> sets/gets the address of the level 0 wait point. hex format. Advanced!
|
- <b>patwait0 [addr]</b> sets/gets the address of the level 0 wait point. hex format. Advanced!
|
||||||
*/
|
*/
|
||||||
@ -1013,20 +992,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page prototype
|
|
||||||
- <b>patloop1 [addr1 addr2]</b> sets/gets the start and stop limits of the level 1 loop. hex format. Advanced!
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "patloop1";
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
|
||||||
++i;
|
|
||||||
|
|
||||||
/*! \page prototype
|
|
||||||
- <b>patnloop1 [n]</b> sets/gets the number of cyclesof the level 1 loop (int).
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "patnloop1";
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
|
||||||
++i;
|
|
||||||
|
|
||||||
/*! \page prototype
|
/*! \page prototype
|
||||||
- <b>patwait1 [addr]</b> sets/gets the address of the level 1 wait point. hex format. Advanced!
|
- <b>patwait1 [addr]</b> sets/gets the address of the level 1 wait point. hex format. Advanced!
|
||||||
*/
|
*/
|
||||||
@ -1041,20 +1006,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page prototype
|
|
||||||
- <b>patloop2 [addr1 addr2]</b> sets/gets the start and stop limits of the level 2 loop. hex format. Advanced!
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "patloop2";
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
|
||||||
++i;
|
|
||||||
|
|
||||||
/*! \page prototype
|
|
||||||
- <b>patnloop2 [n]</b> sets/gets the number of cyclesof the level 2 loop (int).
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "patnloop2";
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdPattern;
|
|
||||||
++i;
|
|
||||||
|
|
||||||
/*! \page prototype
|
/*! \page prototype
|
||||||
- <b>patwait2 [addr]</b> sets/gets the address of the level 2 wait point. hex format. Advanced!
|
- <b>patwait2 [addr]</b> sets/gets the address of the level 2 wait point. hex format. Advanced!
|
||||||
*/
|
*/
|
||||||
@ -2220,13 +2171,6 @@ std::string slsDetectorCommand::helpPattern(int action) {
|
|||||||
|
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
if (action == PUT_ACTION || action == HELP_ACTION) {
|
if (action == PUT_ACTION || action == HELP_ACTION) {
|
||||||
os << "patlimits addr1 addr2\t defines pattern limits between addr1 and addr2" << std::endl;
|
|
||||||
os << "patloop0 addr1 adrr2 \t configures the limits of the 0 loop " << std::endl;
|
|
||||||
os << "patloop1 addr1 adrr2 \t configures the limits of the 1 loop " << std::endl;
|
|
||||||
os << "patloop2 addr1 adrr2 \t configures the limits of the 2 loop " << std::endl;
|
|
||||||
os << "patnloop0 n \t sets number of cycles of the 0 loop " << std::endl;
|
|
||||||
os << "patnloop1 n \t sets number of cycles of the 1 loop " << std::endl;
|
|
||||||
os << "patnloop2 n \t sets number of cycles of the 2 loop " << std::endl;
|
|
||||||
os << "patwait0 addr \t configures pattern wait 0 address " << std::endl;
|
os << "patwait0 addr \t configures pattern wait 0 address " << std::endl;
|
||||||
os << "patwait1 addr \t configures pattern wait 1 address " << std::endl;
|
os << "patwait1 addr \t configures pattern wait 1 address " << std::endl;
|
||||||
os << "patwait2 addr \t configures pattern wait 2 address " << std::endl;
|
os << "patwait2 addr \t configures pattern wait 2 address " << std::endl;
|
||||||
@ -2237,13 +2181,6 @@ std::string slsDetectorCommand::helpPattern(int action) {
|
|||||||
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;
|
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) {
|
if (action == GET_ACTION || action == HELP_ACTION) {
|
||||||
os << "patlimits \t returns pattern limits between addr1 and addr2" << std::endl;
|
|
||||||
os << "patloop0 \t returns the limits of the 0 loop " << std::endl;
|
|
||||||
os << "patloop1 \t returns the limits of the 1 loop " << std::endl;
|
|
||||||
os << "patloop2 \t returns the limits of the 2 loop " << std::endl;
|
|
||||||
os << "patnloop0 \t returns the number of cycles of the 0 loop " << std::endl;
|
|
||||||
os << "patnloop1 \t returns the number of cycles of the 1 loop " << std::endl;
|
|
||||||
os << "patnloop2 \t returns the number of cycles of the 2 loop " << std::endl;
|
|
||||||
os << "patwait0 \t returns the pattern wait 0 address " << std::endl;
|
os << "patwait0 \t returns the pattern wait 0 address " << std::endl;
|
||||||
os << "patwait1 \t returns the pattern wait 1 address " << std::endl;
|
os << "patwait1 \t returns the pattern wait 1 address " << std::endl;
|
||||||
os << "patwait2 \t returns the pattern wait 2 address " << std::endl;
|
os << "patwait2 \t returns the pattern wait 2 address " << std::endl;
|
||||||
@ -2272,149 +2209,7 @@ std::string slsDetectorCommand::cmdPattern(int narg, const char * const args[],
|
|||||||
|
|
||||||
|
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
if (cmd == "patlimits") {
|
if (cmd == "patwait0") {
|
||||||
//get start, stop from stdin
|
|
||||||
if (action == PUT_ACTION) {
|
|
||||||
if (narg < 3)
|
|
||||||
return std::string("wrong usage: should specify both start and stop address (hexadecimal fomat) ");
|
|
||||||
n = -1;
|
|
||||||
if (sscanf(args[1], "%x", &start))
|
|
||||||
;
|
|
||||||
else
|
|
||||||
return std::string("Could not scan start address (hexadecimal fomat) ") + std::string(args[1]);
|
|
||||||
|
|
||||||
if (sscanf(args[2], "%x", &stop))
|
|
||||||
;
|
|
||||||
else
|
|
||||||
return std::string("Could not scan stop address (hexadecimal fomat) ") + std::string(args[2]);
|
|
||||||
|
|
||||||
myDet->setPatternLoops(-1, start, stop, n, detPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto r = myDet->getPatternLoops(-1, detPos);
|
|
||||||
os << "0x" << std::setw(4) << std::setfill('0') << std::hex << r[0] << " 0x" << std::setw(4) << std::setfill('0') << r[1];
|
|
||||||
} else if (cmd == "patloop0") {
|
|
||||||
//get start, stop from stdin
|
|
||||||
|
|
||||||
//get start, stop from stdin
|
|
||||||
if (action == PUT_ACTION) {
|
|
||||||
if (narg < 3)
|
|
||||||
return std::string("wrong usage: should specify both start and stop address (hexadecimal fomat) ");
|
|
||||||
n = -1;
|
|
||||||
if (sscanf(args[1], "%x", &start))
|
|
||||||
;
|
|
||||||
else
|
|
||||||
return std::string("Could not scan start address (hexadecimal fomat) ") + std::string(args[1]);
|
|
||||||
|
|
||||||
if (sscanf(args[2], "%x", &stop))
|
|
||||||
;
|
|
||||||
else
|
|
||||||
return std::string("Could not scan stop address (hexadecimal fomat) ") + std::string(args[2]);
|
|
||||||
|
|
||||||
myDet->setPatternLoops(0, start, stop, n, detPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto r = myDet->getPatternLoops(0, detPos);
|
|
||||||
os << "0x" << std::setw(4) << std::setfill('0') << std::hex << r[0] << " 0x" << std::setw(4) << std::setfill('0') << r[1];
|
|
||||||
|
|
||||||
} else if (cmd == "patloop1") {
|
|
||||||
|
|
||||||
//get start, stop from stdin
|
|
||||||
if (action == PUT_ACTION) {
|
|
||||||
if (narg < 3)
|
|
||||||
return std::string("wrong usage: should specify both start and stop address (hexadecimal fomat) ");
|
|
||||||
n = -1;
|
|
||||||
if (sscanf(args[1], "%x", &start))
|
|
||||||
;
|
|
||||||
else
|
|
||||||
return std::string("Could not scan start address (hexadecimal fomat) ") + std::string(args[1]);
|
|
||||||
|
|
||||||
if (sscanf(args[2], "%x", &stop))
|
|
||||||
;
|
|
||||||
else
|
|
||||||
return std::string("Could not scan stop address (hexadecimal fomat) ") + std::string(args[2]);
|
|
||||||
|
|
||||||
myDet->setPatternLoops(1, start, stop, n, detPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto r = myDet->getPatternLoops(1, detPos);
|
|
||||||
os << "0x" << std::setw(4) << std::setfill('0') << std::hex << r[0] << " 0x" << std::setw(4) << std::setfill('0') << r[1];
|
|
||||||
|
|
||||||
} else if (cmd == "patloop2") {
|
|
||||||
|
|
||||||
//get start, stop from stdin
|
|
||||||
if (action == PUT_ACTION) {
|
|
||||||
if (narg < 3)
|
|
||||||
return std::string("wrong usage: should specify both start and stop address (hexadecimal fomat) ");
|
|
||||||
n = -1;
|
|
||||||
if (sscanf(args[1], "%x", &start))
|
|
||||||
;
|
|
||||||
else
|
|
||||||
return std::string("Could not scan start address (hexadecimal fomat) ") + std::string(args[1]);
|
|
||||||
|
|
||||||
if (sscanf(args[2], "%x", &stop))
|
|
||||||
;
|
|
||||||
else
|
|
||||||
return std::string("Could not scan stop address (hexadecimal fomat) ") + std::string(args[2]);
|
|
||||||
|
|
||||||
myDet->setPatternLoops(2, start, stop, n, detPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto r = myDet->getPatternLoops(2, detPos);
|
|
||||||
os << "0x" << std::setw(4) << std::setfill('0') << std::hex << r[0] << " 0x" << std::setw(4) << std::setfill('0') << r[1];
|
|
||||||
} else if (cmd == "patnloop0") {
|
|
||||||
start = -1;
|
|
||||||
stop = -1;
|
|
||||||
|
|
||||||
if (action == PUT_ACTION) {
|
|
||||||
|
|
||||||
if (sscanf(args[1], "%d", &n))
|
|
||||||
;
|
|
||||||
else
|
|
||||||
return std::string("Could not scan number of loops ") + std::string(args[1]);
|
|
||||||
|
|
||||||
myDet->setPatternLoops(0, start, stop, n, detPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto r = myDet->getPatternLoops(0, detPos);
|
|
||||||
os << std::dec << r[2];
|
|
||||||
} else if (cmd == "patnloop1") {
|
|
||||||
|
|
||||||
start = -1;
|
|
||||||
stop = -1;
|
|
||||||
|
|
||||||
if (action == PUT_ACTION) {
|
|
||||||
|
|
||||||
if (sscanf(args[1], "%d", &n))
|
|
||||||
;
|
|
||||||
else
|
|
||||||
return std::string("Could not scan number of loops ") + std::string(args[1]);
|
|
||||||
|
|
||||||
myDet->setPatternLoops(1, start, stop, n, detPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto r = myDet->getPatternLoops(1, detPos);
|
|
||||||
os << std::dec << r[2];
|
|
||||||
|
|
||||||
} else if (cmd == "patnloop2") {
|
|
||||||
|
|
||||||
start = -1;
|
|
||||||
stop = -1;
|
|
||||||
|
|
||||||
if (action == PUT_ACTION) {
|
|
||||||
|
|
||||||
if (sscanf(args[1], "%d", &n))
|
|
||||||
;
|
|
||||||
else
|
|
||||||
return std::string("Could not scan number of loops ") + std::string(args[1]);
|
|
||||||
|
|
||||||
myDet->setPatternLoops(2, start, stop, n, detPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto r = myDet->getPatternLoops(2, detPos);
|
|
||||||
os << std::dec << r[2];
|
|
||||||
|
|
||||||
} else if (cmd == "patwait0") {
|
|
||||||
|
|
||||||
if (action == PUT_ACTION) {
|
if (action == PUT_ACTION) {
|
||||||
|
|
||||||
|
@ -9,6 +9,78 @@
|
|||||||
auto GET = slsDetectorDefs::GET_ACTION;
|
auto GET = slsDetectorDefs::GET_ACTION;
|
||||||
auto PUT = slsDetectorDefs::PUT_ACTION;
|
auto PUT = slsDetectorDefs::PUT_ACTION;
|
||||||
|
|
||||||
|
TEST_CASE("patnloop", "[.cmd][.ctb]") {
|
||||||
|
for (int loop = 0; loop < 3; ++loop) {
|
||||||
|
if (test::type == slsDetectorDefs::CHIPTESTBOARD) {
|
||||||
|
int val = 0;
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("patnloop" + std::to_string(loop), GET, nullptr, oss));
|
||||||
|
std::string s = (oss.str()).erase (0, strlen("patnloop") + 2);
|
||||||
|
val = std::stoi(s);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("patnloop" + std::to_string(loop) + " 5", PUT, nullptr, oss));
|
||||||
|
REQUIRE(oss.str() == "patnloop" + std::to_string(loop) + " 5\n");
|
||||||
|
}
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("patnloop" + std::to_string(loop) + ' ' + std::to_string(val), PUT));
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(multiSlsDetectorClient("patnloop" + std::to_string(loop), GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("patloop", "[.cmd][.ctb]") {
|
||||||
|
for (int loop = 0; loop < 3; ++loop) {
|
||||||
|
if (test::type == slsDetectorDefs::CHIPTESTBOARD) {
|
||||||
|
uint32_t limit1 = 0, limit2 = 0;
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("patloop" + std::to_string(loop), GET, nullptr, oss));
|
||||||
|
std::string s = oss.str();
|
||||||
|
auto t = sls::split(s, ' ');
|
||||||
|
s = t[1].erase (0, 1);
|
||||||
|
limit1 = stoul(s, 0, 16);
|
||||||
|
limit2 = stoul(t[2], 0, 16);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("patloop" + std::to_string(loop) + " 0x20 0x5c", PUT, nullptr, oss));
|
||||||
|
REQUIRE(oss.str() == "patloop" + std::to_string(loop) + " [0x20, 0x5c]\n");
|
||||||
|
}
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("patloop" + std::to_string(loop) + ' ' + sls::ToStringHex(limit1) + ' ' + sls::ToStringHex(limit2), PUT));
|
||||||
|
REQUIRE_THROWS(multiSlsDetectorClient("patloop" + std::to_string(loop) + " 0x3", PUT));
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(multiSlsDetectorClient("patloop" + std::to_string(loop), GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("patlimits", "[.cmd][.ctb]") {
|
||||||
|
if (test::type == slsDetectorDefs::CHIPTESTBOARD) {
|
||||||
|
uint32_t patlimit1 = 0, patlimit2 = 0;
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("patlimits", GET, nullptr, oss));
|
||||||
|
std::string s = oss.str();
|
||||||
|
auto t = sls::split(s, ' ');
|
||||||
|
s = t[1].erase (0, 1);
|
||||||
|
patlimit1 = stoul(s, 0, 16);
|
||||||
|
patlimit2 = stoul(t[2], 0, 16);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("patlimits 0x20 0x5c", PUT, nullptr, oss));
|
||||||
|
REQUIRE(oss.str() == "patlimits [0x20, 0x5c]\n");
|
||||||
|
}
|
||||||
|
REQUIRE_NOTHROW(multiSlsDetectorClient("patlimits " + sls::ToStringHex(patlimit1) + ' ' + sls::ToStringHex(patlimit2), PUT));
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(multiSlsDetectorClient("patlimits", GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("patword", "[.cmd][.ctb]") {
|
TEST_CASE("patword", "[.cmd][.ctb]") {
|
||||||
if (test::type == slsDetectorDefs::CHIPTESTBOARD) {
|
if (test::type == slsDetectorDefs::CHIPTESTBOARD) {
|
||||||
uint64_t prev_value = 0;
|
uint64_t prev_value = 0;
|
||||||
|
@ -46,7 +46,8 @@ enum detFuncs{
|
|||||||
F_SET_PATTERN_IO_CONTROL, /** < set pattern i/o control */
|
F_SET_PATTERN_IO_CONTROL, /** < set pattern i/o control */
|
||||||
F_SET_PATTERN_CLOCK_CONTROL, /** < set pattern clock control */
|
F_SET_PATTERN_CLOCK_CONTROL, /** < set pattern clock control */
|
||||||
F_SET_PATTERN_WORD, /** < sets pattern word */
|
F_SET_PATTERN_WORD, /** < sets pattern word */
|
||||||
F_SET_PATTERN_LOOP, /** < sets pattern loop */
|
F_SET_PATTERN_LOOP_ADDRESSES, /** < sets pattern loop */
|
||||||
|
F_SET_PATTERN_LOOP_CYCLES,
|
||||||
F_SET_PATTERN_WAIT_ADDR, /** < sets pattern wait addr */
|
F_SET_PATTERN_WAIT_ADDR, /** < sets pattern wait addr */
|
||||||
F_SET_PATTERN_WAIT_TIME, /** < sets pattern wait time */
|
F_SET_PATTERN_WAIT_TIME, /** < sets pattern wait time */
|
||||||
F_SET_PATTERN_MASK, /** < loads a pattern mask */
|
F_SET_PATTERN_MASK, /** < loads a pattern mask */
|
||||||
@ -236,7 +237,8 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_SET_PATTERN_IO_CONTROL: return "F_SET_PATTERN_IO_CONTROL";
|
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_CLOCK_CONTROL: return "F_SET_PATTERN_CLOCK_CONTROL";
|
||||||
case F_SET_PATTERN_WORD: return "F_SET_PATTERN_WORD";
|
case F_SET_PATTERN_WORD: return "F_SET_PATTERN_WORD";
|
||||||
case F_SET_PATTERN_LOOP: return "F_SET_PATTERN_LOOP";
|
case F_SET_PATTERN_LOOP_ADDRESSES: return "F_SET_PATTERN_LOOP_ADDRESSES";
|
||||||
|
case F_SET_PATTERN_LOOP_CYCLES: return "F_SET_PATTERN_LOOP_CYCLES";
|
||||||
case F_SET_PATTERN_WAIT_ADDR: return "F_SET_PATTERN_WAIT_ADDR";
|
case F_SET_PATTERN_WAIT_ADDR: return "F_SET_PATTERN_WAIT_ADDR";
|
||||||
case F_SET_PATTERN_WAIT_TIME: return "F_SET_PATTERN_WAIT_TIME";
|
case F_SET_PATTERN_WAIT_TIME: return "F_SET_PATTERN_WAIT_TIME";
|
||||||
case F_SET_PATTERN_MASK: return "F_SET_PATTERN_MASK";
|
case F_SET_PATTERN_MASK: return "F_SET_PATTERN_MASK";
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#define APIMOENCH 0x190820
|
#define APIMOENCH 0x190820
|
||||||
#define APIMYTHEN3 0x191011
|
#define APIMYTHEN3 0x191011
|
||||||
#define APIGOTTHARD2 0x191017
|
#define APIGOTTHARD2 0x191017
|
||||||
#define APIEIGER 0x191021
|
#define APIGOTTHARD 0x191024
|
||||||
#define APIJUNGFRAU 0x191022
|
#define APIJUNGFRAU 0x191024
|
||||||
#define APIGOTTHARD 0x191021
|
#define APIEIGER 0x191024
|
||||||
#define APICTB 0x191021
|
#define APICTB 0x191024
|
||||||
|
Loading…
x
Reference in New Issue
Block a user