areaDetector  3-5-0
EPICS areaDetector framework
pco.h
Go to the documentation of this file.
1 
25 #ifndef PCO_H_
26 #define PCO_H_
27 
28 #include <epicsEvent.h>
29 #include <epicsTypes.h>
30 #include "ADCameralink.h"
31 #include "pco_structures.h"
32 #include "stopWatch.h"
33 
38 // putIntParam\((?<param>[a-z_]*).*
39 // createParam\("$+{param}",asynInt32,$+{param}\)
40 
41 class epicsShareClass pco : public ADCameralink {
42  public:
43  pco(const char *portName, const char *pcoPort, int maxBuffers,
44  size_t maxMemory, int priority, int stackSize);
45 
46  /* These are the methods that we override from ADDriver */
47  virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
48  virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value);
49 
50  virtual void report(FILE *fp, int details);
51  void
52  pcoTask();
53  void pcoTask2();
56  epicsEventId
60  protected:
61  int pco_first;
62 #define FIRST_pco_PARAM pco_first
63 
65 
72  int open_com;
73 
74  int close_com;
83  int pco_doub_img_mode; // on or off
84 
90  int pco_dly_timebase; // double
91  int pco_fps_mode; // int
92  int pco_busy;
95 
106 
117 
128 
139 
150 
161 
170 
174  int pco_dbg_serprint; // set to int value of serial code to pco- then
175  // printing turns on for that code pnly
176 
177  int pco_ser_waitms; // wait between read and write in serial transaction.
178  // coreco need none. sisw need a few ms
179  int pco_do_camcontrol; // 1 to run camera contol loop- so we can turn it off
180  // in debigg
182 
184 
185  // pco grabber paramers
186 
193  int pco_setallparams; // for setting a large group of settings in one pass
194 
196 
199 
201 
205 
206  // dimax needs extra mem for images. if we need 1 img, we need mem for 3
207  // according
208  // to manual. this adds to num images when we declar mem. in dimax
210  int pco_last;
211 #define LAST_pco_PARAM pco_last
212 
213  enum { pco_paramint, pco_paramdoub };
214 
215  virtual void setDebuggingMessage(int level);
216 
217  volatile int dbg_msg_level;
218 
219  // true to kill dimax dump
220  volatile bool is_cancel_dump;
221 
222  // this is included in the pco.h file
223 
227 
228  void reconfigGrabber(void);
229  void checkEdgeDescramble(NDArray *img_ptr);
230 
231  // after we get image from card, we call this. It does nothing, but can be
232  // overridden
233  virtual void processNewImage(void *img_ptr);
234  virtual void keepHouse(void);
235  int updateParameters(asynUser *pasynUser, epicsInt32 ivalue,
236  epicsFloat64 dvalue, int paramtype);
237 
238  virtual int doSerialTransactions(int function, int ivalue, double dvalue,
239  int paramtype);
240 
241  virtual void clearPipe(FILE *fp);
242 
243  // load PCO DLL
244  int getlib(void);
245  int OpenCamera(void);
246  int Disconnected(int code, char *usrmsg);
247  void resetDimaxMemory(void);
248 
249  int checkCameraMessages(void);
250  int setPcoBaudrate(int function);
251  int ReportError(int code, char *usrmsg);
252  int doSerialCommand(pco_command &cmd, pco_response &rsp, unsigned char *obj,
253  int len);
254 
255  int getPcoStatusParams(void);
256 
257  int setPcoCameraLinkParams(int function);
258  int getPcoCameraLinkParams(void);
259 
260  int getPcoGeneralParams(void);
261  int setPcoGeneralParams(int function);
262 
263  int getPcoSensorParams(void);
264  int setPcoSensorParams(int function);
265 
266  int getPcoTimingParams(void);
267  int setPcoTimingParams(int function);
268 
269  int getPcoStorageParams(void);
270  int setPcoStorageParams(int function);
271 
272  int getPcoRecordingParams(void);
273  int setPcoRecordingParams(int function);
274 
275  int setPcoImageReadParams(int function);
276  int getPcoImageReadParams(void);
277 
278  int dumpOneFrame(int k);
279 
280  void dumpCameraMemory(void);
281 
282  int doHighLevelParams(int function);
283  static char dll_name[];
284 
285 #ifndef USEASYNSERIAL
287 #endif
288 
289  void dbgSerial(void);
290 
292 
296 
297  // avoids race condition- allows camera stats to shut down ADACquire setting
298  // to 0, if no recording is happening.
299  // user turns on acquire, camera turns it off when acq is done.
301 
302  // if trye then dump[ counters get set to 1 and num of imgs in memory.
304 
305  // true to reset mem on acquire.
307 
308  // how may written to port
309  size_t mynwrite;
310  size_t mynread;
312  // asyn user for the serial port
313  asynUser *pasynUserSerial;
314 
315  // interface to serial port octet
316  asynInterface *paynOctet;
317  asynInterface *paynOption;
318 
319  char myServerPort[255];
320  //
321  // camera grabber stuff
322  //
323 
324  // enums to choose which camera we are using...
325  enum whichPCOCam {
329  pco_undef
330 
331  };
332 
333  // we have one overridden function. it is called when we get a frame
334 
336  // space for 128 pixels- we test image to see if its same as last..
337  unsigned short test_line[128];
338 
339  // enough for 1 edge imgae. pco imges are smaller...
340  unsigned short *temp_image;
341 
342  // for debugging....
343 
344  int lastxsize, lastysize;
345 
346  void checkEdgeDescramble(void *img_ptr);
347 
348  int intFlEndian(unsigned int in);
349 
350  private:
351  // int function;
352 
353  char cpstr[256];
354  /* Our data */
355  epicsEventId startEventId;
356  epicsEventId imageEventId;
357  epicsTimeStamp acqStartTime;
358  epicsTimeStamp acqEndTime;
359  epicsTimerId timerId;
360  NDArray *pData;
361  asynUser *pasynUserServer;
363 };
364 #endif
365 
366 #define NUM_pco_PARAMS (&LAST_pco_PARAM - &FIRST_pco_PARAM + 1)
int lastysize
Definition: pco.h:344
int pco_comport_number
Definition: pco.h:168
int pco_cancel_dump
Definition: pco.h:147
bool is_reset_memory
Definition: pco.h:306
int pco_dnsu_mode
Definition: pco.h:157
int pco_clear_ram_seg
Definition: pco.h:102
Definition: pco.h:328
int pco_pixelrate
! need to put into cpp- int
Definition: pco.h:82
int pco_globshut_mcfname
Definition: pco.h:203
int pco_noise_filt_mode
Definition: pco.h:88
int pco_acq_mode
Definition: pco.h:108
int pco_req_img
Definition: pco.h:120
int pco_camera_ram_npages
Definition: pco.h:96
int pco_camlink_pixfreq
Definition: pco.h:135
int pco_reconfig_grabber
Definition: pco.h:159
The NDArrayPool class manages a free list (pool) of NDArray objects.
Definition: NDArray.h:161
int pco_offset_mode
Definition: pco.h:87
int pco_camlink_cont
Definition: pco.h:138
int pco_stop_record
Definition: pco.h:114
int pco_dimax_nimgs_fudge
Definition: pco.h:209
int pco_sensor_format
!
Definition: pco.h:81
epicsEventId stopEventId
This should be private but is accessed from C, must be public.
Definition: pco.h:57
int pco_rec_stop_event_mode
Definition: pco.h:112
Interface to a com port, on a grabber.
Definition: comportInterface.h:24
int pco_memreq_cnt
Definition: pco.h:145
int pco_camera_tot_ram_size
Definition: pco.h:94
int pco_camera_seg_size3
Definition: pco.h:101
int pco_cclines
Definition: pco.h:136
int pco_live_view
Definition: pco.h:151
int pco_is_frame_rate_mode
Definition: pco.h:169
comportInterface * serial_port
Definition: pco.h:286
int pco_first
Definition: pco.h:61
list value
Definition: makeDbAndEdl.py:234
int pco_grab_waittime
Definition: pco.h:181
int pco_disable_descramble
Definition: pco.h:198
stopWatch time1
Definition: pco.h:224
int pco_rpt_img
Definition: pco.h:121
int pco_sleep_ms
Definition: pco.h:68
int last_which_camera
Definition: pco.h:294
int pco_frame_rate
Definition: pco.h:155
int pco_double_image_error
Definition: pco.h:190
bool is_reset_dump_counters
Definition: pco.h:303
xPCO_Description pco_desc
Definition: pco.h:293
size_t mynwrite
Definition: pco.h:309
int pco_rec_stop_event_nimgs
Definition: pco.h:113
int pco_health_error
Definition: pco.h:77
asynUser * pasynUserSerial
Definition: pco.h:313
int pco_is_sleep
Definition: pco.h:69
int com_error_counter
Definition: pco.h:291
int pco_imgs2dump
Definition: pco.h:144
aps designed struct based on PCO SDK.
Definition: pco_structures.h:451
int pco_set_frame_rate
Definition: pco.h:160
int pco_cancel_img
Definition: pco.h:122
int pco_adc_mode
Definition: pco.h:85
int pco_test_pixels
Definition: pco.h:189
int pco_dump_maxdatarate
Definition: pco.h:163
int pco_setallparams
Definition: pco.h:193
int pco_favor_dlytime
Definition: pco.h:164
int pco_trigger_mode
Definition: pco.h:140
int pco_fps_mode
Definition: pco.h:91
int pco_exp_timebase
Definition: pco.h:89
int pco_acqen_sig_stat
Definition: pco.h:109
int pco_play_stop
Definition: pco.h:149
int open_com
Definition: pco.h:72
int pco_init_selftest
!
Definition: pco.h:80
int pco_temp_setpt
Definition: pco.h:86
int pco_storage_mode
Definition: pco.h:104
int pco_rec_submode
Definition: pco.h:105
volatile bool is_cancel_dump
Definition: pco.h:220
volatile int dbg_msg_level
Definition: pco.h:217
int pco_dbg_serprint
Definition: pco.h:174
int pco_delay_time
Definition: pco.h:162
int pco_force_check
Definition: pco.h:134
int pco_last
Definition: pco.h:210
int myeomreason
Definition: pco.h:311
int pco_com_err_max
Definition: pco.h:195
int pco_global_shutter
Definition: pco.h:200
int pco_rec_status
Definition: pco.h:107
int pco_num_imgs_seg3
Definition: pco.h:131
int pco_dump_waitms
Definition: pco.h:153
int is_com_open
Definition: pco.h:75
int pco_hotpix_corr
Definition: pco.h:165
int pco_array_counter
Definition: pco.h:187
int pco_run_counter
Definition: pco.h:67
int pco_do_camcontrol
Definition: pco.h:179
bool is_allow_kill_acquire
Definition: pco.h:300
int pco_is_running
Definition: pco.h:64
int pco_rollshut_mcfname
Definition: pco.h:202
int pco_camera_ram_page_size
Definition: pco.h:97
stopWatch image_timer
Definition: pco.h:335
int pco_conv_12to16
Definition: pco.h:204
int pco_edge_fastscan
Definition: pco.h:167
int pco_is_log
Definition: pco.h:70
int pco_num_imgs_seg1
Definition: pco.h:126
Definition: pco.h:327
bool is_enable_which_camera
Definition: pco.h:295
int pco_dly_timebase
! need to put into cpp- double
Definition: pco.h:90
int pco_do_read_imgs
Definition: pco.h:119
int pco_max_imgs_seg3
Definition: pco.h:132
Definition: pco.h:213
int com_port_name
Definition: pco.h:71
int serial_callback
Definition: pco.h:66
int pco_ser_waitms
Definition: pco.h:177
asynInterface * paynOption
Definition: pco.h:317
int pco_max_imgs_seg1
Definition: pco.h:127
int pco_dump_camera_memory
Definition: pco.h:143
int pco_bit_alignment
Definition: pco.h:123
int pco_camera_seg_size2
Definition: pco.h:100
int pco_dbg_serwrite
Definition: pco.h:171
int pco_dump_counter
Definition: pco.h:152
int pco_health_warning
Definition: pco.h:76
int pco_image_rate
Definition: pco.h:188
int pco_read_end_img
Definition: pco.h:118
int pco_health_status
Definition: pco.h:78
int pco_reset_default_settings
Definition: pco.h:79
int pco_max_imgs_seg2
Definition: pco.h:130
int pco_dnsu_init_mode
Definition: pco.h:158
int pco_camera_seg_size1
Definition: pco.h:99
unsigned short * temp_image
Definition: pco.h:340
int pco_arm_camera
Definition: pco.h:111
int pco_cdi_mode
Definition: pco.h:156
int pco_num_imgs_seg2
Definition: pco.h:129
int pco_num_imgs_seg0
Definition: pco.h:124
size_t mynread
Definition: pco.h:310
int close_com
Definition: pco.h:74
int pco_exp_trig_stat
Definition: pco.h:93
int pco_which_camera
Definition: pco.h:191
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition: NDArray.h:92
int pco_reset_memory
Definition: pco.h:142
int pco_dbg_serstr
Definition: pco.h:173
int pco_doub_img_mode
Definition: pco.h:83
whichPCOCam
Definition: pco.h:325
Definition: stopWatch.h:37
int pco_camera_seg_size0
Definition: pco.h:98
int pco_max_imgs_seg0
Definition: pco.h:125
int pco_play_slow
Definition: pco.h:148
pco.cpp Area Detector Driver for PCO cameras that use Camera Link Inherite ADCameraLink to provide Im...
Definition: pco.h:41
int pco_camlink_pixperclk
Definition: pco.h:137
int pco_dbg_serread
Definition: pco.h:172
int pco_force_trigger
Definition: pco.h:146
int pco_timestamp_mode
Definition: pco.h:110
int pco_read_st_img
Definition: pco.h:116
Inline class to create a binary command to be sent to pco cameras over serial port.
Definition: pco_structures.h:36
int pco_ready2acquire
Definition: pco.h:183
int pco_check_time2
Definition: pco.h:154
Definition: pco.h:326
int pco_read_which_seg
Definition: pco.h:115
int pco_descramble
Definition: pco.h:192
int pco_baudrate
Definition: pco.h:141
int pco_busy
Definition: pco.h:92
int pco_check_time
Definition: pco.h:133
int pco_kill_ioc
Definition: pco.h:197
stopWatch grab_delay
Definition: pco.h:226
stopWatch time2
Definition: pco.h:225
int pco_1612_lookup
Definition: pco.h:166
int pco_active_seg
Definition: pco.h:103
Class to define a single binary response from pco cameras, received over serial port.
Definition: pco_structures.h:180
asynInterface * paynOctet
Definition: pco.h:316