eiger server: interrupt subframe, quad change flipping, registers set left and right separately

This commit is contained in:
maliakal_d 2019-07-29 15:19:46 +02:00
parent 58e6338f9c
commit d981e1b8e5
18 changed files with 325 additions and 54 deletions

View File

@ -19,6 +19,8 @@ This document describes the differences between 4.1.0 and 4.0.2 releases.
- software for eiger quad hardware integrated - software for eiger quad hardware integrated
- command line framesl, cyclesl was printing in float - command line framesl, cyclesl was printing in float
- eiger interrupt subframe flag
- eiger server reg command (+0x100 for left and +0x200 for right)
@ -39,6 +41,13 @@ This document describes the differences between 4.1.0 and 4.0.2 releases.
1. Command line quad integrates Eiger quad hardware 1. Command line quad integrates Eiger quad hardware
2. Control flag to set last subframe to be interrupted depending on subexptime.
By default, it is disabled and will wait till the last sub frame has finished
exposing.
3. Left and Right FEB registers accessed independently using addr (+0x100 and +0x200)
respectively.
Receiver Receiver
-------- --------

View File

@ -124,6 +124,7 @@ enum detFuncs{
F_SOFTWARE_TRIGGER, /** < software trigger */ F_SOFTWARE_TRIGGER, /** < software trigger */
F_QUAD, F_QUAD,
F_INTERRUPT_SUBFRAME,
/* Always append functions hereafter!!! */ /* Always append functions hereafter!!! */
/* Always append functions before!!! */ /* Always append functions before!!! */

View File

@ -1214,6 +1214,7 @@ void Beb_SetDetectorNumber(uint32_t detid) {
int Beb_SetQuad(int val) { int Beb_SetQuad(int val) {
if (val >= 0) { if (val >= 0) {
printf("Setting Quad to %d in Beb\n", val);
Beb_quadEnable = (val == 0 ? 0 : 1); Beb_quadEnable = (val == 0 ? 0 : 1);
Beb_SetDetectorPosition(Beb_positions); Beb_SetDetectorPosition(Beb_positions);
} }

View File

@ -2009,64 +2009,165 @@ int Feb_Control_SoftwareTrigger() {
return 1; return 1;
} }
int Feb_Control_InterruptSubframe(int val) {
if (val >= 0) {
printf("Setting Interrupt Subframe to %d\n", val);
}
// they need to be written separately because the left and right registers have different values for this particular register
uint32_t offset = DAQ_REG_HRDWRE;
int top = Module_TopAddressIsValid(&modules[1]) ? 1 : 0;
uint32_t lvalue = 0;
uint32_t rvalue = 0;
// right
unsigned int addr = top ? Module_GetTopRightAddress (&modules[1]) : Module_GetBottomRightAddress (&modules[1]);
if (val >= 0) {
if(!Feb_Interface_ReadRegister(addr, offset, &rvalue)) {
cprintf(RED,"Could not read %s right interrupt subframe\n", top ? "top" : "bottom");
return -1;
}
uint32_t data = ((val == 0) ? (rvalue &~ DAQ_REG_HRDWRE_INTRRPT_SF_MSK) : (rvalue | DAQ_REG_HRDWRE_INTRRPT_SF_MSK));
if(!Feb_Interface_WriteRegister(addr, offset, data, 0, 0)) {
cprintf(RED,"Could not write 0x%x to %s right interrupt subframe addr 0x%x\n", data, top ? "top" : "bottom", offset);
return -1;
}
}
if(!Feb_Interface_ReadRegister(addr, offset, &rvalue)) {
cprintf(RED,"Could not read back %s right interrupt subframe\n", top ? "top" : "bottom");
return -1;
}
// left
addr = top ? Module_GetTopLeftAddress (&modules[1]) : Module_GetBottomLeftAddress (&modules[1]);
if (val >= 0) {
if(!Feb_Interface_ReadRegister(addr, offset, &lvalue)) {
cprintf(RED,"Could not read %s left interrupt subframe\n", top ? "top" : "bottom");
return -1;
}
uint32_t data = ((val == 0) ? (lvalue &~ DAQ_REG_HRDWRE_INTRRPT_SF_MSK) : (lvalue | DAQ_REG_HRDWRE_INTRRPT_SF_MSK));
if(!Feb_Interface_WriteRegister(addr, offset, data, 0, 0)) {
cprintf(RED,"Could not write 0x%x to %s left interrupt subframe addr 0x%x\n", data, top ? "top" : "bottom", offset);
return -1;
}
}
if(!Feb_Interface_ReadRegister(addr, offset, &lvalue)) {
cprintf(RED,"Could not read back %s left interrupt subframe\n", top ? "top" : "bottom");
return -1;
}
// inconsistent
if (lvalue != rvalue) {
cprintf(RED, "Inconsistent values of interrupt subframe betweeen left and right\n");
return -1;
}
return (lvalue & DAQ_REG_HRDWRE_INTRRPT_SF_MSK) >> DAQ_REG_HRDWRE_INTRRPT_SF_OFST;
}
int Feb_Control_SetQuad(int val) {
// no bottom for quad
if (!Module_TopAddressIsValid(&modules[1])) {
return 0;
}
uint32_t offset = DAQ_REG_HRDWRE;
if (val >= 0) {
printf("Setting Quad to %d in Feb\n", val);
unsigned int addr = Module_GetTopRightAddress (&modules[1]);
uint32_t rvalue = 0;
if(!Feb_Interface_ReadRegister(addr, offset, &rvalue)) {
cprintf(RED,"Could not read top right quad reg\n");
return -1;
}
uint32_t data = ((val == 0) ? (rvalue &~ DAQ_REG_HRDWRE_OW_MSK) : ((rvalue | DAQ_REG_HRDWRE_OW_MSK) &~ DAQ_REG_HRDWRE_TOP_MSK));
if(!Feb_Interface_WriteRegister(addr, offset, data, 0, 0)) {
cprintf(RED,"Could not write 0x%x to top right quad addr 0x%x\n", data, offset);
return -1;
}
}
return 0;
}
uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data) { uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
uint32_t value=0; uint32_t actualOffset = offset;
if(Module_TopAddressIsValid(&modules[1])){ int left = 0;
if(!Feb_Interface_WriteRegister(Module_GetTopRightAddress (&modules[1]),offset, data,0, 0)) { int right = 0;
cprintf(RED,"Could not read tr value. Value read:%d\n", value); // both registers
value = 0; if (offset < 0x100) {
left = 1;
right = 1;
} }
if(!Feb_Interface_WriteRegister(Module_GetTopLeftAddress (&modules[1]),offset, data,0, 0)) { // right registers only
cprintf(RED,"Could not read tl value. Value read:%d\n", value); else if (offset >= 0x200) {
value = 0; right = 1;
} actualOffset = offset - 0x200;
} else { } else {
if(!Feb_Interface_WriteRegister(Module_GetBottomRightAddress (&modules[1]),offset, data,0, 0)) { left = 1;
cprintf(RED,"Could not read br value. Value read:%d\n", value); actualOffset = offset - 0x100;
value = 0;
}
if(!Feb_Interface_WriteRegister(Module_GetBottomLeftAddress (&modules[1]),offset, data,0, 0)) {
cprintf(RED,"Could not read bl value. Value read:%d\n", value);
value = 0;
} }
int top = Module_TopAddressIsValid(&modules[1]) ? 1 : 0;
unsigned int addr = top ? Module_GetTopRightAddress (&modules[1]) : Module_GetBottomRightAddress (&modules[1]);
if (right) {
if(!Feb_Interface_WriteRegister(addr,actualOffset, data,0, 0)) {
cprintf(RED,"Could not write 0x%x to %s right addr 0x%x\n", data, top ? "top" : "bottom", actualOffset);
} }
}
addr = top ? Module_GetTopLeftAddress (&modules[1]) : Module_GetBottomLeftAddress (&modules[1]);
if (left) {
if(!Feb_Interface_WriteRegister(addr,actualOffset, data,0, 0)) {
cprintf(RED,"Could not write 0x%x to %s left addr 0x%x\n", data, top ? "top" : "bottom", actualOffset);
}
}
return Feb_Control_ReadRegister(offset); return Feb_Control_ReadRegister(offset);
} }
uint32_t Feb_Control_ReadRegister(uint32_t offset) { uint32_t Feb_Control_ReadRegister(uint32_t offset) {
uint32_t value=0; uint32_t actualOffset = offset;
uint32_t value1=0; int left = 0;
if(Module_TopAddressIsValid(&modules[1])){ int right = 0;
if(!Feb_Interface_ReadRegister(Module_GetTopRightAddress (&modules[1]),offset, &value)) { // both registers
cprintf(RED,"Could not read value. Value read:%d\n", value); if (offset < 0x100) {
value = 0; left = 1;
right = 1;
} }
printf("Read top right addr: 0x%08x\n", value); // right registers only
if(!Feb_Interface_ReadRegister(Module_GetTopLeftAddress (&modules[1]),offset, &value1)) { else if (offset >= 0x200) {
cprintf(RED,"Could not read value. Value read:%d\n", value1); right = 1;
value1 = 0; actualOffset = offset - 0x200;
}
printf("Read top left addr: 0x%08x\n", value1);
if (value != value1)
value = -1;
} else { } else {
if(!Feb_Interface_ReadRegister(Module_GetBottomRightAddress (&modules[1]),offset, &value)) { left = 1;
cprintf(RED,"Could not read value. Value read:%d\n", value); actualOffset = offset - 0x100;
value = 0;
} }
printf("Read bottom right addr: 0x%08x\n", value); uint32_t lvalue=0;
if(!Feb_Interface_ReadRegister(Module_GetBottomLeftAddress (&modules[1]),offset, &value1)) { uint32_t rvalue=0;
cprintf(RED,"Could not read value. Value read:%d\n", value1); int top = Module_TopAddressIsValid(&modules[1]) ? 1 : 0;
value1 = 0;
unsigned int addr = top ? Module_GetTopRightAddress (&modules[1]) : Module_GetBottomRightAddress (&modules[1]);
if (right) {
if(!Feb_Interface_ReadRegister(addr, actualOffset, &rvalue)) {
cprintf(RED,"Could not read %s right addr 0x%x\n", top ? "top" : "bottom", actualOffset);
return -1;
} }
printf("Read bottom left addr: 0x%08x\n", value1); printf("Read %s right addr: 0x%08x\n", top ? "top" : "bottom", rvalue);
if (value != value1) if (!left) {
value = -1; return rvalue;
} }
return value; }
addr = top ? Module_GetTopLeftAddress (&modules[1]) : Module_GetBottomLeftAddress (&modules[1]);
if(left) {
if(!Feb_Interface_ReadRegister(addr, actualOffset, &lvalue)) {
cprintf(RED,"Could not read %s left addr 0x%x\n", top ? "top" : "bottom", actualOffset);
return -1;
}
printf("Read %s left addr: 0x%08x\n", top ? "top" : "bottom", lvalue);
if (!right) {
return lvalue;
}
}
if (lvalue != rvalue) {
cprintf(RED, "Inconsistent values betweeen left and right\n");
return -1;
}
return lvalue;
} }

View File

@ -204,6 +204,8 @@ int Feb_Control_GetModuleNumber();
int64_t Feb_Control_GetSubMeasuredPeriod(); int64_t Feb_Control_GetSubMeasuredPeriod();
int Feb_Control_SoftwareTrigger(); int Feb_Control_SoftwareTrigger();
int Feb_Control_InterruptSubframe(int val);
int Feb_Control_SetQuad(int val);
uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data); uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
uint32_t Feb_Control_ReadRegister(uint32_t offset); uint32_t Feb_Control_ReadRegister(uint32_t offset);

View File

@ -20,6 +20,14 @@
#define DAQ_REG_SUBFRAME_EXPOSURES 6 #define DAQ_REG_SUBFRAME_EXPOSURES 6
#define DAQ_REG_SUBFRAME_PERIOD 7 //also pg and fifo status register #define DAQ_REG_SUBFRAME_PERIOD 7 //also pg and fifo status register
#define DAQ_REG_HRDWRE 12
#define DAQ_REG_HRDWRE_OW_OFST (0)
#define DAQ_REG_HRDWRE_OW_MSK (0x00000001 << DAQ_REG_HRDWRE_OW_OFST)
#define DAQ_REG_HRDWRE_TOP_OFST (1)
#define DAQ_REG_HRDWRE_TOP_MSK (0x00000001 << DAQ_REG_HRDWRE_TOP_OFST)
#define DAQ_REG_HRDWRE_INTRRPT_SF_OFST (3)
#define DAQ_REG_HRDWRE_INTRRPT_SF_MSK (0x00000001 << DAQ_REG_HRDWRE_INTRRPT_SF_OFST)
#define DAQ_REG_RO_OFFSET 20 #define DAQ_REG_RO_OFFSET 20
#define DAQ_REG_STATUS (DAQ_REG_RO_OFFSET + 0) //also pg and fifo status register #define DAQ_REG_STATUS (DAQ_REG_RO_OFFSET + 0) //also pg and fifo status register
@ -29,6 +37,7 @@
#define DAQ_CTRL_RESET 0x80000000 #define DAQ_CTRL_RESET 0x80000000
#define DAQ_CTRL_START 0x40000000 #define DAQ_CTRL_START 0x40000000
#define ACQ_CTRL_START 0x50000000 //this is 0x10000000 (acq) | 0x40000000 (daq) #define ACQ_CTRL_START 0x50000000 //this is 0x10000000 (acq) | 0x40000000 (daq)

View File

@ -1220,7 +1220,14 @@ int setDetectorPosition(int pos[]) {
int setQuad(int val) { int setQuad(int val) {
return Beb_SetQuad(val); int ret = Beb_SetQuad(val);
if (Feb_Control_SetQuad(val) == -1)
return -1;
return ret;
}
int setInterruptSubframe(int val) {
return Feb_Control_InterruptSubframe(val);
} }

View File

@ -5440,3 +5440,7 @@ int multiSlsDetector::setQuad(int val) {
val = 0; val = 0;
return callDetectorMember(&slsDetector::setQuad, val); return callDetectorMember(&slsDetector::setQuad, val);
} }
int multiSlsDetector::setInterruptSubframe(int val) {
return callDetectorMember(&slsDetector::setInterruptSubframe, val);
}

View File

@ -1876,6 +1876,13 @@ public:
*/ */
int setQuad(int val = -1); int setQuad(int val = -1);
/**
* Set or Get Interrupt last sub frame(Only for Eiger)
* @param val 1 if interrupt last subframe set, else 0, -1 gets
* @returns 1 if interrupt last subframe set, else 0, -1 different values
*/
int setInterruptSubframe(int val = -1);
private: private:
/** /**

View File

@ -9761,6 +9761,9 @@ int slsDetector::setQuad(int val) {
int ret = FAIL; int ret = FAIL;
int retval = -1; int retval = -1;
#ifdef VERBOSE
std::cout<<"Setting Quad to " <<val << std::endl;
#endif
// set row column header in detector // set row column header in detector
if (val >= 0) { if (val >= 0) {
if (thisDetector->onlineFlag==ONLINE_FLAG) { if (thisDetector->onlineFlag==ONLINE_FLAG) {
@ -9803,3 +9806,32 @@ int slsDetector::setQuad(int val) {
} }
return retval; return retval;
} }
int slsDetector::setInterruptSubframe(int val) {
int fnum = F_INTERRUPT_SUBFRAME;
int ret = FAIL;
int retval = -1;
#ifdef VERBOSE
std::cout<<"Setting Interrupt Sub frame to " <<val << std::endl;
#endif
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectControl() == OK){
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
controlSocket->SendDataOnly(&val,sizeof(val));
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret==FAIL){
char mess[MAX_STR_LENGTH] = {};
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
setErrorMask((getErrorMask())|(SOME_ERROR));
}
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
disconnectControl();
if (ret==FORCE_UPDATE)
updateDetector();
}
}
return retval;
}

View File

@ -2281,6 +2281,13 @@ public:
*/ */
int setQuad(int val = -1); int setQuad(int val = -1);
/**
* Set or Get Interrupt last sub frame(Only for Eiger)
* @param val 1 if interrupt last subframe set, else 0, -1 gets
* @returns 1 if interrupt last subframe set, else 0, -1 different values
*/
int setInterruptSubframe(int val = -1);
private: private:
/** /**

View File

@ -428,6 +428,14 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdAdvanced; descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdAdvanced;
++i; ++i;
/*! \page config
- <b>interruptsubframe [i]</b> sets/gets the interrupt subframe flag. Setting it to 1 will interrupt the last subframe at the required exposure time. By default, this is disabled and set to 0, ie. it will wait for the last sub frame to finish exposing. Used for EIGER in 32 bit mode only. \c Returns \c (int).
*/
descrToFuncMap[i].m_pFuncName="interruptsubframe";
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdAdvanced;
++i;
/*! \page config /*! \page config
- <b>extsig:[i] [flag]</b> sets/gets the mode of the external signal i. Options: \c off, \c gate_in_active_high, \c gate_in_active_low, \c trigger_in_rising_edge, \c trigger_in_falling_edge, - <b>extsig:[i] [flag]</b> sets/gets the mode of the external signal i. Options: \c off, \c gate_in_active_high, \c gate_in_active_low, \c trigger_in_rising_edge, \c trigger_in_falling_edge,
\c ro_trigger_in_rising_edge, \c ro_trigger_in_falling_edge, \c gate_out_active_high, \c gate_out_active_low, \c trigger_out_rising_edge, \c trigger_out_falling_edge, \c ro_trigger_out_rising_edge, \c ro_trigger_in_rising_edge, \c ro_trigger_in_falling_edge, \c gate_out_active_high, \c gate_out_active_low, \c trigger_out_rising_edge, \c trigger_out_falling_edge, \c ro_trigger_out_rising_edge,
@ -6062,6 +6070,17 @@ string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
return string("unknown"); return string("unknown");
} else if (cmd=="interruptsubframe") {
myDet->setOnline(ONLINE_FLAG);
if (action==PUT_ACTION) {
int ival = -1;
if (!sscanf(args[1],"%d",&ival))
return string("could not scan interrupt sub frame parameter " + string(args[1]));
myDet->setInterruptSubframe(ival);
}
char ans[100];
sprintf(ans,"%d",myDet->setInterruptSubframe(-1));
return std::string(ans);
} else if (cmd=="extsig") { } else if (cmd=="extsig") {
externalSignalFlag flag=GET_EXTERNAL_SIGNAL_FLAG; externalSignalFlag flag=GET_EXTERNAL_SIGNAL_FLAG;
int is=-1; int is=-1;
@ -6162,6 +6181,7 @@ string slsDetectorCommand::helpAdvanced(int narg, char *args[], int action) {
os << "extsig:i mode \t sets the mode of the external signal i. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl; os << "extsig:i mode \t sets the mode of the external signal i. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl;
os << "flags mode \t sets the readout flags to mode. can be none, storeinram, tot, continous, parallel, nonparallel, safe, digital, analog_digital, overlow, nooverflow, unknown." << std::endl; os << "flags mode \t sets the readout flags to mode. can be none, storeinram, tot, continous, parallel, nonparallel, safe, digital, analog_digital, overlow, nooverflow, unknown." << std::endl;
os << "interruptsubframe flag \t sets the interrupt subframe flag. Setting it to 1 will interrupt the last subframe at the required exposure time. By default, this is disabled and set to 0, ie. it will wait for the last sub frame to finish exposing. Used for EIGER in 32 bit mode only." << std::endl;
os << "programfpga f \t programs the fpga with file f (with .pof extension)." << std::endl; os << "programfpga f \t programs the fpga with file f (with .pof extension)." << std::endl;
os << "resetfpga f \t resets fpga, f can be any value" << std::endl; os << "resetfpga f \t resets fpga, f can be any value" << std::endl;
@ -6175,6 +6195,7 @@ string slsDetectorCommand::helpAdvanced(int narg, char *args[], int action) {
os << "extsig:i \t gets the mode of the external signal i. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl; os << "extsig:i \t gets the mode of the external signal i. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl;
os << "flags \t gets the readout flags. can be none, storeinram, tot, continous, parallel, nonparallel, safe, digital, analog_digital, overflow, nooverflow, unknown" << std::endl; os << "flags \t gets the readout flags. can be none, storeinram, tot, continous, parallel, nonparallel, safe, digital, analog_digital, overflow, nooverflow, unknown" << std::endl;
os << "interruptsubframe \t gets the interrupt subframe flag. Setting it to 1 will interrupt the last subframe at the required exposure time. By default, this is disabled and set to 0, ie. it will wait for the last sub frame to finish exposing. Used for EIGER in 32 bit mode only." << std::endl;
os << "led \t returns led status (0 off, 1 on)" << std::endl; os << "led \t returns led status (0 off, 1 on)" << std::endl;
os << "powerchip \t gets if the chip has been powered on or off" << std::endl; os << "powerchip \t gets if the chip has been powered on or off" << std::endl;
os << "auto_comp_disable \t Currently not implemented. gets if the automatic comparator diable mode is enabled/disabled" << std::endl; os << "auto_comp_disable \t Currently not implemented. gets if the automatic comparator diable mode is enabled/disabled" << std::endl;

View File

@ -1028,12 +1028,16 @@ virtual int setReceiverSilentMode(int i = -1)=0;
*/ */
virtual int setQuad(int val = -1) = 0; virtual int setQuad(int val = -1) = 0;
/**
* Set or Get Interrupt last sub frame(Only for Eiger)
* @param val 1 if interrupt last subframe set, else 0, -1 gets
* @returns 1 if interrupt last subframe set, else 0, -1 different values
*/
virtual int setInterruptSubframe(int val = -1) = 0;
protected: protected:
static const int64_t thisSoftwareVersion=0x20141013;
//protected: //protected:
int *stoppedFlag; int *stoppedFlag;

View File

@ -196,6 +196,7 @@ int setDetectorPosition(int pos[]);
#endif #endif
#ifdef EIGERD #ifdef EIGERD
int setQuad(int val); int setQuad(int val);
int setInterruptSubframe(int val);
#endif #endif

View File

@ -212,6 +212,7 @@ const char* getFunctionName(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_QUAD: return "F_QUAD"; case F_QUAD: return "F_QUAD";
case F_INTERRUPT_SUBFRAME: return "F_INTERRUPT_SUBFRAME";
default: return "Unknown Function"; default: return "Unknown Function";
} }
@ -299,6 +300,7 @@ void function_table() {
flist[F_CHECK_VERSION] = &check_version; flist[F_CHECK_VERSION] = &check_version;
flist[F_SOFTWARE_TRIGGER] = &software_trigger; flist[F_SOFTWARE_TRIGGER] = &software_trigger;
flist[F_QUAD] = &set_quad; flist[F_QUAD] = &set_quad;
flist[F_INTERRUPT_SUBFRAME] = &set_interrupt_subframe;
// check // check
if (NUM_DET_FUNCTIONS >= TOO_MANY_FUNCTIONS_DEFINED) { if (NUM_DET_FUNCTIONS >= TOO_MANY_FUNCTIONS_DEFINED) {
@ -5985,3 +5987,65 @@ int set_quad(int file_des) {
// return ok / fail // return ok / fail
return ret; return ret;
} }
int set_interrupt_subframe(int file_des) {
int ret=OK,ret1=OK;
int n=0;
int retval=-1;
sprintf(mess,"Setting interrupt subframe failed\n");
// execute action
#ifndef EIGERD
//to receive any arguments
while (n > 0)
n = receiveData(file_des,mess,MAX_STR_LENGTH,OTHER);
ret = FAIL;
sprintf(mess,"Function (set_interrupt_subframe) is not implemented for this detector\n");
cprintf(RED, "Warning: %s", mess);
#else
// receive arguments
int arg=-1;
n = receiveData(file_des,&arg,sizeof(arg),INT32);
if (n < 0) return printSocketReadError();
// execute action
if (differentClients && lockStatus && arg!=-1) {
ret = FAIL;
sprintf(mess,"Detector locked by %s\n",lastClientIP);
cprintf(RED, "Warning: %s", mess);
}
#ifdef SLS_DETECTOR_FUNCTION_LIST
else {
#ifdef VERBOSE
printf("Setting Interrupt subframe :%d \n",arg);
#endif
retval=setInterruptSubframe(arg);
#ifdef VERBOSE
printf("retval Interrupt subframe :%d \n",retval);
#endif
if((arg != -1) && (retval != arg)) {
ret=FAIL;
cprintf(RED, "Warning: %s", mess);
}
}
#endif
if (ret==OK && differentClients)
ret=FORCE_UPDATE;
#endif
// ret could be swapped during sendData
ret1 = ret;
// send ok / fail
n = sendData(file_des,&ret1,sizeof(ret),INT32);
// send return argument
if (ret==FAIL) {
n += sendData(file_des,mess,sizeof(mess),OTHER);
}
n += sendData(file_des,&retval,sizeof(retval),INT32);
// return ok / fail
return ret;
}

View File

@ -98,5 +98,6 @@ int storage_cell_start(int);
int check_version(int); int check_version(int);
int software_trigger(int); int software_trigger(int);
int set_quad(int); int set_quad(int);
int set_interrupt_subframe(int);
#endif #endif