aglobalPars[sensor_port]=sFrameParsAll[sensor_port].globalPars;// parameters that are not frame-related, their changes do not initiate any actions so they can be mmaped for both
aglobalPars[sensor_port]=sFrameParsAll[sensor_port].globalPars;// parameters that are not frame-related, their changes do not initiate any actions so they can be mmaped for both
amultiSensIndex[sensor_port]=sFrameParsAll[sensor_port].multiSensIndex;// indexes of individual sensor register shadows (first of 3) - now for all parameters, not just sensor ones
amultiSensIndex[sensor_port]=sFrameParsAll[sensor_port].multiSensIndex;// indexes of individual sensor register shadows (first of 3) - now for all parameters, not just sensor ones
amultiSensRvrsIndex[sensor_port]=sFrameParsAll[sensor_port].multiSensRvrsIndex;// reverse index (to parent) for the multiSensIndex
amultiSensRvrsIndex[sensor_port]=sFrameParsAll[sensor_port].multiSensRvrsIndex;// reverse index (to parent) for the multiSensIndex
if(rslt<0)dev_warn(g_devfp_ptr,"%s:%d:%s - error=%d",__FILE__,__LINE__,__FUNCTION__,rslt);// Nothing to do with errors here - just report?
if(rslt<0)dev_warn(g_devfp_ptr,"port %d: %s:%d:%s - error=%d",sensor_port,__FILE__,__LINE__,__FUNCTION__,rslt);// Nothing to do with errors here - just report?
///TODO: init framepars (zero parameters) before initscripts (not when detecting the sensors) - then initscript will be able to overwrite some
///TODO: init framepars (zero parameters) before initscripts (not when detecting the sensors) - then initscript will be able to overwrite some
voidinit_framepars_ptr(intsensor_port);
voidinit_framepars_ptr(intsensor_port);
intinitSequencers(intsensor_port);///Move to sensorcommon? currently it is used through frameparsall file (lseek)
intinitSequencers(intsensor_port);///Move to sensorcommon? currently it is used through frameparsall file (lseek)
voidinitGlobalPars(intsensor_port);/// resets all global parameters but debug mask (if ELPHEL_DEBUG)
voidinitGlobalPars(intsensor_port);/// resets all global parameters but debug mask (if ELPHEL_DEBUG)
intinitMultiPars(intsensor_port);/// initialize structures for individual per-sensor parameters. Now only works for sensor registers using G_MULTI_REGSM. Should be called aftre/during sensor detection
intinitMultiPars(intsensor_port);/// initialize structures for individual per-sensor parameters. Now only works for sensor registers using G_MULTI_REGSM. Should be called aftre/during sensor detection
voidinitFramePars(intsensor_port);///initialize all parameters, set thisFrameNumber to frame16 (read from hardware, usually 0 after resetting i2c and cmd_seq)
voidinitFramePars(intsensor_port);///initialize all parameters, set thisFrameNumber to frame16 (read from hardware, usually 0 after resetting i2c and cmd_seq)
voidresetFrameNumber(intsensor_port,u32aframe,inthreset);/// reset this frame number (called from initFramePars(), also can be used to avoid frame number integer overflow)
voidresetFrameNumber(intsensor_port,u32aframe,inthreset);/// reset this frame number (called from initFramePars(), also can be used to avoid frame number integer overflow)
@@ -150,17 +150,21 @@ const unsigned long ahead_tab[]=
...
@@ -150,17 +150,21 @@ const unsigned long ahead_tab[]=
/// 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
/// 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
/// 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_limitfps,0,2,1,1,1,0,/// check compressor will keep up, limit sensor FPS if needed
onchange_compmode,0,0,1,1,1,0,/// program compressor modes
// onchange_trigseq, 1, 0, 0, 0, 0, 0, /// program sequencer (int/ext) NOTE:needs >24 bit data, too much for sequencer
// onchange_trigseq, 1, 0, 0, 0, 0, 0, /// program sequencer (int/ext) NOTE:needs >24 bit data, too much for sequencer
onchange_trigseq,1,2,1,1,1,0,/// program sequencer (int/ext) NOTE:needs >24 bit data, too much for sequencer. Should be not later than onchange_triggermode and limitfps
// onchange_trigseq, 1, 2, 1, 1, 1, 0, /// program sequencer (int/ext) NOTE:needs >24 bit data, too much for sequencer. Should be not later than onchange_triggermode and limitfps
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_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_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
/// onchange_compstop should have the same latency as onchange_window
@@ -830,7 +789,9 @@ int mt9x001_pgm_detectsensor (int sensor_port, ///< sensor port
...
@@ -830,7 +789,9 @@ int mt9x001_pgm_detectsensor (int sensor_port, ///< sensor port
add_sensor_proc(sensor_port,onchange_triggermode,&mt9x001_pgm_triggermode);// program sensor trigger mode
add_sensor_proc(sensor_port,onchange_triggermode,&mt9x001_pgm_triggermode);// program sensor trigger mode
add_sensor_proc(sensor_port,onchange_sensorregs,&mt9x001_pgm_sensorregs);// write sensor registers (only changed from outside the driver as they may have different latencies)?
add_sensor_proc(sensor_port,onchange_sensorregs,&mt9x001_pgm_sensorregs);// write sensor registers (only changed from outside the driver as they may have different latencies)?
// setFramePar(thispars, P_SENSOR | FRAMEPAIR_FORCE_NEWPROC, sensor->sensorType); // force actions
// setFramePar(thispars, P_SENSOR | FRAMEPAIR_FORCE_NEWPROC, sensor->sensorType); // force actions
// MDD1(dev_dbg(g_dev_ptr,"\n"));
// MDD1(dev_dbg(g_dev_ptr,"\n"));
///TODO: Fill G_MULTI_REGSM+i - which registers need individual values in multi-sensor applications
///TODO: Fill G_MULTI_REGSM+i - which registers need individual values in multi-sensor applications
...
@@ -888,7 +849,8 @@ int mt9x001_pgm_initsensor (int sensor_port, ///< sensor port
...
@@ -888,7 +849,8 @@ int mt9x001_pgm_initsensor (int sensor_port, ///< sensor port
///< @return 0 - OK, negative - error
///< @return 0 - OK, negative - error
{
{
// unsigned long flags; // this function uses software i2c operations - they need to have interrupts (and hardware i2c off)
// unsigned long flags; // this function uses software i2c operations - they need to have interrupts (and hardware i2c off)
structframeparspair_tpars_to_update[258+(MAX_SENSORS*P_MULTI_NUMREGS)];// for all the sensor registers. Other P_* values will reuse the same ones
// struct frameparspair_t pars_to_update[258+(MAX_SENSORS * P_MULTI_NUMREGS )]; // for all the sensor registers. Other P_* values will reuse the same ones
structframeparspair_tpars_to_update[262+(MAX_SENSORS*P_MULTI_NUMREGS)];// for all the sensor registers. Other P_* values will reuse the same ones
intfirst_sensor_i2c;
intfirst_sensor_i2c;
unsignedshort*sensor_register_overwrites;
unsignedshort*sensor_register_overwrites;
x393_sensio_ctl_tsensio_ctl={.d32=0};
x393_sensio_ctl_tsensio_ctl={.d32=0};
...
@@ -902,36 +864,6 @@ int mt9x001_pgm_initsensor (int sensor_port, ///< sensor port
...
@@ -902,36 +864,6 @@ int mt9x001_pgm_initsensor (int sensor_port, ///< sensor port
structframepars_tfunc2call;///< func2call.pars[] - each parameter has a 32-bit mask of what pgm_function to call - other fields not used
structframepars_tfunc2call;///< func2call.pars[] - each parameter has a 32-bit mask of what pgm_function to call - other fields not used
unsignedlongglobalPars[NUM_GPAR];///< parameters that are not frame-related, their changes do not initiate any actions so they can be mmaped for both R/W
unsignedlongglobalPars[NUM_GPAR];///< parameters that are not frame-related, their changes do not initiate any actions so they can be mmaped for both R/W
...
@@ -997,6 +1001,32 @@ struct framepars_all_t {
...
@@ -997,6 +1001,32 @@ struct framepars_all_t {
unsignedlongmultiSensRvrsIndex[P_MAX_PAR_ROUNDUP];///< reverse index (to parent) for the multiSensIndex in lower 16 bits, high 16 bits - sensor number
unsignedlongmultiSensRvrsIndex[P_MAX_PAR_ROUNDUP];///< reverse index (to parent) for the multiSensIndex in lower 16 bits, high 16 bits - sensor number
};
};
/// Parameters, common for all channels (trigger mode)
structcommon_pars_t{
unsignedlongmaster_chn;///< Master channel (controlparameters through this channel) ([0] - value, [1] - frame)