ctb patterns interface rewritten

This commit is contained in:
maliakal_d 2019-04-18 15:29:43 +02:00
parent ff4ce48e5d
commit 266520741a
13 changed files with 404 additions and 354 deletions

View File

@ -76,7 +76,7 @@ enum DACINDEX {D0, D1, D2, D3, D4, D5, D6, D7, D8, D9,
#define VIO_MIN_MV (1200) // for fpga to function #define VIO_MIN_MV (1200) // for fpga to function
/* Defines in the Firmware */ /* Defines in the Firmware */
#define MAX_PATTERN_LENGTH (0xFFFF) #define MAX_PATTERN_LENGTH (0x7FFF)
#define DIGITAL_IO_DELAY_MAXIMUM_PS ((OUTPUT_DELAY_0_OTPT_STTNG_MSK >> OUTPUT_DELAY_0_OTPT_STTNG_OFST) * OUTPUT_DELAY_0_OTPT_STTNG_STEPS) #define DIGITAL_IO_DELAY_MAXIMUM_PS ((OUTPUT_DELAY_0_OTPT_STTNG_MSK >> OUTPUT_DELAY_0_OTPT_STTNG_OFST) * OUTPUT_DELAY_0_OTPT_STTNG_STEPS)
#define MAX_PHASE_SHIFTS_STEPS (8) #define MAX_PHASE_SHIFTS_STEPS (8)

View File

@ -57,7 +57,7 @@ enum DACINDEX {D0, D1, D2, D3, D4, D5, D6, D7};
#define DAC_MAX_MV (2500) #define DAC_MAX_MV (2500)
/* Defines in the Firmware */ /* Defines in the Firmware */
#define MAX_PATTERN_LENGTH (0xFFFF) #define MAX_PATTERN_LENGTH (0x7FFF)
#define DIGITAL_IO_DELAY_MAXIMUM_PS ((OUTPUT_DELAY_0_OTPT_STTNG_MSK >> OUTPUT_DELAY_0_OTPT_STTNG_OFST) * OUTPUT_DELAY_0_OTPT_STTNG_STEPS) #define DIGITAL_IO_DELAY_MAXIMUM_PS ((OUTPUT_DELAY_0_OTPT_STTNG_MSK >> OUTPUT_DELAY_0_OTPT_STTNG_OFST) * OUTPUT_DELAY_0_OTPT_STTNG_STEPS)
#define MAX_PHASE_SHIFTS_STEPS (8) #define MAX_PHASE_SHIFTS_STEPS (8)

View File

@ -201,7 +201,12 @@ const char* getFunctionName(enum detFuncs func) {
case F_RESET_COUNTER_BLOCK: return "F_RESET_COUNTER_BLOCK"; case F_RESET_COUNTER_BLOCK: return "F_RESET_COUNTER_BLOCK";
case F_ENABLE_TEN_GIGA: return "F_ENABLE_TEN_GIGA"; case F_ENABLE_TEN_GIGA: return "F_ENABLE_TEN_GIGA";
case F_SET_ALL_TRIMBITS: return "F_SET_ALL_TRIMBITS"; case F_SET_ALL_TRIMBITS: return "F_SET_ALL_TRIMBITS";
case F_SET_PATTERN: return "F_SET_PATTERN"; 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: return "F_SET_PATTERN_LOOP";
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_MASK: return "F_SET_PATTERN_MASK"; case F_SET_PATTERN_MASK: return "F_SET_PATTERN_MASK";
case F_GET_PATTERN_MASK: return "F_GET_PATTERN_MASK"; case F_GET_PATTERN_MASK: return "F_GET_PATTERN_MASK";
case F_SET_PATTERN_BIT_MASK: return "F_SET_PATTERN_BIT_MASK"; case F_SET_PATTERN_BIT_MASK: return "F_SET_PATTERN_BIT_MASK";
@ -273,7 +278,12 @@ void function_table() {
flist[F_RESET_COUNTER_BLOCK] = &reset_counter_block; flist[F_RESET_COUNTER_BLOCK] = &reset_counter_block;
flist[F_ENABLE_TEN_GIGA] = &enable_ten_giga; flist[F_ENABLE_TEN_GIGA] = &enable_ten_giga;
flist[F_SET_ALL_TRIMBITS] = &set_all_trimbits; flist[F_SET_ALL_TRIMBITS] = &set_all_trimbits;
flist[F_SET_PATTERN] = &set_pattern; 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] = &set_pattern_loop;
flist[F_SET_PATTERN_WAIT_ADDR] = &set_pattern_wait_addr;
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;
flist[F_GET_PATTERN_MASK] = &get_pattern_mask; flist[F_GET_PATTERN_MASK] = &get_pattern_mask;
flist[F_SET_PATTERN_BIT_MASK] = &set_pattern_bit_mask; flist[F_SET_PATTERN_BIT_MASK] = &set_pattern_bit_mask;
@ -2674,222 +2684,222 @@ int set_all_trimbits(int file_des) {
int set_pattern(int file_des) {
int set_pattern_io_control(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
uint64_t arg = -1;
uint64_t retval = -1;
// receive mode if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
uint64_t arg = -1; return printSocketReadError();
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
return printSocketReadError();
int mode = (int)arg;
FILE_LOG(logDEBUG1, ("Setting Pattern: mode %d\n", mode));
// mode 0: control or word
if (mode == 0) {
// receive arguments
uint64_t args[2] = {-1, -1};
if (receiveData(file_des, args, sizeof(args), INT64) < 0)
return printSocketReadError();
int64_t retval64 = -1;
#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) #if !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
functionNotImplemented(); functionNotImplemented();
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
#else #else
int addr = (int)args[0]; FILE_LOG(logDEBUG1, ("Setting Pattern IO Control to 0x%llx\n", (long long int)arg));
uint64_t word = args[1]; if ((arg == -1) || (Server_VerifyLock() == OK)) {
FILE_LOG(logDEBUG1, (" addr:0x%x word:0x%llx\n", addr, word)); retval = writePatternIOControl(arg);
FILE_LOG(logDEBUG1, ("Pattern IO Control retval: 0x%llx\n", (long long int) retval));
if ((word == -1) || (Server_VerifyLock() == OK)) { validate64(arg, retval, "Pattern IO Control", HEX);
}
// address for set word should be valid (if not -1 or -2, it goes to setword)
if (addr < -2 || addr > MAX_PATTERN_LENGTH) {
ret = FAIL;
sprintf(mess, "Cannot set Pattern (Word, addr:0x%x). Addr must be <= 0x%x\n",
addr, MAX_PATTERN_LENGTH);
FILE_LOG(logERROR, (mess));
} else {
char tempName[100];
memset(tempName, 0, 100);
switch (addr) {
case -1:
strcpy(tempName, "Pattern (I/O Control Register)");
FILE_LOG(logDEBUG1, (" Setting %s, word to 0x%llx\n", tempName, (long long int) word));
retval64 = writePatternIOControl(word);
FILE_LOG(logDEBUG1, (" %s: 0x%llx\n", tempName, (long long int)retval64));
validate64(word, retval64, tempName, HEX);
break;
case -2:
strcpy(tempName, "Pattern (Clock Control Register)");
FILE_LOG(logDEBUG1, (" Setting %s, word to 0x%llx\n", tempName, (long long int) word));
retval64 = writePatternClkControl(word);
FILE_LOG(logDEBUG1, (" %s: 0x%llx\n", tempName, (long long int)retval64));
validate64(word, retval64, tempName, HEX);
break;
default:
sprintf(tempName, "Pattern (Word, addr:0x%x)", addr);
FILE_LOG(logDEBUG1, (" Setting %s, word to 0x%llx\n", tempName, (long long int) word));
retval64 = writePatternWord(addr, word);
FILE_LOG(logDEBUG1, (" %s: 0x%llx\n", tempName, (long long int)retval64));
// do not validate as it can be different due to masking
//validate64(word, retval64, tempName, HEX);
break;
}
}
}
#endif #endif
return Server_SendResult(file_des, INT64, UPDATE, &retval64, sizeof(retval64)); return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
} }
// mode 1: pattern loop
else if (mode == 1) {
// receive arguments
uint64_t args[4] = {-1, -1, -1, -1};
if (receiveData(file_des, args, sizeof(args), INT64) < 0)
return printSocketReadError();
int retvals[3] = {-1, -1, -1};
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) #if !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
functionNotImplemented(); functionNotImplemented();
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
#else #else
int loopLevel = (int)args[0]; FILE_LOG(logDEBUG1, ("Setting Pattern Clock Control to 0x%llx\n", (long long int)arg));
int startAddr = (int)args[1]; if ((arg == -1) || (Server_VerifyLock() == OK)) {
int stopAddr = (int)args[2]; retval = writePatternClkControl(arg);
int numLoops = (int)args[3]; FILE_LOG(logDEBUG1, ("Pattern Clock Control retval: 0x%llx\n", (long long int) retval));
FILE_LOG(logDEBUG1, (" loopLevel:%d startAddr:0x%x stopAddr:0x%x numLoops:%d\n", loopLevel, startAddr, stopAddr, numLoops)); validate64(arg, retval, "Pattern Clock Control", HEX);
}
if (loopLevel < -1 || loopLevel > 2) { // -1 complete pattern
ret = FAIL;
sprintf(mess, "Pattern (Pattern Loop) Level (%d) is not implemented for this detector\n", loopLevel);
FILE_LOG(logERROR,(mess));
}
// level 0-2, addr upto patternlength + 1
else if ((loopLevel != -1) && (startAddr > MAX_PATTERN_LENGTH || stopAddr > MAX_PATTERN_LENGTH )) {
ret = FAIL;
sprintf(mess, "Cannot set Pattern (Pattern Loop, level:%d, startaddr:0x%x, stopaddr:0x%x). "
"Addr must be <= 0x%x\n",
loopLevel, startAddr, stopAddr, MAX_PATTERN_LENGTH);
FILE_LOG(logERROR, (mess));
}
//level -1, addr upto patternlength
else if ((loopLevel == -1) && (startAddr > MAX_PATTERN_LENGTH || stopAddr > MAX_PATTERN_LENGTH)) {
ret = FAIL;
sprintf(mess, "Cannot set Pattern (Pattern Loop, complete pattern, startaddr:0x%x, stopaddr:0x%x). "
"Addr must be <= 0x%x\n",
startAddr, stopAddr, MAX_PATTERN_LENGTH);
FILE_LOG(logERROR, (mess));
}
else if ((startAddr == -1 && stopAddr == -1 && numLoops == -1) || (Server_VerifyLock() == OK)) {
setPatternLoop(loopLevel, &startAddr, &stopAddr, &numLoops);
}
retvals[0] = startAddr;
retvals[1] = stopAddr;
retvals[2] = numLoops;
#endif #endif
return Server_SendResult(file_des, INT32, UPDATE, retvals, sizeof(retvals)); return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
}
// mode 2: wait address
else if (mode == 2) {
// receive arguments
uint64_t args[2] = {-1, -1};
if (receiveData(file_des, args, sizeof(args), INT64) < 0)
return printSocketReadError();
int retval32 = -1;
#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
functionNotImplemented();
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
#else
int loopLevel = (int)args[0];
int addr = (int)args[1];
FILE_LOG(logDEBUG1, (" loopLevel:%d addr:0x%x\n", loopLevel, addr));
if ((addr == -1) || (Server_VerifyLock() == OK)) {
if (loopLevel < 0 || loopLevel > 2) {
ret = FAIL;
sprintf(mess, "Pattern (Wait Address) Level (0x%x) is not implemented for this detector\n", loopLevel);
FILE_LOG(logERROR,(mess));
} else if (addr > MAX_PATTERN_LENGTH) {
ret = FAIL;
sprintf(mess, "Cannot set Pattern (Wait Address, addr:0x%x). Addr must be <= 0x%x\n",
addr, MAX_PATTERN_LENGTH);
FILE_LOG(logERROR, (mess));
} else {
char tempName[100];
memset(tempName, 0, 100);
sprintf(tempName, "Pattern (Wait Address, Level:%d)", loopLevel);
FILE_LOG(logDEBUG1, (" Setting %s to 0x%x\n", tempName, addr));
retval32 = setPatternWaitAddress(loopLevel, addr);
FILE_LOG(logDEBUG1, (" %s: 0x%x\n", tempName, retval32));
validate(addr, retval32, tempName, HEX);
}
}
#endif
return Server_SendResult(file_des, INT32, UPDATE, &retval32, sizeof(retval32));
}
// mode 3: wait time
else if (mode == 3) {
// receive arguments
uint64_t args[2] = {-1, -1};
if (receiveData(file_des, args, sizeof(args), INT64) < 0)
return printSocketReadError();
int64_t retval64 = -1;
#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
functionNotImplemented();
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
#else
int loopLevel = (int)args[0];
uint64_t timeval = args[1];
FILE_LOG(logDEBUG1, (" loopLevel:%d timeval:0x%lld\n", loopLevel, timeval));
if ((timeval == -1) || (Server_VerifyLock() == OK)) {
if (loopLevel < 0 || loopLevel > 2) {
ret = FAIL;
sprintf(mess, "Pattern (Wait Time) Level (%d) is not implemented for this detector\n", loopLevel);
FILE_LOG(logERROR,(mess));
} else {
char tempName[100];
memset(tempName, 0, 100);
sprintf(tempName, "Pattern (Wait Time, Level:%d)", loopLevel);
FILE_LOG(logDEBUG1, (" Setting %s to 0x%lld\n", tempName, (long long int)timeval));
retval64 = setPatternWaitTime(loopLevel, timeval);
FILE_LOG(logDEBUG1, (" %s: 0x%lld\n", tempName, (long long int)retval64));
validate64(timeval, retval64, tempName, HEX);
}
}
#endif
return Server_SendResult(file_des, INT64, UPDATE, &retval64, sizeof(retval64));
}
// mode not defined
else {
ret = FAIL;
sprintf(mess, "Pattern mode index (%d) is not implemented for this detector\n", mode);
FILE_LOG(logERROR,(mess));
return Server_SendResult(file_des, INT64, UPDATE, NULL, 0);
}
} }
int set_pattern_word(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
uint64_t args[2] = {-1, -1};
uint64_t retval = -1;
if (receiveData(file_des, args, sizeof(args), INT64) < 0)
return printSocketReadError();
#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
functionNotImplemented();
#else
int addr = (int)args[0];
uint64_t word = args[1];
FILE_LOG(logDEBUG1, ("Setting Pattern Word (addr:0x%x, word:0x%llx\n", addr, (long long int)word));
if (Server_VerifyLock() == OK) {
// valid address
if (addr > MAX_PATTERN_LENGTH) {
ret = FAIL;
sprintf(mess, "Cannot set Pattern (Word, addr:0x%x). Addr must be <= 0x%x\n",
addr, MAX_PATTERN_LENGTH);
FILE_LOG(logERROR, (mess));
} else {
retval = writePatternWord(addr, word);
FILE_LOG(logDEBUG1, ("Pattern Word retval: 0x%llx\n", (long long int) retval));
// no validation (cannot read as it will execute the pattern)
}
}
#endif
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
}
int set_pattern_loop(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int args[4] = {-1, -1, -1, -1};
int retvals[3] = {-1, -1, -1};
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
return printSocketReadError();
#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
functionNotImplemented();
#else
int loopLevel = args[0];
int startAddr = args[1];
int stopAddr = args[2];
int numLoops = args[3];
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) || (numLoops == -1) || (Server_VerifyLock() == OK)) {
// valid loop level
if (loopLevel < -1 || loopLevel > 2) { // loop level of -1 : complete pattern
ret = FAIL;
sprintf(mess, "Cannot set Pattern loops. Level %d should be between -1 and 2\n",loopLevel);
FILE_LOG(logERROR, (mess));
}
// valid addr for loop level 0-2
else if (startAddr > MAX_PATTERN_LENGTH || stopAddr > MAX_PATTERN_LENGTH ) {
ret = FAIL;
sprintf(mess, "Cannot set Pattern loops. Address (start addr:0x%x and stop addr:0x%x) "
"should be less than 0x%x\n", startAddr, stopAddr, MAX_PATTERN_LENGTH);
FILE_LOG(logERROR, (mess));
}
else {
setPatternLoop(loopLevel, &startAddr, &stopAddr, &numLoops);
FILE_LOG(logDEBUG1, ("Pattern Loops retval: (start:0x%x, stop:0x%x, nloop:%d)\n", startAddr, stopAddr, numLoops));
retvals[0] = startAddr;
retvals[1] = stopAddr;
retvals[2] = numLoops;
validate(args[1], startAddr, "Pattern loops' start address", HEX);
validate(args[2], stopAddr, "Pattern loops' stop address", HEX);
validate(args[3], numLoops, "Pattern loops' number of loops", DEC);
}
}
#endif
return Server_SendResult(file_des, INT32, UPDATE, retvals, sizeof(retvals));
}
int set_pattern_wait_addr(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)
functionNotImplemented();
#else
int loopLevel = args[0];
int addr = args[1];
FILE_LOG(logDEBUG1, ("Setting Pattern wait address (loopLevel:%d addr:0x%x)\n", loopLevel, addr));
if ((addr == -1) || (Server_VerifyLock() == OK)) {
// valid loop level 0-2
if (loopLevel < 0 || loopLevel > 2) {
ret = FAIL;
sprintf(mess, "Cannot set Pattern wait address. Level %d should be between 0 and 2\n",loopLevel);
FILE_LOG(logERROR, (mess));
}
// valid addr
else if (addr > MAX_PATTERN_LENGTH) {
ret = FAIL;
sprintf(mess, "Cannot set Pattern wait address. Address (0x%x) should be less than 0x%x\n", addr, MAX_PATTERN_LENGTH);
FILE_LOG(logERROR, (mess));
}
else {
retval = setPatternWaitAddress(loopLevel, addr);
FILE_LOG(logDEBUG1, ("Pattern wait address retval: 0x%x\n", retval));
validate(addr, retval, "Pattern wait address", HEX);
}
}
#endif
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
}
int set_pattern_wait_time(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
uint64_t args[2] = { -1, -1};
uint64_t retval = -1;
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
return printSocketReadError();
#if !defined(CHIPTESTBOARDD) && !defined(MOENCHD)
functionNotImplemented();
#else
int loopLevel = (int)args[0];
uint64_t timeval = args[1];
FILE_LOG(logDEBUG1, ("Setting Pattern wait time (loopLevel:%d timeval:0x%llx)\n", loopLevel, (long long int)timeval));
if ((timeval == -1) || (Server_VerifyLock() == OK)) {
// valid loop level 0-2
if (loopLevel < 0 || loopLevel > 2) {
ret = FAIL;
sprintf(mess, "Cannot set Pattern wait time. Level %d should be between 0 and 2\n",loopLevel);
FILE_LOG(logERROR, (mess));
}
else {
retval = setPatternWaitTime(loopLevel, timeval);
FILE_LOG(logDEBUG1, ("Pattern wait time retval: 0x%llx\n", (long long int)retval));
validate64(timeval, retval, "Pattern wait time", HEX);
}
}
#endif
return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval));
}
int set_pattern_mask(int file_des) { int set_pattern_mask(int file_des) {
ret = OK; ret = OK;
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));

View File

@ -63,7 +63,12 @@ int reset_counter_block(int);
int calibrate_pedestal(int); int calibrate_pedestal(int);
int enable_ten_giga(int); int enable_ten_giga(int);
int set_all_trimbits(int); int set_all_trimbits(int);
int set_pattern(int); int set_pattern_io_control(int);
int set_pattern_clock_control(int);
int set_pattern_word(int);
int set_pattern_loop(int);
int set_pattern_wait_addr(int);
int set_pattern_wait_time(int);
int set_pattern_mask(int); int set_pattern_mask(int);
int get_pattern_mask(int); int get_pattern_mask(int);
int set_pattern_bit_mask(int); int set_pattern_bit_mask(int);

View File

@ -1798,41 +1798,58 @@ class multiSlsDetector : public virtual slsDetectorDefs {
int setReceiverSilentMode(int i = -1, int detPos = -1); int setReceiverSilentMode(int i = -1, int detPos = -1);
/** /**
* Opens pattern file and sends pattern to CTB * Opens pattern file and sends pattern (CTB/ Moench)
* @param fname pattern file to open * @param fname pattern file to open
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns OK/FAIL * @returns OK/FAIL
*/ */
int setPattern(const std::string &fname, int detPos = -1); int setPattern(const std::string &fname, int detPos = -1);
/**
* Sets pattern IO control (CTB/ Moench)
* @param word 64bit word to be written, -1 gets
* @param detPos -1 for all detectors in list or specific detector position
* @returns actual value
*/
uint64_t setPatternIOControl(uint64_t word = -1, int detPos = -1);
/**
* Sets pattern clock control (CTB/ Moench)
* @param word 64bit word to be written, -1 gets
* @param detPos -1 for all detectors in list or specific detector position
* @returns actual value
*/
uint64_t setPatternClockControl(uint64_t word = -1, int detPos = -1);
/** /**
* Writes a pattern word to the CTB * Writes a pattern word (CTB/ Moench)
* @param addr address of the word, -1 is I/O control register, * @param addr address of the word
* -2 is clk control register * @param word 64bit word to be written, -1 reads the addr (same as executing the pattern)
* @param word 64bit word to be written, -1 gets
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns actual value * @returns actual value
*/ */
uint64_t setPatternWord(int addr, uint64_t word = -1, int detPos = -1); uint64_t setPatternWord(int addr, uint64_t word, int detPos = -1);
/** /**
* Sets the pattern or loop limits in the CTB * Sets the pattern or loop limits (CTB/ Moench)
* @param level -1 complete pattern, 0,1,2, loop level * @param level -1 complete pattern, 0,1,2, loop level
* @param start start address if >=0 * @param start start address for level 0-2, -1 gets
* @param stop stop address if >=0 * @param stop stop address for level 0-2, -1 gets
* @param n number of loops (if level >=0) * @param n number of loops for level 0-2, -1 gets
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns OK/FAIL
*/ */
int setPatternLoops(uint64_t level, uint64_t start, uint64_t stop, uint64_t n, void setPatternLoops(int level, int start = -1, int stop = -1, int n = -1, int detPos = -1);
int detPos = -1);
/**
* Gets the pattern loop limits (CTB/ Moench)
std::array<uint64_t, 3> getPatternLoops(uint64_t level, int detPos = -1); * @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 in the CTB * Sets the wait address (CTB/ Moench)
* @param level 0,1,2, wait level * @param level 0,1,2, wait level
* @param addr wait address, -1 gets * @param addr wait address, -1 gets
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
@ -1841,7 +1858,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
int setPatternWaitAddr(int level, int addr = -1, int detPos = -1); int setPatternWaitAddr(int level, int addr = -1, int detPos = -1);
/** /**
* Sets the wait time in the CTB * Sets the wait time (CTB/ Moench)
* @param level 0,1,2, wait level * @param level 0,1,2, wait level
* @param t wait time, -1 gets * @param t wait time, -1 gets
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
@ -1850,7 +1867,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
uint64_t setPatternWaitTime(int level, uint64_t t = -1, int detPos = -1); uint64_t setPatternWaitTime(int level, uint64_t t = -1, int detPos = -1);
/** /**
* Sets the mask applied to every pattern * Sets the mask applied to every pattern (CTB/ Moench)
* @param mask mask to be applied * @param mask mask to be applied
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns OK or FAIL * @returns OK or FAIL
@ -1858,14 +1875,14 @@ class multiSlsDetector : public virtual slsDetectorDefs {
int setPatternMask(uint64_t mask, int detPos = -1); int setPatternMask(uint64_t mask, int detPos = -1);
/** /**
* Gets the mask applied to every pattern * Gets the mask applied to every pattern (CTB/ Moench)
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns mask set * @returns mask set
*/ */
uint64_t getPatternMask(int detPos = -1); uint64_t getPatternMask(int detPos = -1);
/** /**
* Selects the bits that the mask will be applied to for every pattern * Selects the bits that the mask will be applied to for every pattern (CTB/ Moench)
* @param mask mask to select bits * @param mask mask to select bits
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns OK or FAIL * @returns OK or FAIL
@ -1873,7 +1890,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
int setPatternBitMask(uint64_t mask, int detPos = -1); int setPatternBitMask(uint64_t mask, int detPos = -1);
/** /**
* Gets the bits that the mask will be applied to for every pattern * Gets the bits that the mask will be applied to for every pattern (CTB/ Moench)
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns mask of bits selected * @returns mask of bits selected
*/ */

View File

@ -1641,65 +1641,77 @@ class slsDetector : public virtual slsDetectorDefs{
* @returns OK/FAIL * @returns OK/FAIL
*/ */
int setPattern(const std::string &fname); int setPattern(const std::string &fname);
/** /**
* Writes a pattern word to the CTB * Sets pattern IO control (CTB/ Moench)
* @param addr address of the word, -1 is I/O control register, -2 is clk control register
* @param word 64bit word to be written, -1 gets * @param word 64bit word to be written, -1 gets
* @returns actual value * @returns actual value
*/ */
uint64_t setPatternWord(uint64_t addr, uint64_t word = -1); uint64_t setPatternIOControl(uint64_t word = -1);
/** /**
* Sets the pattern or loop limits in the CTB * Sets pattern clock control (CTB/ Moench)
* @param level -1 complete pattern, 0,1,2, loop level * @param word 64bit word to be written, -1 gets
* @param start start address if >=0 * @returns actual value
* @param stop stop address if >=0
* @param n number of loops (if level >=0)
* @returns OK/FAIL
*/ */
int setPatternLoops(uint64_t level, uint64_t start, uint64_t stop, uint64_t n); uint64_t setPatternClockControl(uint64_t word = -1);
std::array<uint64_t, 3> getPatternLoops(uint64_t level);
/** /**
* Sets the wait address in the CTB * Writes a pattern word (CTB/ Moench)
* @param addr address of the word
* @param word 64bit word to be written, -1 reads the addr (same as executing the pattern)
* @returns actual value
*/
uint64_t setPatternWord(int addr, uint64_t word);
/**
* 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
* @returns array of start addr, stop addr and number of loops
*/
std::array<int, 3> setPatternLoops(int level = -1, int start = -1, int stop = -1, int n = -1);
/**
* Sets the wait address (CTB/ Moench)
* @param level 0,1,2, wait level * @param level 0,1,2, wait level
* @param addr wait address, -1 gets * @param addr wait address, -1 gets
* @returns actual value * @returns actual value
*/ */
int setPatternWaitAddr(uint64_t level, uint64_t addr = -1); int setPatternWaitAddr(int level, int addr = -1);
/** /**
* Sets the wait time in the CTB * Sets the wait time (CTB/ Moench)
* @param level 0,1,2, wait level * @param level 0,1,2, wait level
* @param t wait time, -1 gets * @param t wait time, -1 gets
* @returns actual value * @returns actual value
*/ */
uint64_t setPatternWaitTime(uint64_t level, uint64_t t = -1); uint64_t setPatternWaitTime(int level, uint64_t t = -1);
/** /**
* Sets the mask applied to every pattern * Sets the mask applied to every pattern (CTB/ Moench)
* @param mask mask to be applied * @param mask mask to be applied
* @returns OK or FAIL * @returns OK or FAIL
*/ */
int setPatternMask(uint64_t mask); int setPatternMask(uint64_t mask);
/** /**
* Gets the mask applied to every pattern * Gets the mask applied to every pattern (CTB/ Moench)
* @returns mask set * @returns mask set
*/ */
uint64_t getPatternMask(); uint64_t getPatternMask();
/** /**
* Selects the bits that the mask will be applied to for every pattern * Selects the bits that the mask will be applied to for every pattern (CTB/ Moench)
* @param mask mask to select bits * @param mask mask to select bits
* @returns OK or FAIL * @returns OK or FAIL
*/ */
int setPatternBitMask(uint64_t mask); int setPatternBitMask(uint64_t mask);
/** /**
* Gets the bits that the mask will be applied to for every pattern * Gets the bits that the mask will be applied to for every pattern (CTB/ Moench)
* @returns mask of bits selected * @returns mask of bits selected
*/ */
uint64_t getPatternBitMask(); uint64_t getPatternBitMask();

View File

@ -3591,6 +3591,28 @@ int multiSlsDetector::setPattern(const std::string &fname, int detPos) {
} }
} }
uint64_t multiSlsDetector::setPatternIOControl(uint64_t word, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setPatternIOControl(word);
}
// multi
auto r = parallelCall(&slsDetector::setPatternIOControl, word);
return sls::minusOneIfDifferent(r);
}
uint64_t multiSlsDetector::setPatternClockControl(uint64_t word, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setPatternClockControl(word);
}
// multi
auto r = parallelCall(&slsDetector::setPatternClockControl, word);
return sls::minusOneIfDifferent(r);
}
uint64_t multiSlsDetector::setPatternWord(int addr, uint64_t word, int detPos) { uint64_t multiSlsDetector::setPatternWord(int addr, uint64_t word, int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
@ -3602,25 +3624,24 @@ uint64_t multiSlsDetector::setPatternWord(int addr, uint64_t word, int detPos) {
return sls::minusOneIfDifferent(r); return sls::minusOneIfDifferent(r);
} }
int multiSlsDetector::setPatternLoops(uint64_t level, uint64_t start, uint64_t stop, uint64_t n, int detPos) { void multiSlsDetector::setPatternLoops(int level, int start, int stop, int n, int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
return detectors[detPos]->setPatternLoops(level, start, stop, n); detectors[detPos]->setPatternLoops(level, start, stop, n);
} }
// multi // multi
std::vector<int> r; parallelCall(&slsDetector::setPatternLoops, level, start, stop, n);
for (auto &d : detectors) {
r.push_back(d->setPatternLoops(level, start, stop, n));
}
return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL;
} }
std::array<uint64_t, 3> multiSlsDetector::getPatternLoops(uint64_t level, int detPos){ std::array<int, 3> multiSlsDetector::getPatternLoops(int level, int detPos) {
if (detPos >= 0) // single
return detectors[detPos]->getPatternLoops(level); if (detPos >= 0) {
return detectors[detPos]->setPatternLoops(level, -1, -1, -1);
auto r = parallelCall(&slsDetector::getPatternLoops, level); }
// multi
auto r = parallelCall(&slsDetector::setPatternLoops, level, -1, -1, -1);
return sls::minusOneIfDifferent(r); return sls::minusOneIfDifferent(r);
} }

View File

@ -4477,11 +4477,46 @@ int slsDetector::setPattern(const std::string &fname) {
return addr; return addr;
} }
uint64_t slsDetector::setPatternWord(uint64_t addr, uint64_t word) { uint64_t slsDetector::setPatternIOControl(uint64_t word) {
int fnum = F_SET_PATTERN; int fnum = F_SET_PATTERN_IO_CONTROL;
int ret = FAIL; int ret = FAIL;
uint64_t mode = 0; // sets word uint64_t arg = word;
uint64_t args[]{mode, addr, word}; uint64_t retval = -1;
FILE_LOG(logDEBUG1) << "Setting Pattern IO Control, word: 0x" << std::hex << word << std::dec;
if (detector_shm()->onlineFlag == ONLINE_FLAG) {
auto client = DetectorSocket(detector_shm()->hostname,
detector_shm()->controlPort);
ret = client.sendCommandThenRead(fnum, &arg, sizeof(arg), &retval, sizeof(retval));
FILE_LOG(logDEBUG1) << "Set Pattern IO Control: " << retval;
}
if (ret == FORCE_UPDATE) {
updateDetector();
}
return retval;
}
uint64_t slsDetector::setPatternClockControl(uint64_t word) {
int fnum = F_SET_PATTERN_CLOCK_CONTROL;
int ret = FAIL;
uint64_t arg = word;
uint64_t retval = -1;
FILE_LOG(logDEBUG1) << "Setting Pattern Clock Control, word: 0x" << std::hex << word << std::dec;
if (detector_shm()->onlineFlag == ONLINE_FLAG) {
auto client = DetectorSocket(detector_shm()->hostname,
detector_shm()->controlPort);
ret = client.sendCommandThenRead(fnum, &arg, sizeof(arg), &retval, sizeof(retval));
FILE_LOG(logDEBUG1) << "Set Pattern Clock Control: " << retval;
}
if (ret == FORCE_UPDATE) {
updateDetector();
}
return retval;
}
uint64_t slsDetector::setPatternWord(int addr, uint64_t word) {
int fnum = F_SET_PATTERN_WORD;
int ret = FAIL;
uint64_t args[]{static_cast<uint64_t>(addr), word};
uint64_t retval = -1; uint64_t retval = -1;
FILE_LOG(logDEBUG1) << "Setting Pattern word, addr: 0x" << std::hex << addr FILE_LOG(logDEBUG1) << "Setting Pattern word, addr: 0x" << std::hex << addr
<< ", word: 0x" << word << std::dec; << ", word: 0x" << word << std::dec;
@ -4498,16 +4533,15 @@ uint64_t slsDetector::setPatternWord(uint64_t addr, uint64_t word) {
return retval; return retval;
} }
int slsDetector::setPatternLoops(uint64_t level, uint64_t start, uint64_t stop, std::array<int, 3> slsDetector::setPatternLoops(int level, int start, int stop, int n) {
uint64_t n) { int fnum = F_SET_PATTERN_LOOP;
int fnum = F_SET_PATTERN;
int ret = FAIL; int ret = FAIL;
uint64_t mode = 1; // sets loop int args[]{level, start, stop, n};
uint64_t args[]{mode, level, start, stop, n};
int retvals[3]{}; int retvals[3]{};
std::array<int, 3> r{};
FILE_LOG(logDEBUG1) << "Setting Pat Loops, level: " << level FILE_LOG(logDEBUG1) << "Setting Pat Loops, level: " << level
<< ", start: " << start << ", stop: " << stop << ", start: " << start << ", stop: " << stop
<< ", n: " << n; << ", nloops: " << n;
if (detector_shm()->onlineFlag == ONLINE_FLAG) { if (detector_shm()->onlineFlag == ONLINE_FLAG) {
auto client = DetectorSocket(detector_shm()->hostname, auto client = DetectorSocket(detector_shm()->hostname,
@ -4519,48 +4553,22 @@ int slsDetector::setPatternLoops(uint64_t level, uint64_t start, uint64_t stop,
assert(start == retvals[0]); assert(start == retvals[0]);
assert(stop == retvals[1]); assert(stop == retvals[1]);
assert(n == retvals[2]); assert(n == retvals[2]);
r[0] = retvals[0];
r[1] = retvals[1];
r[2] = retvals[2];
} }
if (ret == FORCE_UPDATE) { if (ret == FORCE_UPDATE) {
updateDetector(); updateDetector();
} }
return ret;
}
std::array<uint64_t, 3> slsDetector::getPatternLoops(uint64_t level) {
int fnum = F_SET_PATTERN;
int ret = FAIL;
uint64_t mode = 1; // sets loop
uint64_t args[]{mode, level, static_cast<uint64_t>(-1),
static_cast<uint64_t>(-1), static_cast<uint64_t>(-1)};
int retvals[3]{};
FILE_LOG(logDEBUG1) << "Setting Pat Loops, level: " << level
<< ", start: " << -1 << ", stop: " << -1
<< ", n: " << -1;
if (detector_shm()->onlineFlag == ONLINE_FLAG) {
auto client = DetectorSocket(detector_shm()->hostname,
detector_shm()->controlPort);
ret = client.sendCommandThenRead(fnum, args, sizeof(args), retvals,
sizeof(retvals));
FILE_LOG(logDEBUG1) << "Get Pat Loops: " << retvals[0] << ", "
<< retvals[1] << ", " << retvals[2];
}
if (ret == FORCE_UPDATE) {
updateDetector();
}
std::array<uint64_t, 3> r{};
r[0] = retvals[0];
r[1] = retvals[1];
r[2] = retvals[2];
return r; return r;
} }
int slsDetector::setPatternWaitAddr(uint64_t level, uint64_t addr) {
int fnum = F_SET_PATTERN; int slsDetector::setPatternWaitAddr(int level, int addr) {
int fnum = F_SET_PATTERN_WAIT_ADDR;
int ret = FAIL; int ret = FAIL;
uint64_t mode = 2; // sets loop
int retval = -1; int retval = -1;
std::array<uint64_t, 3> args{mode, level, addr}; int args[]{level, addr};
FILE_LOG(logDEBUG1) << "Setting Pat Wait Addr, " FILE_LOG(logDEBUG1) << "Setting Pat Wait Addr, "
"level: " "level: "
<< level << ", addr: 0x" << std::hex << addr << level << ", addr: 0x" << std::hex << addr
@ -4569,7 +4577,7 @@ int slsDetector::setPatternWaitAddr(uint64_t level, uint64_t addr) {
if (detector_shm()->onlineFlag == ONLINE_FLAG) { if (detector_shm()->onlineFlag == ONLINE_FLAG) {
auto client = DetectorSocket(detector_shm()->hostname, auto client = DetectorSocket(detector_shm()->hostname,
detector_shm()->controlPort); detector_shm()->controlPort);
ret = client.sendCommandThenRead(fnum, args.data(), sizeof(args), ret = client.sendCommandThenRead(fnum, args, sizeof(args),
&retval, sizeof(retval)); &retval, sizeof(retval));
FILE_LOG(logDEBUG1) << "Set Pat Wait Addr: " << retval; FILE_LOG(logDEBUG1) << "Set Pat Wait Addr: " << retval;
} }
@ -4579,18 +4587,17 @@ int slsDetector::setPatternWaitAddr(uint64_t level, uint64_t addr) {
return retval; return retval;
} }
uint64_t slsDetector::setPatternWaitTime(uint64_t level, uint64_t t) { uint64_t slsDetector::setPatternWaitTime(int level, uint64_t t) {
int fnum = F_SET_PATTERN; int fnum = F_SET_PATTERN_WAIT_TIME;
int ret = FAIL; int ret = FAIL;
uint64_t mode = 3; // sets loop uint64_t retval = -1;
uint64_t retval = -1; // TODO! is this what we want? uint64_t args[]{static_cast<uint64_t>(level), t};
std::array<uint64_t, 3> args{mode, level, t};
FILE_LOG(logDEBUG1) << "Setting Pat Wait Time, level: " << level FILE_LOG(logDEBUG1) << "Setting Pat Wait Time, level: " << level
<< ", t: " << t; << ", t: " << t;
if (detector_shm()->onlineFlag == ONLINE_FLAG) { if (detector_shm()->onlineFlag == ONLINE_FLAG) {
auto client = DetectorSocket(detector_shm()->hostname, auto client = DetectorSocket(detector_shm()->hostname,
detector_shm()->controlPort); detector_shm()->controlPort);
ret = client.sendCommandThenRead(fnum, args.data(), sizeof(args), ret = client.sendCommandThenRead(fnum, args, sizeof(args),
&retval, sizeof(retval)); &retval, sizeof(retval));
FILE_LOG(logDEBUG1) << "Set Pat Wait Time: " << retval; FILE_LOG(logDEBUG1) << "Set Pat Wait Time: " << retval;
} }

View File

@ -5257,10 +5257,10 @@ std::string slsDetectorCommand::cmdPattern(int narg, char *args[], int action, i
else else
return std::string("Could not scan value (hexadecimal fomat) ") + std::string(args[1]); return std::string("Could not scan value (hexadecimal fomat) ") + std::string(args[1]);
myDet->setPatternWord(-1, word, detPos); myDet->setPatternIOControl(word, detPos);
} }
os << std::hex << myDet->setPatternWord(-1, -1, detPos) << std::dec; os << std::hex << myDet->setPatternIOControl(-1, detPos) << std::dec;
} else if (cmd == "patclkctrl") { } else if (cmd == "patclkctrl") {
//get word from stdin //get word from stdin
@ -5271,10 +5271,10 @@ std::string slsDetectorCommand::cmdPattern(int narg, char *args[], int action, i
else else
return std::string("Could not scan value (hexadecimal fomat) ") + std::string(args[1]); return std::string("Could not scan value (hexadecimal fomat) ") + std::string(args[1]);
myDet->setPatternWord(-2, word, detPos); myDet->setPatternClockControl(word, detPos);
} }
os << std::hex << myDet->setPatternWord(-2, -1, detPos) << std::dec; os << std::hex << myDet->setPatternClockControl(-1, detPos) << std::dec;
} else if (cmd == "patlimits") { } else if (cmd == "patlimits") {
//get start, stop from stdin //get start, stop from stdin
@ -5295,13 +5295,8 @@ std::string slsDetectorCommand::cmdPattern(int narg, char *args[], int action, i
myDet->setPatternLoops(-1, start, stop, n, detPos); myDet->setPatternLoops(-1, start, stop, n, detPos);
} }
// start = -1;
// stop = -1;
// n = -1;
// myDet->setPatternLoops(-1, start, stop, n, detPos);
auto r = myDet->getPatternLoops(-1, detPos); auto r = myDet->getPatternLoops(-1, detPos);
os << std::hex << r[0] << " " << r[1]; os << std::hex << r[0] << " " << r[1];
// os << std::hex << start << " " << stop; // << " "<< std::dec << n ;
} else if (cmd == "patloop0") { } else if (cmd == "patloop0") {
//get start, stop from stdin //get start, stop from stdin
@ -5323,11 +5318,6 @@ std::string slsDetectorCommand::cmdPattern(int narg, char *args[], int action, i
myDet->setPatternLoops(0, start, stop, n, detPos); myDet->setPatternLoops(0, start, stop, n, detPos);
} }
// start = -1;
// stop = -1;
// n = -1;
// myDet->setPatternLoops(0, start, stop, n, detPos);
// os << std::hex << start << " " << stop; // << " "<< std::dec << n ;
auto r = myDet->getPatternLoops(0, detPos); auto r = myDet->getPatternLoops(0, detPos);
os << std::hex << r[0] << " " << r[1]; os << std::hex << r[0] << " " << r[1];
@ -5351,11 +5341,6 @@ std::string slsDetectorCommand::cmdPattern(int narg, char *args[], int action, i
myDet->setPatternLoops(1, start, stop, n, detPos); myDet->setPatternLoops(1, start, stop, n, detPos);
} }
// start = -1;
// stop = -1;
// n = -1;
// myDet->setPatternLoops(1, start, stop, n, detPos);
// os << std::hex << start << " " << stop; // << " "<< std::dec << n ;
auto r = myDet->getPatternLoops(1, detPos); auto r = myDet->getPatternLoops(1, detPos);
os << std::hex << r[0] << " " << r[1]; os << std::hex << r[0] << " " << r[1];
@ -5379,11 +5364,6 @@ std::string slsDetectorCommand::cmdPattern(int narg, char *args[], int action, i
myDet->setPatternLoops(2, start, stop, n, detPos); myDet->setPatternLoops(2, start, stop, n, detPos);
} }
// start = -1;
// stop = -1;
// n = -1;
// myDet->setPatternLoops(2, start, stop, n, detPos);
// os << std::hex << start << " " << stop << std::dec; // << " "<< std::dec << n ;
auto r = myDet->getPatternLoops(2, detPos); auto r = myDet->getPatternLoops(2, detPos);
os << std::hex << r[0] << " " << r[1]; os << std::hex << r[0] << " " << r[1];
} else if (cmd == "patnloop0") { } else if (cmd == "patnloop0") {
@ -5400,11 +5380,6 @@ std::string slsDetectorCommand::cmdPattern(int narg, char *args[], int action, i
myDet->setPatternLoops(0, start, stop, n, detPos); myDet->setPatternLoops(0, start, stop, n, detPos);
} }
// start = -1;
// stop = -1;
// n = -1;
// myDet->setPatternLoops(0, start, stop, n, detPos);
// os << n;
auto r = myDet->getPatternLoops(0, detPos); auto r = myDet->getPatternLoops(0, detPos);
os << std::hex << r[2]; os << std::hex << r[2];
} else if (cmd == "patnloop1") { } else if (cmd == "patnloop1") {
@ -5422,11 +5397,6 @@ std::string slsDetectorCommand::cmdPattern(int narg, char *args[], int action, i
myDet->setPatternLoops(1, start, stop, n, detPos); myDet->setPatternLoops(1, start, stop, n, detPos);
} }
// start = -1;
// stop = -1;
// n = -1;
// myDet->setPatternLoops(1, start, stop, n, detPos);
// os << n;
auto r = myDet->getPatternLoops(1, detPos); auto r = myDet->getPatternLoops(1, detPos);
os << std::hex << r[2]; os << std::hex << r[2];
@ -5445,11 +5415,6 @@ std::string slsDetectorCommand::cmdPattern(int narg, char *args[], int action, i
myDet->setPatternLoops(2, start, stop, n, detPos); myDet->setPatternLoops(2, start, stop, n, detPos);
} }
// start = -1;
// stop = -1;
// n = -1;
// myDet->setPatternLoops(2, start, stop, n, detPos);
// os << n;
auto r = myDet->getPatternLoops(2, detPos); auto r = myDet->getPatternLoops(2, detPos);
os << std::hex << r[2]; os << std::hex << r[2];

View File

@ -47,7 +47,12 @@ enum detFuncs{
F_RESET_COUNTER_BLOCK, /**< resets the counter block memory for gotthard */ F_RESET_COUNTER_BLOCK, /**< resets the counter block memory for gotthard */
F_ENABLE_TEN_GIGA, /**< enable 10Gbe */ F_ENABLE_TEN_GIGA, /**< enable 10Gbe */
F_SET_ALL_TRIMBITS, /** < set all trimbits to this value */ F_SET_ALL_TRIMBITS, /** < set all trimbits to this value */
F_SET_PATTERN, /** < loads a pattern */ F_SET_PATTERN_IO_CONTROL, /** < set pattern i/o control */
F_SET_PATTERN_CLOCK_CONTROL, /** < set pattern clock control */
F_SET_PATTERN_WORD, /** < sets pattern word */
F_SET_PATTERN_LOOP, /** < sets pattern loop */
F_SET_PATTERN_WAIT_ADDR, /** < sets pattern wait addr */
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 */
F_GET_PATTERN_MASK, /** < retrieves pattern mask */ F_GET_PATTERN_MASK, /** < retrieves pattern mask */
F_SET_PATTERN_BIT_MASK, /** < loads bitmask for the pattern */ F_SET_PATTERN_BIT_MASK, /** < loads bitmask for the pattern */
@ -171,7 +176,12 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_RESET_COUNTER_BLOCK: return "F_RESET_COUNTER_BLOCK"; case F_RESET_COUNTER_BLOCK: return "F_RESET_COUNTER_BLOCK";
case F_ENABLE_TEN_GIGA: return "F_ENABLE_TEN_GIGA"; case F_ENABLE_TEN_GIGA: return "F_ENABLE_TEN_GIGA";
case F_SET_ALL_TRIMBITS: return "F_SET_ALL_TRIMBITS"; case F_SET_ALL_TRIMBITS: return "F_SET_ALL_TRIMBITS";
case F_SET_PATTERN: return "F_SET_PATTERN"; 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: return "F_SET_PATTERN_LOOP";
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_MASK: return "F_SET_PATTERN_MASK"; case F_SET_PATTERN_MASK: return "F_SET_PATTERN_MASK";
case F_GET_PATTERN_MASK: return "F_GET_PATTERN_MASK"; case F_GET_PATTERN_MASK: return "F_GET_PATTERN_MASK";
case F_SET_PATTERN_BIT_MASK: return "F_SET_PATTERN_BIT_MASK"; case F_SET_PATTERN_BIT_MASK: return "F_SET_PATTERN_BIT_MASK";
@ -197,6 +207,9 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_CHECK_VERSION: return "F_CHECK_VERSION"; case F_CHECK_VERSION: return "F_CHECK_VERSION";
case F_SOFTWARE_TRIGGER: return "F_SOFTWARE_TRIGGER"; case F_SOFTWARE_TRIGGER: return "F_SOFTWARE_TRIGGER";
case F_LED: return "F_LED"; case F_LED: return "F_LED";
case F_DIGITAL_IO_DELAY: return "F_DIGITAL_IO_DELAY";
case F_COPY_DET_SERVER: return "F_COPY_DET_SERVER";
case F_REBOOT_CONTROLLER: return "F_REBOOT_CONTROLLER";
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS"; case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START"; case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";

View File

@ -6,5 +6,5 @@
#define APILIB 0x190405 #define APILIB 0x190405
#define APIRECEIVER 0x190405 #define APIRECEIVER 0x190405
#define APIGUI 0x190405 #define APIGUI 0x190405
#define APICTB 0x190412
#define APIEIGER 0x190412 #define APIEIGER 0x190412
#define APICTB 0x190418