mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-06 18:10:40 +02:00
Client and jungfrau server funcs added for pattern generator
This commit is contained in:
parent
2d66e1f731
commit
308b3aa9b1
@ -90,7 +90,9 @@ enum {
|
|||||||
F_CALIBRATE_PEDESTAL, /**< starts acquistion, calibrates pedestal and write back to fpga */
|
F_CALIBRATE_PEDESTAL, /**< starts acquistion, calibrates pedestal and write back to fpga */
|
||||||
|
|
||||||
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_CTB_PATTERN /** < loads a pattern in the CTB */
|
||||||
|
|
||||||
|
|
||||||
/* Always append functions hereafter!!! */
|
/* Always append functions hereafter!!! */
|
||||||
|
@ -2612,3 +2612,121 @@ int calibratePedestal(int frames){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint64_t writePatternWord(int addr, uint64_t word) {
|
||||||
|
|
||||||
|
int cntrl=0;
|
||||||
|
if (addr>=MAX_PATTERN_LENGTH)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (word>=0) {
|
||||||
|
set64BitReg(word,PATTERN_IN_REG_LSB,PATTERN_IN_REG_MSB);
|
||||||
|
cntrl= (addr&APATTERN_MASK) << PATTERN_CTRL_ADDR_OFFSET;
|
||||||
|
bus_w(PATTERN_CNTRL_REG, cntrl);
|
||||||
|
bus_w(PATTERN_CNTRL_REG, cntrl | (1<< PATTERN_CTRL_WRITE_BIT) );
|
||||||
|
bus_w(PATTERN_CNTRL_REG, cntrl);
|
||||||
|
}
|
||||||
|
return word;
|
||||||
|
}
|
||||||
|
uint64_t writePatternIOControl(uint64_t word) {
|
||||||
|
if (word>=0)set64BitReg(word,PATTERN_IOCTRL_REG_LSB,PATTERN_IOCTRL_REG_MSB);
|
||||||
|
return get64BitReg(PATTERN_IOCTRL_REG_LSB,PATTERN_IOCTRL_REG_MSB);
|
||||||
|
|
||||||
|
}
|
||||||
|
uint64_t writePatternClkControl(uint64_t word) {
|
||||||
|
if (word>=0)set64BitReg(word,PATTERN_IOCLKCTRL_REG_LSB,PATTERN_IOCLKCTRL_REG_MSB);
|
||||||
|
return get64BitReg(PATTERN_IOCLKCTRL_REG_LSB,PATTERN_IOCLKCTRL_REG_MSB);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int setPatternLoop(int level, int *start, int *stop, int *n) {
|
||||||
|
int ret=OK;
|
||||||
|
int lval=0;
|
||||||
|
|
||||||
|
|
||||||
|
switch (level) {
|
||||||
|
case 0:
|
||||||
|
if (*n>=0) bus_w(*n,PATTERN_N_LOOP0_REG);
|
||||||
|
*n=bus_r(PATTERN_N_LOOP0_REG);
|
||||||
|
lval=bus_r(PATTERN_LOOP0_AREG);
|
||||||
|
if (*start==-1) *start=(lval>> ASTART_OFFSET) & APATTERN_MASK;
|
||||||
|
if (*stop==-1) *start=(lval>> ASTOP_OFFSET) & APATTERN_MASK;
|
||||||
|
lval= ((*start & APATTERN_MASK) << ASTART_OFFSET) | ((*stop & APATTERN_MASK) << ASTOP_OFFSET);
|
||||||
|
bus_w(lval, PATTERN_LOOP0_AREG);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (*n>=0) bus_w(*n,PATTERN_N_LOOP1_REG);
|
||||||
|
*n=bus_r(PATTERN_N_LOOP1_REG);
|
||||||
|
lval=bus_r(PATTERN_LOOP1_AREG);
|
||||||
|
if (*start==-1) *start=(lval>> ASTART_OFFSET) & APATTERN_MASK;
|
||||||
|
if (*stop==-1) *start=(lval>> ASTOP_OFFSET) & APATTERN_MASK;
|
||||||
|
lval= ((*start & APATTERN_MASK) << ASTART_OFFSET) | ((*stop & APATTERN_MASK) << ASTOP_OFFSET);
|
||||||
|
bus_w(lval, PATTERN_LOOP1_AREG);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (*n>=0) bus_w(*n,PATTERN_N_LOOP2_REG);
|
||||||
|
*n=bus_r(PATTERN_N_LOOP2_REG);
|
||||||
|
lval=bus_r(PATTERN_LOOP2_AREG);
|
||||||
|
if (*start==-1) *start=(lval>> ASTART_OFFSET) & APATTERN_MASK;
|
||||||
|
if (*stop==-1) *start=(lval>> ASTOP_OFFSET) & APATTERN_MASK;
|
||||||
|
lval= ((*start & APATTERN_MASK) << ASTART_OFFSET) | ((*stop & APATTERN_MASK) << ASTOP_OFFSET);
|
||||||
|
bus_w(lval, PATTERN_LOOP2_AREG);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case -1:
|
||||||
|
|
||||||
|
lval=bus_r(PATTERN_LIMITS_AREG);
|
||||||
|
if (*start==-1) start=(lval>> ASTART_OFFSET) & APATTERN_MASK;
|
||||||
|
if (*stop==-1) start=(lval>> ASTOP_OFFSET) & APATTERN_MASK;
|
||||||
|
lval= ((*start & APATTERN_MASK) << ASTART_OFFSET) | ((*stop & APATTERN_MASK) << ASTOP_OFFSET);
|
||||||
|
bus_w(lval, PATTERN_LIMITS_AREG);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ret=FAIL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int setPatternWaitAddress(int level, int addr) {
|
||||||
|
int ret=-1;
|
||||||
|
switch (level) {
|
||||||
|
case 0:
|
||||||
|
if (addr>=0) bus_w(addr,PATTERN_WAIT0_AREG);
|
||||||
|
return bus_r(PATTERN_WAIT0_AREG);
|
||||||
|
case 1:
|
||||||
|
if (addr>=0) bus_w(addr,PATTERN_WAIT1_AREG);
|
||||||
|
return bus_r(PATTERN_WAIT1_AREG);
|
||||||
|
case 2:
|
||||||
|
if (addr>=0) bus_w(addr,PATTERN_WAIT2_AREG);
|
||||||
|
return bus_r(PATTERN_WAIT2_AREG);
|
||||||
|
};
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint64_t setPatternWaitTime(int level, uint64_t t) {
|
||||||
|
uint64_t ret=-1;
|
||||||
|
switch (level) {
|
||||||
|
case 0:
|
||||||
|
if (t>=0) set64BitReg(t,PATTERN_WAIT0_TIME_REG_LSB,PATTERN_WAIT0_TIME_REG_MSB);
|
||||||
|
return get64BitReg(PATTERN_WAIT0_TIME_REG_LSB,PATTERN_WAIT0_TIME_REG_MSB);
|
||||||
|
case 1:
|
||||||
|
if (t>=0) set64BitReg(t,PATTERN_WAIT1_TIME_REG_LSB,PATTERN_WAIT1_TIME_REG_MSB);
|
||||||
|
return get64BitReg(PATTERN_WAIT1_TIME_REG_LSB,PATTERN_WAIT1_TIME_REG_MSB);
|
||||||
|
case 2:
|
||||||
|
if (t>=0) set64BitReg(t,PATTERN_WAIT2_TIME_REG_LSB,PATTERN_WAIT2_TIME_REG_MSB);
|
||||||
|
return get64BitReg(PATTERN_WAIT2_TIME_REG_LSB,PATTERN_WAIT2_TIME_REG_MSB);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,6 +149,14 @@ int resetCounterBlock(int startACQ);
|
|||||||
|
|
||||||
int calibratePedestal(int frames);
|
int calibratePedestal(int frames);
|
||||||
|
|
||||||
|
uint64_t writePatternWord(int addr, uint64_t word);
|
||||||
|
uint64_t writePatternIOControl(uint64_t word);
|
||||||
|
uint64_t writePatternClkControl(uint64_t word);
|
||||||
|
int setPatternLoop(int level, int *start, int *stop, int *n);
|
||||||
|
int setPatternWaitAddress(int level, int addr);
|
||||||
|
uint64_t setPatternWaitTime(int level, uint64_t t);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -108,7 +108,6 @@
|
|||||||
//#define FLOW_STATUS_REG 0x12<<11
|
//#define FLOW_STATUS_REG 0x12<<11
|
||||||
//#define FRAME_REG 0x13<<11
|
//#define FRAME_REG 0x13<<11
|
||||||
#define MULTI_PURPOSE_REG 0x14<<11
|
#define MULTI_PURPOSE_REG 0x14<<11
|
||||||
#define DAQ_REG 0x15<<11
|
|
||||||
//#define TIME_FROM_START_REG 0x16<<11
|
//#define TIME_FROM_START_REG 0x16<<11
|
||||||
#define DAC_REG 64<<11//0x17<<11// control the dacs
|
#define DAC_REG 64<<11//0x17<<11// control the dacs
|
||||||
//ADC
|
//ADC
|
||||||
@ -210,12 +209,44 @@
|
|||||||
#define DETECTORIP_AREG 75<<11//detectorip_AReg_c : integer:= 75; */
|
#define DETECTORIP_AREG 75<<11//detectorip_AReg_c : integer:= 75; */
|
||||||
#define IPCHKSUM_AREG 76<<11//ipchksum_AReg_c : integer:= 76; */
|
#define IPCHKSUM_AREG 76<<11//ipchksum_AReg_c : integer:= 76; */
|
||||||
|
|
||||||
|
#define PATTERN_CNTRL_REG 82<<11
|
||||||
|
#define PATTERN_LIMITS_AREG 83<<11
|
||||||
|
|
||||||
|
#define PATTERN_LOOP0_AREG 84<<11
|
||||||
|
#define PATTERN_N_LOOP0_REG 85<<11
|
||||||
|
|
||||||
|
#define PATTERN_LOOP1_AREG 86<<11
|
||||||
|
#define PATTERN_N_LOOP1_REG 87<<11
|
||||||
|
|
||||||
|
#define PATTERN_LOOP2_AREG 88<<11
|
||||||
|
#define PATTERN_N_LOOP2_REG 89<<11
|
||||||
|
|
||||||
|
#define PATTERN_WAIT0_AREG 90<<11
|
||||||
|
#define PATTERN_WAIT1_AREG 91<<11
|
||||||
|
#define PATTERN_WAIT2_AREG 92<<11
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define DAQ_REG 93<<11
|
||||||
|
#define ADC_LATCH_ENABLE_REG 94<<11
|
||||||
|
|
||||||
|
|
||||||
|
#define PATTERN_IOCTRL_REG_LSB 108<<11
|
||||||
|
#define PATTERN_IOCTRL_REG_MSB 109<<12
|
||||||
|
#define PATTERN_IOCLKCTRL_REG_LSB 110<<11
|
||||||
|
#define PATTERN_IOCLKCTRL_REG_MSB 111<<11
|
||||||
|
#define PATTERN_IN_REG_LSB 112<<11
|
||||||
|
#define PATTERN_IN_REG_MSB 113<<11
|
||||||
|
#define PATTERN_WAIT0_TIME_REG_LSB 114<<11
|
||||||
|
#define PATTERN_WAIT0_TIME_REG_MSB 115<<11
|
||||||
|
#define PATTERN_WAIT1_TIME_REG_LSB 116<<11
|
||||||
|
#define PATTERN_WAIT1_TIME_REG_MSB 117<<11
|
||||||
|
#define PATTERN_WAIT2_TIME_REG_LSB 118<<11
|
||||||
|
#define PATTERN_WAIT2_TIME_REG_MSB 119<<11
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -450,14 +481,24 @@
|
|||||||
#define PPL_C0_CNT_PARAM_DEFAULT 0x20D0C
|
#define PPL_C0_CNT_PARAM_DEFAULT 0x20D0C
|
||||||
#define PPL_C1_CNT_PARAM_DEFAULT 0xA0A0
|
#define PPL_C1_CNT_PARAM_DEFAULT 0xA0A0
|
||||||
#define PPL_C2_CNT_PARAM_DEFAULT 0x20D0C
|
#define PPL_C2_CNT_PARAM_DEFAULT 0x20D0C
|
||||||
#define PPL_C2_CNT_PARAM_DEFAULT 0x0808
|
#define PPL_C3_CNT_PARAM_DEFAULT 0x0808
|
||||||
#define PPL_BW_PARAM_DEFAULT 0x2EE0
|
#define PPL_BW_PARAM_DEFAULT 0x2EE0
|
||||||
#define PPL_VCO_PARAM_DEFAULT 0x1
|
#define PPL_VCO_PARAM_DEFAULT 0x1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**------------------
|
||||||
|
-- pattern registers definitions
|
||||||
|
--------------------------------------------- */
|
||||||
|
#define IOSIGNALS_MASK 0xfffffffffffff
|
||||||
|
#define ADC_ENABLE_BIT 63
|
||||||
|
#define APATTERN_MASK 0x3ff
|
||||||
|
#define ASTART_OFFSET 0
|
||||||
|
#define ASTOP_OFFSET 16
|
||||||
|
#define PATTERN_CTRL_WRITE_BIT 0
|
||||||
|
#define PATTERN_CTRL_ADDR_OFFSET 16
|
||||||
|
#define MAX_PATTERN_LENGTH 1024
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -227,6 +227,7 @@ int function_table() {
|
|||||||
flist[F_START_RECEIVER]=&start_receiver;
|
flist[F_START_RECEIVER]=&start_receiver;
|
||||||
flist[F_STOP_RECEIVER]=&stop_receiver;
|
flist[F_STOP_RECEIVER]=&stop_receiver;
|
||||||
flist[F_CALIBRATE_PEDESTAL]=&calibrate_pedestal;
|
flist[F_CALIBRATE_PEDESTAL]=&calibrate_pedestal;
|
||||||
|
flist[F_SET_CTB_PATTERN]=&set_ctb_pattern;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3106,3 +3107,138 @@ int calibrate_pedestal(int file_des){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int set_ctb_pattern(int file_des){
|
||||||
|
|
||||||
|
int ret=FAIL;
|
||||||
|
int retval=-1;
|
||||||
|
int n;
|
||||||
|
int mode;
|
||||||
|
uint64_t word, retval64, t;
|
||||||
|
int addr;
|
||||||
|
int level, start, stop, nl;
|
||||||
|
|
||||||
|
sprintf(mess,"Could not set pattern\n");
|
||||||
|
|
||||||
|
n = receiveDataOnly(file_des,&mode,sizeof(mode));
|
||||||
|
switch (mode) {
|
||||||
|
|
||||||
|
case 0: //sets word
|
||||||
|
n = receiveDataOnly(file_des,&addr,sizeof(addr));
|
||||||
|
n = receiveDataOnly(file_des,&word,sizeof(word));
|
||||||
|
ret=OK;
|
||||||
|
|
||||||
|
switch (addr) {
|
||||||
|
case -1:
|
||||||
|
retval64=writePatternIOControl(word);
|
||||||
|
break;
|
||||||
|
case -2:
|
||||||
|
retval64=writePatternClkControl(word);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
retval64=writePatternWord(addr,word);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//write word;
|
||||||
|
//@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
|
||||||
|
|
||||||
|
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
|
if (ret==FAIL)
|
||||||
|
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
|
else
|
||||||
|
n += sendDataOnly(file_des,&retval64,sizeof(retval64));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1: //pattern loop
|
||||||
|
n = receiveDataOnly(file_des,&level,sizeof(level));
|
||||||
|
n = receiveDataOnly(file_des,&start,sizeof(start));
|
||||||
|
n = receiveDataOnly(file_des,&stop,sizeof(stop));
|
||||||
|
n = receiveDataOnly(file_des,&nl,sizeof(nl));
|
||||||
|
|
||||||
|
|
||||||
|
/** Sets the pattern or loop limits in the CTB
|
||||||
|
@param level -1 complete pattern, 0,1,2, loop level
|
||||||
|
@param start start address if >=0
|
||||||
|
@param stop stop address if >=0
|
||||||
|
@param n number of loops (if level >=0)
|
||||||
|
@returns OK/FAIL
|
||||||
|
*/
|
||||||
|
ret=setPatternLoop(level, &start, &stop, &nl);
|
||||||
|
|
||||||
|
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
|
if (ret==FAIL)
|
||||||
|
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
|
else {
|
||||||
|
n += sendDataOnly(file_des,&start,sizeof(start));
|
||||||
|
n += sendDataOnly(file_des,&stop,sizeof(stop));
|
||||||
|
n += sendDataOnly(file_des,&nl,sizeof(nl));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case 2: //wait address
|
||||||
|
n = receiveDataOnly(file_des,&level,sizeof(level));
|
||||||
|
n = receiveDataOnly(file_des,&addr,sizeof(addr));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Sets the wait address in the CTB
|
||||||
|
@param level 0,1,2, wait level
|
||||||
|
@param addr wait address, -1 gets
|
||||||
|
@returns actual value
|
||||||
|
*/
|
||||||
|
retval=setPatternWaitAddress(level,addr);
|
||||||
|
ret=OK;
|
||||||
|
if (ret==FAIL)
|
||||||
|
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
|
else {
|
||||||
|
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case 3: //wait time
|
||||||
|
n = receiveDataOnly(file_des,&level,sizeof(level));
|
||||||
|
n = receiveDataOnly(file_des,&t,sizeof(t));
|
||||||
|
|
||||||
|
|
||||||
|
/** Sets the wait time in the CTB
|
||||||
|
@param level 0,1,2, wait level
|
||||||
|
@param t wait time, -1 gets
|
||||||
|
@returns actual value
|
||||||
|
*/
|
||||||
|
|
||||||
|
ret=OK;
|
||||||
|
|
||||||
|
retval64=setPatternWaitTime(level,t);
|
||||||
|
|
||||||
|
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
|
if (ret==FAIL)
|
||||||
|
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
|
else
|
||||||
|
n += sendDataOnly(file_des,&retval64,sizeof(retval64));
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
ret=FAIL;
|
||||||
|
sprintf(mess,"%s - wrong mode %d\n",mess, mode);
|
||||||
|
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
|
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*return ok/fail*/
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,5 +93,6 @@ int stop_receiver(int);
|
|||||||
int calibrate_pedestal(int);
|
int calibrate_pedestal(int);
|
||||||
|
|
||||||
int set_roi(int);
|
int set_roi(int);
|
||||||
|
int set_ctb_pattern(int);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4843,3 +4843,126 @@ int multiSlsDetector::enableTenGigabitEthernet(int i){
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** opens pattern file and sends pattern to CTB
|
||||||
|
@param fname pattern file to open
|
||||||
|
@returns OK/FAIL
|
||||||
|
*/
|
||||||
|
int setCTBPattern(string fname) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Writes a pattern word to the CTB
|
||||||
|
@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
|
||||||
|
@returns actual value
|
||||||
|
*/
|
||||||
|
uint64_t setCTBWord(int addr,uint64_t word) {
|
||||||
|
uint64_t ret=-100,ret1;
|
||||||
|
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++)
|
||||||
|
if (detectors[idet]){
|
||||||
|
ret1=detectors[idet]->setCTBWord(addr, word);
|
||||||
|
if(detectors[idet]->getErrorMask())
|
||||||
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
if(ret==-100)
|
||||||
|
ret=ret1;
|
||||||
|
else if (ret!=ret1)
|
||||||
|
ret=-1;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Sets the pattern or loop limits in the CTB
|
||||||
|
@param level -1 complete pattern, 0,1,2, loop level
|
||||||
|
@param start start address if >=0
|
||||||
|
@param stop stop address if >=0
|
||||||
|
@param n number of loops (if level >=0)
|
||||||
|
@returns OK/FAIL
|
||||||
|
*/
|
||||||
|
int setCTBPatLoops(int level,int &start, int &stop, int &n) {
|
||||||
|
|
||||||
|
|
||||||
|
int ret=-100,ret1;
|
||||||
|
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++)
|
||||||
|
if (detectors[idet]){
|
||||||
|
ret1=detectors[idet]->setCTBPatLoops(level, start, stop, n);
|
||||||
|
if(detectors[idet]->getErrorMask())
|
||||||
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
if(ret==-100)
|
||||||
|
ret=ret1;
|
||||||
|
else if (ret!=ret1)
|
||||||
|
ret=-1;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Sets the wait address in the CTB
|
||||||
|
@param level 0,1,2, wait level
|
||||||
|
@param addr wait address, -1 gets
|
||||||
|
@returns actual value
|
||||||
|
*/
|
||||||
|
int setCTBPatWaitAddr(int level, int addr) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int ret=-100,ret1;
|
||||||
|
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++)
|
||||||
|
if (detectors[idet]){
|
||||||
|
ret1=detectors[idet]->setCTBPatWaitAddr(level, addr);
|
||||||
|
if(detectors[idet]->getErrorMask())
|
||||||
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
if(ret==-100)
|
||||||
|
ret=ret1;
|
||||||
|
else if (ret!=ret1)
|
||||||
|
ret=-1;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sets the wait time in the CTB
|
||||||
|
@param level 0,1,2, wait level
|
||||||
|
@param t wait time, -1 gets
|
||||||
|
@returns actual value
|
||||||
|
*/
|
||||||
|
int setCTBPatWaitTime(int level, uint64_t t=-1) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int ret=-100,ret1;
|
||||||
|
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++)
|
||||||
|
if (detectors[idet]){
|
||||||
|
ret1=detectors[idet]->setCTBPatWaitTime(level,t);
|
||||||
|
if(detectors[idet]->getErrorMask())
|
||||||
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
|
if(ret==-100)
|
||||||
|
ret=ret1;
|
||||||
|
else if (ret!=ret1)
|
||||||
|
ret=-1;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1240,6 +1240,59 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******** CTB funcs */
|
||||||
|
|
||||||
|
/** opens pattern file and sends pattern to CTB
|
||||||
|
@param fname pattern file to open
|
||||||
|
@returns OK/FAIL
|
||||||
|
*/
|
||||||
|
int setCTBPattern(string fname);
|
||||||
|
|
||||||
|
|
||||||
|
/** Writes a pattern word to the CTB
|
||||||
|
@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
|
||||||
|
@returns actual value
|
||||||
|
*/
|
||||||
|
int setCTBWord(int addr,uint64_t word=-1);
|
||||||
|
|
||||||
|
/** Sets the pattern or loop limits in the CTB
|
||||||
|
@param level -1 complete pattern, 0,1,2, loop level
|
||||||
|
@param start start address if >=0
|
||||||
|
@param stop stop address if >=0
|
||||||
|
@param n number of loops (if level >=0)
|
||||||
|
@returns OK/FAIL
|
||||||
|
*/
|
||||||
|
int setCTBPatLoops(int level,int &start, int &stop, int &n);
|
||||||
|
|
||||||
|
|
||||||
|
/** Sets the wait address in the CTB
|
||||||
|
@param level 0,1,2, wait level
|
||||||
|
@param addr wait address, -1 gets
|
||||||
|
@returns actual value
|
||||||
|
*/
|
||||||
|
int setCTBPatWaitAddr(int level, int addr=-1);
|
||||||
|
|
||||||
|
/** Sets the wait time in the CTB
|
||||||
|
@param level 0,1,2, wait level
|
||||||
|
@param t wait time, -1 gets
|
||||||
|
@returns actual value
|
||||||
|
*/
|
||||||
|
int setCTBPatWaitTime(int level, uint64_t t=-1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,15 +145,15 @@ main(void) {
|
|||||||
fprintf(fd,"patlimits %04x %04x\n",start, stop);
|
fprintf(fd,"patlimits %04x %04x\n",start, stop);
|
||||||
|
|
||||||
for (iloop=0; iloop<MAXLOOPS; iloop++) {
|
for (iloop=0; iloop<MAXLOOPS; iloop++) {
|
||||||
fprintf(fd,"loop%d %04x %04x\n",iloop, startloopaddr[iloop], stoploopaddr[iloop]);
|
fprintf(fd,"patloop%d %04x %04x\n",iloop, startloopaddr[iloop], stoploopaddr[iloop]);
|
||||||
if ( startloopaddr[iloop]<0 || stoploopaddr[iloop]<= startloopaddr[iloop]) nloop[iloop]=0;
|
if ( startloopaddr[iloop]<0 || stoploopaddr[iloop]<= startloopaddr[iloop]) nloop[iloop]=0;
|
||||||
fprintf(fd,"nloop%d %d\n",iloop, nloop[iloop]);
|
fprintf(fd,"patnloop%d %d\n",iloop, nloop[iloop]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (iloop=0; iloop<MAXTIMERS; iloop++) {
|
for (iloop=0; iloop<MAXTIMERS; iloop++) {
|
||||||
fprintf(fd,"wait%d %04x\n",iloop, waitaddr[iloop]);
|
fprintf(fd,"patwait%d %04x\n",iloop, waitaddr[iloop]);
|
||||||
if (waitaddr[iloop]<0) waittime[iloop]=0;
|
if (waitaddr[iloop]<0) waittime[iloop]=0;
|
||||||
fprintf(fd,"waittime%d %lld\n",iloop, waittime[iloop]);
|
fprintf(fd,"patwaittime%d %lld\n",iloop, waittime[iloop]);
|
||||||
}
|
}
|
||||||
|
|
||||||
close((int)fd);
|
close((int)fd);
|
||||||
|
@ -6792,3 +6792,235 @@ int slsDetector::enableTenGigabitEthernet(int i){
|
|||||||
thisDetector->tenGigaEnable=retval;
|
thisDetector->tenGigaEnable=retval;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******** CTB funcs */
|
||||||
|
|
||||||
|
/** opens pattern file and sends pattern to CTB
|
||||||
|
@param fname pattern file to open
|
||||||
|
@returns OK/FAIL
|
||||||
|
*/
|
||||||
|
int setCTBPattern(string fname) {
|
||||||
|
|
||||||
|
|
||||||
|
int fnum=F_SEND_RECEIVER_DETHOSTNAME;
|
||||||
|
int ret = FAIL;
|
||||||
|
char retval[MAX_STR_LENGTH]="";
|
||||||
|
|
||||||
|
|
||||||
|
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::cout << "Sending detector hostname to Receiver " << thisDetector->hostname << std::endl;
|
||||||
|
#endif
|
||||||
|
if (connectData() == OK)
|
||||||
|
ret=thisReceiver->sendString(fnum,retval,thisDetector->hostname);
|
||||||
|
if((ret==FAIL) || (strcmp(retval,thisDetector->hostname)))
|
||||||
|
setErrorMask((getErrorMask())|(RECEIVER_DET_HOSTNAME_NOT_SET));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Writes a pattern word to the CTB
|
||||||
|
@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
|
||||||
|
@returns actual value
|
||||||
|
*/
|
||||||
|
uint64_t setCTBWord(int addr,uint64_t word) {
|
||||||
|
|
||||||
|
uint64_t ret;
|
||||||
|
|
||||||
|
int ret=FAIL;
|
||||||
|
uint64_t retval=-1;
|
||||||
|
int fnum=F_SET_CTB_PATTERN;
|
||||||
|
int mode=0; //sets word
|
||||||
|
|
||||||
|
char mess[100];
|
||||||
|
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::cout<<"Setting CTB word" <<std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
|
if (connectControl() == OK){
|
||||||
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
|
controlSocket->SendDataOnly(&mode,sizeof(mode));
|
||||||
|
controlSocket->SendDataOnly(&addr,sizeof(addr));
|
||||||
|
controlSocket->SendDataOnly(&word,sizeof(word));
|
||||||
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
|
if (ret!=FAIL)
|
||||||
|
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||||
|
else {
|
||||||
|
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||||
|
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||||
|
}
|
||||||
|
controlSocket->Disconnect();
|
||||||
|
if (ret==FORCE_UPDATE)
|
||||||
|
updateDetector();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sets the pattern or loop limits in the CTB
|
||||||
|
@param level -1 complete pattern, 0,1,2, loop level
|
||||||
|
@param start start address if >=0
|
||||||
|
@param stop stop address if >=0
|
||||||
|
@param n number of loops (if level >=0)
|
||||||
|
@returns OK/FAIL
|
||||||
|
*/
|
||||||
|
int setCTBPatLoops(int level,int &start, int &stop, int &n) {
|
||||||
|
|
||||||
|
|
||||||
|
int retval[3], args[4];
|
||||||
|
|
||||||
|
args[0]=level;
|
||||||
|
args[1]=start;
|
||||||
|
args[2]=stop;
|
||||||
|
args[3]=n;
|
||||||
|
|
||||||
|
|
||||||
|
int ret=FAIL;
|
||||||
|
uint64_t retval=-1;
|
||||||
|
int fnum=F_SET_CTB_PATTERN;
|
||||||
|
int mode=1; //sets loop
|
||||||
|
|
||||||
|
char mess[100];
|
||||||
|
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::cout<<"Setting CTB word" <<std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
|
if (connectControl() == OK){
|
||||||
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
|
controlSocket->SendDataOnly(&mode,sizeof(mode));
|
||||||
|
controlSocket->SendDataOnly(&args,sizeof(args));
|
||||||
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
|
if (ret!=FAIL) {
|
||||||
|
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||||
|
start=retval[0];
|
||||||
|
stop=retval[1];
|
||||||
|
n=retval[2];
|
||||||
|
} else {
|
||||||
|
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||||
|
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||||
|
}
|
||||||
|
controlSocket->Disconnect();
|
||||||
|
if (ret==FORCE_UPDATE)
|
||||||
|
updateDetector();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Sets the wait address in the CTB
|
||||||
|
@param level 0,1,2, wait level
|
||||||
|
@param addr wait address, -1 gets
|
||||||
|
@returns actual value
|
||||||
|
*/
|
||||||
|
int setCTBPatWaitAddr(int level, int addr=-1) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int retval=-1;
|
||||||
|
|
||||||
|
|
||||||
|
int ret=FAIL;
|
||||||
|
uint64_t retval=-1;
|
||||||
|
int fnum=F_SET_CTB_PATTERN;
|
||||||
|
int mode=3; //sets loop
|
||||||
|
|
||||||
|
char mess[100];
|
||||||
|
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::cout<<"Setting CTB word" <<std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
|
if (connectControl() == OK){
|
||||||
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
|
controlSocket->SendDataOnly(&mode,sizeof(mode));
|
||||||
|
controlSocket->SendDataOnly(&level,sizeof(level));
|
||||||
|
controlSocket->SendDataOnly(&addr,sizeof(addr));
|
||||||
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
|
if (ret!=FAIL) {
|
||||||
|
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||||
|
} else {
|
||||||
|
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||||
|
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||||
|
}
|
||||||
|
controlSocket->Disconnect();
|
||||||
|
if (ret==FORCE_UPDATE)
|
||||||
|
updateDetector();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sets the wait time in the CTB
|
||||||
|
@param level 0,1,2, wait level
|
||||||
|
@param t wait time, -1 gets
|
||||||
|
@returns actual value
|
||||||
|
*/
|
||||||
|
int setCTBPatWaitTime(int level, uint64_t t=-1) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
uint64_t retval=-1;
|
||||||
|
|
||||||
|
|
||||||
|
int ret=FAIL;
|
||||||
|
uint64_t retval=-1;
|
||||||
|
int fnum=F_SET_CTB_PATTERN;
|
||||||
|
int mode=4; //sets loop
|
||||||
|
|
||||||
|
char mess[100];
|
||||||
|
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::cout<<"Setting CTB word" <<std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
|
if (connectControl() == OK){
|
||||||
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
|
controlSocket->SendDataOnly(&mode,sizeof(mode));
|
||||||
|
controlSocket->SendDataOnly(&level,sizeof(level));
|
||||||
|
controlSocket->SendDataOnly(&t,sizeof(t));
|
||||||
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
|
if (ret!=FAIL) {
|
||||||
|
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||||
|
} else {
|
||||||
|
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||||
|
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||||
|
}
|
||||||
|
controlSocket->Disconnect();
|
||||||
|
if (ret==FORCE_UPDATE)
|
||||||
|
updateDetector();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1650,6 +1650,48 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
*/
|
*/
|
||||||
int enableTenGigabitEthernet(int i = -1);
|
int enableTenGigabitEthernet(int i = -1);
|
||||||
|
|
||||||
|
|
||||||
|
/******** CTB funcs */
|
||||||
|
|
||||||
|
/** opens pattern file and sends pattern to CTB
|
||||||
|
@param fname pattern file to open
|
||||||
|
@returns OK/FAIL
|
||||||
|
*/
|
||||||
|
int setCTBPattern(string fname);
|
||||||
|
|
||||||
|
|
||||||
|
/** Writes a pattern word to the CTB
|
||||||
|
@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
|
||||||
|
@returns actual value
|
||||||
|
*/
|
||||||
|
int setCTBWord(int addr,uint64_t word=-1);
|
||||||
|
|
||||||
|
/** Sets the pattern or loop limits in the CTB
|
||||||
|
@param level -1 complete pattern, 0,1,2, loop level
|
||||||
|
@param start start address if >=0
|
||||||
|
@param stop stop address if >=0
|
||||||
|
@param n number of loops (if level >=0)
|
||||||
|
@returns OK/FAIL
|
||||||
|
*/
|
||||||
|
int setCTBPatLoops(int level,int &start, int &stop, int &n);
|
||||||
|
|
||||||
|
|
||||||
|
/** Sets the wait address in the CTB
|
||||||
|
@param level 0,1,2, wait level
|
||||||
|
@param addr wait address, -1 gets
|
||||||
|
@returns actual value
|
||||||
|
*/
|
||||||
|
int setCTBPatWaitAddr(int level, int addr=-1);
|
||||||
|
|
||||||
|
/** Sets the wait time in the CTB
|
||||||
|
@param level 0,1,2, wait level
|
||||||
|
@param t wait time, -1 gets
|
||||||
|
@returns actual value
|
||||||
|
*/
|
||||||
|
int setCTBPatWaitTime(int level, uint64_t t=-1);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
|
@ -519,6 +519,8 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
case GOTTHARD: return string("Gotthard"); \
|
case GOTTHARD: return string("Gotthard"); \
|
||||||
case AGIPD: return string("Agipd"); \
|
case AGIPD: return string("Agipd"); \
|
||||||
case MOENCH: return string("Moench"); \
|
case MOENCH: return string("Moench"); \
|
||||||
|
case JUNGFRAU: return string("Jungfrau"); \
|
||||||
|
case JUNGFRAUCTB: return string("JungfrauCTB"); \
|
||||||
default: return string("Unknown"); \
|
default: return string("Unknown"); \
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@ -533,6 +535,8 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
if (type=="Gotthard") return GOTTHARD; \
|
if (type=="Gotthard") return GOTTHARD; \
|
||||||
if (type=="Agipd") return AGIPD; \
|
if (type=="Agipd") return AGIPD; \
|
||||||
if (type=="Moench") return MOENCH; \
|
if (type=="Moench") return MOENCH; \
|
||||||
|
if (type=="Jungfrau") return JUNGFRAU; \
|
||||||
|
if (type=="JungfrauCTB") return JUNGFRAUCTB; \
|
||||||
return GENERIC;};
|
return GENERIC;};
|
||||||
|
|
||||||
|
|
||||||
|
@ -869,6 +869,97 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
|||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
|
||||||
|
/* pattern generator */
|
||||||
|
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="pattern"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPattern;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="patword"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPattern;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="patioctrl"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPattern;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="patclkctrl"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPattern;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="patlimits"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPattern;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="patloop0"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPattern;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="patnloop0"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPattern;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="patwait0"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPattern;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="patwaittime0"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPattern;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="patloop1"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPattern;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="patnloop1"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPattern;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="patwait1"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPattern;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="patwaittime1"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPattern;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="patloop2"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPattern;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="patnloop2"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPattern;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="patwait2"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPattern;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="patwaittime2"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPattern;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
numberOfCommands=i;
|
numberOfCommands=i;
|
||||||
|
|
||||||
// #ifdef VERBOSE
|
// #ifdef VERBOSE
|
||||||
@ -4153,10 +4244,11 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
|
|||||||
string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
|
string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
|
||||||
|
|
||||||
ostringstream os;
|
ostringstream os;
|
||||||
if (action==PUT_ACTION || action==HELP_ACTION)
|
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||||
os << "receiver [status] \t starts/stops the receiver to listen to detector packets. - can be start or stop" << std::endl;
|
os << "receiver [status] \t starts/stops the receiver to listen to detector packets. - can be start or stop" << std::endl;
|
||||||
os << "r_readfreq \t sets the gui read frequency of the receiver, 0 if gui requests frame, >0 if receiver sends every nth frame to gui" << std::endl;
|
os << "r_readfreq \t sets the gui read frequency of the receiver, 0 if gui requests frame, >0 if receiver sends every nth frame to gui" << std::endl;
|
||||||
os << "tengiga \t sets system to be configure for 10Gbe if set to 1, else 1Gbe if set to 0" << std::endl;
|
os << "tengiga \t sets system to be configure for 10Gbe if set to 1, else 1Gbe if set to 0" << std::endl;
|
||||||
|
}
|
||||||
if (action==GET_ACTION || action==HELP_ACTION){
|
if (action==GET_ACTION || action==HELP_ACTION){
|
||||||
os << "receiver \t returns the status of receiver - can be running or idle" << std::endl;
|
os << "receiver \t returns the status of receiver - can be running or idle" << std::endl;
|
||||||
os << "framescaught \t returns the number of frames caught by receiver(average for multi)" << std::endl;
|
os << "framescaught \t returns the number of frames caught by receiver(average for multi)" << std::endl;
|
||||||
@ -4173,4 +4265,82 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
string slsDetectorCommand::helpPattern(int narg, char *args[], int action) {
|
||||||
|
|
||||||
|
ostringstream os;
|
||||||
|
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||||
|
os << "pattern fname \t loads pattern file" << std::endl;
|
||||||
|
os << "patword addr word \t writes pattern word - only very advanced users!" << std::endl;
|
||||||
|
os << "patioctrl reg\t configures inputs/outputs of the chiptest board - only advanced users!" << std::endl;
|
||||||
|
os << "patclkctrl reg\t configures output clk enable of the chiptest board- only advanced users! " << std::endl;
|
||||||
|
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 << "patwait1 addr \t configures pattern wait 1 address " << std::endl;
|
||||||
|
os << "patwait2 addr \t configures pattern wait 2 address " << std::endl;
|
||||||
|
os << "patwaittime0 nclk \t sets wait 0 waiting time in clock number " << std::endl;
|
||||||
|
os << "patwaittime1 nclk \t sets wait 1 waiting time in clock number " << std::endl;
|
||||||
|
os << "patwaittime2 nclk \t sets wait 2 waiting time in clock number " << std::endl;
|
||||||
|
}
|
||||||
|
if (action==GET_ACTION || action==HELP_ACTION){
|
||||||
|
os << "pattern \t cannot get" << std::endl;
|
||||||
|
os << "patword \t cannot get" << std::endl;
|
||||||
|
os << "patioctrl \t returns inputs/outputs of the chiptest board - only advanced users!" << std::endl;
|
||||||
|
os << "patclkctrl\t returns output clk enable of the chiptest board- only advanced users! " << std::endl;
|
||||||
|
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 << "patwait1 \t returns the pattern wait 1 address " << std::endl;
|
||||||
|
os << "patwait2 \t returns the pattern wait 2 address " << std::endl;
|
||||||
|
os << "patwaittime0 \t returns the wait 0 waiting time in clock number " << std::endl;
|
||||||
|
os << "patwaittime1 \t returns the wait 1 waiting time in clock number " << std::endl;
|
||||||
|
os << "patwaittime2 \t returns the wait 2 waiting time in clock number " << std::endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
return os.str();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
|
||||||
|
|
||||||
|
/********
|
||||||
|
|
||||||
|
Must implement set ctb functions in slsDetector and multiSlsDetector
|
||||||
|
|
||||||
|
**********/
|
||||||
|
ostringstream os;
|
||||||
|
if (cmd=="pattern")
|
||||||
|
else if (cmd=="patword") ;
|
||||||
|
else if (cmd=="patioctrl") ;
|
||||||
|
else if (cmd=="patclkctrl") ;
|
||||||
|
else if (cmd=="patlimits") ;
|
||||||
|
else if (cmd=="patloop0") ;
|
||||||
|
else if (cmd=="patloop1") ;
|
||||||
|
else if (cmd=="patloop2") ;
|
||||||
|
else if (cmd=="patnloop0") ;
|
||||||
|
else if (cmd=="patnloop1") ;
|
||||||
|
else if (cmd=="patnloop2") ;
|
||||||
|
else if (cmd=="patwait0") ;
|
||||||
|
else if (cmd=="patwait1") ;
|
||||||
|
else if (cmd=="patwait2") ;
|
||||||
|
else if (cmd=="patwaittime0") ;
|
||||||
|
else if (cmd=="patwaittime1") ;
|
||||||
|
else if (cmd=="patwaittime2") ;
|
||||||
|
else return helpPattern(narg, args, action);
|
||||||
|
|
||||||
|
return os.str();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,7 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
static string helpEnablefwrite(int narg, char *args[], int action);
|
static string helpEnablefwrite(int narg, char *args[], int action);
|
||||||
static string helpOverwrite(int narg, char *args[], int action);
|
static string helpOverwrite(int narg, char *args[], int action);
|
||||||
static string helpReceiver(int narg, char *args[], int action);
|
static string helpReceiver(int narg, char *args[], int action);
|
||||||
|
static string helpPattern(int narg, char *args[], int action);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -155,6 +156,7 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
string cmdEnablefwrite(int narg, char *args[], int action);
|
string cmdEnablefwrite(int narg, char *args[], int action);
|
||||||
string cmdOverwrite(int narg, char *args[], int action);
|
string cmdOverwrite(int narg, char *args[], int action);
|
||||||
string cmdReceiver(int narg, char *args[], int action);
|
string cmdReceiver(int narg, char *args[], int action);
|
||||||
|
string cmdPattern(int narg, char *args[], int action);
|
||||||
|
|
||||||
|
|
||||||
int numberOfCommands;
|
int numberOfCommands;
|
||||||
|
@ -702,12 +702,77 @@ virtual int enableReceiverCompression(int i = -1)=0;
|
|||||||
/returns if 10Gbe is enabled
|
/returns if 10Gbe is enabled
|
||||||
*/
|
*/
|
||||||
virtual int enableTenGigabitEthernet(int i = -1)=0;
|
virtual int enableTenGigabitEthernet(int i = -1)=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******** CTB funcs */
|
||||||
|
|
||||||
|
/** opens pattern file and sends pattern to CTB
|
||||||
|
@param fname pattern file to open
|
||||||
|
@returns OK/FAIL
|
||||||
|
*/
|
||||||
|
virtual int setCTBPattern(string fname)=0;
|
||||||
|
|
||||||
|
|
||||||
|
/** Writes a pattern word to the CTB
|
||||||
|
@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
|
||||||
|
@returns actual value
|
||||||
|
*/
|
||||||
|
virtual uint64_t setCTBWord(int addr,uint64_t word=-1)=0;
|
||||||
|
|
||||||
|
/** Sets the pattern or loop limits in the CTB
|
||||||
|
@param level -1 complete pattern, 0,1,2, loop level
|
||||||
|
@param start start address if >=0
|
||||||
|
@param stop stop address if >=0
|
||||||
|
@param n number of loops (if level >=0)
|
||||||
|
@returns OK/FAIL
|
||||||
|
*/
|
||||||
|
virtual int setCTBPatLoops(int level,int &start, int &stop, int &n)=0;
|
||||||
|
|
||||||
|
|
||||||
|
/** Sets the wait address in the CTB
|
||||||
|
@param level 0,1,2, wait level
|
||||||
|
@param addr wait address, -1 gets
|
||||||
|
@returns actual value
|
||||||
|
*/
|
||||||
|
virtual int setCTBPatWaitAddr(int level, int addr=-1)=0;
|
||||||
|
|
||||||
|
/** Sets the wait time in the CTB
|
||||||
|
@param level 0,1,2, wait level
|
||||||
|
@param t wait time, -1 gets
|
||||||
|
@returns actual value
|
||||||
|
*/
|
||||||
|
virtual int setCTBPatWaitTime(int level, uint64_t t=-1)=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
static const int64_t thisSoftwareVersion=0x20120124;
|
static const int64_t thisSoftwareVersion=0x20141013;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user