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