mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 08:10:02 +02:00
fixed fifodepth to return defualt size, also moved destroying and creating threads to fifostructure, had forgotten to override setnumberofframes calling fifostructure which is important for gotthard
This commit is contained in:
parent
f16db2e6ca
commit
18eb1274c5
@ -312,10 +312,11 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Number of Frames expected by receiver from detector
|
* Set Number of Frames expected by receiver from detector
|
||||||
* The data receiver status will change from running to idle when it gets this number of frames FIXME: (Not implemented)
|
* The data receiver status will change from running to idle when it gets this number of frames
|
||||||
* @param i number of frames expected
|
* @param i number of frames expected
|
||||||
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
void setNumberOfFrames(const uint64_t i);
|
int setNumberOfFrames(const uint64_t i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Dynamic Range or Number of Bits Per Pixel
|
* Set Dynamic Range or Number of Bits Per Pixel
|
||||||
|
@ -371,8 +371,9 @@ class UDPInterface {
|
|||||||
* Set Number of Frames expected by receiver from detector
|
* Set Number of Frames expected by receiver from detector
|
||||||
* The data receiver status will change from running to idle when it gets this number of frames FIXME: (Not implemented)
|
* The data receiver status will change from running to idle when it gets this number of frames FIXME: (Not implemented)
|
||||||
* @param i number of frames expected
|
* @param i number of frames expected
|
||||||
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
virtual void setNumberOfFrames(const uint64_t i) = 0;
|
virtual int setNumberOfFrames(const uint64_t i) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Dynamic Range or Number of Bits Per Pixel
|
* Set Dynamic Range or Number of Bits Per Pixel
|
||||||
|
@ -102,6 +102,15 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
|||||||
*/
|
*/
|
||||||
int setAcquisitionPeriod(const uint64_t i);
|
int setAcquisitionPeriod(const uint64_t i);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overridden method
|
||||||
|
* Set Number of Frames expected by receiver from detector
|
||||||
|
* The data receiver status will change from running to idle when it gets this number of frames
|
||||||
|
* @param i number of frames expected
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
int setNumberOfFrames(const uint64_t i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden method
|
* Overridden method
|
||||||
* Set Dynamic Range or Number of Bits Per Pixel
|
* Set Dynamic Range or Number of Bits Per Pixel
|
||||||
@ -253,6 +262,8 @@ private:
|
|||||||
/**
|
/**
|
||||||
* Set up the Fifo Structure for processing buffers
|
* Set up the Fifo Structure for processing buffers
|
||||||
* between listening and writer threads
|
* between listening and writer threads
|
||||||
|
* When the parameters ahve been determined and if fifostructure needs to be changes,
|
||||||
|
* the listerning and writing threads are also destroyed together with this
|
||||||
* @return OK or FAIL
|
* @return OK or FAIL
|
||||||
*/
|
*/
|
||||||
int setupFifoStructure();
|
int setupFifoStructure();
|
||||||
|
@ -334,11 +334,14 @@ int UDPBaseImplementation::setAcquisitionPeriod(const uint64_t i){
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPBaseImplementation::setNumberOfFrames(const uint64_t i){
|
int UDPBaseImplementation::setNumberOfFrames(const uint64_t i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
numberOfFrames = i;
|
numberOfFrames = i;
|
||||||
FILE_LOG(logINFO) << "Number of Frames:" << numberOfFrames;
|
FILE_LOG(logINFO) << "Number of Frames:" << numberOfFrames;
|
||||||
|
|
||||||
|
//overrridden child classes might return FAIL
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UDPBaseImplementation::setDynamicRange(const uint32_t i){
|
int UDPBaseImplementation::setDynamicRange(const uint32_t i){
|
||||||
|
@ -282,23 +282,11 @@ int UDPStandardImplementation::setupFifoStructure(){
|
|||||||
|
|
||||||
// fifo depth
|
// fifo depth
|
||||||
uint32_t oldFifoSize = fifoSize;
|
uint32_t oldFifoSize = fifoSize;
|
||||||
//default
|
|
||||||
if(!fifoDepth){
|
|
||||||
switch(myDetectorType){
|
|
||||||
case GOTTHARD: fifoSize = GOTTHARD_FIFO_SIZE; break;
|
|
||||||
case MOENCH: fifoSize = MOENCH_FIFO_SIZE; break;
|
|
||||||
case PROPIX: fifoSize = PROPIX_FIFO_SIZE; break;
|
|
||||||
case EIGER: fifoSize = EIGER_FIFO_SIZE * packetsPerFrame; break;//listens to 1 packet at a time and size depends on packetsperframe
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//change by user
|
if(myDetectorType == EIGER)
|
||||||
else{
|
fifoSize = fifoDepth * packetsPerFrame;//listens to 1 packet at a time and size depends on packetsperframe
|
||||||
if(myDetectorType == EIGER)
|
else
|
||||||
fifoSize = fifoDepth * packetsPerFrame;
|
fifoSize = fifoDepth;
|
||||||
else fifoSize = fifoDepth;
|
|
||||||
}
|
|
||||||
|
|
||||||
//reduce fifo depth if > 1 numberofJobsPerBuffer
|
//reduce fifo depth if > 1 numberofJobsPerBuffer
|
||||||
if(fifoSize % numberofJobsPerBuffer)
|
if(fifoSize % numberofJobsPerBuffer)
|
||||||
@ -313,6 +301,11 @@ int UDPStandardImplementation::setupFifoStructure(){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//delete threads
|
||||||
|
if(threadStarted){
|
||||||
|
createListeningThreads(true);
|
||||||
|
createWriterThreads(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//set up fifo structure
|
//set up fifo structure
|
||||||
@ -357,6 +350,18 @@ int UDPStandardImplementation::setupFifoStructure(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
cout << "Fifo structure(s) reconstructed" << endl;
|
cout << "Fifo structure(s) reconstructed" << endl;
|
||||||
|
|
||||||
|
//create threads
|
||||||
|
if(createListeningThreads() == FAIL){
|
||||||
|
FILE_LOG(logERROR) << "Could not create listening thread";
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
if(createWriterThreads() == FAIL){
|
||||||
|
FILE_LOG(logERROR) << "Could not create writer threads";
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
setThreadPriorities();
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,11 +488,25 @@ int UDPStandardImplementation::setAcquisitionPeriod(const uint64_t i){
|
|||||||
FILE_LOG(logDEBUG) << __AT__ << " called";
|
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||||
|
|
||||||
acquisitionPeriod = i;
|
acquisitionPeriod = i;
|
||||||
if(setupFifoStructure() == FAIL)
|
if((myDetectorType == GOTTHARD) && (myDetectorType == MOENCH))
|
||||||
return FAIL;
|
if(setupFifoStructure() == FAIL)
|
||||||
|
return FAIL;
|
||||||
|
|
||||||
FILE_LOG(logINFO) << "Acquisition Period: " << (double)acquisitionPeriod/(1E9) << "s";
|
FILE_LOG(logINFO) << "Acquisition Period: " << (double)acquisitionPeriod/(1E9) << "s";
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int UDPStandardImplementation::setNumberOfFrames(const uint64_t i){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||||
|
|
||||||
|
numberOfFrames = i;
|
||||||
|
if((myDetectorType == GOTTHARD) && (myDetectorType == MOENCH))
|
||||||
|
if(setupFifoStructure() == FAIL)
|
||||||
|
return FAIL;
|
||||||
|
|
||||||
|
FILE_LOG(logINFO) << "Number of Frames:" << numberOfFrames;
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -511,30 +530,15 @@ int UDPStandardImplementation::setDynamicRange(const uint32_t i){
|
|||||||
//new dynamic range, then restart threads and resetup fifo structure
|
//new dynamic range, then restart threads and resetup fifo structure
|
||||||
if(oldDynamicRange != dynamicRange){
|
if(oldDynamicRange != dynamicRange){
|
||||||
|
|
||||||
//delete threads
|
|
||||||
if(threadStarted){
|
|
||||||
createListeningThreads(true);
|
|
||||||
createWriterThreads(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//gui buffer
|
//gui buffer
|
||||||
if(latestData){delete[] latestData; latestData = NULL;}
|
if(latestData){delete[] latestData; latestData = NULL;}
|
||||||
latestData = new char[frameSize];
|
latestData = new char[frameSize];
|
||||||
|
|
||||||
//restructure fifo
|
//restructure fifo
|
||||||
|
numberofJobsPerBuffer = -1;
|
||||||
if(setupFifoStructure() == FAIL)
|
if(setupFifoStructure() == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
|
||||||
//create threads
|
|
||||||
if(createListeningThreads() == FAIL){
|
|
||||||
FILE_LOG(logERROR) << "Could not create listening thread";
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
if(createWriterThreads() == FAIL){
|
|
||||||
FILE_LOG(logERROR) << "Could not create writer threads";
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
setThreadPriorities();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -582,12 +586,6 @@ int UDPStandardImplementation::setTenGigaEnable(const bool b){
|
|||||||
//new enable, then restart threads and resetup fifo structure
|
//new enable, then restart threads and resetup fifo structure
|
||||||
if(oldTenGigaEnable != tengigaEnable){
|
if(oldTenGigaEnable != tengigaEnable){
|
||||||
|
|
||||||
//delete threads
|
|
||||||
if(threadStarted){
|
|
||||||
createListeningThreads(true);
|
|
||||||
createWriterThreads(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//gui buffer
|
//gui buffer
|
||||||
if(latestData){delete[] latestData; latestData = NULL;}
|
if(latestData){delete[] latestData; latestData = NULL;}
|
||||||
latestData = new char[frameSize];
|
latestData = new char[frameSize];
|
||||||
@ -596,16 +594,6 @@ int UDPStandardImplementation::setTenGigaEnable(const bool b){
|
|||||||
if(setupFifoStructure() == FAIL)
|
if(setupFifoStructure() == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
|
||||||
//create threads
|
|
||||||
if(createListeningThreads() == FAIL){
|
|
||||||
FILE_LOG(logERROR) << "Could not create listening thread";
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
if(createWriterThreads() == FAIL){
|
|
||||||
FILE_LOG(logERROR) << "Could not create writer threads";
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
setThreadPriorities();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -674,6 +662,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
|
|||||||
packetIndexMask = GOTTHARD_PACKET_INDEX_MASK;
|
packetIndexMask = GOTTHARD_PACKET_INDEX_MASK;
|
||||||
maxPacketsPerFile = MAX_FRAMES_PER_FILE * GOTTHARD_PACKETS_PER_FRAME;
|
maxPacketsPerFile = MAX_FRAMES_PER_FILE * GOTTHARD_PACKETS_PER_FRAME;
|
||||||
fifoSize = GOTTHARD_FIFO_SIZE;
|
fifoSize = GOTTHARD_FIFO_SIZE;
|
||||||
|
fifoDepth = GOTTHARD_FIFO_SIZE;
|
||||||
//footerOffset = Not applicable;
|
//footerOffset = Not applicable;
|
||||||
break;
|
break;
|
||||||
case PROPIX:
|
case PROPIX:
|
||||||
@ -687,6 +676,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
|
|||||||
packetIndexMask = PROPIX_PACKET_INDEX_MASK;
|
packetIndexMask = PROPIX_PACKET_INDEX_MASK;
|
||||||
maxPacketsPerFile = MAX_FRAMES_PER_FILE * PROPIX_PACKETS_PER_FRAME;
|
maxPacketsPerFile = MAX_FRAMES_PER_FILE * PROPIX_PACKETS_PER_FRAME;
|
||||||
fifoSize = PROPIX_FIFO_SIZE;
|
fifoSize = PROPIX_FIFO_SIZE;
|
||||||
|
fifoDepth = PROPIX_FIFO_SIZE;
|
||||||
//footerOffset = Not applicable;
|
//footerOffset = Not applicable;
|
||||||
break;
|
break;
|
||||||
case MOENCH:
|
case MOENCH:
|
||||||
@ -700,6 +690,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
|
|||||||
packetIndexMask = MOENCH_PACKET_INDEX_MASK;
|
packetIndexMask = MOENCH_PACKET_INDEX_MASK;
|
||||||
maxPacketsPerFile = MOENCH_MAX_FRAMES_PER_FILE * MOENCH_PACKETS_PER_FRAME;
|
maxPacketsPerFile = MOENCH_MAX_FRAMES_PER_FILE * MOENCH_PACKETS_PER_FRAME;
|
||||||
fifoSize = MOENCH_FIFO_SIZE;
|
fifoSize = MOENCH_FIFO_SIZE;
|
||||||
|
fifoDepth = MOENCH_FIFO_SIZE;
|
||||||
//footerOffset = Not applicable;
|
//footerOffset = Not applicable;
|
||||||
break;
|
break;
|
||||||
case EIGER:
|
case EIGER:
|
||||||
@ -714,6 +705,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
|
|||||||
packetIndexMask = EIGER_PACKET_INDEX_MASK;
|
packetIndexMask = EIGER_PACKET_INDEX_MASK;
|
||||||
maxPacketsPerFile = EIGER_MAX_FRAMES_PER_FILE * packetsPerFrame;
|
maxPacketsPerFile = EIGER_MAX_FRAMES_PER_FILE * packetsPerFrame;
|
||||||
fifoSize = EIGER_FIFO_SIZE;
|
fifoSize = EIGER_FIFO_SIZE;
|
||||||
|
fifoDepth = EIGER_FIFO_SIZE;
|
||||||
footerOffset = EIGER_PACKET_HEADER_SIZE + oneDataSize;
|
footerOffset = EIGER_PACKET_HEADER_SIZE + oneDataSize;
|
||||||
break;
|
break;
|
||||||
case JUNGFRAUCTB:
|
case JUNGFRAUCTB:
|
||||||
@ -728,6 +720,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
|
|||||||
packetIndexMask = JCTB_PACKET_INDEX_MASK;
|
packetIndexMask = JCTB_PACKET_INDEX_MASK;
|
||||||
maxPacketsPerFile = JFCTB_MAX_FRAMES_PER_FILE * JCTB_PACKETS_PER_FRAME;
|
maxPacketsPerFile = JFCTB_MAX_FRAMES_PER_FILE * JCTB_PACKETS_PER_FRAME;
|
||||||
fifoSize = JCTB_FIFO_SIZE;
|
fifoSize = JCTB_FIFO_SIZE;
|
||||||
|
fifoDepth = JCTB_FIFO_SIZE;
|
||||||
//footerOffset = Not applicable;
|
//footerOffset = Not applicable;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -749,17 +742,6 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
|
|||||||
numberofJobsPerBuffer = -1;
|
numberofJobsPerBuffer = -1;
|
||||||
setupFifoStructure();
|
setupFifoStructure();
|
||||||
|
|
||||||
//create threads
|
|
||||||
if(createListeningThreads() == FAIL){
|
|
||||||
FILE_LOG(logERROR) << "Could not create listening thread";
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
if(createWriterThreads() == FAIL){
|
|
||||||
FILE_LOG(logERROR) << "Could not create writer threads";
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
setThreadPriorities();
|
|
||||||
|
|
||||||
//allocate for latest data (frame copy for gui)
|
//allocate for latest data (frame copy for gui)
|
||||||
latestData = new char[frameSize];
|
latestData = new char[frameSize];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user