Difference between revisions of "Driver parameters"

From ElphelWiki
Jump to: navigation, search
 
(History)
Line 7: Line 7:
  
 
  1136    ImageWidth =  ioctl(data_fd, _CCCMD( CCAM_RPARS , P_ACTUAL_WIDTH ), 0);
 
  1136    ImageWidth =  ioctl(data_fd, _CCCMD( CCAM_RPARS , P_ACTUAL_WIDTH ), 0);
 +
 +
Some elements are readonly (like P_SENSOR that returns the type of the sensor used in the camera), others (P_UPDATE) initiate actions when written.
 +
 +
These arrays and parameter definitions were changing with the new camera models, new sensors features that became available, new additions to the FPGA code. Address space of just 64 locations was too small and we have to eliminate older parameters and combine several in a single 32-bit word.
 +
 +
== Read/write/lseek vs. ioctl ==

Revision as of 20:46, 16 October 2007

History

From the very first Elphel camera (Model 303) camera driver maintained data array that was accessible by the applications through IOCTL calls. Total number of elements (32-bit data words) was 64 (limited by address bits designated for that purpose in IOCTL command map, the indexes are defined in the c313a.h(names starting with P_ ). Most (but not all) of the elements are represented in two arrays - imageParamsW[] and imageParamsR[], first (W for "write") having the data passed by the applications through IOCTL (example from the ccam.c - described in Ccam.cgi. The next line passes compression quality received as part of the GET request to the driver:

1852         if ((vp=paramValue(gparams, "iq")))		ioctl(devfd, _CCCMD(CCAM_WPARS ,  P_QUALITY),      strtol (vp,&cp,10));

The second array - imageParamsR[] (R for "read") holds the current value that driver uses. In most cases driver tries to make this value as close as possible to the one specified by application, if the application passed the invalid value driver will use the corrected one. Next line returns the current image width used by the driver (currently it is always a multiple of 16):

1136    ImageWidth =  ioctl(data_fd, _CCCMD( CCAM_RPARS , P_ACTUAL_WIDTH ), 0);

Some elements are readonly (like P_SENSOR that returns the type of the sensor used in the camera), others (P_UPDATE) initiate actions when written.

These arrays and parameter definitions were changing with the new camera models, new sensors features that became available, new additions to the FPGA code. Address space of just 64 locations was too small and we have to eliminate older parameters and combine several in a single 32-bit word.

Read/write/lseek vs. ioctl