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.
Functions | |
| 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 *edtinfo, char *cfgfname, char *bitdir, int pdv_debug) |
| Initializes the board and camera. | |
| int | pdv_readcfg (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. | |
| 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.
The structure can be deallocated with free() later.
Definition at line 239 of file pdv_initcam.c.
| 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, | |
| Dependent * | dd_p, | |||
| int | unit, | |||
| Edtinfo * | edtinfo, | |||
| char * | cfgfname, | |||
| char * | bitdir, | |||
| int | pdv_debug | |||
| ) |
Initializes the 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_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 free'd by pdv_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 edtinfo; EdtDev *pdv_p; dep = pdv_alloc_dependent(); pdv_readcfg(cfgfname, dd_p, &edtinfo); unit = edt_parse_unit(unitstr, edt_devname, "pdv"); pdv_p = edt_open(edt_devname, unit); pdv_initcam(pdv_p, dd_p, unit, &edtinfo, cfgfname, bitdir, 0); edt_close(pdv_p); free(dd_p);
Definition at line 130 of file pdv_initcam.c.
| int pdv_readcfg | ( | 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.
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) | |
| ei_p | structure with miscellaneous driver flags to fill in (information not in dd_p). Defined in initcam.h. |
1.5.1