mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 05:47:14 +02:00
adding exptime to receiver for file header
This commit is contained in:
@ -173,6 +173,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
*/
|
*/
|
||||||
uint64_t getAcquisitionPeriod() const;
|
uint64_t getAcquisitionPeriod() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Acquisition Time
|
||||||
|
* @return acquisition time
|
||||||
|
*/
|
||||||
|
uint64_t getAcquisitionTime() const;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get Number of Frames expected by receiver from detector
|
* Get 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)
|
||||||
@ -343,6 +349,13 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
*/
|
*/
|
||||||
int setAcquisitionPeriod(const uint64_t i);
|
int setAcquisitionPeriod(const uint64_t i);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Acquisition Time
|
||||||
|
* @param i acquisition time
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
int setAcquisitionTime(const uint64_t i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* The data receiver status will change from running to idle when it gets this number of frames
|
||||||
@ -508,9 +521,11 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
/** Number of Packets per Frame*/
|
/** Number of Packets per Frame*/
|
||||||
uint32_t packetsPerFrame;
|
uint32_t packetsPerFrame;
|
||||||
/** Acquisition Period */
|
/** Acquisition Period */
|
||||||
int64_t acquisitionPeriod;
|
uint64_t acquisitionPeriod;
|
||||||
|
/** Acquisition Time */
|
||||||
|
uint64_t acquisitionTime;
|
||||||
/** Frame Number */
|
/** Frame Number */
|
||||||
int64_t numberOfFrames;
|
uint64_t numberOfFrames;
|
||||||
/** Dynamic Range */
|
/** Dynamic Range */
|
||||||
uint32_t dynamicRange;
|
uint32_t dynamicRange;
|
||||||
/** Ten Giga Enable*/
|
/** Ten Giga Enable*/
|
||||||
|
@ -233,6 +233,12 @@ class UDPInterface {
|
|||||||
*/
|
*/
|
||||||
virtual uint64_t getAcquisitionPeriod() const = 0;
|
virtual uint64_t getAcquisitionPeriod() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Acquisition Time
|
||||||
|
* @return acquisition time
|
||||||
|
*/
|
||||||
|
virtual uint64_t getAcquisitionTime() const = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get Number of Frames expected by receiver from detector
|
* Get 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)
|
||||||
@ -399,6 +405,13 @@ class UDPInterface {
|
|||||||
*/
|
*/
|
||||||
virtual int setAcquisitionPeriod(const uint64_t i) = 0;
|
virtual int setAcquisitionPeriod(const uint64_t i) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Acquisition Time
|
||||||
|
* @param i acquisition time
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
virtual int setAcquisitionTime(const uint64_t i) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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)
|
||||||
|
@ -128,6 +128,13 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
|||||||
*/
|
*/
|
||||||
int setAcquisitionPeriod(const uint64_t i);
|
int setAcquisitionPeriod(const uint64_t i);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Acquisition Time
|
||||||
|
* @param i acquisition time
|
||||||
|
* @return OK or FAIL
|
||||||
|
*/
|
||||||
|
int setAcquisitionTime(const uint64_t i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden method
|
* Overridden method
|
||||||
* Set Number of Frames expected by receiver from detector
|
* Set Number of Frames expected by receiver from detector
|
||||||
@ -608,7 +615,7 @@ private:
|
|||||||
/** If file created successfully for all Writer Threads */
|
/** If file created successfully for all Writer Threads */
|
||||||
bool fileCreateSuccess;
|
bool fileCreateSuccess;
|
||||||
|
|
||||||
const static int FILE_HEADER_SIZE = 500;
|
const static unsigned int FILE_HEADER_SIZE = 500;
|
||||||
|
|
||||||
char fileHeader[MAX_NUMBER_OF_WRITER_THREADS][FILE_HEADER_SIZE];
|
char fileHeader[MAX_NUMBER_OF_WRITER_THREADS][FILE_HEADER_SIZE];
|
||||||
|
|
||||||
@ -705,7 +712,7 @@ private:
|
|||||||
char guiFileName[MAX_NUMBER_OF_WRITER_THREADS][MAX_STR_LENGTH];
|
char guiFileName[MAX_NUMBER_OF_WRITER_THREADS][MAX_STR_LENGTH];
|
||||||
|
|
||||||
/** Number of packets copied to be sent to gui (others padded) */
|
/** Number of packets copied to be sent to gui (others padded) */
|
||||||
int guiNumPackets[MAX_NUMBER_OF_WRITER_THREADS];
|
uint32_t guiNumPackets[MAX_NUMBER_OF_WRITER_THREADS];
|
||||||
|
|
||||||
/** Semaphore to synchronize Writer and GuiReader threads*/
|
/** Semaphore to synchronize Writer and GuiReader threads*/
|
||||||
sem_t writerGuiSemaphore[MAX_NUMBER_OF_WRITER_THREADS]; //datacompression, only first thread sends to gui
|
sem_t writerGuiSemaphore[MAX_NUMBER_OF_WRITER_THREADS]; //datacompression, only first thread sends to gui
|
||||||
|
@ -41,6 +41,7 @@ void UDPBaseImplementation::initializeMembers(){
|
|||||||
strcpy(detHostname,"");
|
strcpy(detHostname,"");
|
||||||
packetsPerFrame = 0;
|
packetsPerFrame = 0;
|
||||||
acquisitionPeriod = 0;
|
acquisitionPeriod = 0;
|
||||||
|
acquisitionTime = 0;
|
||||||
numberOfFrames = 0;
|
numberOfFrames = 0;
|
||||||
dynamicRange = 16;
|
dynamicRange = 16;
|
||||||
tengigaEnable = false;
|
tengigaEnable = false;
|
||||||
@ -183,6 +184,8 @@ uint32_t UDPBaseImplementation::getDataStreamEnable() const{ FILE_LOG(logDEBUG)
|
|||||||
|
|
||||||
uint64_t UDPBaseImplementation::getAcquisitionPeriod() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return acquisitionPeriod;}
|
uint64_t UDPBaseImplementation::getAcquisitionPeriod() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return acquisitionPeriod;}
|
||||||
|
|
||||||
|
uint64_t UDPBaseImplementation::getAcquisitionTime() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return acquisitionTime;}
|
||||||
|
|
||||||
uint64_t UDPBaseImplementation::getNumberOfFrames() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return numberOfFrames;}
|
uint64_t UDPBaseImplementation::getNumberOfFrames() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return numberOfFrames;}
|
||||||
|
|
||||||
uint32_t UDPBaseImplementation::getDynamicRange() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return dynamicRange;}
|
uint32_t UDPBaseImplementation::getDynamicRange() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return dynamicRange;}
|
||||||
@ -360,6 +363,16 @@ int UDPBaseImplementation::setAcquisitionPeriod(const uint64_t i){
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int UDPBaseImplementation::setAcquisitionTime(const uint64_t i){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
acquisitionTime = i;
|
||||||
|
FILE_LOG(logINFO) << "Acquisition Time:" << (double)acquisitionTime/(1E9) << "s";
|
||||||
|
|
||||||
|
//overrridden child classes might return FAIL
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
int UDPBaseImplementation::setNumberOfFrames(const uint64_t i){
|
int UDPBaseImplementation::setNumberOfFrames(const uint64_t i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
|
@ -299,9 +299,14 @@ int UDPStandardImplementation::setupFifoStructure(){
|
|||||||
//random frame sent to gui, then frames per buffer depends on acquisition period
|
//random frame sent to gui, then frames per buffer depends on acquisition period
|
||||||
else{
|
else{
|
||||||
//calculate 100ms/period to get frames to listen to at a time
|
//calculate 100ms/period to get frames to listen to at a time
|
||||||
if(!acquisitionPeriod)
|
if(acquisitionPeriod)
|
||||||
i = SAMPLE_TIME_IN_NS;
|
i = SAMPLE_TIME_IN_NS/acquisitionPeriod;
|
||||||
else i = SAMPLE_TIME_IN_NS/acquisitionPeriod;
|
else{
|
||||||
|
if(acquisitionTime)
|
||||||
|
i = SAMPLE_TIME_IN_NS/acquisitionTime;
|
||||||
|
else
|
||||||
|
i = SAMPLE_TIME_IN_NS;
|
||||||
|
}
|
||||||
//max frames to listen to at a time is limited by 1000
|
//max frames to listen to at a time is limited by 1000
|
||||||
if (i > MAX_JOBS_PER_THREAD)
|
if (i > MAX_JOBS_PER_THREAD)
|
||||||
numberofJobsPerBuffer = MAX_JOBS_PER_THREAD;
|
numberofJobsPerBuffer = MAX_JOBS_PER_THREAD;
|
||||||
@ -605,6 +610,23 @@ int UDPStandardImplementation::setAcquisitionPeriod(const uint64_t i){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int UDPStandardImplementation::setAcquisitionTime(const uint64_t i){
|
||||||
|
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||||
|
|
||||||
|
acquisitionTime = i;
|
||||||
|
if(setupFifoStructure() == FAIL)
|
||||||
|
return FAIL;
|
||||||
|
|
||||||
|
FILE_LOG(logINFO) << "Acquisition Period: " << (double)acquisitionTime/(1E9) << "s";
|
||||||
|
|
||||||
|
if(myDetectorType == EIGER)
|
||||||
|
for(int i=0; i<MAX_NUMBER_OF_WRITER_THREADS; i++)
|
||||||
|
updateFileHeader(i);
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int UDPStandardImplementation::setNumberOfFrames(const uint64_t i){
|
int UDPStandardImplementation::setNumberOfFrames(const uint64_t i){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " called";
|
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||||
|
|
||||||
@ -1136,7 +1158,7 @@ void UDPStandardImplementation::startReadout(){
|
|||||||
currentReceivedInBuffer += udpSocket[i]->getCurrentTotalReceived();
|
currentReceivedInBuffer += udpSocket[i]->getCurrentTotalReceived();
|
||||||
|
|
||||||
//wait for all packets
|
//wait for all packets
|
||||||
if(totalP!=numberOfFrames*packetsPerFrame*numberofListeningThreads){
|
if((unsigned long long int)totalP!=numberOfFrames*packetsPerFrame*numberofListeningThreads){
|
||||||
|
|
||||||
//wait as long as there is change from prev totalP,
|
//wait as long as there is change from prev totalP,
|
||||||
//and also change from received in buffer to previous value
|
//and also change from received in buffer to previous value
|
||||||
@ -1611,25 +1633,27 @@ int UDPStandardImplementation::createNewFile(int ithread){
|
|||||||
if(totalWritingPacketCount[ithread]){
|
if(totalWritingPacketCount[ithread]){
|
||||||
if(numberofWriterThreads>1){
|
if(numberofWriterThreads>1){
|
||||||
cprintf(BLUE,"\nThread:%d File:%s"
|
cprintf(BLUE,"\nThread:%d File:%s"
|
||||||
"\nLost:%d"
|
"\nLost:%lld"
|
||||||
"\tPackets:%lld"
|
"\tPackets:%lld"
|
||||||
"\tFrame#:%lld"
|
"\tFrame#:%lld"
|
||||||
"\tPFrame#:%lld\n",
|
"\tPFrame#:%lld\n",
|
||||||
ithread,completeFileName[ithread],
|
ithread,completeFileName[ithread],
|
||||||
( ((int)(currentFrameNumber[ithread]-frameNumberInPreviousFile[ithread])*packetsPerFrame) - totalPacketsInFile[ithread]),
|
(long long int)(((currentFrameNumber[ithread]-frameNumberInPreviousFile[ithread])*packetsPerFrame) - totalPacketsInFile[ithread]),
|
||||||
totalPacketsInFile[ithread],currentFrameNumber[ithread],frameNumberInPreviousFile[ithread]
|
(long long int)totalPacketsInFile[ithread],
|
||||||
|
(long long int)currentFrameNumber[ithread],
|
||||||
|
(long long int)frameNumberInPreviousFile[ithread]
|
||||||
);
|
);
|
||||||
}else{
|
}else{
|
||||||
cprintf(BLUE,"\nFile:%s"
|
cprintf(BLUE,"\nFile:%s"
|
||||||
"\nLost:%d"
|
"\nLost:%lld"
|
||||||
"\tPackets:%lld"
|
"\tPackets:%lld"
|
||||||
"\tFrame#:%lld"
|
"\tFrame#:%lld"
|
||||||
"\tPFrame#:%lld\n",
|
"\tPFrame#:%lld\n",
|
||||||
completeFileName[ithread],
|
completeFileName[ithread],
|
||||||
( ((int)(currentFrameNumber[ithread]-frameNumberInPreviousFile[ithread])*packetsPerFrame) - totalPacketsInFile[ithread]),
|
(long long int)(((currentFrameNumber[ithread]-frameNumberInPreviousFile[ithread])*packetsPerFrame) - totalPacketsInFile[ithread]),
|
||||||
totalPacketsInFile[ithread],
|
(long long int)totalPacketsInFile[ithread],
|
||||||
currentFrameNumber[ithread],
|
(long long int)currentFrameNumber[ithread],
|
||||||
frameNumberInPreviousFile[ithread]
|
(long long int)frameNumberInPreviousFile[ithread]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1754,10 +1778,9 @@ void UDPStandardImplementation::startDataCallback(){
|
|||||||
int oneframesize = oneDataSize * packetsPerFrame;
|
int oneframesize = oneDataSize * packetsPerFrame;
|
||||||
char* buffer = new char[packetsPerFrame*oneDataSize];
|
char* buffer = new char[packetsPerFrame*oneDataSize];
|
||||||
memset(buffer,0xFF,oneframesize);
|
memset(buffer,0xFF,oneframesize);
|
||||||
int bufferoffset = 0;
|
|
||||||
int size = 0;
|
int size = 0;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
int currentfnum = 0;
|
uint32_t currentfnum = 0;
|
||||||
uint64_t fnum = 0;
|
uint64_t fnum = 0;
|
||||||
uint32_t pnum = 0;
|
uint32_t pnum = 0;
|
||||||
uint32_t snum = 0;
|
uint32_t snum = 0;
|
||||||
@ -2138,7 +2161,7 @@ int UDPStandardImplementation::prepareAndListenBuffer(int ithread, int cSize, ch
|
|||||||
//set fnum, pnum and deactivatedpacket label
|
//set fnum, pnum and deactivatedpacket label
|
||||||
eiger_packet_header_t* header;
|
eiger_packet_header_t* header;
|
||||||
eiger_packet_footer_t* footer;
|
eiger_packet_footer_t* footer;
|
||||||
int pnum=0;
|
uint32_t pnum=0;
|
||||||
//loop by each packet
|
//loop by each packet
|
||||||
for(int offset=fifoBufferHeaderSize;
|
for(int offset=fifoBufferHeaderSize;
|
||||||
offset<receivedSize;
|
offset<receivedSize;
|
||||||
@ -2169,9 +2192,8 @@ int UDPStandardImplementation::prepareAndListenBuffer(int ithread, int cSize, ch
|
|||||||
|
|
||||||
jfrau_packet_header_t* header;
|
jfrau_packet_header_t* header;
|
||||||
int offset = fifoBufferHeaderSize;
|
int offset = fifoBufferHeaderSize;
|
||||||
int pnum = packetsPerFrame-1;
|
uint32_t pnum = packetsPerFrame-1;
|
||||||
int currentpnum;
|
uint32_t currentpnum;
|
||||||
int currentfnum=-1;
|
|
||||||
|
|
||||||
//read first packet
|
//read first packet
|
||||||
receivedSize=0;
|
receivedSize=0;
|
||||||
@ -2294,7 +2316,6 @@ void UDPStandardImplementation::startFrameIndices(int ithread){
|
|||||||
FILE_LOG(logDEBUG) << __AT__ << " called";
|
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||||
|
|
||||||
//determine startFrameIndex
|
//determine startFrameIndex
|
||||||
jfrau_packet_header_t* header=0;
|
|
||||||
switch(myDetectorType){
|
switch(myDetectorType){
|
||||||
case EIGER:
|
case EIGER:
|
||||||
startFrameIndex = 0; //frame number always resets
|
startFrameIndex = 0; //frame number always resets
|
||||||
@ -2790,25 +2811,25 @@ void UDPStandardImplementation::stopWriting(int ithread, char* wbuffer){
|
|||||||
if(totalWritingPacketCountFromLastCheck[ithread]){
|
if(totalWritingPacketCountFromLastCheck[ithread]){
|
||||||
if(numberofWriterThreads>1){
|
if(numberofWriterThreads>1){
|
||||||
printf("Thread:%d"
|
printf("Thread:%d"
|
||||||
"\tLost:%d"
|
"\tLost:%lld"
|
||||||
"\tPackets:%lld"
|
"\tPackets:%lld"
|
||||||
"\tFrame#:%lld"
|
"\tFrame#:%lld"
|
||||||
"\tPFrame#r:%lld\n",
|
"\tPFrame#r:%lld\n",
|
||||||
ithread,
|
ithread,
|
||||||
( ((int)(currentFrameNumber[ithread]-frameNumberInPreviousCheck[ithread])*packetsPerFrame) - totalWritingPacketCountFromLastCheck[ithread]),
|
(long long int)(((currentFrameNumber[ithread]-frameNumberInPreviousCheck[ithread])*packetsPerFrame) - totalWritingPacketCountFromLastCheck[ithread]),
|
||||||
totalWritingPacketCountFromLastCheck[ithread],
|
(long long int)totalWritingPacketCountFromLastCheck[ithread],
|
||||||
currentFrameNumber[ithread],
|
(long long int)currentFrameNumber[ithread],
|
||||||
frameNumberInPreviousCheck[ithread]
|
(long long int)frameNumberInPreviousCheck[ithread]
|
||||||
);
|
);
|
||||||
}else{
|
}else{
|
||||||
printf("Lost:%d"
|
printf("Lost:%lld"
|
||||||
"\tPackets:%lld"
|
"\tPackets:%lld"
|
||||||
"\tFrame#:%lld"
|
"\tFrame#:%lld"
|
||||||
"\tPFrame#:%lld\n",
|
"\tPFrame#:%lld\n",
|
||||||
( ((int)(currentFrameNumber[ithread]-frameNumberInPreviousCheck[ithread])*packetsPerFrame) - totalWritingPacketCountFromLastCheck[ithread]),
|
(long long int)(((currentFrameNumber[ithread]-frameNumberInPreviousCheck[ithread])*packetsPerFrame) - totalWritingPacketCountFromLastCheck[ithread]),
|
||||||
totalWritingPacketCountFromLastCheck[ithread],
|
(long long int)totalWritingPacketCountFromLastCheck[ithread],
|
||||||
currentFrameNumber[ithread],
|
(long long int)currentFrameNumber[ithread],
|
||||||
frameNumberInPreviousCheck[ithread]
|
(long long int)frameNumberInPreviousCheck[ithread]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2969,14 +2990,14 @@ void UDPStandardImplementation::handleWithoutMissingPackets(int ithread, char* w
|
|||||||
|
|
||||||
//Print packet loss and filenames
|
//Print packet loss and filenames
|
||||||
if(tempframenumber && (tempframenumber%(maxFramesPerFile/10)) == 0){
|
if(tempframenumber && (tempframenumber%(maxFramesPerFile/10)) == 0){
|
||||||
printf("Lost:%d"
|
printf("Lost:%lld"
|
||||||
"\tPackets:%lld"
|
"\tPackets:%lld"
|
||||||
"\tFrame#:%lld"
|
"\tFrame#:%lld"
|
||||||
"\tPFrame#:%lld\n",
|
"\tPFrame#:%lld\n",
|
||||||
( ((int)(currentFrameNumber[ithread]-frameNumberInPreviousCheck[ithread])*packetsPerFrame) - totalWritingPacketCountFromLastCheck[ithread]),
|
(long long int)(((currentFrameNumber[ithread]-frameNumberInPreviousCheck[ithread])*packetsPerFrame) - totalWritingPacketCountFromLastCheck[ithread]),
|
||||||
totalWritingPacketCountFromLastCheck[ithread],
|
(long long int)totalWritingPacketCountFromLastCheck[ithread],
|
||||||
currentFrameNumber[ithread],
|
(long long int)currentFrameNumber[ithread],
|
||||||
frameNumberInPreviousCheck[ithread]
|
(long long int)frameNumberInPreviousCheck[ithread]
|
||||||
);
|
);
|
||||||
|
|
||||||
//reset counters for each new file
|
//reset counters for each new file
|
||||||
@ -3052,9 +3073,9 @@ void UDPStandardImplementation::writeFileWithoutCompression(int ithread, char* w
|
|||||||
//second part to not check when there has been something written previously
|
//second part to not check when there has been something written previously
|
||||||
if(numpackets &&(lastFrameNumberInFile[ithread]>=0)){
|
if(numpackets &&(lastFrameNumberInFile[ithread]>=0)){
|
||||||
//get start frame (required to create new file at the right juncture)
|
//get start frame (required to create new file at the right juncture)
|
||||||
uint64_t startframe =-1;
|
uint64_t startframe = 0;
|
||||||
uint32_t pnum;
|
uint32_t pnum = 0;
|
||||||
uint32_t snum;
|
uint32_t snum = 0;
|
||||||
//if(ithread) cout<<"getting start frame number"<<endl;
|
//if(ithread) cout<<"getting start frame number"<<endl;
|
||||||
if(getFrameandPacketNumber(ithread, wbuffer + offset, startframe,pnum,snum) == FAIL){
|
if(getFrameandPacketNumber(ithread, wbuffer + offset, startframe,pnum,snum) == FAIL){
|
||||||
//error in frame number sent by fpga
|
//error in frame number sent by fpga
|
||||||
@ -3062,7 +3083,7 @@ void UDPStandardImplementation::writeFileWithoutCompression(int ithread, char* w
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//if(ithread) cout<<"done getting start frame number"<<endl;
|
//if(ithread) cout<<"done getting start frame number"<<endl;
|
||||||
if(startframe == lastFrameNumberInFile[ithread]){
|
if(startframe == (unsigned long long int)lastFrameNumberInFile[ithread]){
|
||||||
if(writeUptoFrameNumber(ithread, wbuffer, offset, startframe+1, numpackets, packetsWritten) == FAIL)
|
if(writeUptoFrameNumber(ithread, wbuffer, offset, startframe+1, numpackets, packetsWritten) == FAIL)
|
||||||
//weird frame number of zero from fpga
|
//weird frame number of zero from fpga
|
||||||
return;
|
return;
|
||||||
@ -3163,6 +3184,7 @@ void UDPStandardImplementation::updateFileHeader(int ithread){
|
|||||||
"x\t\t: %d pixels\n"
|
"x\t\t: %d pixels\n"
|
||||||
"y\t\t: %d pixels\n"
|
"y\t\t: %d pixels\n"
|
||||||
"Frames\t\t: %lld\n"
|
"Frames\t\t: %lld\n"
|
||||||
|
"Exptime (ns)\t: %lld\n"
|
||||||
"Period (ns)\t: %lld\n"
|
"Period (ns)\t: %lld\n"
|
||||||
"Timestamp\t: %s\n\n"
|
"Timestamp\t: %s\n\n"
|
||||||
|
|
||||||
@ -3184,10 +3206,11 @@ void UDPStandardImplementation::updateFileHeader(int ithread){
|
|||||||
//only for eiger right now
|
//only for eiger right now
|
||||||
EIGER_PIXELS_IN_ONE_ROW,EIGER_PIXELS_IN_ONE_COL,
|
EIGER_PIXELS_IN_ONE_ROW,EIGER_PIXELS_IN_ONE_COL,
|
||||||
(long long int)numberOfFrames,
|
(long long int)numberOfFrames,
|
||||||
|
(long long int)acquisitionTime,
|
||||||
(long long int)acquisitionPeriod,
|
(long long int)acquisitionPeriod,
|
||||||
ctime(&t));
|
ctime(&t));
|
||||||
if(strlen(fileHeader[ithread]) > FILE_HEADER_SIZE)
|
if(strlen(fileHeader[ithread]) > FILE_HEADER_SIZE)
|
||||||
cprintf(BG_RED,"File Header Size %d is too small for fixed file header size %d\n",strlen(fileHeader[ithread]),FILE_HEADER_SIZE);
|
cprintf(BG_RED,"File Header Size %d is too small for fixed file header size %d\n",strlen(fileHeader[ithread]),(int)FILE_HEADER_SIZE);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3395,7 +3418,7 @@ int UDPStandardImplementation::getFrameandPacketNumber(int ithread, char* wbuffe
|
|||||||
framenumber = (uint32_t)(*( (uint64_t*) footer));
|
framenumber = (uint32_t)(*( (uint64_t*) footer));
|
||||||
//error in frame number sent by fpga
|
//error in frame number sent by fpga
|
||||||
if(!((uint32_t)(*( (uint64_t*) footer)))){
|
if(!((uint32_t)(*( (uint64_t*) footer)))){
|
||||||
framenumber = -1;
|
framenumber = 0;
|
||||||
FILE_LOG(logERROR) << "Fifo "<< ithread << ": Frame Number is zero from firmware.";
|
FILE_LOG(logERROR) << "Fifo "<< ithread << ": Frame Number is zero from firmware.";
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
@ -2439,7 +2439,14 @@ int slsReceiverTCPIPInterface::set_timer() {
|
|||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(index[0] == FRAME_PERIOD){
|
if(index[0] == ACQUISITION_TIME){
|
||||||
|
if(index[1]>=0){
|
||||||
|
ret = receiverBase->setAcquisitionTime(index[1]);
|
||||||
|
if(ret == FAIL)
|
||||||
|
strcpy(mess,"Could not allocate memory for listening fifo\n");
|
||||||
|
}
|
||||||
|
retval=receiverBase->getAcquisitionTime();
|
||||||
|
}else if(index[0] == FRAME_PERIOD){
|
||||||
if(index[1]>=0){
|
if(index[1]>=0){
|
||||||
ret = receiverBase->setAcquisitionPeriod(index[1]);
|
ret = receiverBase->setAcquisitionPeriod(index[1]);
|
||||||
if(ret == FAIL)
|
if(ret == FAIL)
|
||||||
@ -2457,7 +2464,9 @@ int slsReceiverTCPIPInterface::set_timer() {
|
|||||||
}
|
}
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
if(ret!=FAIL){
|
if(ret!=FAIL){
|
||||||
if(index[0] == FRAME_PERIOD)
|
if(index[0] == ACQUISITION_TIME)
|
||||||
|
cout << "acquisition time:" << retval << endl;
|
||||||
|
else if(index[0] == FRAME_PERIOD)
|
||||||
cout << "acquisition period:" << retval << endl;
|
cout << "acquisition period:" << retval << endl;
|
||||||
else
|
else
|
||||||
cout << "frame number:" << retval << endl;
|
cout << "frame number:" << retval << endl;
|
||||||
|
Reference in New Issue
Block a user