ngc 1.4.0
 
Loading...
Searching...
No Matches
ngcdcsAO.hpp
Go to the documentation of this file.
1
7#ifndef ngcdcsAO_H
8#define ngcdcsAO_H
9
10
11#ifndef __cplusplus
12#error This is a C++ include file and cannot be used from plain C
13#endif
14
15#include <ngc/core/ngcbAddr.h>
16#include <ngc/core/ngcbMOD.hpp>
20
24#define ngcdcsAO_ALICE 0x00010000
25#define ngcdcsAO_ALICE_REV0 0x00100000
26
30#define ngcdcsAO_UNITY_GAIN 1
31
35#define ngcdcsAO_MAX_GAIN 2000
36
40#define ngcdcsAO_MAX_INITFILES 8
41
45#define ngcdcsAO_OVRILLUM_MAXCNT 1
46
50#define ngcdcsAO_SENS_TEMP 1 //< temperature sensor
51#define ngcdcsAO_SENS_RHUM 2 //< humidity sensor
52#define ngcdcsAO_SENS_PRESSURE 4 //< pressure sensor
53#define ngcdcsAO_SENS_OVRILLUM 8 //< over-illumination
54
58#define ngcdcsAO_SENS_ALL (ngcdcsAO_SENS_TEMP|ngcdcsAO_SENS_RHUM|ngcdcsAO_SENS_PRESSURE|ngcdcsAO_SENS_OVRILLUM)
59
64 double gain; //< Amplifier gain (in dB)
65 int clamp; //< Clamp level
66 int input; //< Input selection
67
70 gain = 0.0;
71 clamp = 512;
72 input = 0;
73 }
74};
75
80 int delay; //< Serial i/o delay (ticks of 5 milliseconds)
81 int clampL; //< Clamp enabled flag (left side)
82 int clampR; //< Clamp enabled flag (right side)
83 int enabled; //< AFE enabled
84 ngcdcs_afe_chan_t chan[8]; //< AFE channels
85
88 clampL = 1;
89 clampR = 1;
90 delay = 1;
91 enabled = 1;
92 }
93};
94
99 double hv1; //< High voltage calibration point for unity gain
100 double hv2; //< High voltage 1st calibration point
101 double hv3; //< High voltage 2nd calibration point
102 double hvsty1; //< Sensitivity for unity gain calibration point (V/gain)
103 double hvsty2; //< Sensitivity for 1st gain calibration point (V/gain)
104 double hvsty3; //< Sensitivity for 2nd gain calibration point (V/gain)
105 double hvprc1; //< Precision of unity gain calibration point (%)
106 double hvprc2; //< Precision for 1st gain calibration point (%)
107 double hvprc3; //< Precision for 2nd gain calibration point (%)
108 double eqOffset; //< High voltage calibration equation offset
109 double eqSlope; //< High voltage calibration equation slope
110
113 hv1 = 0.0;
114 hv2 = 0.0;
115 hv3 = 0.0;
116 hvsty1 = 1.0;
117 hvsty2 = 0.1;
118 hvsty3 = 0.0003;
119 hvprc1 = 1.0;
120 hvprc2 = 5.0;
121 hvprc3 = 5.0;
122 eqOffset = 20.0;
123 eqSlope = 3.0;
124 }
125};
126
131public:
132 int pol; //< Polarity
133 int yEnd; //< End line
134 int xStart; //< Toggle start
135 int xEnd; //< Toggle end
136 int tc; //< Time constant
137
139 ngcdcsAO_REGION() {pol = 1; yEnd = 0; xStart = 0; xEnd = 0; tc = 0x9;}
140
142 virtual ~ngcdcsAO_REGION() {}
143
144protected:
145private:
146};
147
152public:
153 int pol; //< Polarity
154 int yStart; //< Mask start
155 int yEnd; //< Mask end
156
158 ngcdcsAO_MASK() {pol = 1; yStart = 0; yEnd = 0;}
159
161 virtual ~ngcdcsAO_MASK() {}
162
163protected:
164private:
165};
166
171public:
172 int pol; //< Polarity
173 int xStart; //< Toggle start
174 int xEnd; //< Toggle end
175
177 ngcdcsAO_PAT() {pol = 1; xStart = 0; xEnd = 0;}
178
180 virtual ~ngcdcsAO_PAT() {}
181
182protected:
183private:
184};
185
190public:
191 ngcdcsAO_REGION region[7]; //< Regions
192 ngcdcsAO_MASK mask[3]; //< Masks
193 ngcdcsAO_PAT pat; //< Pattrn
194
197 region[0].yEnd = 0x1fff;
198 region[0].xEnd = 0xffff;
199 }
200
202 virtual ~ngcdcsAO_RMP() {}
203
205 int MsbMask() {
206 int i;
207 int msb = 0x0;
208 for (i=0;i<3;i++)
209 {
210 msb |= ((mask[i].yStart >> 12) & 0x1) << (i * 2);
211 msb |= ((mask[i].yEnd >> 12) & 0x1) << ((i * 2) + 1);
212 }
213 return (msb);
214 }
215
217 int MsbPat() {
218 int msb = 0x0;
219 msb |= ((pat.xStart >> 12) & 0xf);
220 msb |= ((pat.xEnd >> 12) & 0xf) << 4;
221 return (msb);
222 }
223
225 int MsbY() {
226 int i;
227 int msb = 0x0;
228 for (i=0;i<7;i++) msb |= ((region[i].yEnd >> 12) & 0x1) << i;
229 return (msb);
230 }
231
233 int RegMsbX1(int idx) {
234 if ((idx == 0) || (idx == 1)) return (0);
235 else if (idx == 2) return (1);
236 else if ((idx == 3) || (idx == 4)) return (2);
237 else if (idx == 5) return (3);
238 else if (idx == 6) return (4);
239 else return (5);
240 }
241
243 int MsbX1(int idx) {return MsbX(RegMsbX1(idx));}
244
246 int RegMsbX2(int idx) {
247 if (idx == 0) return (0);
248 else if ((idx == 1) || (idx == 2)) return (1);
249 else if (idx == 3) return (2);
250 else if ((idx == 4) || (idx == 5)) return (3);
251 else if (idx == 6) return (4);
252 else return (5);
253 }
254
256 int MsbX2(int idx) {return MsbX(RegMsbX2(idx));}
257
259 int MsbX(int idx) {
260 int msb = 0x0;
261 if (idx == 0)
262 {
263 msb |= (region[0].xStart >> 12) & 0xf;
264 msb |= ((region[0].xEnd >> 12) & 0xf) << 4;
265 msb |= ((region[1].xStart >> 12) & 0xf) << 8;
266 }
267 else if (idx == 1)
268 {
269 msb |= (region[1].xEnd >> 12) & 0xf;
270 msb |= ((region[2].xStart >> 12) & 0xf) << 4;
271 msb |= ((region[2].xEnd >> 12) & 0xf) << 8;
272 }
273 else if (idx == 2)
274 {
275 msb |= (region[3].xStart >> 12) & 0xf;
276 msb |= ((region[3].xEnd >> 12) & 0xf) << 4;
277 msb |= ((region[4].xStart >> 12) & 0xf) << 8;
278 }
279 else if (idx == 3)
280 {
281 msb |= (region[4].xEnd >> 12) & 0xf;
282 msb |= ((region[5].xStart >> 12) & 0xf) << 4;
283 msb |= ((region[5].xEnd >> 12) & 0xf) << 8;
284 }
285 else if (idx == 4)
286 {
287 msb |= (region[6].xStart >> 12) & 0xf;
288 msb |= ((region[6].xEnd >> 12) & 0xf) << 4;
289 }
290 return (msb);
291 }
292
294 int Pol() {
295 int i;
296 int pol = 1 << 7;
297 for (i=0;i<7;i++) pol |= (region[i].pol & 0x1) << i;
298 pol |= (pat.pol & 0x1) << 8;
299 for (i=0;i<3;i++) pol |= (mask[i].pol & 0x1) << (i + 9);
300 return (pol);
301 }
302
303protected:
304private:
305};
306
310class ngcdcsAO: public ngcbMOD
311{
312public:
314 explicit ngcdcsAO(const ngcb_route_t &r);
315
317 ngcdcsAO(ngcbIFC *ifc, const ngcb_route_t &r);
318
320 virtual ~ngcdcsAO();
321
324
326 int hwRev;
327
330
333
336
339
342
345
348
350 int gain;
351
354
357
360
363
366
369
372
375
377 int delay[42];
378
380 double reDelay[8];
381
383 double feDelay[8];
384
386 double vsph[4];
387
389 double viph[4];
390
392 int nx;
393
395 int ny;
396
399
401 int hvChan[4];
402
405
407 char pixMask[256];
408
411
414
417
419 void Reset();
420
422 int Enable(int check = 1);
423
425 int Disable();
426
428 int Selftest();
429
431 virtual int AtStop();
432
434 virtual int AfterStop();
435
437 virtual int AtStart();
438
440 virtual int AutoStart();
441
443 int CkAddrCB(int addr, const int *buffer, int size);
444
446 void WrAddrCB(int addr, const int *buffer, int size);
447
449 virtual int Update(int sensor, int force = 0);
450
452 int CheckOvrIllum();
453
455 int ResetHead();
456
458 int ResetSensors(int errFlag = 0);
459
461 int ResetRHum();
462
464 int ResetTemp();
465
467 int ResetPressure();
468
470 int ResetOvrIllum();
471
473 int SensorError(int sensor);
474
476 int ResetAfe(int update = 1);
477
479 int Master(int flag);
480
482 int DataLink(int flag);
483
485 int SerialLink(int flag);
486
488 int Gain(int value);
489
491 int Gain(int quadrant, int value);
492
494 int Delay(int idx, int ticks);
495
497 int VoltageIPhase(int idx, double volt);
498
500 int VoltageSPhase(int idx, double volt);
501
503 int Dim(int x, int y);
504
506 int DimX(int x);
507
509 int DimY(int y);
510
512 unsigned int FrameCnt();
513
515 double FrameRate();
516
518 int Shift(int clkNum, int shift, int edge, int force = 0);
519
521 int GetClk(int clkNum, int patNum, char *clkString);
522
524 int AmpGain(int channel, double value);
525
527 int Clamp(int channel, int level);
528
530 int ClampOn(int side, int flag);
531
533 int Input(int channel, int input);
534
536 int CtrlReg() {return (ctrlReg_);}
537
539 int SetupKey(const char *key, const int *idx, const char *value,
540 int *status = NULL);
541
543 int StatusKey(const char *key, const int *idx, char *value,
544 int *status = NULL);
545
546protected:
547
548private:
550 struct timeval timeReset_;
551
553 int aliceCtrl_;
554
556 int ctrlReg_;
557
559 int delayReg1_;
560
562 int delayReg2_;
563
565 int delayReg3_;
566
568 int delayReg4_;
569
571 int delayReg5_;
572
574 int phCtrlReg_;
575
577 int levelIPhaseReg_;
578
580 int levelSPhaseReg_;
581
583 int overIlluminationCnt_;
584
586 unsigned int aliceAdc_[4];
587
589 ngcbALARM *overIlluminationAlarm_;
590
592 void Init_();
593
595 void Log_(const char *msg);
596
598 int LvlIPhase2Reg_(double volt);
599
601 int LvlSPhase2Reg_(double volt);
602
604 double Reg2LvlIPhase_(int value);
605
607 double Reg2LvlSPhase_(int value);
608
610 int UpdateSensors_(int sensor, int force);
611
613 int WrAdc_(int adc, int chan, int addr, int value);
614
616 int WrAdc_(int addr, int value);
617
619 int AlInitRMP_();
620
622 int RcpEndY_(int idx, int value);
623
625 int RcpStartX_(int idx, int value);
626
628 int RcpEndX_(int idx, int value);
629
631 int RcpTC_(int idx, int value);
632
634 int RcpPol_(int idx, int value);\
635
637 int MaskStartY_(int idx, int value);
638
640 int MaskEndY_(int idx, int value);
641
643 int MaskPol_(int idx, int value);
644
646 int PatStartX_(int value);
647
649 int PatEndX_(int value);
650
652 int PatPol_(int value);
653
655 int CalibDelays_();
656};
657
658#endif
Definition ngcbALARM.hpp:99
Definition ngcbIFC.hpp:754
ngcbMOD(const ngcbMOD &other)
Copy constructor.
Definition ngcbMOD.cpp:43
Definition ngcdcsAO.hpp:151
int pol
Definition ngcdcsAO.hpp:153
int yStart
Definition ngcdcsAO.hpp:154
int yEnd
Definition ngcdcsAO.hpp:155
virtual ~ngcdcsAO_MASK()
Destructor.
Definition ngcdcsAO.hpp:161
ngcdcsAO_MASK()
Constructor.
Definition ngcdcsAO.hpp:158
Definition ngcdcsAO.hpp:170
ngcdcsAO_PAT()
Constructor.
Definition ngcdcsAO.hpp:177
int xStart
Definition ngcdcsAO.hpp:173
int xEnd
Definition ngcdcsAO.hpp:174
virtual ~ngcdcsAO_PAT()
Destructor.
Definition ngcdcsAO.hpp:180
int pol
Definition ngcdcsAO.hpp:172
Definition ngcdcsAO.hpp:130
int tc
Definition ngcdcsAO.hpp:136
ngcdcsAO_REGION()
Constructor.
Definition ngcdcsAO.hpp:139
int xEnd
Definition ngcdcsAO.hpp:135
int pol
Definition ngcdcsAO.hpp:132
virtual ~ngcdcsAO_REGION()
Destructor.
Definition ngcdcsAO.hpp:142
int xStart
Definition ngcdcsAO.hpp:134
int yEnd
Definition ngcdcsAO.hpp:133
Definition ngcdcsAO.hpp:189
int MsbX2(int idx)
Get region xEnd MSB register value.
Definition ngcdcsAO.hpp:256
virtual ~ngcdcsAO_RMP()
Destructor.
Definition ngcdcsAO.hpp:202
int Pol()
Get polarity register value.
Definition ngcdcsAO.hpp:294
int RegMsbX1(int idx)
Get region xStart MSB register index.
Definition ngcdcsAO.hpp:233
int MsbY()
Get region line-end MSB register value.
Definition ngcdcsAO.hpp:225
int MsbX(int idx)
Get region xStart,xEnd MSB register value.
Definition ngcdcsAO.hpp:259
ngcdcsAO_MASK mask[3]
Definition ngcdcsAO.hpp:192
ngcdcsAO_PAT pat
Definition ngcdcsAO.hpp:193
ngcdcsAO_RMP()
Constructor.
Definition ngcdcsAO.hpp:196
int MsbMask()
Get mask MSB register value.
Definition ngcdcsAO.hpp:205
ngcdcsAO_REGION region[7]
Definition ngcdcsAO.hpp:191
int RegMsbX2(int idx)
Get region xEnd MSB register index.
Definition ngcdcsAO.hpp:246
int MsbPat()
Get pattern MSB register value.
Definition ngcdcsAO.hpp:217
int MsbX1(int idx)
Get region xStart MSB register value.
Definition ngcdcsAO.hpp:243
int DimY(int y)
Set image y-dimension.
Definition ngcdcsAO.cpp:2409
virtual int AfterStop()
Function to be executed after read-out stop.
Definition ngcdcsAO.cpp:856
int hvChan[4]
High-voltage channel.
Definition ngcdcsAO.hpp:401
int Enable(int check=1)
Call-back at transition to operational state.
Definition ngcdcsAO.cpp:197
int ny
Image transfer y-dimension.
Definition ngcdcsAO.hpp:395
char initFile[ngcdcsAO_MAX_INITFILES][256]
Register initialization file.
Definition ngcdcsAO.hpp:323
int Dim(int x, int y)
Set image dimension.
Definition ngcdcsAO.cpp:2363
void Reset()
Align software state after reset.
Definition ngcdcsAO.cpp:162
ngcdcsCLDC * cldc
Assocoated clock- and bias-generator.
Definition ngcdcsAO.hpp:413
int ResetHead()
Reset AO camera.
Definition ngcdcsAO.cpp:1001
virtual ~ngcdcsAO()
Destructor.
Definition ngcdcsAO.cpp:50
double reDelay[8]
Rising edge calibration delays (in ticks)
Definition ngcdcsAO.hpp:380
int serialLink
Serial link to AO-system disabled/enabled flag.
Definition ngcdcsAO.hpp:347
virtual int AutoStart()
Function to be executed after read-out start.
Definition ngcdcsAO.cpp:881
double viph[4]
Multi-level-clock voltage levels I-phase.
Definition ngcdcsAO.hpp:389
int autoStart
Automatic immediate start.
Definition ngcdcsAO.hpp:329
int SerialLink(int flag)
Enable/disable serial link to AO-system.
Definition ngcdcsAO.cpp:1363
int dataLink
Data-link to NGC-LLCU disabled/enabled flag.
Definition ngcdcsAO.hpp:344
int SetupKey(const char *key, const int *idx, const char *value, int *status=NULL)
Setup.
Definition ngcdcsAoSetup.cpp:25
double sensSettleTime
Sensor settling time.
Definition ngcdcsAO.hpp:371
int Gain(int value)
Set gain.
Definition ngcdcsAO.cpp:1374
int nx
Image transfer x-dimension.
Definition ngcdcsAO.hpp:392
ngcdcsAO_RMP rmp
ALICE rgions, masks, patterns.
Definition ngcdcsAO.hpp:398
int maxGain
Maximum gain.
Definition ngcdcsAO.hpp:353
int ResetRHum()
Reset humidity sensor.
Definition ngcdcsAO.cpp:1059
void WrAddrCB(int addr, const int *buffer, int size)
Write-to-address call-back for alignment.
Definition ngcdcsAO.cpp:598
int sensEnabled
Sensor interface disabled/enabled flag.
Definition ngcdcsAO.hpp:365
int master
Synchronisation master flag.
Definition ngcdcsAO.hpp:341
int DimX(int x)
Set image x-dimension.
Definition ngcdcsAO.cpp:2404
int ResetPressure()
Reset pressure sensor.
Definition ngcdcsAO.cpp:1126
int VoltageSPhase(int idx, double volt)
Set multi-level-clock voltage levels (S-phase)
Definition ngcdcsAO.cpp:2303
int gain
Gain step.
Definition ngcdcsAO.hpp:350
int VoltageIPhase(int idx, double volt)
Set multi-level-clock voltage levels (I-phase)
Definition ngcdcsAO.cpp:2243
ngcdcsSEQ * seq
Associated sequencer.
Definition ngcdcsAO.hpp:416
int StatusKey(const char *key, const int *idx, char *value, int *status=NULL)
Status.
Definition ngcdcsAoStatus.cpp:25
ngcdcs_aocal_t calib[4]
High voltage calibration.
Definition ngcdcsAO.hpp:404
int ResetTemp()
Reset temperature sensor.
Definition ngcdcsAO.cpp:1085
int DataLink(int flag)
Enable/disable data-link to NGC-LLCU.
Definition ngcdcsAO.cpp:1324
int CtrlReg()
Return actual control register mirror.
Definition ngcdcsAO.hpp:536
int Clamp(int channel, int level)
Set clamp level (0 - 1020)
Definition ngcdcsAO.cpp:2828
int shpWidth
SHP-widht (ALICE)
Definition ngcdcsAO.hpp:374
int Delay(int idx, int ticks)
Set delay (in ticks)
Definition ngcdcsAO.cpp:2004
int CheckOvrIllum()
Check over-illumination sensor.
Definition ngcdcsAO.cpp:890
char pixMask[256]
Calibration pixel mask.
Definition ngcdcsAO.hpp:407
int GetClk(int clkNum, int patNum, char *clkString)
Get clock state values.
Definition ngcdcsAO.cpp:2656
int ClampOn(int side, int flag)
Enable Clamp.
Definition ngcdcsAO.cpp:2924
ngcdcsSHTx_TEMP temp
Temperature sensor (degC)
Definition ngcdcsAO.hpp:332
unsigned int FrameCnt()
Return current frame counter.
Definition ngcdcsAO.cpp:3077
virtual int AtStop()
Function to be executed before read-out stop.
Definition ngcdcsAO.cpp:847
int rstStart
Reset at start.
Definition ngcdcsAO.hpp:359
int Disable()
Call-back at transition to not operational state.
Definition ngcdcsAO.cpp:513
int sensPrefill
Prefill sensor filter windows.
Definition ngcdcsAO.hpp:368
int ResetOvrIllum()
Reset over-illumination detection.
Definition ngcdcsAO.cpp:1193
int AmpGain(int channel, double value)
Set amplifier gain (in dB - from 0.0 to 36.0 dB)
Definition ngcdcsAO.cpp:2742
int Selftest()
Execute selftest.
Definition ngcdcsAO.cpp:564
int ResetAfe(int update=1)
Reset AFE interface.
Definition ngcdcsAO.cpp:3025
double vsph[4]
Multi-level-clock voltage levels S-phase.
Definition ngcdcsAO.hpp:386
int SensorError(int sensor)
Return sensor error state.
Definition ngcdcsAO.cpp:1170
virtual int AtStart()
Function to be executed before read-out start.
Definition ngcdcsAO.cpp:865
ngcdcs_afe_t afe
Analog Front End control (AFE)
Definition ngcdcsAO.hpp:410
ngcdcsSHTx_RHUM rhum
Relative humidity sensor (%)
Definition ngcdcsAO.hpp:335
int hwRev
Hardware revision (0=protoype, 1=reshaped)
Definition ngcdcsAO.hpp:326
int Shift(int clkNum, int shift, int edge, int force=0)
Clock-shifter.
Definition ngcdcsAO.cpp:2450
ngcdcsAO(const ngcb_route_t &r)
Constructor with route.
Definition ngcdcsAO.cpp:29
int Master(int flag)
Enable/disable synchronisation master flag.
Definition ngcdcsAO.cpp:1285
int expAbort
Abort exposure on over-illumination.
Definition ngcdcsAO.hpp:362
double FrameRate()
Return actual frame rate (Hz)
Definition ngcdcsAO.cpp:3096
virtual int Update(int sensor, int force=0)
Run next sensor update cycle.
Definition ngcdcsAO.cpp:668
int delay[42]
42 delays (in ticks)
Definition ngcdcsAO.hpp:377
ngcdcsMPL115A pressure
Pressure sensor (kPa)
Definition ngcdcsAO.hpp:338
int ResetSensors(int errFlag=0)
Reset all sensors.
Definition ngcdcsAO.cpp:949
int overIllumination
Over-illumination flag.
Definition ngcdcsAO.hpp:356
double feDelay[8]
Falling edge calibration delays (in ticks)
Definition ngcdcsAO.hpp:383
int CkAddrCB(int addr, const int *buffer, int size)
Check-address call-back for alignment.
Definition ngcdcsAO.cpp:572
int Input(int channel, int input)
Select AFE input (0=CCD, 1=AUX1, 2=AUX2)
Definition ngcdcsAO.cpp:2964
Definition ngcdcsCLDC.hpp:594
Definition ngcdcsSENS.hpp:233
Definition ngcdcsSEQ.hpp:574
Definition ngcdcsSENS.hpp:176
Definition ngcdcsSENS.hpp:157
#define ngcdcsAO_MAX_INITFILES
Definition ngcdcsAO.hpp:40
Definition ngcbIFC.hpp:72
Definition ngcdcsAO.hpp:63
ngcdcs_afe_chan_t()
Constructor.
Definition ngcdcsAO.hpp:69
int input
Definition ngcdcsAO.hpp:66
int clamp
Definition ngcdcsAO.hpp:65
double gain
Definition ngcdcsAO.hpp:64
Definition ngcdcsAO.hpp:79
int delay
Definition ngcdcsAO.hpp:80
int clampL
Definition ngcdcsAO.hpp:81
ngcdcs_afe_chan_t chan[8]
Definition ngcdcsAO.hpp:84
int enabled
Definition ngcdcsAO.hpp:83
ngcdcs_afe_t()
Constructor.
Definition ngcdcsAO.hpp:87
int clampR
Definition ngcdcsAO.hpp:82
Definition ngcdcsAO.hpp:98
double hvprc1
Definition ngcdcsAO.hpp:105
double hvsty2
Definition ngcdcsAO.hpp:103
double hv1
Definition ngcdcsAO.hpp:99
double eqSlope
Definition ngcdcsAO.hpp:109
double hvprc3
Definition ngcdcsAO.hpp:107
double hv2
Definition ngcdcsAO.hpp:100
double hvsty1
Definition ngcdcsAO.hpp:102
double hvsty3
Definition ngcdcsAO.hpp:104
ngcdcs_aocal_t()
Constructor.
Definition ngcdcsAO.hpp:112
double hv3
Definition ngcdcsAO.hpp:101
double eqOffset
Definition ngcdcsAO.hpp:108
double hvprc2
Definition ngcdcsAO.hpp:106