areaDetector  3-5-0
EPICS areaDetector framework
pvCamSrc.h
Go to the documentation of this file.
1 /* pvCamSrc.h
2  *
3  * This is a driver for a PVCam (PI/Acton) detector.
4  *
5  * Author: Brian Tieman
6  *
7  * Created: 06/14/2008
8  *
9  */
10 
11 #ifndef PVCAMSRC_H
12 #define PVCAMSRC_H
13 
14 #include <stddef.h>
15 #include <stdlib.h>
16 #include <stdarg.h>
17 #include <math.h>
18 #include <stdio.h>
19 #include <errno.h>
20 #include <string.h>
21 
22 #include <epicsTime.h>
23 #include <epicsThread.h>
24 #include <epicsEvent.h>
25 #include <epicsMutex.h>
26 #include <epicsString.h>
27 #include <epicsStdio.h>
28 #include <epicsMutex.h>
29 #include <cantProceed.h>
30 
31 #include "ADDriver.h"
32 
33 #include "drvPVCam.h"
34 
35 /* PM FILES */
36 #include "master.h"
37 #include "pvcam.h"
38 
39 //______________________________________________________________________________________________
40 
41 static const char *driverName = "drvPVCam";
42 
43 //______________________________________________________________________________________________
44 
46 #define POLL_TIME 0.01
47 
48 #define NUM_PV_CAM_PARAMS (sizeof(PVCamParamString)/sizeof(PVCamParamString[0]))
49 
50 #define MAX_DETECTORS_SUPPORTED 3
51 #define MAX_SPEEDS_SUPPORTED 5
52 
53 //______________________________________________________________________________________________
54 
55 #define PVCamInitDetectorString "PVCAM_INITIALIZE_DETECTOR"
56 #define PVCamSlot1CamString "PVCAM_SLOT1"
57 #define PVCamSlot2CamString "PVCAM_SLOT2"
58 #define PVCamSlot3CamString "PVCAM_SLOT3"
59 #define PVCamDetectorSelectedString "PVCAM_DETECTORSELECTED"
60 #define PVCamChipNameRBVString "PVCAM_CHIPNAME"
61 #define PVCamNumParallelPixelsRBVString "PVCAM_NUMPARALLELPIXELS"
62 #define PVCamNumSerialPixelsRBVString "PVCAM_NUMSERIALPIXELS"
63 #define PVCamPixelParallelSizeRBVString "PVCAM_PIXELPARALLELSIZE"
64 #define PVCamPixelSerialSizeRBVString "PVCAM_PIXELSERIALSIZE"
65 #define PVCamChipHeightMMRBVString "PVCAM_CHIPHEIGHT"
66 #define PVCamChipWidthMMRBVString "PVCAM_CHIPWIDTH"
67 #define PVCamPixelParallelDistRBVString "PVCAM_PIXELPARALLELDIST"
68 #define PVCamPixelSerialDistRBVString "PVCAM_PIXELSERIALDIST"
69 #define PVCamPostMaskRBVString "PVCAM_POSTMASK"
70 #define PVCamPreMaskRBVString "PVCAM_PREMASK"
71 #define PVCamPostScanRBVString "PVCAM_POSTSCAN"
72 #define PVCamPreScanRBVString "PVCAM_PRESCAN"
73 #define PVCamNumPortsRBVString "PVCAM_NUMPORTS"
74 #define PVCamFullWellCapacityRBVString "PVCAM_FULLWELLCAPACITY"
75 #define PVCamFrameTransferCapableRBVString "PVCAM_FRAMETRANSFERCAPABLE"
76 #define PVCamNumSpeedTableEntriesRBVString "PVCAM_NUMSPEEDTABLEENTRIES"
77 #define PVCamSpeedTableIndexString "PVCAM_SPEEDTABLEINDEX"
78 #define PVCamSpeedTableIndexRBVString "PVCAM_SPEEDTABLEINDEX_RBV"
79 #define PVCamBitDepthRBVString "PVCAM_BITDEPTH"
80 #define PVCamPixelTimeRBVString "PVCAM_PIXELTIME"
81 #define PVCamGainIndexString "PVCAM_GAININDEX"
82 #define PVCamGainIndexRBVString "PVCAM_GAININDEX_RBV"
83 #define PVCamMaxGainIndexRBVString "PVCAM_MAXGAININDEX"
84 #define PVCamMinShutterOpenDelayRBVString "PVCAM_MINSHUTTEROPENDELAY"
85 #define PVCamMaxShutterOpenDelayRBVString "PVCAM_MAXSHUTTEROPENDELAY"
86 #define PVCamMinShutterCloseDelayRBVString "PVCAM_MINSHUTTERCLOSEDELAY"
87 #define PVCamMaxShutterCloseDelayRBVString "PVCAM_MAXSHUTTERCLOSEDELAY"
88 #define PVCamShutterOpenDelayString "PVCAM_SHUTTEROPENDELAY"
89 #define PVCamShutterOpenDelayRBVString "PVCAM_SHUTTEROPENDELAY_RBV"
90 #define PVCamShutterCloseDelayString "PVCAM_SHUTTERCLOSEDELAY"
91 #define PVCamShutterCloseDelayRBVString "PVCAM_SHUTTERCLOSEDELAY_RBV"
92 #define PVCamMeasuredTemperatureRBVString "PVCAM_MEASUREDTEMPERATURE"
93 #define PVCamMinTemperatureRBVString "PVCAM_MINTEMPERATURE"
94 #define PVCamMaxTemperatureRBVString "PVCAM_MAXTEMPERATURE"
95 #define PVCamSetTemperatureString "PVCAM_SETTEMPERATURE"
96 #define PVCamSetTemperatureRBVString "PVCAM_SETTEMPERATURE_RBV"
97 #define PVCamDetectorModeString "PVCAM_DETECTORMODE"
98 #define PVCamDetectorModeRBVString "PVCAM_DETECTORMODE_RBV"
99 #define PVCamTriggerModeString "PVCAM_TRIGGERMODE"
100 #define PVCamTriggerModeRBVString "PVCAM_TRIGGERMODE_RBV"
101 #define PVCamTriggerEdgeString "PVCAM_TRIGGEREDGE"
102 #define PVCamTriggerEdgeRBVString "PVCAM_TRIGGEREDGE_RBV"
103 #define PVCamCamFirmwareVersRBVString "PVCAM_CAMFIRMWAREVERS_RBV"
104 #define PVCamPCIFWVersRBVString "PVCAM_PCIFWVERS_RBV"
105 #define PVCamHeadSerialNumRBVString "PVCAM_HEADSERNUM_RBV"
106 #define PVCamSerialNumRBVString "PVCAM_SERIALNUM_RBV"
107 #define PVCamPVCamVersRBVString "PVCAM_PVCAMVERS_RBV"
108 #define PVCamDevDrvVersRBVString "PVCAM_DEVDRVVERS_RBV"
109 
110 //______________________________________________________________________________________________
111 
114 class pvCam : public ADDriver
115 {
116 public:
118 epicsEventId startEventId,
119  stopEventId;
121 
122  pvCam(const char *portName, int maxSizeX, int maxSizeY, NDDataType_t dataType,
123  int maxBuffers, size_t maxMemory, int priority, int stackSize);
124 
125  /* These are the methods that we override from ADDriver */
126  virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
127  virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value);
128  void report(FILE *fp, int details);
129 
130  /* These are the methods that are new to this class */
131  template <typename epicsType> int computeArray(int maxSizeX, int maxSizeY);
132 
133  int allocateBuffer();
134  int computeImage();
135 
136  void pvCamAcquisitionTask();
137  void pvCamMonitorTask();
138 
139  ~pvCam ();
140 
141 protected:
143  #define FIRST_PVCAM_PARAM PVCamInitDetector
197  #define LAST_PVCAM_PARAM PVCamDevDrvVersRBV
198 
199 private:
200 int16 numDetectorsInstalled,
201  detectorSelected,
202  detectorHandle;
203 
204 char *detectorList[5];
205 
206 unsigned short *rawData;
207 
208  void outputErrorMessage (const char *functionName, const char *appMessage);
209 
210  void initializeDetectorInterface (void);
211  void selectDetector (int selectedDetector);
212 
213  void queryCurrentSettings (void);
214 
215  void initializeDetector (void);
216 
217  int getAcquireStatus (void);
218  bool tempAvailable;
219 
220 };
221 
222 #define NUM_PVCAM_PARAMS ((int)(&LAST_PVCAM_PARAM - &FIRST_PVCAM_PARAM + 1))
223 
224 //______________________________________________________________________________________________
225 
226 #endif
Class from which areaDetector drivers are directly derived.
Definition: ADDriver.h:141
int PVCamTriggerModeRBV
Definition: pvCamSrc.h:188
int PVCamPostMaskRBV
Definition: pvCamSrc.h:157
int PVCamPostScanRBV
Definition: pvCamSrc.h:159
Definition: NDFileHDF5Layout.h:36
pvCam(const char *portName, int maxSizeX, int maxSizeY, NDDataType_t dataType, int maxBuffers, size_t maxMemory, int priority, int stackSize)
Definition: pvCam.cpp:46
NDDataType_t
Enumeration of NDArray data types.
Definition: NDAttribute.h:27
int PVCamPixelParallelSizeRBV
Definition: pvCamSrc.h:151
int PVCamMinShutterOpenDelayRBV
Definition: pvCamSrc.h:172
int PVCamDetectorModeRBV
Definition: pvCamSrc.h:186
virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value)
Called when asyn clients call pasynFloat64->write().
Definition: pvCam.cpp:657
int imagesRemaining
Definition: pvCamSrc.h:117
int PVCamSerialNumRBV
Definition: pvCamSrc.h:194
int allocateBuffer()
Definition: pvCam.cpp:227
int PVCamSpeedTableIndex
Definition: pvCamSrc.h:165
int PVCamShutterOpenDelayRBV
Definition: pvCamSrc.h:177
int PVCamShutterCloseDelayRBV
Definition: pvCamSrc.h:179
int PVCamGainIndexRBV
Definition: pvCamSrc.h:170
int PVCamCamFirmwareVersRBV
Definition: pvCamSrc.h:191
int PVCamNumSerialPixelsRBV
Definition: pvCamSrc.h:150
NDArray * pRaw
Definition: pvCamSrc.h:120
list value
Definition: makeDbAndEdl.py:234
int PVCamFrameTransferCapableRBV
Definition: pvCamSrc.h:163
int PVCamFullWellCapacityRBV
Definition: pvCamSrc.h:162
int PVCamDevDrvVersRBV
Definition: pvCamSrc.h:196
int PVCamTriggerEdgeRBV
Definition: pvCamSrc.h:190
int PVCamMaxGainIndexRBV
Definition: pvCamSrc.h:171
int PVCamNumPortsRBV
Definition: pvCamSrc.h:161
int PVCamTriggerEdge
Definition: pvCamSrc.h:189
int PVCamShutterOpenDelay
Definition: pvCamSrc.h:176
char * portName
The name of this asyn port.
Definition: asynPortDriver.h:179
void pvCamMonitorTask()
Definition: pvCam.cpp:538
int PVCamSlot1Cam
Definition: pvCamSrc.h:144
int PVCamPixelSerialSizeRBV
Definition: pvCamSrc.h:152
~pvCam()
Definition: pvCam.cpp:709
int PVCamShutterCloseDelay
Definition: pvCamSrc.h:178
int PVCamMinShutterCloseDelayRBV
Definition: pvCamSrc.h:174
void pvCamAcquisitionTask()
Definition: pvCam.cpp:386
int PVCamInitDetector
Definition: pvCamSrc.h:142
int PVCamTriggerMode
Definition: pvCamSrc.h:187
int PVCamMaxShutterCloseDelayRBV
Definition: pvCamSrc.h:175
int PVCamHeadSerialNumRBV
Definition: pvCamSrc.h:193
int computeArray(int maxSizeX, int maxSizeY)
Definition: pvCam.cpp:208
int PVCamDetectorMode
Definition: pvCamSrc.h:185
int PVCamPreMaskRBV
Definition: pvCamSrc.h:158
int PVCamPVCamVersRBV
Definition: pvCamSrc.h:195
int PVCamMinTemperatureRBV
Definition: pvCamSrc.h:181
int PVCamMaxTemperatureRBV
Definition: pvCamSrc.h:182
void report(FILE *fp, int details)
Report status of the driver.
Definition: pvCam.cpp:690
int PVCamSetTemperature
Definition: pvCamSrc.h:183
epicsEventId stopEventId
Definition: pvCamSrc.h:118
Driver for Roper (Photometrics and Princeton Instruments) cameras using the PvCam library.
Definition: pvCamSrc.h:114
int PVCamBitDepthRBV
Definition: pvCamSrc.h:167
int PVCamPixelParallelDistRBV
Definition: pvCamSrc.h:155
int PVCamChipWidthMMRBV
Definition: pvCamSrc.h:154
int PVCamNumParallelPixelsRBV
Definition: pvCamSrc.h:149
int PVCamPreScanRBV
Definition: pvCamSrc.h:160
int PVCamPCIFWVersRBV
Definition: pvCamSrc.h:192
int PVCamNumSpeedTableEntriesRBV
Definition: pvCamSrc.h:164
int PVCamSetTemperatureRBV
Definition: pvCamSrc.h:184
int PVCamChipNameRBV
Definition: pvCamSrc.h:148
int PVCamChipHeightMMRBV
Definition: pvCamSrc.h:153
virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value)
Sets an int32 parameter.
Definition: pvCam.cpp:575
int PVCamPixelTimeRBV
Definition: pvCamSrc.h:168
int PVCamPixelSerialDistRBV
Definition: pvCamSrc.h:156
int PVCamSpeedTableIndexRBV
Definition: pvCamSrc.h:166
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition: NDArray.h:92
int PVCamDetectorSelected
Definition: pvCamSrc.h:147
int computeImage()
Definition: pvCam.cpp:246
int PVCamMeasuredTemperatureRBV
Definition: pvCamSrc.h:180
int PVCamGainIndex
Definition: pvCamSrc.h:169
int PVCamMaxShutterOpenDelayRBV
Definition: pvCamSrc.h:173
int PVCamSlot2Cam
Definition: pvCamSrc.h:145
epicsEventId startEventId
Definition: pvCamSrc.h:118
int PVCamSlot3Cam
Definition: pvCamSrc.h:146