implemented fifo depth configurable from client

This commit is contained in:
Dhanya Maliakal 2015-11-17 10:30:53 +01:00
parent f68d6d0ab6
commit 66db11421f
8 changed files with 86 additions and 3 deletions

View File

@ -51,6 +51,7 @@ using namespace std;
#define ALLTIMBITS_NOT_SET 0x0000000000002000ULL #define ALLTIMBITS_NOT_SET 0x0000000000002000ULL
#define COULD_NOT_SET_SPEED_PARAMETERS 0x0000000000004000ULL #define COULD_NOT_SET_SPEED_PARAMETERS 0x0000000000004000ULL
#define COULD_NOT_SET_READOUT_FLAGS 0x0000000000008000ULL #define COULD_NOT_SET_READOUT_FLAGS 0x0000000000008000ULL
#define COULD_NOT_SET_FIFO_DEPTH 0x0000000000010000ULL
// 0x00000000FFFFFFFFULL // 0x00000000FFFFFFFFULL
/** @short class returning all error messages for error mask */ /** @short class returning all error messages for error mask */
@ -157,6 +158,9 @@ public:
if(slsErrorMask&COULD_NOT_SET_READOUT_FLAGS) if(slsErrorMask&COULD_NOT_SET_READOUT_FLAGS)
retval.append("Could not set the readout flag\n"); retval.append("Could not set the readout flag\n");
if(slsErrorMask&COULD_NOT_SET_FIFO_DEPTH)
retval.append("Could not set receiver fifo depth\n");
return retval; return retval;
} }

View File

@ -4938,6 +4938,25 @@ int multiSlsDetector::enableTenGigabitEthernet(int i){
int multiSlsDetector::setReceiverFifoDepth(int i){
int ret=-100,ret1;
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++)
if (detectors[idet]){
ret1=detectors[idet]->setReceiverFifoDepth(i);
if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet));
if(ret==-100)
ret=ret1;
else if (ret!=ret1)
ret=-1;
}
return ret;
}
/** opens pattern file and sends pattern to CTB /** opens pattern file and sends pattern to CTB
@param fname pattern file to open @param fname pattern file to open

View File

@ -1248,6 +1248,12 @@ class multiSlsDetector : public slsDetectorUtils {
*/ */
int enableTenGigabitEthernet(int i = -1); int enableTenGigabitEthernet(int i = -1);
/** set/get receiver fifo depth
* @param i is -1 to get, any other value to set the fifo deph
/returns the receiver fifo depth
*/
int setReceiverFifoDepth(int i = -1);
/******** CTB funcs */ /******** CTB funcs */

View File

@ -7140,6 +7140,32 @@ int slsDetector::enableTenGigabitEthernet(int i){
int slsDetector::setReceiverFifoDepth(int i){
int fnum=F_SET_RECEIVER_FIFO_DEPTH;
int ret = FAIL;
int retval=-1;
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
#ifdef VERBOSE
if(i ==-1)
std::cout<< "Getting Receiver Fifo Depth" << endl;
else
std::cout<< "Setting Receiver Fifo Depth to " << i << endl;
#endif
if (connectData() == OK)
ret=thisReceiver->sendInt(fnum,retval,i);
if(ret==FAIL)
setErrorMask((getErrorMask())|(COULD_NOT_SET_FIFO_DEPTH));
}
return retval;
}
/******** CTB funcs */ /******** CTB funcs */
/** opens pattern file and sends pattern to CTB /** opens pattern file and sends pattern to CTB

View File

@ -1682,6 +1682,11 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
*/ */
int enableTenGigabitEthernet(int i = -1); int enableTenGigabitEthernet(int i = -1);
/** set/get receiver fifo depth
* @param i is -1 to get, any other value to set the fifo deph
/returns the receiver fifo depth
*/
int setReceiverFifoDepth(int i = -1);
/******** CTB funcs */ /******** CTB funcs */

View File

@ -407,6 +407,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
i++; i++;
/* flags */ /* flags */
descrToFuncMap[i].m_pFuncName="flags"; descrToFuncMap[i].m_pFuncName="flags";
@ -916,6 +917,9 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver; descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
i++; i++;
descrToFuncMap[i].m_pFuncName="rx_fifodepth"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
i++;
/* pattern generator */ /* pattern generator */
@ -4186,7 +4190,7 @@ string slsDetectorCommand::cmdConfiguration(int narg, char *args[], int action)
string sval; string sval;
if (narg<2) if (narg<2 && cmd != "rx_printconfig")
return string("should specify I/O file"); return string("should specify I/O file");
myDet->setOnline(ONLINE_FLAG); myDet->setOnline(ONLINE_FLAG);
@ -4203,7 +4207,7 @@ string slsDetectorCommand::cmdConfiguration(int narg, char *args[], int action)
} else if (cmd=="rx_printconfig"){ } else if (cmd=="rx_printconfig"){
if (action==PUT_ACTION) if (action==PUT_ACTION)
return string("cannot put"); return string("cannot put");
myDet->printReceiverConfiguration(); return string(""+myDet->printReceiverConfiguration());
}else if (cmd=="parameters") { }else if (cmd=="parameters") {
if (action==PUT_ACTION) { if (action==PUT_ACTION) {
sval=string(args[1]); sval=string(args[1]);
@ -4351,6 +4355,19 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
sprintf(answer,"%d",myDet->enableTenGigabitEthernet()); sprintf(answer,"%d",myDet->enableTenGigabitEthernet());
return string(answer); return string(answer);
}
else if(cmd=="rx_fifodepth"){
if (action==PUT_ACTION){
if (!sscanf(args[1],"%d",&ival))
return string("Could not scan rx_fifodepth input ")+string(args[1]);
if(ival>=0)
sprintf(answer,"%d",myDet->setReceiverFifoDepth(ival));
}else
sprintf(answer,"%d",myDet->setReceiverFifoDepth());
return string(answer);
} }
return string("could not decode command"); return string("could not decode command");
@ -4367,6 +4384,7 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
os << "resetframescaught [any value] \t resets frames caught by receiver" << std::endl; os << "resetframescaught [any value] \t resets frames caught by receiver" << 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;
os << "rx_fifodepth [val]\t sets receiver fifo depth to val" << 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;
@ -4374,6 +4392,7 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
os << "frameindex \t returns the current frame index of receiver(average for multi)" << std::endl; os << "frameindex \t returns the current frame index of receiver(average for multi)" << std::endl;
os << "r_readfreq \t returns the gui read frequency of the receiver" << std::endl; os << "r_readfreq \t returns the gui read frequency of the receiver" << std::endl;
os << "tengiga \t returns 1 if the system is configured for 10Gbe else 0 for 1Gbe" << std::endl; os << "tengiga \t returns 1 if the system is configured for 10Gbe else 0 for 1Gbe" << std::endl;
os << "rx_fifodepth \t returns receiver fifo depth" << std::endl;
} }
return os.str(); return os.str();

View File

@ -711,7 +711,11 @@ virtual int enableReceiverCompression(int i = -1)=0;
*/ */
virtual int enableTenGigabitEthernet(int i = -1)=0; virtual int enableTenGigabitEthernet(int i = -1)=0;
/** set/get receiver fifo depth
* @param i is -1 to get, any other value to set the fifo deph
/returns the receiver fifo depth
*/
virtual int setReceiverFifoDepth(int i = -1)=0;
/******** CTB funcs */ /******** CTB funcs */