areaDetector 1-9
|
00001 /* pvCamSrc.h 00002 * 00003 * This is a driver for a PVCam (PI/Acton) detector. 00004 * 00005 * Author: Brian Tieman 00006 * 00007 * Created: 06/14/2008 00008 * 00009 */ 00010 00011 #ifndef PVCAMSRC_H 00012 #define PVCAMSRC_H 00013 00014 #include <stddef.h> 00015 #include <stdlib.h> 00016 #include <stdarg.h> 00017 #include <math.h> 00018 #include <stdio.h> 00019 #include <errno.h> 00020 #include <string.h> 00021 00022 #include <epicsTime.h> 00023 #include <epicsThread.h> 00024 #include <epicsEvent.h> 00025 #include <epicsMutex.h> 00026 #include <epicsString.h> 00027 #include <epicsStdio.h> 00028 #include <epicsMutex.h> 00029 #include <cantProceed.h> 00030 00031 #include "ADDriver.h" 00032 00033 #include "drvPVCam.h" 00034 00035 /* PM FILES */ 00036 #include "master.h" 00037 #include "pvcam.h" 00038 00039 //______________________________________________________________________________________________ 00040 00041 static const char *driverName = "drvPVCam"; 00042 00043 //______________________________________________________________________________________________ 00044 00046 #define POLL_TIME 0.01 00047 00048 #define NUM_PV_CAM_PARAMS (sizeof(PVCamParamString)/sizeof(PVCamParamString[0])) 00049 00050 #define MAX_DETECTORS_SUPPORTED 3 00051 #define MAX_SPEEDS_SUPPORTED 5 00052 00053 //______________________________________________________________________________________________ 00054 00055 #define PVCamInitDetectorString "PVCAM_INITIALIZE_DETECTOR" 00056 #define PVCamSlot1CamString "PVCAM_SLOT1" 00057 #define PVCamSlot2CamString "PVCAM_SLOT2" 00058 #define PVCamSlot3CamString "PVCAM_SLOT3" 00059 #define PVCamDetectorSelectedString "PVCAM_DETECTORSELECTED" 00060 #define PVCamChipNameRBVString "PVCAM_CHIPNAME" 00061 #define PVCamNumParallelPixelsRBVString "PVCAM_NUMPARALLELPIXELS" 00062 #define PVCamNumSerialPixelsRBVString "PVCAM_NUMSERIALPIXELS" 00063 #define PVCamPixelParallelSizeRBVString "PVCAM_PIXELPARALLELSIZE" 00064 #define PVCamPixelSerialSizeRBVString "PVCAM_PIXELSERIALSIZE" 00065 #define PVCamChipHeightMMRBVString "PVCAM_CHIPHEIGHT" 00066 #define PVCamChipWidthMMRBVString "PVCAM_CHIPWIDTH" 00067 #define PVCamPixelParallelDistRBVString "PVCAM_PIXELPARALLELDIST" 00068 #define PVCamPixelSerialDistRBVString "PVCAM_PIXELSERIALDIST" 00069 #define PVCamPostMaskRBVString "PVCAM_POSTMASK" 00070 #define PVCamPreMaskRBVString "PVCAM_PREMASK" 00071 #define PVCamPostScanRBVString "PVCAM_POSTSCAN" 00072 #define PVCamPreScanRBVString "PVCAM_PRESCAN" 00073 #define PVCamNumPortsRBVString "PVCAM_NUMPORTS" 00074 #define PVCamFullWellCapacityRBVString "PVCAM_FULLWELLCAPACITY" 00075 #define PVCamFrameTransferCapableRBVString "PVCAM_FRAMETRANSFERCAPABLE" 00076 #define PVCamNumSpeedTableEntriesRBVString "PVCAM_NUMSPEEDTABLEENTRIES" 00077 #define PVCamSpeedTableIndexString "PVCAM_SPEEDTABLEINDEX" 00078 #define PVCamSpeedTableIndexRBVString "PVCAM_SPEEDTABLEINDEX_RBV" 00079 #define PVCamBitDepthRBVString "PVCAM_BITDEPTH" 00080 #define PVCamPixelTimeRBVString "PVCAM_PIXELTIME" 00081 #define PVCamGainIndexString "PVCAM_GAININDEX" 00082 #define PVCamGainIndexRBVString "PVCAM_GAININDEX_RBV" 00083 #define PVCamMaxGainIndexRBVString "PVCAM_MAXGAININDEX" 00084 #define PVCamMinShutterOpenDelayRBVString "PVCAM_MINSHUTTEROPENDELAY" 00085 #define PVCamMaxShutterOpenDelayRBVString "PVCAM_MAXSHUTTEROPENDELAY" 00086 #define PVCamMinShutterCloseDelayRBVString "PVCAM_MINSHUTTERCLOSEDELAY" 00087 #define PVCamMaxShutterCloseDelayRBVString "PVCAM_MAXSHUTTERCLOSEDELAY" 00088 #define PVCamShutterOpenDelayString "PVCAM_SHUTTEROPENDELAY" 00089 #define PVCamShutterOpenDelayRBVString "PVCAM_SHUTTEROPENDELAY_RBV" 00090 #define PVCamShutterCloseDelayString "PVCAM_SHUTTERCLOSEDELAY" 00091 #define PVCamShutterCloseDelayRBVString "PVCAM_SHUTTERCLOSEDELAY_RBV" 00092 #define PVCamMeasuredTemperatureRBVString "PVCAM_MEASUREDTEMPERATURE" 00093 #define PVCamMinTemperatureRBVString "PVCAM_MINTEMPERATURE" 00094 #define PVCamMaxTemperatureRBVString "PVCAM_MAXTEMPERATURE" 00095 #define PVCamSetTemperatureString "PVCAM_SETTEMPERATURE" 00096 #define PVCamSetTemperatureRBVString "PVCAM_SETTEMPERATURE_RBV" 00097 #define PVCamDetectorModeString "PVCAM_DETECTORMODE" 00098 #define PVCamDetectorModeRBVString "PVCAM_DETECTORMODE_RBV" 00099 #define PVCamTriggerModeString "PVCAM_TRIGGERMODE" 00100 #define PVCamTriggerModeRBVString "PVCAM_TRIGGERMODE_RBV" 00101 #define PVCamTriggerEdgeString "PVCAM_TRIGGEREDGE" 00102 #define PVCamTriggerEdgeRBVString "PVCAM_TRIGGEREDGE_RBV" 00103 #define PVCamCamFirmwareVersRBVString "PVCAM_CAMFIRMWAREVERS_RBV" 00104 #define PVCamPCIFWVersRBVString "PVCAM_PCIFWVERS_RBV" 00105 #define PVCamHeadSerialNumRBVString "PVCAM_HEADSERNUM_RBV" 00106 #define PVCamSerialNumRBVString "PVCAM_SERIALNUM_RBV" 00107 #define PVCamPVCamVersRBVString "PVCAM_PVCAMVERS_RBV" 00108 #define PVCamDevDrvVersRBVString "PVCAM_DEVDRVVERS_RBV" 00109 00110 //______________________________________________________________________________________________ 00111 00112 class pvCam : public ADDriver 00113 { 00114 public: 00115 int imagesRemaining; 00116 epicsEventId startEventId, 00117 stopEventId; 00118 NDArray *pRaw; 00119 00120 pvCam(const char *portName, int maxSizeX, int maxSizeY, NDDataType_t dataType, 00121 int maxBuffers, size_t maxMemory, int priority, int stackSize); 00122 00123 /* These are the methods that we override from ADDriver */ 00124 virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value); 00125 virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value); 00126 void report(FILE *fp, int details); 00127 00128 /* These are the methods that are new to this class */ 00129 template <typename epicsType> int computeArray(int maxSizeX, int maxSizeY); 00130 00131 int allocateBuffer(); 00132 int computeImage(); 00133 00134 void pvCamAcquisitionTask(); 00135 void pvCamMonitorTask(); 00136 00137 ~pvCam (); 00138 00139 protected: 00140 int PVCamInitDetector; 00141 #define FIRST_PVCAM_PARAM PVCamInitDetector 00142 int PVCamSlot1Cam; 00143 int PVCamSlot2Cam; 00144 int PVCamSlot3Cam; 00145 int PVCamDetectorSelected; 00146 int PVCamChipNameRBV; 00147 int PVCamNumParallelPixelsRBV; 00148 int PVCamNumSerialPixelsRBV; 00149 int PVCamPixelParallelSizeRBV; 00150 int PVCamPixelSerialSizeRBV; 00151 int PVCamChipHeightMMRBV; 00152 int PVCamChipWidthMMRBV; 00153 int PVCamPixelParallelDistRBV; 00154 int PVCamPixelSerialDistRBV; 00155 int PVCamPostMaskRBV; 00156 int PVCamPreMaskRBV; 00157 int PVCamPostScanRBV; 00158 int PVCamPreScanRBV; 00159 int PVCamNumPortsRBV; 00160 int PVCamFullWellCapacityRBV; 00161 int PVCamFrameTransferCapableRBV; 00162 int PVCamNumSpeedTableEntriesRBV; 00163 int PVCamSpeedTableIndex; 00164 int PVCamSpeedTableIndexRBV; 00165 int PVCamBitDepthRBV; 00166 int PVCamPixelTimeRBV; 00167 int PVCamGainIndex; 00168 int PVCamGainIndexRBV; 00169 int PVCamMaxGainIndexRBV; 00170 int PVCamMinShutterOpenDelayRBV; 00171 int PVCamMaxShutterOpenDelayRBV; 00172 int PVCamMinShutterCloseDelayRBV; 00173 int PVCamMaxShutterCloseDelayRBV; 00174 int PVCamShutterOpenDelay; 00175 int PVCamShutterOpenDelayRBV; 00176 int PVCamShutterCloseDelay; 00177 int PVCamShutterCloseDelayRBV; 00178 int PVCamMeasuredTemperatureRBV; 00179 int PVCamMinTemperatureRBV; 00180 int PVCamMaxTemperatureRBV; 00181 int PVCamSetTemperature; 00182 int PVCamSetTemperatureRBV; 00183 int PVCamDetectorMode; 00184 int PVCamDetectorModeRBV; 00185 int PVCamTriggerMode; 00186 int PVCamTriggerModeRBV; 00187 int PVCamTriggerEdge; 00188 int PVCamTriggerEdgeRBV; 00189 int PVCamCamFirmwareVersRBV; 00190 int PVCamPCIFWVersRBV; 00191 int PVCamHeadSerialNumRBV; 00192 int PVCamSerialNumRBV; 00193 int PVCamPVCamVersRBV; 00194 int PVCamDevDrvVersRBV; 00195 #define LAST_PVCAM_PARAM PVCamDevDrvVersRBV 00196 00197 private: 00198 int16 numDetectorsInstalled, 00199 detectorSelected, 00200 detectorHandle; 00201 00202 char *detectorList[5]; 00203 00204 unsigned short *rawData; 00205 00206 void outputErrorMessage (const char *functionName, char *appMessage); 00207 00208 void initializeDetectorInterface (void); 00209 void selectDetector (int selectedDetector); 00210 00211 void queryCurrentSettings (void); 00212 00213 void initializeDetector (void); 00214 00215 int getAcquireStatus (void); 00216 bool tempAvailable; 00217 }; 00218 00219 #define NUM_PVCAM_PARAMS ((int)(&LAST_PVCAM_PARAM - &FIRST_PVCAM_PARAM + 1)) 00220 00221 //______________________________________________________________________________________________ 00222 00223 #endif