areaDetector  3-5-0
EPICS areaDetector framework
FastCCD.h
Go to the documentation of this file.
1 
9 #ifndef FastCCD_H
10 #define FastCCD_H
11 
12 #include "cin.h"
13 #include "ADDriver.h"
14 
15 #define MAX_ENUM_STRING_SIZE 26
16 
17 #define FastCCDPollingPeriodString "POLL_PERIOD"
18 
19 #define FastCCDFramestoreString "FRAMESTORE"
20 
21 #define FastCCDMux1String "FCCD_MUX1"
22 #define FastCCDMux2String "FCCD_MUX2"
23 
24 #define FastCCDFirmwarePathString "FIRMWARE_PATH"
25 #define FastCCDBiasPathString "BIAS_PATH"
26 #define FastCCDClockPathString "CLOCK_PATH"
27 #define FastCCDFCRICPathString "FCRIC_PATH"
28 
29 #define FastCCDFirmwareUploadString "FIRMWARE_UPLOAD"
30 #define FastCCDClockUploadString "CLOCK_UPLOAD"
31 #define FastCCDBiasUploadString "BIAS_UPLOAD"
32 #define FastCCDFCRICUploadString "FCRIC_UPLOAD"
33 
34 #define FastCCDPowerString "CIN_POWER"
35 #define FastCCDFPPowerString "CIN_FP_POWER"
36 #define FastCCDCameraPowerString "CAMERA_POWER"
37 #define FastCCDCameraPowerModeString "CAMERA_POWER_MODE"
38 
39 #define FastCCDBiasString "BIAS"
40 #define FastCCDClocksString "CLOCKS"
41 
42 #define FastCCDFPGAStatusString "FPGA_STATUS"
43 #define FastCCDDCMStatusString "DCM_STATUS"
44 
45 #define FastCCDBaseBoardIDString "BASE_BOARD_ID"
46 #define FastCCDBaseSerialNumString "BASE_SERIAL_NUM"
47 #define FastCCDBaseFPGAVersionString "BASE_FPGA_VER"
48 #define FastCCDFabBoardIDString "FAB_BOARD_ID"
49 #define FastCCDFabSerialNumString "FAB_SERIAL_NUM"
50 #define FastCCDFabFPGAVersionString "FAB_FPGA_VER"
51 
52 #define FastCCDStatusHBString "STATUS_HB"
53 
54 #define FastCCDBadPckString "BAD_PCK"
55 #define FastCCDDroppedPckString "DROPPED_PCK"
56 #define FastCCDLastFrameString "LAST_FRAME"
57 #define FastCCDResetStatsString "RESET_STATS"
58 #define FastCCDPacketBufferString "PACKET_BUFFER"
59 #define FastCCDFrameBufferString "FRAME_BUFFER"
60 
61 #define FastCCDOverscanRowsString "OVERSCAN_ROWS"
62 #define FastCCDOverscanColsString "OVERSCAN_COLS"
63 
64 #define FastCCDFclkString "FCLK"
65 
66 #define FastCCDFCRICGainString "FCRIC_GAIN"
67 #define FastCCDFCRICClampString "FCRIC_CLAMP"
68 
69 #define FastCCDVBus12V0String "VBUS_12V0"
70 #define FastCCDVMgmt3v3String "VMGMT_3V3"
71 #define FastCCDVMgmt2v5String "VMGMT_2V5"
72 #define FastCCDVMgmt1v2String "VMGMT_1V2"
73 #define FastCCDVEnet1v0String "VENET_1V0"
74 #define FastCCDVS3E3v3String "VS3E_3V3"
75 #define FastCCDVGen3v3String "VGEN_3V3"
76 #define FastCCDVGen2v5String "VGEN_2V5"
77 #define FastCCDV60v9String "V6_0V9"
78 #define FastCCDV61v0String "V6_1V0"
79 #define FastCCDV62v5String "V6_2V5"
80 #define FastCCDVFpString "VFP"
81 
82 #define FastCCDIBus12V0String "IBUS_12V0"
83 #define FastCCDIMgmt3v3String "IMGMT_3V3"
84 #define FastCCDIMgmt2v5String "IMGMT_2V5"
85 #define FastCCDIMgmt1v2String "IMGMT_1V2"
86 #define FastCCDIEnet1v0String "IENET_1V0"
87 #define FastCCDIS3E3v3String "IS3E_3V3"
88 #define FastCCDIGen3v3String "IGEN_3V3"
89 #define FastCCDIGen2v5String "IGEN_2V5"
90 #define FastCCDI60v9String "I6_0V9"
91 #define FastCCDI61v0String "I6_1V0"
92 #define FastCCDI62v5String "I6_2V5"
93 #define FastCCDIFpString "IFP"
94 
95 #define FastCCDBiasPosHString "BIAS_POSH"
96 #define FastCCDBiasNegHString "BIAS_NEGH"
97 #define FastCCDBiasPosRGString "BIAS_POSRG"
98 #define FastCCDBiasNegRGString "BIAS_NEGRG"
99 #define FastCCDBiasPosSWString "BIAS_POSSW"
100 #define FastCCDBiasNegSWString "BIAS_NEGSW"
101 #define FastCCDBiasPosVString "BIAS_POSV"
102 #define FastCCDBiasNegVString "BIAS_NEGV"
103 #define FastCCDBiasPosTGString "BIAS_POSTG"
104 #define FastCCDBiasNegTGString "BIAS_NEGTG"
105 #define FastCCDBiasPosVFString "BIAS_POSVF"
106 #define FastCCDBiasNegVFString "BIAS_NEGVF"
107 #define FastCCDBiasNEDGEString "BIAS_NEDGE"
108 #define FastCCDBiasOTGString "BIAS_OTG"
109 #define FastCCDBiasVDDRString "BIAS_VDDR"
110 #define FastCCDBiasVDDOutString "BIAS_VDDOUT"
111 #define FastCCDBiasBufBaseString "BIAS_BUFBASE"
112 #define FastCCDBiasBufDeltaString "BIAS_BUFDELTA"
113 #define FastCCDBiasSpare1String "BIAS_SPARE1"
114 #define FastCCDBiasSpare2String "BIAS_SPARE2"
115 
116 #define FastCCDBiasPosHWString "BIAS_POSH_W"
117 #define FastCCDBiasNegHWString "BIAS_NEGH_W"
118 #define FastCCDBiasPosRGWString "BIAS_POSRG_W"
119 #define FastCCDBiasNegRGWString "BIAS_NEGRG_W"
120 #define FastCCDBiasPosSWWString "BIAS_POSSW_W"
121 #define FastCCDBiasNegSWWString "BIAS_NEGSW_W"
122 #define FastCCDBiasPosVWString "BIAS_POSV_W"
123 #define FastCCDBiasNegVWString "BIAS_NEGV_W"
124 #define FastCCDBiasPosTGWString "BIAS_POSTG_W"
125 #define FastCCDBiasNegTGWString "BIAS_NEGTG_W"
126 #define FastCCDBiasPosVFWString "BIAS_POSVF_W"
127 #define FastCCDBiasNegVFWString "BIAS_NEGVF_W"
128 #define FastCCDBiasNEDGEWString "BIAS_NEDGE_W"
129 #define FastCCDBiasOTGWString "BIAS_OTG_W"
130 #define FastCCDBiasVDDRWString "BIAS_VDDR_W"
131 #define FastCCDBiasVDDOutWString "BIAS_VDDOUT_W"
132 #define FastCCDBiasBufBaseWString "BIAS_BUFBASE_W"
133 #define FastCCDBiasBufDeltaWString "BIAS_BUFDELTA_W"
134 #define FastCCDBiasSpare1WString "BIAS_SPARE1_W"
135 #define FastCCDBiasSpare2WString "BIAS_SPARE2_W"
136 
137 #define FastCCDBiasWriteVString "BIAS_WRITEV"
138 
139 #define FastCCDFOTestString "FO_TEST"
140 
141 #define FastCCDBootString "BOOT"
142 #define FastCCDSendBiasString "SEND_BIAS"
143 #define FastCCDSendFCRICString "SEND_FCRIC"
144 
145 #define FastCCDTimingModeString "TIMING_MODE"
146 #define FastCCDSendTimingString "SEND_TIMING"
147 #define FastCCDTimingNameString "TIMING_NAME"
148 #define FastCCDTimingName0String "TIMING_NAME_0"
149 #define FastCCDTimingName1String "TIMING_NAME_1"
150 #define FastCCDTimingName2String "TIMING_NAME_2"
151 #define FastCCDTimingName3String "TIMING_NAME_3"
152 #define FastCCDTimingName4String "TIMING_NAME_4"
153 #define FastCCDTimingName5String "TIMING_NAME_5"
154 #define FastCCDTimingName6String "TIMING_NAME_6"
155 #define FastCCDTimingName7String "TIMING_NAME_7"
156 #define FastCCDTimingName8String "TIMING_NAME_8"
157 #define FastCCDTimingName9String "TIMING_NAME_9"
158 
159 //C Function prototypes to tie in with EPICS
160 static void FastCCDStatusTaskC(void *drvPvt);
161 static void FastCCDDataStatsTaskC(void *drvPvt);
162 static void FastCCDDetectorWaitTaskC(void *drvPvt);
163 static void exitHandler(void *drvPvt);
164 static void messageCallbackC(const char *message, int severity, void *ptr);
165 static void allocateImageC(cin_data_frame_t *frame, void *ptr);
166 static void processImageC(cin_data_frame_t *frame, void *ptr);
167 
172 class FastCCD : public ADDriver {
173  public:
174  FastCCD(const char *portName, int maxBuffers, size_t maxMemory,
175  int priority, int stackSize, int packetBuffer, int imageBuffer,
176  const char *baseIP, const char *fabricIP, const char *fabricMAC);
177 
178  ~FastCCD();
179 
180  /* Overload the connect and disconnect routines */
181 
182  asynStatus connect(asynUser *pasynUser);
183  asynStatus disconnect(asynUser *pasynUser);
184 
185  /* These are the methods that we override from ADDriver */
186  asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
187  asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value);
188  asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t nc, size_t *na);
189 
190  // Filename to report driver info
191  void report(FILE *fp, int details);
192 
193  // Should be private, but are called from C so must be public
194  void statusTask(void);
195  void dataStatsTask(void);
196  void detectorWaitTask(void);
197 
198  void messageCallback(const char *message, int severity);
199  void allocateImage(cin_data_frame_t *frame);
200  void processImage(cin_data_frame_t *frame);
201 
202  protected:
203  // Mux Variables
205  #define FIRST_FASTCCD_PARAM FastCCDMux1
207 
208  // Driver Parameters
210 
211  // Framestore Flag
213 
214  // Overscan
217 
218  // FCLK
220 
221  // FCRIC
224 
225  // File upload
234 
235  // Power Status
240 
241  // Bias and Clocks
244 
245  // Frame FPGA
248 
249  // Versioning Info
256 
257  // Status HB
259 
260  // Data packet stats
261 
268 
269  // Fiber Optic Test Mode
271 
272  // New boot mode
277 
278  // Timing Name Strings
282 
283  // Bias Settings
326 
327  // Power monitor Variables
354  #define LAST_FASTCCD_PARAM FastCCDIFp
355 
356  private:
357 
358  int cinPacketBuffer;
359  int cinImageBuffer;
360 
361  char *cinBaseIP;
362  char *cinFabricIP;
363  char *cinFabricMAC;
364 
365  int firstFrameFlag;
366 
367  // Connect / Disconnect
368 
369  asynStatus disconnectCamera();
370  asynStatus connectCamera();
371 
372  asynStatus setupAcquisition();
373 
374  epicsEventId statusEvent;
375  epicsEventId dataStatsEvent;
376  epicsEventId dataEvent;
377  epicsEventId detectorWaitEvent;
378 
379  double statusPollingPeriod;
380  double dataStatsPollingPeriod;
381 
382  int framesRemaining;
383  int freeRun;
384 
385  struct timespec lastFrameTimestamp;
386 
387  void getCameraStatus(int first_run);
388  int uploadConfig(int status, int path);
389  int uploadFirmware(void);
390 
391 protected:
393  cin_ctl_t cin_ctl;
394  cin_data_t cin_data;
395 };
396 
397 #define NUM_FastCCD_DET_PARAMS ((int)(&LAST_FASTCCD_PARAM- &FIRST_FASTCCD_PARAM + 1))
398 
399 #endif //FastCCD_H
400 
int FastCCDFCRICGain
Definition: FastCCD.h:222
int FastCCDBiasSpare2
Definition: FastCCD.h:303
int FastCCDFCRICPath
Definition: FastCCD.h:233
int FastCCDVEnet1v0
Definition: FastCCD.h:334
int FastCCDBiasNegRG
Definition: FastCCD.h:287
int FastCCDI62v5
Definition: FastCCD.h:352
Class from which areaDetector drivers are directly derived.
Definition: ADDriver.h:141
int FastCCDFramestore
Definition: FastCCD.h:212
int FastCCDBiasPath
Definition: FastCCD.h:231
int FastCCDVMgmt3v3
Definition: FastCCD.h:331
int FastCCDBiasNegTG
Definition: FastCCD.h:293
int FastCCDBadPck
Definition: FastCCD.h:262
void report(FILE *fp, int details)
Report status of the driver.
Definition: FastCCD.cpp:821
int FastCCDBiasVDDR
Definition: FastCCD.h:298
int FastCCDFirmwarePath
Definition: FastCCD.h:230
int FastCCDBiasBufBase
Definition: FastCCD.h:300
int FastCCDBiasNegHW
Definition: FastCCD.h:306
int FastCCDMux2
Definition: FastCCD.h:206
int FastCCDFPGAStatus
Definition: FastCCD.h:246
int FastCCDFabFPGAVersion
Definition: FastCCD.h:255
int FastCCDBiasPosVF
Definition: FastCCD.h:294
int FastCCDBiasPosTG
Definition: FastCCD.h:292
int FastCCDBiasPosHW
Definition: FastCCD.h:305
int FastCCDBaseFPGAVersion
Definition: FastCCD.h:252
cin_ctl_t cin_ctl
Definition: FastCCD.h:393
int FastCCDBiasNegSW
Definition: FastCCD.h:289
int FastCCDVFp
Definition: FastCCD.h:341
int FastCCDTimingNameN[10]
Definition: FastCCD.h:280
int FastCCDIFp
Definition: FastCCD.h:353
int FastCCDBiasPosTGW
Definition: FastCCD.h:313
int FastCCDPacketBuffer
Definition: FastCCD.h:266
Driver class for FastCCD CCD.
Definition: FastCCD.h:172
int FastCCDFabBoardID
Definition: FastCCD.h:253
list value
Definition: makeDbAndEdl.py:234
int FastCCDIGen3v3
Definition: FastCCD.h:348
int FastCCDBiasNegSWW
Definition: FastCCD.h:310
int FastCCDVMgmt2v5
Definition: FastCCD.h:332
asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value)
Called when asyn clients call pasynInt32->writr().
Definition: FastCCD.cpp:915
int FastCCDBiasWriteV
Definition: FastCCD.h:304
int FastCCDLastFrame
Definition: FastCCD.h:264
int FastCCDFabSerialNum
Definition: FastCCD.h:254
int FastCCDBiasUpload
Definition: FastCCD.h:227
char * portName
The name of this asyn port.
Definition: asynPortDriver.h:179
int FastCCDFirmwareUpload
Definition: FastCCD.h:226
int FastCCDTimingName
Definition: FastCCD.h:279
int FastCCDDCMStatus
Definition: FastCCD.h:247
int FastCCDBiasVDDOut
Definition: FastCCD.h:299
int FastCCDBiasNegVF
Definition: FastCCD.h:295
int FastCCDIGen2v5
Definition: FastCCD.h:349
int FastCCDOverscanCols
Definition: FastCCD.h:216
int FastCCDBiasBufBaseW
Definition: FastCCD.h:321
int FastCCDBiasNegTGW
Definition: FastCCD.h:314
int FastCCDBiasSpare1
Definition: FastCCD.h:302
int FastCCDMux1
Definition: FastCCD.h:204
asynStatus connect(asynUser *pasynUser)
Connects driver to device; The base class implementation simply calls pasynManager->exceptionConnect ...
Definition: FastCCD.cpp:28
int FastCCDSendTiming
Definition: FastCCD.h:274
int FastCCDVGen3v3
Definition: FastCCD.h:336
int FastCCDBiasNegVFW
Definition: FastCCD.h:316
~FastCCD()
Destructor.
Definition: FastCCD.cpp:706
int FastCCDBiasNEDGE
Definition: FastCCD.h:296
int FastCCDFrameBuffer
Definition: FastCCD.h:267
int FastCCDBiasOTGW
Definition: FastCCD.h:318
int FastCCDBaseBoardID
Definition: FastCCD.h:250
int FastCCDBiasNegRGW
Definition: FastCCD.h:308
int FastCCDBiasNegH
Definition: FastCCD.h:285
int FastCCDI61v0
Definition: FastCCD.h:351
int FastCCDIMgmt3v3
Definition: FastCCD.h:343
int FastCCDDroppedPck
Definition: FastCCD.h:263
int FastCCDBiasPosSWW
Definition: FastCCD.h:309
int FastCCDBiasPosRGW
Definition: FastCCD.h:307
int FastCCDPwrBus12V
Definition: FastCCD.h:328
asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value)
Called when asyn clients call pasynFloat64->write().
Definition: FastCCD.cpp:844
int FastCCDBiasPosVFW
Definition: FastCCD.h:315
int FastCCDPower
Definition: FastCCD.h:236
int FastCCDBiasSpare2W
Definition: FastCCD.h:324
NDArray * pImage
Definition: FastCCD.h:392
void detectorWaitTask(void)
Definition: FastCCD.cpp:1827
int FastCCDClocks
Definition: FastCCD.h:243
int FastCCDBiasWriteVW
Definition: FastCCD.h:325
int FastCCDBiasNegVW
Definition: FastCCD.h:312
int FastCCDFCRICUpload
Definition: FastCCD.h:229
int FastCCDV61v0
Definition: FastCCD.h:339
int FastCCDFCRICClamp
Definition: FastCCD.h:223
int FastCCDBiasPosRG
Definition: FastCCD.h:286
int FastCCDBiasNEDGEW
Definition: FastCCD.h:317
void processImage(cin_data_frame_t *frame)
Definition: FastCCD.cpp:158
int FastCCDBiasSpare1W
Definition: FastCCD.h:323
int FastCCDPollingPeriod
Definition: FastCCD.h:209
int FastCCDSendFCRIC
Definition: FastCCD.h:276
int FastCCDPwrMgmt2V3
Definition: FastCCD.h:329
void statusTask(void)
Update status of detector.
Definition: FastCCD.cpp:1763
FastCCD(const char *portName, int maxBuffers, size_t maxMemory, int priority, int stackSize, int packetBuffer, int imageBuffer, const char *baseIP, const char *fabricIP, const char *fabricMAC)
Constructor for FastCCD driver; most parameters are simply passed to ADDriver::ADDriver.
Definition: FastCCD.cpp:273
void allocateImage(cin_data_frame_t *frame)
Definition: FastCCD.cpp:113
int FastCCDI60v9
Definition: FastCCD.h:350
int FastCCDBiasBufDeltaW
Definition: FastCCD.h:322
int FastCCDVMgmt1v2
Definition: FastCCD.h:333
int FastCCDBiasPosSW
Definition: FastCCD.h:288
cin_data_t cin_data
Definition: FastCCD.h:394
int FastCCDStatusHB
Definition: FastCCD.h:258
int FastCCDBiasVDDRW
Definition: FastCCD.h:319
int FastCCDFPPower
Definition: FastCCD.h:237
int FastCCDTimingMode
Definition: FastCCD.h:281
int FastCCDBiasOTG
Definition: FastCCD.h:297
int FastCCDBiasPosH
Definition: FastCCD.h:284
int FastCCDIS3E3v3
Definition: FastCCD.h:347
int FastCCDBiasVDDOutW
Definition: FastCCD.h:320
int FastCCDBiasPosV
Definition: FastCCD.h:290
int FastCCDClockPath
Definition: FastCCD.h:232
int FastCCDIMgmt1v2
Definition: FastCCD.h:345
int FastCCDClockUpload
Definition: FastCCD.h:228
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition: NDArray.h:92
int FastCCDFOTest
Definition: FastCCD.h:270
int FastCCDVBus12V0
Definition: FastCCD.h:330
int FastCCDBoot
Definition: FastCCD.h:273
int FastCCDIMgmt2v5
Definition: FastCCD.h:344
int FastCCDVS3E3v3
Definition: FastCCD.h:335
int FastCCDV62v5
Definition: FastCCD.h:340
int FastCCDFclk
Definition: FastCCD.h:219
int FastCCDCameraPowerMode
Definition: FastCCD.h:239
int FastCCDSendBias
Definition: FastCCD.h:275
int FastCCDBias
Definition: FastCCD.h:242
int FastCCDOverscanRows
Definition: FastCCD.h:215
void messageCallback(const char *message, int severity)
Definition: FastCCD.cpp:90
int FastCCDBiasBufDelta
Definition: FastCCD.h:301
asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t nc, size_t *na)
Called when asyn clients call pasynOctet->write().
Definition: FastCCD.cpp:1295
void dataStatsTask(void)
Definition: FastCCD.cpp:1343
int FastCCDBaseSerialNum
Definition: FastCCD.h:251
int FastCCDIBus12V0
Definition: FastCCD.h:342
int FastCCDV60v9
Definition: FastCCD.h:338
int FastCCDBiasPosVW
Definition: FastCCD.h:311
int FastCCDCameraPower
Definition: FastCCD.h:238
asynStatus disconnect(asynUser *pasynUser)
Disconnects driver from device; the base class implementation simply calls pasynManager->exceptionDis...
Definition: FastCCD.cpp:74
int FastCCDResetStats
Definition: FastCCD.h:265
int FastCCDIEnet1v0
Definition: FastCCD.h:346
int FastCCDVGen2v5
Definition: FastCCD.h:337
int FastCCDBiasNegV
Definition: FastCCD.h:291