mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 21:07:13 +02:00
somewhere in between.. next step include generalData pointer in listerner and dataprocessor calss in constructor and a setter
This commit is contained in:
@ -38,10 +38,34 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
static uint64_t GetErrorMask();
|
||||
|
||||
/**
|
||||
* Reset RunningMask
|
||||
* Get acquisition started flag
|
||||
* @return acquisition started flag
|
||||
*/
|
||||
static void ResetRunningMask();
|
||||
static bool GetAcquisitionStartedFlag();
|
||||
|
||||
/**
|
||||
* Get measurement started flag
|
||||
* @return measurement started flag
|
||||
*/
|
||||
static bool GetMeasurementStartedFlag();
|
||||
|
||||
/**
|
||||
* Get Total Complete Frames Caught for an entire acquisition (including all scans)
|
||||
* @return total number of frames caught for entire acquisition
|
||||
*/
|
||||
uint64_t GetNumTotalFramesCaught();
|
||||
|
||||
/**
|
||||
* Get Frames Complete Caught for each real time acquisition (eg. for each scan)
|
||||
* @return number of frames caught for each scan
|
||||
*/
|
||||
uint64_t GetNumFramesCaught();
|
||||
|
||||
/**
|
||||
* Get Current Frame Index thats been processed for an entire acquisition (including all scans)
|
||||
* @return -1 if no frames have been caught, else current frame index (represents all scans too)
|
||||
*/
|
||||
uint64_t GetProcessedAcquisitionIndex();
|
||||
|
||||
/**
|
||||
* Set bit in RunningMask to allow thread to run
|
||||
@ -59,6 +83,26 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
*/
|
||||
void SetFifo(Fifo*& f);
|
||||
|
||||
/**
|
||||
* Reset parameters for new acquisition (including all scans)
|
||||
*/
|
||||
void ResetParametersforNewAcquisition();
|
||||
|
||||
/**
|
||||
* Reset parameters for new measurement (eg. for each scan)
|
||||
*/
|
||||
void ResetParametersforNewMeasurement();
|
||||
|
||||
/**
|
||||
* Create New File
|
||||
*/
|
||||
int CreateNewFile();
|
||||
|
||||
/**
|
||||
* Closes file
|
||||
*/
|
||||
void CloseFile();
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
@ -99,6 +143,30 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
|
||||
/** Fifo structure */
|
||||
Fifo* fifo;
|
||||
|
||||
|
||||
// individual members
|
||||
/** Aquisition Started flag */
|
||||
static bool acquisitionStartedFlag;
|
||||
|
||||
/** Measurement Started flag */
|
||||
static bool measurementStartedFlag;
|
||||
|
||||
/**Number of complete frames caught for an entire acquisition (including all scans) */
|
||||
uint64_t numTotalFramesCaught;
|
||||
|
||||
/** Number of complete frames caught for each real time acquisition (eg. for each scan) */
|
||||
uint64_t numFramesCaught;
|
||||
|
||||
/** Frame Number of First Frame of an entire Acquisition (including all scans) */
|
||||
uint64_t firstAcquisitionIndex;
|
||||
|
||||
/** Frame Number of First Frame for each real time acquisition (eg. for each scan) */
|
||||
uint64_t firstMeasurementIndex;
|
||||
|
||||
/** Frame Number of latest processed frame number of an entire Acquisition (including all scans) */
|
||||
uint64_t currentFrameIndex;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -60,8 +60,18 @@ public:
|
||||
/** Default Fifo depth */
|
||||
uint32_t defaultFifoDepth;
|
||||
|
||||
/** Threads per receiver */
|
||||
uint32_t threadsPerReceiver;
|
||||
|
||||
/** Size of a header packet */
|
||||
uint32_t headerPacketSize;
|
||||
|
||||
/** Cosntructor */
|
||||
GeneralData(){};
|
||||
GeneralData():
|
||||
packetIndexMask(0),
|
||||
packetIndexOffset(0),
|
||||
threadsPerReceiver(1),
|
||||
headerPacketSize(0){};
|
||||
|
||||
/** Destructor */
|
||||
virtual ~GeneralData(){};
|
||||
@ -85,6 +95,24 @@ public:
|
||||
packetNumber = frameNumber&packetIndexMask;
|
||||
frameNumber = (frameNumber & frameIndexMask) >> frameIndexOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting dynamic range changes member variables
|
||||
* @param dr dynamic range
|
||||
* @param tgEnable true if 10GbE is enabled, else false
|
||||
*/
|
||||
virtual void SetDynamicRange(int dr, bool tgEnable) {
|
||||
//This is a generic function that is overloaded by a dervied class
|
||||
};
|
||||
|
||||
/**
|
||||
* Setting ten giga enable changes member variables
|
||||
* @param tgEnable true if 10GbE is enabled, else false
|
||||
* @param dr dynamic range
|
||||
*/
|
||||
virtual void SetTenGigaEnable(bool tgEnable, int dr) {
|
||||
//This is a generic function that is overloaded by a dervied class
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -105,7 +133,7 @@ class GotthardData : public GeneralData {
|
||||
packetIndexMask = 1;
|
||||
maxFramesPerFile = MAX_FRAMES_PER_FILE;
|
||||
fifoBufferSize = packetSize*packetsPerFrame;
|
||||
fifoBufferHeaderSize= HEADER_SIZE_NUM_TOT_PACKETS;
|
||||
fifoBufferHeaderSize= FIFO_BUFFER_HEADER_SIZE;
|
||||
defaultFifoDepth = 25000;
|
||||
};
|
||||
};
|
||||
@ -126,7 +154,7 @@ class ShortGotthardData : public GeneralData {
|
||||
frameIndexMask = 0xFFFFFFFF;
|
||||
maxFramesPerFile = SHORT_MAX_FRAMES_PER_FILE;
|
||||
fifoBufferSize = packetSize*packetsPerFrame;
|
||||
fifoBufferHeaderSize= HEADER_SIZE_NUM_TOT_PACKETS;
|
||||
fifoBufferHeaderSize= FIFO_BUFFER_HEADER_SIZE;
|
||||
defaultFifoDepth = 25000;
|
||||
};
|
||||
};
|
||||
@ -154,7 +182,7 @@ class PropixData : public GeneralData {
|
||||
packetIndexMask = 1;
|
||||
maxFramesPerFile = MAX_FRAMES_PER_FILE;
|
||||
fifoBufferSize = packetSize*packetsPerFrame;
|
||||
fifoBufferHeaderSize= HEADER_SIZE_NUM_TOT_PACKETS;
|
||||
fifoBufferHeaderSize= FIFO_BUFFER_HEADER_SIZE;
|
||||
defaultFifoDepth = 25000;
|
||||
};
|
||||
};
|
||||
@ -180,7 +208,7 @@ class Moench02Data : public GeneralData {
|
||||
packetIndexMask = 0xFF;
|
||||
maxFramesPerFile = MOENCH_MAX_FRAMES_PER_FILE;
|
||||
fifoBufferSize = packetSize*packetsPerFrame;
|
||||
fifoBufferHeaderSize= HEADER_SIZE_NUM_TOT_PACKETS + FILE_FRAME_HEADER_LENGTH;
|
||||
fifoBufferHeaderSize= FIFO_BUFFER_HEADER_SIZE + FILE_FRAME_HEADER_SIZE;
|
||||
defaultFifoDepth = 2500;
|
||||
};
|
||||
};
|
||||
@ -206,7 +234,7 @@ class Moench03Data : public GeneralData {
|
||||
packetIndexMask = 0xFFFFFFFF;
|
||||
maxFramesPerFile = JFRAU_MAX_FRAMES_PER_FILE;
|
||||
fifoBufferSize = packetSize*packetsPerFrame;
|
||||
fifoBufferHeaderSize= HEADER_SIZE_NUM_TOT_PACKETS + FILE_FRAME_HEADER_LENGTH;
|
||||
fifoBufferHeaderSize= FIFO_BUFFER_HEADER_SIZE + FILE_FRAME_HEADER_SIZE;
|
||||
defaultFifoDepth = 2500;
|
||||
};
|
||||
};
|
||||
@ -229,7 +257,7 @@ class JCTBData : public GeneralData {
|
||||
imageSize = dataSize*packetsPerFrame;
|
||||
maxFramesPerFile = JFCTB_MAX_FRAMES_PER_FILE;
|
||||
fifoBufferSize = packetSize*packetsPerFrame;
|
||||
fifoBufferHeaderSize= HEADER_SIZE_NUM_TOT_PACKETS + FILE_FRAME_HEADER_LENGTH;
|
||||
fifoBufferHeaderSize= FIFO_BUFFER_HEADER_SIZE + FILE_FRAME_HEADER_SIZE;
|
||||
defaultFifoDepth = 2500;
|
||||
};
|
||||
};
|
||||
@ -261,13 +289,9 @@ private:
|
||||
packetSize = packetHeaderSize + dataSize;
|
||||
packetsPerFrame = 128;
|
||||
imageSize = dataSize*packetsPerFrame;
|
||||
frameIndexMask = 0xffffff;
|
||||
frameIndexOffset = 0;
|
||||
packetIndexMask = 0;
|
||||
packetIndexOffset = 0;
|
||||
maxFramesPerFile = JFRAU_MAX_FRAMES_PER_FILE;
|
||||
fifoBufferSize = packetSize*packetsPerFrame;
|
||||
fifoBufferHeaderSize= HEADER_SIZE_NUM_TOT_PACKETS + FILE_FRAME_HEADER_LENGTH;
|
||||
fifoBufferHeaderSize= FIFO_BUFFER_HEADER_SIZE + FILE_FRAME_HEADER_SIZE;
|
||||
defaultFifoDepth = 2500;
|
||||
};
|
||||
|
||||
@ -285,7 +309,7 @@ private:
|
||||
uint64_t& frameNumber, uint32_t& packetNumber, uint32_t& subFrameNumber, uint64_t bunchId) {
|
||||
subFrameNumber = 0;
|
||||
jfrau_packet_header_t* header = (jfrau_packet_header_t*)(packetData);
|
||||
frameNumber = (*( (uint32_t*) header->frameNumber))&frameIndexMask;
|
||||
frameNumber = (uint64_t)(*( (uint32_t*) header->frameNumber));
|
||||
packetNumber = (uint32_t)(*( (uint8_t*) header->packetNumber));
|
||||
bunchId = (*((uint64_t*) header->bunchid));
|
||||
}
|
||||
@ -323,17 +347,16 @@ private:
|
||||
nPixelsY = 256;
|
||||
dataSize = 1024;
|
||||
packetSize = 1040;
|
||||
packetsPerFrame = 1;
|
||||
packetsPerFrame = 256;
|
||||
imageSize = dataSize*packetsPerFrame;
|
||||
frameIndexMask = 0xFFFFFFFF;
|
||||
frameIndexOffset = 0;
|
||||
packetIndexMask = 0;
|
||||
packetIndexOffset = 0;
|
||||
frameIndexMask = 0xffffff;
|
||||
maxFramesPerFile = EIGER_MAX_FRAMES_PER_FILE;
|
||||
fifoBufferSize = packetSize*packetsPerFrame;
|
||||
fifoBufferHeaderSize= HEADER_SIZE_NUM_TOT_PACKETS + FILE_FRAME_HEADER_LENGTH;
|
||||
fifoBufferHeaderSize= FIFO_BUFFER_HEADER_SIZE + FILE_FRAME_HEADER_SIZE;
|
||||
defaultFifoDepth = 100;
|
||||
footerOffset = packetHeaderSize+dataSize;
|
||||
threadsPerReceiver = 2;
|
||||
headerPacketSize = 48;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -351,13 +374,38 @@ private:
|
||||
bunchId = 0;
|
||||
subFrameNumber = 0;
|
||||
eiger_packet_footer_t* footer = (eiger_packet_footer_t*)(packetData + footerOffset);
|
||||
frameNumber = (uint64_t)(*( (uint64_t*) footer));
|
||||
packetNumber = (*( (uint16_t*) footer->packetNumber))-1;
|
||||
frameNumber = (uint64_t)((*( (uint64_t*) footer)) & frameIndexMask);
|
||||
packetNumber = (uint32_t)(*( (uint16_t*) footer->packetNumber))-1;
|
||||
if (dynamicRange == 32) {
|
||||
eiger_packet_header_t* header = (eiger_packet_header_t*) (packetData);
|
||||
subFrameNumber = *( (uint32_t*) header->subFrameNumber);
|
||||
subFrameNumber = (uint64_t) *( (uint32_t*) header->subFrameNumber);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting dynamic range changes member variables
|
||||
* @param dr dynamic range
|
||||
* @param tgEnable true if 10GbE is enabled, else false
|
||||
*/
|
||||
void SetDynamicRange(int dr, bool tgEnable) {
|
||||
packetsPerFrame = (tgEnable ? 4 : 16) * dr;
|
||||
imageSize = dataSize*packetsPerFrame;
|
||||
fifoBufferSize = packetSize*packetsPerFrame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting ten giga enable changes member variables
|
||||
* @param tgEnable true if 10GbE is enabled, else false
|
||||
* @param dr dynamic range
|
||||
*/
|
||||
void SetTenGigaEnable(bool tgEnable, int dr) {
|
||||
dataSize = (tgEnable ? 4096 : 1024);
|
||||
packetSize = (tgEnable ? 4112 : 1040);;
|
||||
packetsPerFrame = (tgEnable ? 4 : 16) * dr;
|
||||
imageSize = dataSize*packetsPerFrame;
|
||||
fifoBufferSize = packetSize*packetsPerFrame;
|
||||
footerOffset = packetHeaderSize+dataSize;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "ThreadObject.h"
|
||||
|
||||
class Fifo;
|
||||
class genericSocket;
|
||||
|
||||
class Listener : private virtual slsReceiverDefs, public ThreadObject {
|
||||
|
||||
@ -38,10 +39,27 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
|
||||
static uint64_t GetErrorMask();
|
||||
|
||||
/**
|
||||
* Reset RunningMask
|
||||
* Get acquisition started flag
|
||||
* @return acquisition started flag
|
||||
*/
|
||||
static void ResetRunningMask();
|
||||
static bool GetAcquisitionStartedFlag();
|
||||
|
||||
/**
|
||||
* Get measurement started flag
|
||||
* @return measurement started flag
|
||||
*/
|
||||
static bool GetMeasurementStartedFlag();
|
||||
|
||||
/**
|
||||
* Get Total Packets caught in an acquisition
|
||||
* @return Total Packets caught in an acquisition
|
||||
*/
|
||||
uint64_t GetTotalPacketsCaught();
|
||||
|
||||
/**
|
||||
* Get number of bytes currently received in udp buffer
|
||||
*/
|
||||
uint64_t GetNumReceivedinUDPBuffer();
|
||||
|
||||
/**
|
||||
* Set bit in RunningMask to allow thread to run
|
||||
@ -59,6 +77,33 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
|
||||
*/
|
||||
void SetFifo(Fifo*& f);
|
||||
|
||||
/**
|
||||
* Reset parameters for new acquisition (including all scans)
|
||||
*/
|
||||
void ResetParametersforNewAcquisition();
|
||||
|
||||
/**
|
||||
* Reset parameters for new measurement (eg. for each scan)
|
||||
*/
|
||||
void ResetParametersforNewMeasurement();
|
||||
|
||||
/**
|
||||
* Creates UDP Sockets
|
||||
* @param portnumber udp port number
|
||||
* @param packetSize size of one packet
|
||||
* @param eth ethernet interface or null
|
||||
* @param headerPacketSize size of a header packet
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int CreateUDPSockets(uint32_t portnumber, uint32_t packetSize, const char* eth, uint32_t headerPacketSize);
|
||||
|
||||
/**
|
||||
* Shuts down and deletes UDP Sockets
|
||||
*/
|
||||
void ShutDownUDPSocket();
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -82,7 +127,6 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
|
||||
void ThreadExecution();
|
||||
|
||||
|
||||
|
||||
/** type of thread */
|
||||
static const std::string TypeName;
|
||||
|
||||
@ -101,8 +145,28 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
|
||||
/** Fifo structure */
|
||||
Fifo* fifo;
|
||||
|
||||
int count;
|
||||
|
||||
// individual members
|
||||
/** Aquisition Started flag */
|
||||
static bool acquisitionStartedFlag;
|
||||
|
||||
/** Measurement Started flag */
|
||||
static bool measurementStartedFlag;
|
||||
|
||||
/**Number of complete Packets caught for an entire acquisition (including all scans) */
|
||||
uint64_t numTotalPacketsCaught;
|
||||
|
||||
/** Number of complete Packets caught for each real time acquisition (eg. for each scan) */
|
||||
uint64_t numPacketsCaught;
|
||||
|
||||
/** Frame Number of First Frame of an entire Acquisition (including all scans) */
|
||||
uint64_t firstAcquisitionIndex;
|
||||
|
||||
/** Frame Number of First Frame for each real time acquisition (eg. for each scan) */
|
||||
uint64_t firstMeasurementIndex;
|
||||
|
||||
/** UDP Sockets - Detector to Receiver */
|
||||
genericSocket* udpSocket;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -127,7 +127,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
|
||||
/**
|
||||
* Get Current Frame Index for an entire acquisition (including all scans)
|
||||
* @return current frame index (represents all scans too)
|
||||
* @return -1 if no frames have been caught, else current frame index (represents all scans too)
|
||||
*/
|
||||
int64_t getAcquisitionIndex() const;
|
||||
|
||||
@ -456,9 +456,8 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
|
||||
/**
|
||||
* Shuts down and deletes UDP Sockets
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int shutDownUDPSockets();
|
||||
void shutDownUDPSockets();
|
||||
|
||||
/**
|
||||
* Get the buffer-current frame read by receiver
|
||||
@ -477,10 +476,9 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
void abort(); //FIXME: needed, isn't stopReceiver enough?
|
||||
|
||||
/**
|
||||
* Closes file / all files(if multiple files)
|
||||
* @param ithread writer thread index
|
||||
* Closes all files
|
||||
*/
|
||||
void closeFile(int ithread = 0);
|
||||
void closeFiles();
|
||||
|
||||
/**
|
||||
* Activate / Deactivate Receiver
|
||||
@ -536,8 +534,6 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
detectorType myDetectorType;
|
||||
/** detector hostname */
|
||||
char detHostname[MAX_STR_LENGTH];
|
||||
/** Number of Packets per Frame*/
|
||||
uint32_t packetsPerFrame;
|
||||
/** Acquisition Period */
|
||||
uint64_t acquisitionPeriod;
|
||||
/** Acquisition Time */
|
||||
@ -587,16 +583,6 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
/** Data Compression Enable - save only hits */
|
||||
bool dataCompressionEnable;
|
||||
|
||||
//***acquisition count parameters***
|
||||
/** Total packets caught for an entire acquisition (including all scans) */
|
||||
uint64_t totalPacketsCaught;
|
||||
/** Packets Caught for each real time acquisition (eg. for each scan) */
|
||||
uint64_t packetsCaught;
|
||||
|
||||
//***acquisition indices parameters***
|
||||
/** Actual current frame index of an entire acquisition (including all scans) */
|
||||
uint64_t acquisitionIndex;
|
||||
|
||||
//***acquisition parameters***
|
||||
/* Short Frame Enable or index of adc enabled, else -1 if all enabled (gotthard specific) TODO: move to setROI */
|
||||
int shortFrameEnable;
|
||||
@ -609,8 +595,6 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
static const int DEFAULT_STREAMING_TIMER = 500;
|
||||
|
||||
|
||||
|
||||
|
||||
//***callback parameters***
|
||||
/**
|
||||
* function being called back for start acquisition
|
||||
|
@ -188,7 +188,7 @@ class UDPInterface {
|
||||
|
||||
/**
|
||||
* Get Current Frame Index for an entire acquisition (including all scans)
|
||||
* @return current frame index (represents all scans too) or -1 if no packets caught
|
||||
* @return -1 if no frames have been caught, else current frame index (represents all scans too) or -1 if no packets caught
|
||||
*/
|
||||
virtual int64_t getAcquisitionIndex() const = 0;
|
||||
|
||||
@ -513,9 +513,8 @@ class UDPInterface {
|
||||
|
||||
/**
|
||||
* Shuts down and deletes UDP Sockets
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
virtual int shutDownUDPSockets() = 0;
|
||||
virtual void shutDownUDPSockets() = 0;
|
||||
|
||||
/**
|
||||
* Get the buffer-current frame read by receiver
|
||||
@ -534,10 +533,9 @@ class UDPInterface {
|
||||
virtual void abort() = 0; //FIXME: needed, isnt stopReceiver enough?
|
||||
|
||||
/**
|
||||
* Closes file / all files(if multiple files)
|
||||
* @param ithread writer thread index
|
||||
* Closes all files
|
||||
*/
|
||||
virtual void closeFile(int ithread = 0) = 0;
|
||||
virtual void closeFiles() = 0;
|
||||
|
||||
/**
|
||||
* Activate / Deactivate Receiver
|
||||
|
@ -35,17 +35,9 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
||||
*/
|
||||
virtual ~UDPStandardImplementation();
|
||||
|
||||
//*** initial parameters (behavioral)***
|
||||
/**
|
||||
* Set receiver type (and corresponding detector variables in derived STANDARD class)
|
||||
* It is the first function called by the client when connecting to receiver
|
||||
* @param d detector type
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int setDetectorType(const detectorType d);
|
||||
|
||||
|
||||
//*** Getters ***
|
||||
//*** Overloaded Functions called by TCP Interface ***
|
||||
/**
|
||||
* Get Total Frames Caught for an entire acquisition (including all scans)
|
||||
* @return total number of frames caught for entire acquisition
|
||||
@ -58,11 +50,12 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
||||
*/
|
||||
uint64_t getFramesCaught() const;
|
||||
|
||||
/**
|
||||
* Get Current Frame Index for an entire acquisition (including all scans)
|
||||
* @return -1 if no frames have been caught, else current frame index (represents all scans too)
|
||||
*/
|
||||
int64_t getAcquisitionIndex() const;
|
||||
|
||||
|
||||
//*** Setters ***
|
||||
|
||||
//*** file parameters ***
|
||||
/**
|
||||
* Set File Name Prefix (without frame index, file index and extension (_f000000000000_8.raw))
|
||||
* Does not check for file existence since it is created only at startReceiver
|
||||
@ -70,7 +63,6 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
||||
*/
|
||||
void setFileName(const char c[]);
|
||||
|
||||
//*** acquisition parameters ***
|
||||
/**
|
||||
* Set Short Frame Enabled, later will be moved to getROI (so far only for gotthard)
|
||||
* @param i index of adc enabled, else -1 if all enabled
|
||||
@ -99,9 +91,93 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
||||
*/
|
||||
int setAcquisitionPeriod(const uint64_t i);
|
||||
|
||||
//*** Behavioral functions ***
|
||||
/**
|
||||
* 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
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* Set Dynamic Range or Number of Bits Per Pixel
|
||||
* @param i dynamic range that is 4, 8, 16 or 32
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int setDynamicRange(const uint32_t i);
|
||||
|
||||
/**
|
||||
* Set Ten Giga Enable
|
||||
* @param b true if 10GbE enabled, else false (1G enabled)
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int setTenGigaEnable(const bool b);
|
||||
|
||||
/**
|
||||
* Set Fifo Depth
|
||||
* @param i fifo depth value
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int setFifoDepth(const uint32_t i);
|
||||
|
||||
/**
|
||||
* Set receiver type (and corresponding detector variables in derived STANDARD class)
|
||||
* It is the first function called by the client when connecting to receiver
|
||||
* @param d detector type
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int setDetectorType(const detectorType d);
|
||||
|
||||
/**
|
||||
* Reset acquisition parameters such as total frames caught for an entire acquisition (including all scans)
|
||||
*/
|
||||
void resetAcquisitionCount();
|
||||
|
||||
/**
|
||||
* Start Listening for Packets by activating all configuration settings to receiver
|
||||
* When this function returns, it has status RUNNING(upon SUCCESS) or IDLE (upon failure)
|
||||
* @param c error message if FAIL
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int startReceiver(char *c=NULL);
|
||||
|
||||
/**
|
||||
* Stop Listening for Packets
|
||||
* Calls startReadout(), which stops listening and sets status to Transmitting
|
||||
* When it has read every frame in buffer, the status changes to Run_Finished
|
||||
* When this function returns, receiver has status IDLE
|
||||
* Pre: status is running, semaphores have been instantiated,
|
||||
* Post: udp sockets shut down, status is idle, semaphores destroyed
|
||||
*/
|
||||
void stopReceiver();
|
||||
|
||||
/**
|
||||
* Stop Listening to Packets
|
||||
* and sets status to Transmitting
|
||||
* Next step would be to get all data and stop receiver completely and return with idle state
|
||||
* Pre: status is running, udp sockets have been initialized, stop receiver initiated
|
||||
* Post:udp sockets closed, status is transmitting
|
||||
*/
|
||||
void startReadout();
|
||||
|
||||
/**
|
||||
* Shuts down and deletes UDP Sockets
|
||||
* also called in case of illegal shutdown of receiver
|
||||
*/
|
||||
void shutDownUDPSockets();
|
||||
|
||||
/**
|
||||
* Closes file / all files(data compression involves multiple files)
|
||||
* TCPIPInterface can also call this in case of illegal shutdown of receiver
|
||||
*/
|
||||
void closeFiles();
|
||||
|
||||
private:
|
||||
|
||||
@ -127,6 +203,31 @@ private:
|
||||
*/
|
||||
int SetupFifoStructure();
|
||||
|
||||
/**
|
||||
* Reset parameters for new measurement (eg. for each scan)
|
||||
*/
|
||||
void ResetParametersforNewMeasurement();
|
||||
|
||||
/**
|
||||
* Creates UDP Sockets
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int CreateUDPSockets();
|
||||
|
||||
/**
|
||||
* Creates the first file
|
||||
* also does the startAcquisitionCallBack
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int SetupWriter();
|
||||
|
||||
/**
|
||||
* Start Running
|
||||
* Set running mask and post semaphore of the threads
|
||||
* to start the inner loop in execution thread
|
||||
*/
|
||||
void StartRunning();
|
||||
|
||||
|
||||
//*** Class Members ***
|
||||
|
||||
|
@ -4,21 +4,33 @@
|
||||
#include "sls_receiver_defs.h"
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#define GOODBYE -200
|
||||
|
||||
//local network parameters
|
||||
#define RECEIVE_SOCKET_BUFFER_SIZE (100*1024*1024)
|
||||
#define MAX_SOCKET_INPUT_PACKET_QUEUE 250000
|
||||
//socket
|
||||
#define GOODBYE -200
|
||||
#define RECEIVE_SOCKET_BUFFER_SIZE (100*1024*1024)
|
||||
#define MAX_SOCKET_INPUT_PACKET_QUEUE 250000
|
||||
|
||||
//files
|
||||
#define DO_NOTHING 0
|
||||
#define CREATE_FILES 1
|
||||
#define DO_EVERYTHING 2
|
||||
#define DO_NOTHING 0
|
||||
#define CREATE_FILES 1
|
||||
#define DO_EVERYTHING 2
|
||||
|
||||
//binary
|
||||
#define FILE_FRAME_HEADER_SIZE 16
|
||||
|
||||
//fifo
|
||||
#define FIFO_BUFFER_HEADER_SIZE 4
|
||||
|
||||
//parameters to calculate fifo depth
|
||||
#define SAMPLE_TIME_IN_NS 100000000//100ms
|
||||
#define MAX_JOBS_PER_THREAD 1000
|
||||
|
||||
#define DUMMY_PACKET_VALUE 0xFFFFFFFF;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
//binary
|
||||
#define FILE_BUF_SIZE (16*1024*1024) //16mb
|
||||
#define FILE_FRAME_HEADER_LENGTH 16
|
||||
#define FILE_HEADER_BUNCHID_OFFSET 8
|
||||
|
||||
//hdf5
|
||||
@ -30,8 +42,6 @@
|
||||
|
||||
|
||||
#define HEADER_SIZE_NUM_TOT_PACKETS 4
|
||||
#define SAMPLE_TIME_IN_NS 100000000//100ms
|
||||
#define MAX_JOBS_PER_THREAD 1000
|
||||
#define ALL_MASK_32 0xFFFFFFFF
|
||||
|
||||
|
||||
@ -142,43 +152,5 @@
|
||||
#define EIGER_PACKET_INDEX_MASK 0x0
|
||||
|
||||
|
||||
//data structures
|
||||
/**
|
||||
* structure of an eiger packet header
|
||||
* subframenum subframe number for 32 bit mode (already written by firmware)
|
||||
* missingpacket explicitly put to 0xFF to recognize it in file read (written by software)
|
||||
* portnum 0 for the first port and 1 for the second port (written by software to file)
|
||||
* dynamicrange dynamic range or bits per pixel (written by software to file)
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char subFrameNumber[4];
|
||||
unsigned char missingPacket[2];
|
||||
unsigned char portIndex[1];
|
||||
unsigned char dynamicRange[1];
|
||||
} eiger_packet_header_t;
|
||||
|
||||
/**
|
||||
* structure of an eiger packet footer
|
||||
* framenum 48 bit frame number (already written by firmware)
|
||||
* packetnum packet number (already written by firmware)
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char frameNumber[6];
|
||||
unsigned char packetNumber[2];
|
||||
} eiger_packet_footer_t;
|
||||
|
||||
/**
|
||||
* structure of an jungfrau packet header
|
||||
* empty header
|
||||
* framenumber
|
||||
* packetnumber
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char emptyHeader[6];
|
||||
unsigned char reserved[4];
|
||||
unsigned char packetNumber[1];
|
||||
unsigned char frameNumber[3];
|
||||
unsigned char bunchid[8];
|
||||
} jfrau_packet_header_t;
|
||||
|
||||
*/
|
||||
#endif
|
||||
|
@ -269,15 +269,6 @@ private:
|
||||
/** Lock Status if server locked to a client */
|
||||
int lockStatus;
|
||||
|
||||
/** Short frame */
|
||||
int shortFrame;
|
||||
|
||||
/** Packets per frame */
|
||||
int packetsPerFrame;
|
||||
|
||||
/** Dynamic Range */
|
||||
int dynamicrange;
|
||||
|
||||
/** kill tcp server thread */
|
||||
int killTCPServerThread;
|
||||
|
||||
|
Reference in New Issue
Block a user