libpdv.h

Go to the documentation of this file.
00001 
00002 /* #pragma ident "@(#)libpdv.h  1.128 07/25/07 EDT" */
00003 
00004 
00009 #ifndef _LIBPDV_H_
00010 #define _LIBPDV_H_
00011 
00012 
00013 
00014 #ifdef __cplusplus
00015 
00016 extern "C" {
00017 
00018 #endif
00019 
00020 #include "edtinc.h"
00021 
00026 typedef  EdtDev PdvDev ;
00027 
00028 #ifndef bits2bytes
00029 #define bits2bytes(bits) (((int)bits + 7) / 8)
00030 #endif
00031 
00032 /* pdv_serial_command_flagged  flags */
00033 #define SCFLAG_NORESP   1
00034 
00035 EDTAPI EdtDev *pdv_open(char *edt_devname, int unit);
00036 
00037 EDTAPI PdvDev * pdv_open_device(const char *edt_devname, int unit, int channel, int verbose);
00038 EDTAPI PdvDev * pdv_open_channel(const char *edt_devname, int unit, int channel);
00039 EDTAPI void pdv_serial_txrx(PdvDev * pdv_p, char *txbuf, int txcount, char *rxbuf, 
00040                             int rxcount, int timeout, u_char *wchar);
00041 
00042 EDTAPI int pdv_close(PdvDev *pdv_p);
00043 EDTAPI int pdv_read(PdvDev *pdv_p, unsigned char *buf,  unsigned long size) ;
00044 EDTAPI unsigned char  *pdv_image(PdvDev *pdv_p) ;
00045 EDTAPI void pdv_start_image(PdvDev *pdv_p) ;
00046 EDTAPI void pdv_start_images(PdvDev *pdv_p, int count) ;
00047 EDTAPI void  pdv_perror(char *str) ;
00048 EDTAPI void  pdv_setdebug(PdvDev *pdv_p, int debug) ;
00049 EDTAPI void  pdv_new_debug(int debug) ;
00050 EDTAPI void pdv_start_hardware_continuous(PdvDev *pdv_p) ;
00051 EDTAPI void pdv_stop_hardware_continuous(PdvDev *pdv_p) ;
00052 EDTAPI void pdv_flush_fifo(PdvDev *pdv_p) ;
00053 EDTAPI void pdv_flush_channel_fifo(PdvDev *pdv_p) ;
00054 EDTAPI void pdv_set_interlace(PdvDev *pdv_p, int interlace) ;
00055 EDTAPI unsigned char  *pdv_wait_image(PdvDev *pdv_p) ;
00056 EDTAPI unsigned char  *pdv_last_image_timed(PdvDev *pdv_p, u_int *timep) ;
00057 EDTAPI unsigned char  *pdv_wait_last_image_timed(PdvDev *pdv_p, u_int *timep) ;
00058 EDTAPI unsigned char  *pdv_wait_image_timed(PdvDev *pdv_p, u_int *timep) ;
00059 EDTAPI unsigned char  *pdv_wait_images_timed(PdvDev *pdv_p, int count, u_int *timep) ;
00060 EDTAPI unsigned char  *pdv_wait_images(PdvDev *pdv_p, int count) ;
00061 
00062 EDTAPI unsigned char  *pdv_wait_image_raw(PdvDev *pdv_p) ;
00063 EDTAPI unsigned char  *pdv_last_image_timed_raw(PdvDev *pdv_p, u_int *timep, int doRaw) ;
00064 EDTAPI unsigned char  *pdv_wait_last_image_timed_raw(PdvDev *pdv_p, u_int *timep, int doRaw) ;
00065 EDTAPI unsigned char  *pdv_wait_image_timed_raw(PdvDev *pdv_p, u_int *timep, int doRaw) ;
00066 EDTAPI unsigned char  *pdv_wait_images_timed_raw(PdvDev *pdv_p, int count, u_int *timep, int doRaw) ;
00067 EDTAPI unsigned char  *pdv_wait_images_raw(PdvDev *pdv_p, int count) ;
00068 
00069 EDTAPI char *pdv_get_cameratype(PdvDev *pdv_p);
00070 
00071 EDTAPI char *pdv_get_camera_class(PdvDev * pdv_p);
00072 EDTAPI char *pdv_get_camera_model(PdvDev * pdv_p);
00073 EDTAPI char *pdv_get_camera_info(PdvDev * pdv_p);
00074 
00075 EDTAPI char *pdv_camera_type(PdvDev *pdv_p);
00076 EDTAPI int  pdv_get_width(PdvDev *pdv_p);
00077 EDTAPI int  pdv_get_pitch(PdvDev *pdv_p);
00078 EDTAPI int  pdv_set_width(PdvDev *pdv_p, int value);
00079 EDTAPI int  pdv_get_height(PdvDev *pdv_p);
00080 
00081 EDTAPI int  pdv_get_frame_height(PdvDev *pdv_p);
00082 EDTAPI int  pdv_set_frame_height(PdvDev *pdv_p, int value);
00083 EDTAPI u_char *pdv_get_interleave_data(PdvDev *pdv_p, u_char *buf, int bufnum);
00084 EDTAPI int  pdv_bytes_per_line(int width, int depth);
00085 
00086 EDTAPI int  pdv_setsize(PdvDev* pdv_p, int width, int height);
00087 EDTAPI int  pdv_set_height(PdvDev *pdv_p, int value);
00088 EDTAPI int  pdv_get_depth(PdvDev *pdv_p);
00089 EDTAPI int  pdv_get_extdepth(PdvDev *pdv_p);
00090 EDTAPI int  pdv_set_depth(PdvDev *pdv_p, int value);
00091 EDTAPI int  pdv_set_extdepth(PdvDev *pdv_p, int value);
00092 EDTAPI int  pdv_set_depth_extdepth(PdvDev * pdv_p, int depth, int extdepth);
00093 EDTAPI int  pdv_set_depth_extdepth_dpath(PdvDev * pdv_p, int depth, int extdepth, u_int dpath);
00094 EDTAPI void pdv_cl_set_base_channels(PdvDev *pdv_p, int htaps, int vtaps);
00095 EDTAPI int  pdv_get_imagesize(PdvDev *pdv_p);
00096 EDTAPI int  pdv_image_size(PdvDev * pdv_p);
00097 EDTAPI int  pdv_get_dmasize(PdvDev *pdv_p);
00098 EDTAPI int  pdv_get_rawio_size(PdvDev *pdv_p);
00099 EDTAPI int  pdv_get_allocated_size(PdvDev *pdv_p);
00100 EDTAPI int  pdv_get_fulldma_size(PdvDev *pdv_p, int *extrasizep);
00101 EDTAPI int  pdv_set_shutter_method(PdvDev *pdv_p, int method, unsigned int mcl);
00102 EDTAPI int  pdv_set_exposure(PdvDev *pdv_p, int value);
00103 EDTAPI int  pdv_set_exposure_mcl(PdvDev *pdv_p, int value);
00104 EDTAPI int  pdv_set_gain(PdvDev *pdv_p, int value);
00105 EDTAPI int  pdv_set_blacklevel(PdvDev *pdv_p, int value);
00106 EDTAPI int  pdv_set_binning(PdvDev *pdv_p, int xval, int yval);
00107 EDTAPI int  pdv_set_mode(PdvDev *pdv_p, char *mode, int mcl);
00108 EDTAPI int  pdv_get_exposure(PdvDev *pdv_p) ;
00109 EDTAPI int  pdv_get_gain(PdvDev *pdv_p) ;
00110 EDTAPI int  pdv_get_blacklevel(PdvDev *pdv_p) ;
00111 EDTAPI int  pdv_set_aperture(PdvDev *edt_p, int value);
00112 EDTAPI int  pdv_get_aperture(PdvDev *edt_p);
00113 EDTAPI int  pdv_set_timeout(PdvDev *pdv_p, int value) ;
00114 EDTAPI int  pdv_auto_set_timeout(PdvDev *pdv_p) ;
00115 EDTAPI int  pdv_get_timeout(PdvDev *pdv_p) ;
00116 EDTAPI int  pdv_update_values_from_camera(PdvDev *pdv_p) ;
00117 EDTAPI int  pdv_overrun(PdvDev *pdv_p) ;
00118 EDTAPI int  pdv_timeouts(PdvDev *pdv_p) ;
00119 EDTAPI int  pdv_timeout_cleanup(PdvDev *pdv_p) ;
00120 EDTAPI int  pdv_timeout_restart(PdvDev *pdv_p, int restart) ;
00121 EDTAPI int  pdv_in_continuous(PdvDev *pdv_p);
00122 EDTAPI int  pdv_serial_write(PdvDev *ed, const char *buf, int size) ;
00123 EDTAPI int  pdv_serial_read(PdvDev *fd, char *buf, int size) ;
00124 EDTAPI int  pdv_serial_read_blocking(PdvDev *fd, char *buf, int size) ;
00125 EDTAPI int  pdv_serial_read_nullterm(PdvDev *fd, char *buf, int size, int nullterm) ;
00126 
00127 EDTAPI int  pdv_serial_read_enable(PdvDev *pdv_p);
00128 EDTAPI int  pdv_is_serial_enabled(PdvDev *pdv_p);
00129 EDTAPI int  pdv_serial_read_disable(PdvDev *pdv_p);
00130 EDTAPI int  pdv_serial_check_enabled(PdvDev *pdv_p);
00131 
00132 EDTAPI char *pdv_serial_term(PdvDev *ed) ;
00133 EDTAPI void pdv_set_serial_delimiters(PdvDev *ed, char *newprefix, char *newterm) ;
00134 EDTAPI char *pdv_serial_prefix(PdvDev *ed) ;
00135 EDTAPI void pdv_reset_serial(PdvDev *pdv_p) ;
00136 EDTAPI int  pdv_serial_command(EdtDev *pd, const char *cmd) ;
00137 EDTAPI int  pdv_serial_command_flagged(EdtDev *pd, const char *cmd, u_int flag) ;
00138 EDTAPI int  pdv_serial_binary_command(EdtDev *pd, const char *cmd, int len) ;
00139 EDTAPI int  pdv_serial_binary_command_flagged(EdtDev *pd, const char *cmd, int len, u_int flag) ;
00140 EDTAPI int  pdv_send_basler_frame(EdtDev *pd, u_char *cmd, int len) ;
00141 EDTAPI int  pdv_read_basler_frame(EdtDev *pd, u_char *cmd, int len) ;
00142 EDTAPI int  pdv_read_duncan_frame(EdtDev * pdv_p, u_char *frame) ;
00143 EDTAPI int  pdv_send_duncan_frame(PdvDev * pdv_p, u_char *cmdbuf, int size);
00144 EDTAPI int  pdv_serial_command_hex(EdtDev *pd, const char *cmd, int len) ;
00145 EDTAPI int  pdv_serial_wait(EdtDev *pd, int msecs, int count) ;
00146 EDTAPI int  pdv_serial_get_numbytes(EdtDev *pd) ;
00147 EDTAPI int  pdv_serial_wait_next(EdtDev * edt_p, int msecs, int count) ;
00148 
00149 EDTAPI int  pdv_serial_write_available(PdvDev *pdv_p);
00150 
00151 EDTAPI int  pdv_get_serial_block_size(void);
00152 EDTAPI void pdv_set_serial_block_size(int newsize);
00153 
00154 
00155 EDTAPI int  pdv_interlace_method(EdtDev *pd) ;
00156 EDTAPI int  pdv_read_response(EdtDev *pd, char *buf) ;
00157 EDTAPI int pdv_debug_level(void) ;
00158 EDTAPI u_char ** pdv_buffer_addresses(EdtDev *edt_p) ;
00159 EDTAPI uchar_t *pdv_alloc(int size) ;
00160 EDTAPI void pdv_free(uchar_t *ptr) ;
00161 EDTAPI int  ES10deInterleave(u_char *src, int width, int rows, u_char *dest) ;
00162 EDTAPI int  ES10_byte64(u_char *src, int width, int rows, u_char *dest) ;
00163 EDTAPI int  ES10_word_deInterleave(u_short *src, int width, int rows, u_short *dest) ;
00164 EDTAPI int  ES10_word_deInterleave_odd(u_short *src, int width, int rows, u_short *dest) ;
00165 EDTAPI int  ES10_word_deInterleave_hilo(u_short *src, int width, int rows, u_short *dest) ;
00166 EDTAPI int  dalsa_4ch_deInterleave(u_char *src, int width, int rows, u_char *dest);
00167 EDTAPI int  dalsa_2ch_deInterleave(u_char *src, int width, int rows, u_char *dest);
00168 EDTAPI int  specinst_4port_deInterleave(u_short *src, int width, int rows, u_short *dest);
00169 EDTAPI int  pdv_multibuf(EdtDev *edt_p, int numbufs) ;
00170 EDTAPI int  merge_image(u_char *evenptr, u_char *oddptr,int width,
00171                         int rows, int depth, u_char *dest, int offset) ;
00172 EDTAPI void pdv_mark_ras(u_char *buf, int n, int width, int height, int x, int y) ;
00173 EDTAPI void pdv_mark_bin(u_char *buf, int n, int width, int height, int x, int y) ;
00174 EDTAPI void pdv_mark_ras_depth(void *buf, int n, int width, int height, int x, int y, int depth, int fg) ;
00175 EDTAPI void pdv_mark_bin_16(u_short *buf, int n, int width, int height, int x, int y) ;
00176 EDTAPI int little_endian(void);
00177 EDTAPI int pdv_set_serial_parity(EdtDev  *edt_p, char polarity);
00178 EDTAPI int pdv_set_baud(EdtDev  *edt_p, int  baud);
00179 EDTAPI int pdv_get_baud(EdtDev  *edt_p);
00180 EDTAPI void pdv_check_fpga_rev(PdvDev *pdv_p);
00181 EDTAPI void pdv_check(EdtDev *edt_p) ;
00182 EDTAPI void pdv_checkfrm(EdtDev *edt_p, u_short *image, u_int imagesize, int verbose) ;
00183 EDTAPI int pdv_set_roi(PdvDev *pdv_p, int hskip, int hactv, int vskip, int vactv) ;
00184 EDTAPI int pdv_get_roi_enabled(PdvDev *pdv_p);
00185 EDTAPI int  pdv_auto_set_roi(PdvDev *pdv_p) ;
00186 EDTAPI int pdv_enable_roi(PdvDev *pdv_p, int flag) ;
00187 EDTAPI int pdv_set_cam_width(PdvDev *pdv_p, int value) ;
00188 EDTAPI int pdv_set_cam_height(PdvDev *pdv_p, int value) ;
00189 EDTAPI int pdv_access(char *fname, int perm) ;
00190 EDTAPI int pdv_strobe(PdvDev *pdv_p, int count, int interval) ;
00191 EDTAPI int pdv_set_strobe_dac(PdvDev * pdv_p, u_int value) ;
00192 EDTAPI int pdv_set_strobe_counters(PdvDev * pdv_p, int count, int delay, int period);
00193 EDTAPI int pdv_enable_strobe(PdvDev * pdv_p, int ena);
00194 EDTAPI int pdv_strobe_method(PdvDev *pdv_p);
00195 
00196 EDTAPI int pdv_read_response(PdvDev *pdv_p, char *buf);
00197 
00198 EDTAPI int pdv_set_strobe_dac(PdvDev *pdv_p, u_int value);
00199 
00200 EDTAPI void pdv_setup_continuous(PdvDev *pdv_p) ;
00201 EDTAPI void pdv_setup_continuous_channel(PdvDev *pdv_p) ;
00202 EDTAPI void pdv_stop_continuous(PdvDev *pdv_p) ;
00203 
00204 EDTAPI int pdv_get_min_shutter(EdtDev *edt_p);
00205 EDTAPI int pdv_get_max_shutter(EdtDev *edt_p);
00206 EDTAPI int pdv_get_min_gain(EdtDev *edt_p);
00207 EDTAPI int pdv_get_max_gain(EdtDev *edt_p);
00208 EDTAPI int pdv_get_min_offset(EdtDev *edt_p);
00209 EDTAPI int pdv_get_max_offset(EdtDev *edt_p);
00210 EDTAPI void pdv_invert(PdvDev *pd, int val);
00211 EDTAPI int pdv_get_invert(PdvDev * pdv_p);
00212 EDTAPI void pdv_set_firstpixel_counter(PdvDev * pdv_p, int ena);
00213 EDTAPI int pdv_get_firstpixel_counter(PdvDev * pdv_p);
00214 EDTAPI void pdv_send_break(EdtDev *edt_p);
00215 
00216 EDTAPI int pdv_set_header_type(PdvDev *pdv_p, int header_type, int irig_slave, int irig_offset, int irig_raw);
00217 EDTAPI void pdv_set_header_size(EdtDev *edt_p, int nSize);
00218 EDTAPI int pdv_get_header_size(EdtDev *edt_p);
00219 EDTAPI void pdv_set_header_position(EdtDev *edt_p, HdrPosition pos);
00220 EDTAPI HdrPosition pdv_get_header_position(EdtDev *edt_p);
00221 EDTAPI void pdv_set_header_offset(EdtDev *edt_p, int noffset);
00222 EDTAPI int pdv_get_header_offset(EdtDev *edt_p);
00223 EDTAPI void pdv_set_header_dma(EdtDev *edt_p, int ndma);
00224 EDTAPI int pdv_get_header_dma(EdtDev *edt_p);
00225 
00226 EDTAPI int pdv_get_dmasize(EdtDev *pdv_p);
00227 
00228 EDTAPI unsigned char * pdv_get_last_image(PdvDev * pdv_p);
00229 EDTAPI unsigned char * pdv_wait_last_image(PdvDev * pdv_p, int *nSkipped);
00230 EDTAPI unsigned char * pdv_wait_next_image(PdvDev * pdv_p, int *nSkipped);
00231 EDTAPI unsigned char * pdv_wait_last_image_raw(PdvDev * pdv_p, int *nSkipped, int doRaw);
00232 EDTAPI unsigned char * pdv_wait_next_image_raw(PdvDev * pdv_p, int *nSkipped, int doRaw);
00233 
00234 EDTAPI int pdv_set_buffers(PdvDev *pdv_p, int nbufs, unsigned char **pBufs);
00235 EDTAPI int pdv_set_buffers_x(PdvDev *pdv_p, int nbufs, int size, unsigned char **pBufs);
00236 
00237 EDTAPI int pdv_get_cam_width(PdvDev *pdv_p);
00238 EDTAPI int pdv_get_cam_height(PdvDev *pdv_p);
00239 EDTAPI int pdv_force_single(PdvDev *pdv_p);
00240 EDTAPI int pdv_variable_size(PdvDev *pdv_p);
00241 EDTAPI int pdv_pause_for_serial(PdvDev *pdv_p);
00242 EDTAPI int pdv_get_shutter_method(PdvDev *pdv_p, u_int *mcl);
00243 EDTAPI int pdv_shutter_method(PdvDev *pdv_p);
00244 
00245 EDTAPI int pdv_get_serial_timeout(PdvDev *pdv_p);
00246 
00247 EDTAPI int pdv_dalsa_ls_set_expose(PdvDev *pdv_p, int hskip, int hactv) ;
00248 EDTAPI int pdv_is_kodak_i(PdvDev *pdv_p);
00249 EDTAPI void  pdv_set_defaults(PdvDev *pdv_p) ;
00250 
00251 EDTAPI int pdv_is_atmel(PdvDev *pdv_p);
00252 EDTAPI int pdv_hamamatsu(PdvDev *pdv_p);
00253 EDTAPI void pdv_enable_external_trigger(PdvDev *pdv_p, int flag);
00254 
00255 EDTAPI void pdv_set_fval_done(PdvDev *pdv_p, int enable);
00256 EDTAPI int pdv_get_fval_done(PdvDev *pdv_p);
00257 EDTAPI int pdv_get_lines_xferred(PdvDev *pdv_p);
00258 EDTAPI int pdv_get_width_xferred(PdvDev *pdv_p);
00259 EDTAPI int pdv_cl_get_fv_counter(PdvDev *pdv_p);
00260 EDTAPI void pdv_cl_reset_fv_counter(PdvDev *pdv_p);
00261 EDTAPI int pdv_cl_camera_connected(PdvDev *pdv_p);
00262 
00263 EDTAPI int pdv_reset_dma_framecount(PdvDev *pdv_p);
00264 
00265 EDTAPI int pdv_set_frame_period(PdvDev *pdv_p, int rate, int method);
00266 EDTAPI int pdv_get_frame_period(PdvDev *pdv_p);
00267 EDTAPI int pdv_cameralink_foiunit(PdvDev *pdv_p);
00268 EDTAPI int pdv_is_cameralink(PdvDev *pdv_p);
00269 EDTAPI int pdv_is_simulator(PdvDev *pdv_p);
00270 
00271 EDTAPI void pdv_start_expose(PdvDev *pdv_p);
00272 
00273 EDTAPI int pdv_set_exposure_basler202k(PdvDev * pdv_p, int value);
00274 EDTAPI int pdv_set_gain_basler202k(PdvDev * pdv_p, int valuea, int valueb);
00275 EDTAPI int pdv_set_offset_basler202k(PdvDev * pdv_p, int valuea, int valueb);
00276 EDTAPI int pdv_set_exposure_duncan_ch(PdvDev * pdv_p, int value, int ch);
00277 EDTAPI int pdv_set_gain_duncan_ch(PdvDev * pdv_p, int value, int ch);
00278 
00279 EDTAPI int pdv_process_inplace(PdvDev *pdv_p);
00280 EDTAPI int pdv_deinterlace(PdvDev *pdv_p, PdvDependent *dd_p, 
00281                         u_char *dmabuf, u_char *output_buf);
00282 
00283 EDTAPI int pdv_check_framesync(PdvDev *pdv_p, u_char *image_p, u_int *framecnt);
00284 EDTAPI int pdv_enable_framesync(PdvDev *pdv_p, int mode);
00285 EDTAPI int pdv_framesync_mode(PdvDev *pdv_p);
00286 
00287 #ifndef PDV_TIMESTAMP_SIZE
00288 
00289 #define PDV_TIMESTAMP_SIZE 8
00290 
00291 #endif
00292 
00293 /* Bayer filter interpolation routines */
00294 
00295 extern double bayer_rgb_scale[3];
00296 
00297 void EDTAPI get_bayer_luts(u_char **red, u_char **green, u_char **blue);
00298 
00299 void EDTAPI set_bayer_parameters(int input_bits,
00300                                          double rgb_scale[3],
00301                                          double gamma,
00302                                          int blackoffset,
00303                                          int red_first,
00304                                          int green_first);
00305 
00306 /* Some cameras need different scale factors on even/odd rows */
00307 
00308 void EDTAPI set_bayer_even_odd_row_scale(double evenscale, double oddscale);
00309 
00310 extern double bayer_even_row_scale, bayer_odd_row_scale;
00311 
00312 
00313 /********** DVC Routines ****************/
00314 
00315 typedef struct _tagDVCState {
00316         char mode[4];
00317 
00318         int binx;
00319         int biny;
00320         int exposure;
00321         int blackoffset;
00322         int gain;
00323 
00324 } DVCState;
00325 
00326 EDTAPI int  pdv_set_binning_dvc(PdvDev *pdv_p, int xval, int yval);
00327 
00328 EDTAPI int  pdv_set_mode_dvc(PdvDev *pdv_p, char *mode);
00329 
00330 EDTAPI int pdv_is_dvc(PdvDev *pdv_p);
00331 
00332 EDTAPI int pdv_update_from_dvc(PdvDev *pdv_p);
00333 
00334 EDTAPI int pdv_get_dvc_state(PdvDev *pdv_p, DVCState *pState);
00335 
00336 EDTAPI int pdv_set_dvc_state(PdvDev *pdv_p, DVCState *pState);
00337 
00338 EDTAPI int pdv_set_waitchar(PdvDev *pdv_p, int enable, u_char wchar) ;
00339 EDTAPI int pdv_get_waitchar(PdvDev * pdv_p, u_char *wchar) ;
00340 
00341 
00342 #include "edt_types.h"
00343 
00344 #include "pdv_interlace.h"
00345 
00346 
00347 
00348 #ifdef __cplusplus
00349 
00350 }
00351 
00352 #endif
00353 
00354 #endif /* _LIBPDV_H_ */
00355 

Generated on 19 Jun 2015 by  doxygen 1.4.7