Typically the external utility program initcam handles these tasks (possibly invoked by an EDT application such as pdvshow or camconfig.) initcam calls these subroutines to do the work, and they are avaiable as well for programmers who wish to invoke them directly from a user application. See the initcam.c source code for an example of how how to use these subroutines to read configration files and initialize the board from within an application.
|Dependent *||pdv_alloc_dependent ()|
|Allocates a dependent structure, for use by pdv_readcfg and pdv_initcam, and checks for and reports error conditions as a result of the alloc. |
|int||pdv_auto_set_timeout (PdvDev *pdv_p)|
|Sets a reasonable image timeout value based on image size and exposure time (if set) and pixel clock speed (also if set). |
|int||pdv_initcam (EdtDev *pdv_p, Dependent *dd_p, int unit, Edtinfo *ei_p, const char *cfgfname, char *bitdir, int pdv_debug)|
|Initializes the framegrabber board and camera. |
|int||pdv_readcfg (const char *cfgfile, Dependent *dd_p, Edtinfo *ei_p)|
|Reads a configuration file and fills in the dependent and edtinfo structures based on the information in the file. |
The structure can be deallocated with free() later.
|int pdv_auto_set_timeout||(||PdvDev *||pdv_p||)|
Sets a reasonable image timeout value based on image size and exposure time (if set) and pixel clock speed (also if set).
pdv_initcam calls this subroutine after reading in the various camera parameters from the config file. Since most configs don't (presently) have a pclock_speed directive specified, it assumes a conservative 5 Mhz pixel clock speed, which can make for a long timeout value. As a result, for faster cameras in general, and large format ones specifically, if data loss occurs for whatever reason, the pdv_wait acquisition routines may block for an excessively long time if data loss occurs. To get around this, either add a pclock_speed directive to the config file (preferred), or set your own fixed timeout override with the user_timeout directive or pdv_set_timeout.
|int pdv_initcam||(||EdtDev *||pdv_p,|
|const char *||cfgfname,|
Initializes the framegrabber board and camera.
This is the "guts" of the inticam program that gets executed to initialize when you choose a camera. The library subroutine is provided for programmers who wish to incorporate the initialization procedure into their own applications.
pdv_initcam is designed to initialize EDT framegrabber (input) boards only. For simulator boards, (e.g. the PCIe8 DVa CLS) see the clsiminit.c example/utility application.
|pdv_p||pointer to edt device structure returned by edt_open|
|dd_p||pointer to a previously allocated (via pdv_alloc_dependent) and initialized (through pdv_readcfg) dependent structure. The library uses this until it is either freed by edt_close, or no longer used by later calls to this function (which means that if you call pdv_initcam again, you should free() pdv_p->dd_p first to avoid memory leaks).|
|unit||unit number of the device. The first unit is 0.|
|edtinfo||miscellaneous variable information structure, defined in initcam.h, initialized via pdv_readcfg.|
|cfgfname||path name of configuration file.|
|bitdir||directory path name for .bit (FPGA) files. If NULL, pdv_initcam will search for bitfiles under ".", then "./camera_config/bitfiles".|
|pdv_debug||should be set to 0 (but is ignored currently).|
Dependent *dd_p; Edtinfo ei_p; EdtDev *edt_p; int unit, channel; char* unitstr = argv; dep = pdv_alloc_dependent(); pdv_readcfg(cfgfname, dd_p, &edtinfo); unit = edt_parse_unit_channel(unitstr, edt_devname, "pdv", &channel); edt_p = edt_open_channel(edt_devname, unit, channel); pdv_initcam(edt_p, dd_p, unit, &ei_p, cfgfname, bitdir, 0); edt_close(edt_p); free(dd_p);
|int pdv_readcfg||(||const char *||cfgfile,|
Reads a configuration file and fills in the dependent and edtinfo structures based on the information in the file.
These structures can then be passed in to pdv_initcam to initialize the board and camera.
|cfgfile||path name of configuration file to read|
|dd_p||device and camera dependent information structure to fill in, defined in camera.h (user-allocated -- see pdv_alloc_dependent) -- persistent (stored in the driver)|
|ei_p||structure holding non-persistent initialization strings and variables (information not in dd_p). Defined in initcam.h.|