24 #include <epicsTime.h>
25 #include <epicsTypes.h>
26 #include <epicsThread.h>
27 #include <epicsEvent.h>
28 #include <epicsMutex.h>
29 #include <epicsString.h>
30 #include <epicsStdio.h>
31 #include <cantProceed.h>
32 #include <epicsTypes.h>
34 #include <asynOctetSyncIO.h>
36 #include <pv/pvTimeStamp.h>
44 #define ADnEDFirstParamString "ADNED_FIRST"
45 #define ADnEDLastParamString "ADNED_LAST"
46 #define ADnEDResetParamString "ADNED_RESET"
47 #define ADnEDStartParamString "ADNED_START"
48 #define ADnEDStopParamString "ADNED_STOP"
49 #define ADnEDPauseParamString "ADNED_PAUSE"
50 #define ADnEDEventDebugParamString "ADNED_EVENT_DEBUG"
51 #define ADnEDSeqCounterParamString "ADNED_SEQ_COUNTER"
52 #define ADnEDPulseCounterParamString "ADNED_PULSE_COUNTER"
53 #define ADnEDEventRateParamString "ADNED_EVENT_RATE"
54 #define ADnEDSeqIDParamString "ADNED_SEQ_ID"
55 #define ADnEDSeqIDMissingParamString "ADNED_SEQ_ID_MISSING"
56 #define ADnEDSeqIDNumMissingParamString "ADNED_SEQ_ID_NUM_MISSING"
57 #define ADnEDBadTimeStampParamString "ADNED_BAD_TIMESTAMP"
58 #define ADnEDPChargeParamString "ADNED_PCHARGE"
59 #define ADnEDPChargeIntParamString "ADNED_PCHARGE_INT"
60 #define ADnEDEventUpdatePeriodParamString "ADNED_EVENT_UPDATE_PERIOD"
61 #define ADnEDFrameUpdatePeriodParamString "ADNED_FRAME_UPDATE_PERIOD"
62 #define ADnEDNumChannelsParamString "ADNED_NUM_CHANNELS"
63 #define ADnEDPVNameParamString "ADNED_PV_NAME"
64 #define ADnEDNumDetParamString "ADNED_NUM_DET"
65 #define ADnEDDetPixelNumStartParamString "ADNED_DET_PIXEL_NUM_START"
66 #define ADnEDDetPixelNumEndParamString "ADNED_DET_PIXEL_NUM_END"
67 #define ADnEDDetPixelNumSizeParamString "ADNED_DET_PIXEL_NUM_SIZE"
68 #define ADnEDDetTOFNumBinsParamString "ADNED_DET_TOF_NUM_BINS"
69 #define ADnEDDet2DTypeParamString "ADNED_DET_2D_TYPE"
70 #define ADnEDDetNDArrayStartParamString "ADNED_DET_NDARRAY_START"
71 #define ADnEDDetNDArrayEndParamString "ADNED_DET_NDARRAY_END"
72 #define ADnEDDetNDArraySizeParamString "ADNED_DET_NDARRAY_SIZE"
73 #define ADnEDDetNDArrayTOFStartParamString "ADNED_DET_NDARRAY_TOF_START"
74 #define ADnEDDetNDArrayTOFEndParamString "ADNED_DET_NDARRAY_TOF_END"
75 #define ADnEDDetEventRateParamString "ADNED_DET_EVENT_RATE"
76 #define ADnEDDetEventTotalParamString "ADNED_DET_EVENT_TOTAL"
77 #define ADnEDDetTOFROIStartParamString "ADNED_DET_TOF_ROI_START"
78 #define ADnEDDetTOFROISizeParamString "ADNED_DET_TOF_ROI_SIZE"
79 #define ADnEDDetTOFROIEnableParamString "ADNED_DET_TOF_ROI_ENABLE"
80 #define ADnEDDetTOFArrayResetParamString "ADNED_DET_TOF_ARRAY_RESET"
82 #define ADnEDDetTOFTransFile0ParamString "ADNED_DET_TOF_TRANS_FILE0"
83 #define ADnEDDetTOFTransFile1ParamString "ADNED_DET_TOF_TRANS_FILE1"
84 #define ADnEDDetTOFTransFile2ParamString "ADNED_DET_TOF_TRANS_FILE2"
85 #define ADnEDDetTOFTransFile3ParamString "ADNED_DET_TOF_TRANS_FILE3"
86 #define ADnEDDetTOFTransFile4ParamString "ADNED_DET_TOF_TRANS_FILE4"
87 #define ADnEDDetTOFTransFile5ParamString "ADNED_DET_TOF_TRANS_FILE5"
88 #define ADnEDDetTOFTransInt0ParamString "ADNED_DET_TOF_TRANS_INT0"
89 #define ADnEDDetTOFTransInt1ParamString "ADNED_DET_TOF_TRANS_INT1"
90 #define ADnEDDetTOFTransInt2ParamString "ADNED_DET_TOF_TRANS_INT2"
91 #define ADnEDDetTOFTransInt3ParamString "ADNED_DET_TOF_TRANS_INT3"
92 #define ADnEDDetTOFTransInt4ParamString "ADNED_DET_TOF_TRANS_INT4"
93 #define ADnEDDetTOFTransInt5ParamString "ADNED_DET_TOF_TRANS_INT5"
94 #define ADnEDDetTOFTransFloat0ParamString "ADNED_DET_TOF_TRANS_FLOAT0"
95 #define ADnEDDetTOFTransFloat1ParamString "ADNED_DET_TOF_TRANS_FLOAT1"
96 #define ADnEDDetTOFTransFloat2ParamString "ADNED_DET_TOF_TRANS_FLOAT2"
97 #define ADnEDDetTOFTransFloat3ParamString "ADNED_DET_TOF_TRANS_FLOAT3"
98 #define ADnEDDetTOFTransFloat4ParamString "ADNED_DET_TOF_TRANS_FLOAT4"
99 #define ADnEDDetTOFTransFloat5ParamString "ADNED_DET_TOF_TRANS_FLOAT5"
100 #define ADnEDDetTOFTransPrintParamString "ADNED_DET_TOF_TRANS_PRINT"
101 #define ADnEDDetTOFTransDebugParamString "ADNED_DET_TOF_TRANS_DEBUG"
102 #define ADnEDDetTOFTransTypeParamString "ADNED_DET_TOF_TRANS_TYPE"
103 #define ADnEDDetTOFTransOffsetParamString "ADNED_DET_TOF_TRANS_OFFSET"
104 #define ADnEDDetTOFTransScaleParamString "ADNED_DET_TOF_TRANS_SCALE"
106 #define ADnEDDetPixelMapFileParamString "ADNED_DET_PIXEL_MAP_FILE"
107 #define ADnEDDetPixelMapPrintParamString "ADNED_DET_PIXEL_MAP_PRINT"
108 #define ADnEDDetPixelMapEnableParamString "ADNED_DET_PIXEL_MAP_ENABLE"
109 #define ADnEDDetPixelROIStartXParamString "ADNED_DET_PIXEL_ROI_START_X"
110 #define ADnEDDetPixelROISizeXParamString "ADNED_DET_PIXEL_ROI_SIZE_X"
111 #define ADnEDDetPixelROIStartYParamString "ADNED_DET_PIXEL_ROI_START_Y"
112 #define ADnEDDetPixelROISizeYParamString "ADNED_DET_PIXEL_ROI_SIZE_Y"
113 #define ADnEDDetPixelSizeXParamString "ADNED_DET_PIXEL_SIZE_X"
114 #define ADnEDDetPixelROIEnableParamString "ADNED_DET_PIXEL_ROI_ENABLE"
115 #define ADnEDTOFMaxParamString "ADNED_TOF_MAX"
116 #define ADnEDAllocSpaceParamString "ADNED_ALLOC_SPACE"
117 #define ADnEDAllocSpaceStatusParamString "ADNED_ALLOC_SPACE_STATUS"
120 asynStatus
ADnEDConfig(
const char *portName,
int maxBuffers,
size_t maxMemory,
int debug);
133 ADnED(
const char *portName,
int maxBuffers,
size_t maxMemory,
int debug);
140 size_t nChars,
size_t *nActual);
141 virtual void report(FILE *fp,
int details);
147 void eventHandler(std::tr1::shared_ptr<epics::pvData::PVStructure>
const &pv_struct, epicsUInt32 channelID);
154 void printPixelMap(epicsUInt32 det);
155 void printTofTrans(epicsUInt32 det);
156 asynStatus checkPixelMap(epicsUInt32 det);
157 asynStatus setupChannelMonitor(
const char *pvName,
int channel);
158 bool matchTransFile(
const int asynParam, epicsUInt32 &transIndex);
159 bool matchTransInt(
const int asynParam, epicsUInt32 &transIndex);
160 bool matchTransFloat(
const int asynParam, epicsUInt32 &transIndex);
161 void resetTOFArray(epicsUInt32 det);
164 static const epicsInt32 s_ADNED_MAX_STRING_SIZE;
165 static const epicsInt32 s_ADNED_MAX_DETS;
166 static const epicsInt32 s_ADNED_MAX_CHANNELS;
167 static const epicsUInt32 s_ADNED_ALLOC_STATUS_OK;
168 static const epicsUInt32 s_ADNED_ALLOC_STATUS_REQ;
169 static const epicsUInt32 s_ADNED_ALLOC_STATUS_FAIL;
170 static const epicsUInt32 s_ADNED_2D_PLOT_XY;
171 static const epicsUInt32 s_ADNED_2D_PLOT_XTOF;
172 static const epicsUInt32 s_ADNED_2D_PLOT_YTOF;
173 static const epicsUInt32 s_ADNED_2D_PLOT_PIXELIDTOF;
176 epicsUInt32 m_acquiring;
180 epicsUInt32 m_pulseCounter;
181 epicsFloat64 m_pChargeInt;
182 epicsTimeStamp m_nowTime;
183 double m_nowTimeSecs;
184 double m_lastTimeSecs;
189 epicsUInt32 m_dataMaxSize;
190 epicsUInt32 m_bufferMaxSize;
191 epicsUInt32 m_tofMax;
192 epics::pvData::PVTimeStamp m_PVTimeStamp;
213 epicsUInt32 m_eventsSinceLastUpdate;
217 epics::pvAccess::ChannelProvider::shared_pointer p_ChannelProvider;
218 std::tr1::shared_ptr<nEDChannel::nEDChannelRequester> p_ChannelRequester;
219 std::tr1::shared_ptr<nEDChannel::nEDMonitorRequester> p_MonitorRequester[
ADNED_MAX_CHANNELS];
226 const epicsUInt32 m_debug;
228 epicsEventId m_startEvent;
229 epicsEventId m_stopEvent;
230 epicsEventId m_startFrame;
231 epicsEventId m_stopFrame;
235 #define ADNED_FIRST_DRIVER_COMMAND ADnEDFirstParam
240 int ADnEDEventDebugParam;
241 int ADnEDSeqCounterParam;
242 int ADnEDPulseCounterParam;
243 int ADnEDEventRateParam;
245 int ADnEDSeqIDMissingParam;
246 int ADnEDSeqIDNumMissingParam;
247 int ADnEDBadTimeStampParam;
248 int ADnEDPChargeParam;
249 int ADnEDPChargeIntParam;
250 int ADnEDEventUpdatePeriodParam;
251 int ADnEDFrameUpdatePeriodParam;
252 int ADnEDNumChannelsParam;
253 int ADnEDPVNameParam;
254 int ADnEDNumDetParam;
255 int ADnEDDetPixelNumStartParam;
256 int ADnEDDetPixelNumEndParam;
257 int ADnEDDetPixelNumSizeParam;
258 int ADnEDDetTOFNumBinsParam;
259 int ADnEDDet2DTypeParam;
260 int ADnEDDetNDArrayStartParam;
261 int ADnEDDetNDArrayEndParam;
262 int ADnEDDetNDArraySizeParam;
263 int ADnEDDetNDArrayTOFStartParam;
264 int ADnEDDetNDArrayTOFEndParam;
265 int ADnEDDetEventRateParam;
266 int ADnEDDetEventTotalParam;
267 int ADnEDDetTOFROIStartParam;
268 int ADnEDDetTOFROISizeParam;
269 int ADnEDDetTOFROIEnableParam;
270 int ADnEDDetTOFArrayResetParam;
272 int ADnEDDetTOFTransFile0Param;
273 int ADnEDDetTOFTransFile1Param;
274 int ADnEDDetTOFTransFile2Param;
275 int ADnEDDetTOFTransFile3Param;
276 int ADnEDDetTOFTransFile4Param;
277 int ADnEDDetTOFTransFile5Param;
278 int ADnEDDetTOFTransInt0Param;
279 int ADnEDDetTOFTransInt1Param;
280 int ADnEDDetTOFTransInt2Param;
281 int ADnEDDetTOFTransInt3Param;
282 int ADnEDDetTOFTransInt4Param;
283 int ADnEDDetTOFTransInt5Param;
284 int ADnEDDetTOFTransFloat0Param;
285 int ADnEDDetTOFTransFloat1Param;
286 int ADnEDDetTOFTransFloat2Param;
287 int ADnEDDetTOFTransFloat3Param;
288 int ADnEDDetTOFTransFloat4Param;
289 int ADnEDDetTOFTransFloat5Param;
290 int ADnEDDetTOFTransPrintParam;
291 int ADnEDDetTOFTransDebugParam;
292 int ADnEDDetTOFTransTypeParam;
293 int ADnEDDetTOFTransOffsetParam;
294 int ADnEDDetTOFTransScaleParam;
296 int ADnEDDetPixelMapFileParam;
297 int ADnEDDetPixelMapPrintParam;
298 int ADnEDDetPixelMapEnableParam;
299 int ADnEDDetPixelROIStartXParam;
300 int ADnEDDetPixelROISizeXParam;
301 int ADnEDDetPixelROIStartYParam;
302 int ADnEDDetPixelROISizeYParam;
303 int ADnEDDetPixelSizeXParam;
304 int ADnEDDetPixelROIEnableParam;
305 int ADnEDTOFMaxParam;
306 int ADnEDAllocSpaceParam;
307 int ADnEDAllocSpaceStatusParam;
309 #define ADNED_LAST_DRIVER_COMMAND ADnEDLastParam
313 #define NUM_DRIVER_PARAMS (&ADNED_LAST_DRIVER_COMMAND - &ADNED_FIRST_DRIVER_COMMAND + 1)
asynStatus ADnEDConfig(const char *portName, int maxBuffers, size_t maxMemory, int debug)
The following functions have C linkage, and can be called directly or from iocsh.
Definition: ADnED.cpp:1834
asynStatus ADnEDCreateFactory()
Config function for IOC shell.
Definition: ADnED.cpp:1852
#define ADNED_MAX_CHANNELS
Definition: ADnEDGlobals.h:4
#define ADNED_MAX_DETS
Definition: ADnEDGlobals.h:3
Class from which areaDetector drivers are directly derived.
Definition: ADDriver.h:132
virtual void report(FILE *fp, int details)
Report status of the driver.
Definition: ADnED.cpp:402
virtual asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t nChars, size_t *nActual)
Reimplementing this function from asynNDArrayDriver to deal with strings.
Definition: ADnED.cpp:675
void eventHandler(std::tr1::shared_ptr< epics::pvData::PVStructure > const &pv_struct, epicsUInt32 channelID)
Event handler callback for monitor.
Definition: ADnED.cpp:981
asynStatus allocArray(void)
Allocate local storage for event handler.
Definition: ADnED.cpp:1318
virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value)
Reimplementing this function from ADDriver to deal with integer values.
Definition: ADnED.cpp:423
static asynStatus createFactory()
Class function to create a PVAccess client factory.
Definition: ADnED.cpp:380
void frameTask(void)
Frame readout task.
Definition: ADnED.cpp:1716
virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value)
Reimplementing this function from ADDriver to deal with floating point values.
Definition: ADnED.cpp:620
ADnED(const char *portName, int maxBuffers, size_t maxMemory, int debug)
Constructor.
Definition: ADnED.cpp:67
virtual ~ADnED()
Destructor.
Definition: ADnED.cpp:372
asynStatus clearParams(void)
Clear parameters and data members on a acqusition start.
Definition: ADnED.cpp:1429
void eventTask(void)
Event readout task.
Definition: ADnED.cpp:1477
list value
Definition: makeDbAndEdl.py:234