constunsignedshortlepton_ahead_tab[]=// copied from mt9x001
{/// function ASAP C,S C,NS, A,S A,NS NOL
onchange_recalcseq,0,0,0,0,0,0,/// recalculate sequences/latencies, according to P_SKIP, P_TRIG
onchange_detectsensor,1,0,0,0,0,0,/// detect sensor type, sets sensor structure (capabilities), function pointers
onchange_sensorphase,1,0,0,0,0,0,/// program sensor clock/phase (do immediately)
onchange_i2c,0,0,0,0,0,0,/// program i2c
onchange_initsensor,1,0,0,0,0,0,/// resets sensor, reads sensor registers, schedules "secret" manufacturer's corrections to the registers (stops/re-enables hardware i2c)
onchange_afterinit,0,0,0,0,0,0,/// restore image size, decimation,... after sensor reset or set them according to sensor capabilities if none were specified
onchange_multisens,0,2,1,1,1,0,/// chnages related to multiplexed sensors
onchange_window,0,2,1,1,1,0,/// program sensor WOI and mirroring (flipping) - NOTE: 1 bad frame to skip
onchange_window_safe,0,1,1,1,1,0,/// program sensor WOI and mirroring (flipping) - NOTE: no bad frames
onchange_exposure,0,2,1,1,1,0,/// program exposure
onchange_gains,0,1,1,1,1,0,/// program analog gains
onchange_triggermode,0,2,1,1,1,0,/// program sensor trigger mode TODO: does it have any sense here?
onchange_sensorin,0,0,0,0,0,0,/// program sensor input in FPGA (Bayer, 8/16 bits, ??), stop sensor (if needed)
onchange_sensorstop,0,0,0,0,0,0,/// Stop acquisition from the sensor to the FPGA (start has latency of 2)
onchange_sensorrun,0,1,1,1,1,0,/// Start/single acquisition from the sensor to the FPGA (stop has latency of 1)
onchange_gamma,0,1,1,1,1,0,/// program gamma table - make sure table is calculated, maybe send all but last word)
onchange_hist,0,0,0,0,0,0,/// program histogram window TODO: fix FPGA - (now pos_top will be read too early - will use previous ) and add latency
onchange_aexp,0,0,0,0,0,0,/// program autoexposure mode TODO: look what exactly is changed here
onchange_quality,0,0,0,0,0,0,/// program quantization table(s)
onchange_memsensor,0,0,0,0,0,0,/// program memory channels 0 (sensor->memory) and 1 (memory->FPN)
onchange_memcompressor,0,0,0,0,0,0,/// program memory channel 2 (memory->compressor) (delays programming until onchange_comprestart if needed)
/// For Micron sensors limitfps should have the same latency as changing window height, otherwise when WOI_HEIGHT 0x3c0->0x790 and next frame VBLANK 0x13e->0x284
/// sensor waits till the counter overflows (>10 seconds) without any frame sync pulses
onchange_limitfps,0,2,1,1,1,0,/// check compressor will keep up, limit sensor FPS if needed
onchange_compmode,0,0,0,0,0,0,/// program compressor modes
onchange_focusmode,1,0,0,0,0,0,/// program focus modes (through writing the tables, so no sequencer)
onchange_trigseq,0,2,1,1,1,0,/// NC393: OK to program through the sequencer (full 32 bits)
onchange_irq,0,0,0,0,0,0,/// program smart IRQ mode
onchange_comprestart,0,0,0,0,0,0,/// restart after changing geometry (recognizes ASAP and programs memory channel 2 then)
// onchange_compstop should have the same latency as onchange_window
dev_dbg(g_dev_ptr,"{%d} copied %d bytes of sensor static parameters\n",sensor_port,sizeof(lepton35));
add_sensor_proc(sensor_port,onchange_detectsensor,&lepton_pgm_detectsensor);// detect sensor type, sets sensor structure (capabilities), function pointers NOTE: will be called directly, not through pointers
add_sensor_proc(sensor_port,onchange_initsensor,&lepton_pgm_initsensor);// resets sensor, reads sensor registers, schedules "secret" manufacturer's corrections to the registers (stops/re-enables hardware i2c)
add_sensor_proc(sensor_port,onchange_sensorin,&lepton_pgm_sensorin);// see mt9f002
add_sensor_proc(sensor_port,onchange_exposure,&lepton_pgm_exposure);// program exposure
add_sensor_proc(sensor_port,onchange_window,&lepton_pgm_window);// program sensor WOI and mirroring (flipping)
add_sensor_proc(sensor_port,onchange_window_safe,&lepton_pgm_window_safe);// program sensor WOI and mirroring (flipping) - now - only flipping? with lower latency
add_sensor_proc(sensor_port,onchange_limitfps,&lepton_pgm_limitfps);// check compressor will keep up, limit sensor FPS if needed
add_sensor_proc(sensor_port,onchange_gains,&lepton_pgm_gains);// program analog gains
add_sensor_proc(sensor_port,onchange_triggermode,&lepton_pgm_triggermode);// program sensor trigger mode
add_sensor_proc(sensor_port,onchange_sensorregs,&lepton_pgm_sensorregs);// write sensor registers (only changed from outside the driver as they may have different latencies)?
setFramePar(sensor_port,thispars,P_SENSOR,sensor->sensorType);// should cause other actions
if(nupdate)setFramePars(sensor_port,thispars,nupdate,pars_to_update);// save changes to sensor register shadows
return0;
}
/** Check if compressor can keep up, limit sensor FPS if needed
* FPS is limited by increasing verical blanking, it can not be be made too big, so this method does not work to make time lapse rate. horisontal blanking
* is kept at minimum (to reduce ERS effect) if not specified. If it is specified (>minimal) - it will be used instead.
* calculate line period.
*
* FIXME - uses P_VIRTUAL_WIDTH w/o decreasing it when changing image size? Replace VIRT_WIDTH with HOR_BANK?
* Or require always set them to zero when chnaging WOI?
* FIXME for multisensor - needs per-sensor individual parameters. This uses sensor registers, not the general parameters (i.e. height) */
intlepton_pgm_limitfps(intsensor_port,///< sensor port number (0..3)