-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathandorCCD.h
193 lines (161 loc) · 4.87 KB
/
andorCCD.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/**
* Area Detector driver for the Andor CCD.
*
* @author Matthew Pearson
* @date June 2009
*
* Updated Dec 2011 for Asyn 4-17 and areaDetector 1-7
*
* Major updates to get callbacks working, etc. by Mark Rivers Feb. 2011
*/
#ifndef ANDORCCD_H
#define ANDORCCD_H
// YF
#define USE_LIBCIN 1
// YF: All added code will be in #ifdef USE_LIBCIN block
#ifdef USE_LIBCIN
#include "cin.h"
#endif
#include "ADDriver.h"
#define MAX_ENUM_STRING_SIZE 26
#define MAX_ADC_SPEEDS 16
#define MAX_PREAMP_GAINS 16
#define AndorCoolerParamString "ANDOR_COOLER"
#define AndorTempStatusMessageString "ANDOR_TEMP_STAT"
#define AndorMessageString "ANDOR_MESSAGE"
#define AndorShutterModeString "ANDOR_SHUTTER_MODE"
#define AndorShutterExTTLString "ANDOR_SHUTTER_EXTTL"
#define AndorPalFileNameString "ANDOR_PAL_FILE_PATH"
#define AndorAccumulatePeriodString "ANDOR_ACCUMULATE_PERIOD"
#define AndorPreAmpGainString "ANDOR_PREAMP_GAIN"
#define AndorAdcSpeedString "ANDOR_ADC_SPEED"
#define FCCDSetBiasString "FCCD_SETBIAS"
#define FCCDSetClocksString "FCCD_SETCLOCKS"
typedef struct {
int ADCIndex;
int AmpIndex;
int HSSpeedIndex;
float HSSpeed;
int BitDepth;
char *EnumString;
int EnumValue;
} AndorADCSpeed_t;
typedef struct {
float Gain;
char *EnumString;
int EnumValue;
} AndorPreAmpGain_t;
/**
* Driver class for Andor CCD. This inherits from ADDriver class in areaDetector.
*
*/
class AndorCCD : public ADDriver {
public:
AndorCCD(const char *portName, int maxBuffers, size_t maxMemory,
const char *installPath, int priority, int stackSize);
virtual ~AndorCCD();
/* These are the methods that we override from ADDriver */
virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value);
virtual void report(FILE *fp, int details);
virtual asynStatus readEnum(asynUser *pasynUser, char *strings[], int values[], int severities[],
size_t nElements, size_t *nIn);
// Should be private, but are called from C so must be public
void statusTask(void);
void dataTask(void);
protected:
int AndorCoolerParam;
#define FIRST_ANDOR_PARAM AndorCoolerParam
int AndorTempStatusMessage;
int AndorMessage;
int AndorShutterMode;
int AndorShutterExTTL;
int AndorPalFileName;
int AndorAccumulatePeriod;
int AndorPreAmpGain;
int AndorAdcSpeed;
int FCCDSetBias;
int FCCDSetClocks;
#define LAST_ANDOR_PARAM FCCDSetClocks
private:
unsigned int checkStatus(unsigned int returnStatus);
asynStatus setupAcquisition();
asynStatus setupShutter(int command);
void saveDataFrame(int frameNumber);
void setupADCSpeeds();
void setupPreAmpGains();
/**
* Additional image mode to those in ADImageMode_t
*/
static const epicsInt32 AImageFastKinetics;
/**
* List of acquisiton modes.
*/
static const epicsUInt32 AASingle;
static const epicsUInt32 AAAccumulate;
static const epicsUInt32 AARunTillAbort;
static const epicsUInt32 AATimeDelayedInt;
/**
* List of trigger modes.
*/
static const epicsUInt32 ATInternal;
static const epicsUInt32 ATExternal1;
static const epicsUInt32 ATExternal2;
static const epicsUInt32 ATExternal1or2;
/**
* List of detector status states
*/
static const epicsUInt32 ASIdle;
static const epicsUInt32 ASTempCycle;
static const epicsUInt32 ASAcquiring;
static const epicsUInt32 ASAccumTimeNotMet;
static const epicsUInt32 ASKineticTimeNotMet;
static const epicsUInt32 ASErrorAck;
static const epicsUInt32 ASAcqBuffer;
static const epicsUInt32 ASSpoolError;
/**
* List of detector readout modes.
*/
static const epicsInt32 ARFullVerticalBinning;
static const epicsInt32 ARMultiTrack;
static const epicsInt32 ARRandomTrack;
static const epicsInt32 ARSingleTrack;
static const epicsInt32 ARImage;
/**
* List of shutter modes
*/
static const epicsInt32 AShutterAuto;
static const epicsInt32 AShutterOpen;
static const epicsInt32 AShutterClose;
epicsEventId statusEvent;
epicsEventId dataEvent;
double mPollingPeriod;
double mFastPollingPeriod;
unsigned int mAcquiringData;
char *mInstallPath;
/**
* ADC speed parameters
*/
int mNumAmps;
int mNumADCs;
int mNumADCSpeeds;
AndorADCSpeed_t mADCSpeeds[MAX_ADC_SPEEDS];
int mTotalPreAmpGains;
int mNumPreAmpGains;
AndorPreAmpGain_t mPreAmpGains[MAX_PREAMP_GAINS];
//Shutter control parameters
float mAcquireTime;
float mAcquirePeriod;
float mAccumulatePeriod;
#ifdef USE_LIBCIN
protected:
struct cin_port m_port;
NDArray *m_pArray;
private:
int FCCD_Init();
int FCCD_GetImage();
void int_handler(int dummy);
#endif
};
#define NUM_ANDOR_DET_PARAMS ((int)(&LAST_ANDOR_PARAM - &FIRST_ANDOR_PARAM + 1))
#endif //ANDORCCD_H