20 #include <epicsString.h>
21 #include <epicsEvent.h>
22 #include <epicsThread.h>
26 static const int ONE_BIT = 1;
27 static const int SIX_BIT = 6;
28 static const int TWELVE_BIT = 12;
29 static const int TWENTY_FOUR_BIT = 24;
31 static const double ONE_BILLION = 1.E9;
33 static const double SHORT_TIME = 0.000025;
35 typedef std::variant<std::shared_ptr<xsp::lambda::Receiver>, std::shared_ptr<xsp::PostDecoder> >
lambda_input;
45 ADLambda(
const char *portName,
const char *configPath,
int numModules,
int fake);
48 virtual asynStatus disconnect();
51 void waitAcquireThread();
53 void acquireThread(
int receiver);
57 void report(FILE *fp,
int details);
63 #define LAMBDA_FIRST_PARAM LAMBDA_ConfigFilePath
79 bool connected =
false;
80 bool hasDecoder =
false;
83 void incrementValue(
int param);
84 void decrementValue(
int param);
85 void readParameters();
86 void sendParameters();
87 void writeDepth(
int depth);
89 bool tryStartAcquire();
90 bool tryStopAcquire();
94 void spawnAcquireThread(
int receiver);
95 void spawnAcquireDecoderThread();
97 std::unique_ptr<xsp::System> sys;
98 std::shared_ptr<xsp::lambda::Detector> det;
100 std::vector< lambda_input > inputs;
102 std::map<int, NDArray*> frames;
103 std::deque<NDArray*> export_queue;
105 epicsEvent* startAcquireEvent;
106 epicsEvent* stopAcquireEvent;
107 epicsEvent** threadFinishEvents;
108 epicsMutex* dequeLock;
121 #define LAMBDA_ConfigFilePathString "LAMBDA_CONFIG_FILE_PATH"
122 #define LAMBDA_DecoderDetectedString "LAMBDA_DECODER_DETECTED"
123 #define LAMBDA_EnergyThresholdString "LAMBDA_ENERGY_THRESHOLD"
124 #define LAMBDA_DualThresholdString "LAMBDA_DUAL_THRESHOLD"
125 #define LAMBDA_DecodedQueueDepthString "LAMBDA_DECODED_QUEUE_DEPTH"
126 #define LAMBDA_OperatingModeString "LAMBDA_OPERATING_MODE"
127 #define LAMBDA_DualModeString "LAMBDA_DUAL_MODE"
128 #define LAMBDA_ChargeSummingString "LAMBDA_CHARGE_SUMMING"
129 #define LAMBDA_GatingEnableString "LAMBDA_GATING_ENABLE"
130 #define LAMBDA_BadFrameCounterString "LAMBDA_BAD_FRAME_COUNTER"
131 #define LAMBDA_BadImageString "LAMBDA_BAD_IMAGE"
132 #define LAMBDA_ReadoutThreadsString "LAMBDA_NUM_READOUT_THREADS"
133 #define LAMBDA_StitchWidthString "LAMBDA_STITCHED_WIDTH"
134 #define LAMBDA_StitchHeightString "LAMBDA_STITCHED_HEIGHT"
std::variant< std::shared_ptr< xsp::lambda::Receiver >, std::shared_ptr< xsp::PostDecoder > > lambda_input
Definition: ADLambda.h:35
Class from which areaDetector drivers are directly derived.
Definition: ADDriver.h:132
virtual asynStatus connect(asynUser *pasynUser)
Connects driver to device; This method is called when the driver's pasynCommon->connect() function is...
Definition: ADDriver.cpp:63
virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value)
Sets an int32 parameter.
Definition: ADDriver.cpp:84
Class to wrap Lambda detector library provided by X-Spectrum.
Definition: ADLambda.h:41
int LAMBDA_ConfigFilePath
Definition: ADLambda.h:62
int LAMBDA_DecoderDetected
Definition: ADLambda.h:64
int LAMBDA_BadFrameCounter
Definition: ADLambda.h:72
int LAMBDA_StitchedWidth
Definition: ADLambda.h:75
int LAMBDA_DualMode
Definition: ADLambda.h:69
int LAMBDA_ReadoutThreads
Definition: ADLambda.h:74
int LAMBDA_BadImage
Definition: ADLambda.h:73
int LAMBDA_DualThreshold
Definition: ADLambda.h:66
int LAMBDA_EnergyThreshold
Definition: ADLambda.h:65
void acquireDecoderThread()
static const char * driverName
Definition: ADLambda.h:43
int LAMBDA_DecodedQueueDepth
Definition: ADLambda.h:67
int LAMBDA_ChargeSumming
Definition: ADLambda.h:70
int LAMBDA_GatingEnable
Definition: ADLambda.h:71
int LAMBDA_OperatingMode
Definition: ADLambda.h:68
int LAMBDA_StitchedHeight
Definition: ADLambda.h:76
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition: NDArray.h:99
virtual void report(FILE *fp, int details)
Report status of the driver.
Definition: asynNDArrayDriver.cpp:753
@ string
Definition: NDFileHDF5Layout.h:44
list value
Definition: makeDbAndEdl.py:234
Definition: ADLambda.h:115
int receiver
Definition: ADLambda.h:117
ADLambda * driver
Definition: ADLambda.h:116