Commit ab467480 authored by Andrey Filippov's avatar Andrey Filippov

debugging for multiplexer

parent 8b4b7b64
...@@ -837,7 +837,7 @@ inline void _processParsSeq(int sensor_port, ///< sensor port ...@@ -837,7 +837,7 @@ inline void _processParsSeq(int sensor_port, ///< sensor port
{ {
unsigned long todo, mask, remain; unsigned long todo, mask, remain;
int job_ahead; // doing job "job_ahead" ahead of needed int job_ahead; // doing job "job_ahead" ahead of needed
int pars_ahead; // considering parameter "pars_ahead" of the (frame16+job_ahead) mod 8 int pars_ahead; // considering parameter "pars_ahead" of the (frame16+job_ahead) mod 16
int frame_proc; // current frame for which parameters are considered int frame_proc; // current frame for which parameters are considered
struct framepars_t * procpars; struct framepars_t * procpars;
struct framepars_t * prevpars; // maybe - drop calculation for each function, move it to pgm_* where needed? struct framepars_t * prevpars; // maybe - drop calculation for each function, move it to pgm_* where needed?
...@@ -968,7 +968,10 @@ void _processPars(int sensor_port, struct sensorproc_t * sensorproc, int frame16 ...@@ -968,7 +968,10 @@ void _processPars(int sensor_port, struct sensorproc_t * sensorproc, int frame16
dev_dbg(g_devfp_ptr,"port= %d (after second _processParsASAP), frame16=%d, maxahead=%d\n", sensor_port, frame16, maxahead); dev_dbg(g_devfp_ptr,"port= %d (after second _processParsASAP), frame16=%d, maxahead=%d\n", sensor_port, frame16, maxahead);
} }
dev_dbg(g_devfp_ptr,"port= %d (after second _processParsASAP), frame16=%d, maxahead=%d\n", sensor_port, frame16, maxahead); dev_dbg(g_devfp_ptr,"port= %d (after second _processParsASAP), frame16=%d, maxahead=%d\n", sensor_port, frame16, maxahead);
if (debug_flags) debug_flags--; if (debug_flags) {
dev_dbg(g_devfp_ptr,"debug_flags= %d \n", debug_flags);
debug_flags--;
}
} }
...@@ -1007,7 +1010,7 @@ int processPars(int sensor_port, struct sensorproc_t * sensorproc, int frame16, ...@@ -1007,7 +1010,7 @@ int processPars(int sensor_port, struct sensorproc_t * sensorproc, int frame16,
if (debug_flags) { if (debug_flags) {
MDP(DBGB_FPPT,sensor_port,"==from tasklet: frame16=%d, maxahead=%d\n", MDP(DBGB_FPPT,sensor_port,"==from tasklet: frame16=%d, maxahead=%d\n",
frame16, maxahead) frame16, maxahead)
dev_dbg(g_devfp_ptr,"==from tasklet: port= %d, frame16=%d, maxahead=%d\n", sensor_port, frame16, maxahead); dev_dbg(g_devfp_ptr,"==from tasklet: port= %d, frame16=%d, maxahead=%d now=0x%lx\n", sensor_port, frame16, maxahead, getThisFrameNumber(sensor_port));
} }
dev_dbg(g_devfp_ptr,"port= %d, frame16=%d, maxahead=%d\n", sensor_port, frame16, maxahead); dev_dbg(g_devfp_ptr,"port= %d, frame16=%d, maxahead=%d\n", sensor_port, frame16, maxahead);
...@@ -1021,13 +1024,12 @@ int processPars(int sensor_port, struct sensorproc_t * sensorproc, int frame16, ...@@ -1021,13 +1024,12 @@ int processPars(int sensor_port, struct sensorproc_t * sensorproc, int frame16,
if (debug_flags) { if (debug_flags) {
MDP(DBGB_FPPT,sensor_port,"==Done from tasklet: frame16=%d, maxahead=%d\n", MDP(DBGB_FPPT,sensor_port,"==Done from tasklet: frame16=%d, maxahead=%d\n",
frame16, maxahead) frame16, maxahead)
dev_dbg(g_devfp_ptr,"== Done from tasklet: port= %d, frame16=%d, maxahead=%d\n", sensor_port, frame16, maxahead); dev_dbg(g_devfp_ptr,"== Done from tasklet: port= %d, frame16=%d, maxahead=%d now=0x%lx\n", sensor_port, frame16, maxahead, getThisFrameNumber(sensor_port));
} }
return 0; return 0;
} }
#endif #endif
/** /**
* @brief schedule pgm_func to be executed for selected frame (frame16) * @brief schedule pgm_func to be executed for selected frame (frame16)
* @param sensor_port sensor port number (0..3) * @param sensor_port sensor port number (0..3)
......
...@@ -16,7 +16,7 @@ void init_framepars_ptr(int sensor_port); ...@@ -16,7 +16,7 @@ void init_framepars_ptr(int sensor_port);
int initSequencers (int sensor_port); ///Move to sensorcommon? currently it is used through frameparsall file (lseek) int initSequencers (int sensor_port); ///Move to sensorcommon? currently it is used through frameparsall file (lseek)
void initGlobalPars (int sensor_port); /// resets all global parameters but debug mask (if ELPHEL_DEBUG) void initGlobalPars (int sensor_port); /// resets all global parameters but debug mask (if ELPHEL_DEBUG)
int initMultiPars (int sensor_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 int initMultiPars (int sensor_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
void initFramePars (int sensor_port); ///initialize all parameters, set thisFrameNumber to frame8 (read from hardware, usually 0 after resetting i2c and cmd_seq) void initFramePars (int sensor_port); ///initialize all parameters, set thisFrameNumber to frame16 (read from hardware, usually 0 after resetting i2c and cmd_seq)
void resetFrameNumber (int sensor_port, u32 aframe, int hreset); /// reset this frame number (called from initFramePars(), also can be used to avoid frame number integer overflow) void resetFrameNumber (int sensor_port, u32 aframe, int hreset); /// reset this frame number (called from initFramePars(), also can be used to avoid frame number integer overflow)
unsigned long get_imageParamsFrame(int sensor_port, int n, int frame); unsigned long get_imageParamsFrame(int sensor_port, int n, int frame);
......
...@@ -1989,8 +1989,8 @@ int mt9x001_pgm_triggermode (int sensor_port, ///< sensor p ...@@ -1989,8 +1989,8 @@ int mt9x001_pgm_triggermode (int sensor_port, ///< sensor p
dev_dbg(g_dev_ptr,"{%d} frame16=%d\n",sensor_port,frame16); dev_dbg(g_dev_ptr,"{%d} frame16=%d\n",sensor_port,frame16);
if (frame16 >= PARS_FRAMES) return -1; // wrong frame if (frame16 >= PARS_FRAMES) return -1; // wrong frame
newreg= (thispars->pars[P_SENSOR_REGS+P_MT9X001_RMODE1] & 0xfe7f) | // old value without snamshot and GRR bits newreg= (thispars->pars[P_SENSOR_REGS+P_MT9X001_RMODE1] & 0xfe7f) | // old value without snamshot and GRR bits
((thispars->pars[P_TRIG] & 4)?0x100:0) | // snapshot mode for P_TRIG==4 or 5 ((thispars->pars[P_TRIG] & 4)?0x100:0) | // snapshot mode for P_TRIG==4 or 20
((thispars->pars[P_TRIG] & 1)?0x80:0); // GRR mode for P_TRIG==5 (no effect for 1 ((thispars->pars[P_TRIG] & 0x10)?0x80:0); // GRR mode for P_TRIG==20
if (newreg != thispars->pars[P_SENSOR_REGS+P_MT9X001_RMODE1]) { if (newreg != thispars->pars[P_SENSOR_REGS+P_MT9X001_RMODE1]) {
// turn off triggered mode immediately, turn on later (or should made at least before changing camsync parameters) // turn off triggered mode immediately, turn on later (or should made at least before changing camsync parameters)
if (!(thispars->pars[P_TRIG] & 4)){ if (!(thispars->pars[P_TRIG] & 4)){
......
...@@ -320,6 +320,7 @@ int multisensor_read_i2c (int sensor_port, const char * class_name, in ...@@ -320,6 +320,7 @@ int multisensor_read_i2c (int sensor_port, const char * class_name, in
int multisensor_write_i2c (int sensor_port, const char * class_name,int sa7_offs, u32 reg_addr, u32 reg_data); int multisensor_write_i2c (int sensor_port, const char * class_name,int sa7_offs, u32 reg_addr, u32 reg_data);
int multisensor_pgm_multisens (int sensor_port, struct sensor_t * sensor, struct framepars_t * thispars, struct framepars_t * prevpars, int frame16); int multisensor_pgm_multisens (int sensor_port, struct sensor_t * sensor, struct framepars_t * thispars, struct framepars_t * prevpars, int frame16);
int multisensor_pgm_sensorphase (int sensor_port, struct sensor_t * sensor, struct framepars_t * thispars, struct framepars_t * prevpars, int frame16); int multisensor_pgm_sensorphase (int sensor_port, struct sensor_t * sensor, struct framepars_t * thispars, struct framepars_t * prevpars, int frame16);
int multisensor_pgm_sdram_phase (int sensor_port, struct sensor_t * sensor, struct framepars_t * thispars, struct framepars_t * prevpars, int frame16);
int multisensor_set_freq (int sensor_port, int first, struct framepars_t * thispars); int multisensor_set_freq (int sensor_port, int first, struct framepars_t * thispars);
int multisensor_set_phase_verify (int sensor_port, int reg_addr, int resetDCM, unsigned long newPhase, unsigned long oldPhase); int multisensor_set_phase_verify (int sensor_port, int reg_addr, int resetDCM, unsigned long newPhase, unsigned long oldPhase);
int multisensor_set_phase_recover (int sensor_port, int reg_addr, int resetDCM, unsigned long newPhase, unsigned long oldPhase); int multisensor_set_phase_recover (int sensor_port, int reg_addr, int resetDCM, unsigned long newPhase, unsigned long oldPhase);
...@@ -1000,8 +1001,13 @@ int multisensor_pgm_detectsensor (int sensor_port, ///< sensor p ...@@ -1000,8 +1001,13 @@ int multisensor_pgm_detectsensor (int sensor_port, ///< sensor p
int rslt=0; // or-ed by MULTISENSOR_WRITE_I2C(sa,ra,v,sz) int rslt=0; // or-ed by MULTISENSOR_WRITE_I2C(sa,ra,v,sz)
int i; int i;
int this_sensor_type; int this_sensor_type;
long * multiOutDelay; long * multiOutDelay;
x393_sens_mode_t sens_mode = {.d32=0}; // to disable senosr channel and prevent SoF pulses while 10359 memory is being trained
sens_mode.chn_en = 0;
sens_mode.chn_en_set = 1;
X393_SEQ_SEND1 (sensor_port, frame16, x393_sens_mode, sens_mode);
dev_dbg(g_dev_ptr,"{%d}@0x%lx: X393_SEQ_SEND1(0x%x, 0x%x, x393_sens_mode, 0x%x) disabling SoF - init_sesnor will reenable: 0x%x\n",
sensor_port, getThisFrameNumber(sensor_port), sensor_port, frame16, sens_mode.d32, getHardFrameNumber(sensor_port,0));
// .hact_delay = -2500, // -2.5ns delay in ps // .hact_delay = -2500, // -2.5ns delay in ps
// .sensorDelay = 2460, // Delay from sensor clock at FPGA output to pixel data transition (FPGA input), short cable (ps) // .sensorDelay = 2460, // Delay from sensor clock at FPGA output to pixel data transition (FPGA input), short cable (ps)
multi_unitialized=0; // reset this static variable - it will prevent copying individual flips to multiple until composite mode is used multi_unitialized=0; // reset this static variable - it will prevent copying individual flips to multiple until composite mode is used
...@@ -1045,9 +1051,13 @@ int multisensor_pgm_detectsensor (int sensor_port, ///< sensor p ...@@ -1045,9 +1051,13 @@ int multisensor_pgm_detectsensor (int sensor_port, ///< sensor p
// reset system and SDRAM DCMs on 10359 // reset system and SDRAM DCMs on 10359
MULTISENSOR_WRITE_I2C16(sensor_port,I2C359_DCM_SYSTEM, I2C359_DCM_RESET | I2C359_DCM_RESET90); MULTISENSOR_WRITE_I2C16(sensor_port,I2C359_DCM_SYSTEM, I2C359_DCM_RESET | I2C359_DCM_RESET90);
rslt=0;
#ifdef ADJUST_SDRAM_AT_SENSORPHASE
MULTISENSOR_WRITE_I2C16(sensor_port,I2C359_DCM_SDRAM, I2C359_DCM_RESET | I2C359_DCM_RESET90); MULTISENSOR_WRITE_I2C16(sensor_port,I2C359_DCM_SDRAM, I2C359_DCM_RESET | I2C359_DCM_RESET90);
multisensor_initSDRAM(sensor_port, thispars); // init 10359 SDRAM multisensor_initSDRAM(sensor_port, thispars); // init 10359 SDRAM
rslt=0; #endif
// TODO: read other? // TODO: read other?
// MULTISENSOR_WRITE_I2C16_SHADOW(I2C359_I2CMUX, I2C359_I2CMUX_2MEM); // MULTISENSOR_WRITE_I2C16_SHADOW(I2C359_I2CMUX, I2C359_I2CMUX_2MEM);
...@@ -1068,6 +1078,11 @@ int multisensor_pgm_detectsensor (int sensor_port, ///< sensor p ...@@ -1068,6 +1078,11 @@ int multisensor_pgm_detectsensor (int sensor_port, ///< sensor p
if (rslt>0) dev_info(g_dev_ptr,"10359A sensor clock set to %d\n", rslt); if (rslt>0) dev_info(g_dev_ptr,"10359A sensor clock set to %d\n", rslt);
else if (rslt==0) dev_info(g_dev_ptr,"10359A sensors are using 10353 system clock, as set in configuration\n"); else if (rslt==0) dev_info(g_dev_ptr,"10359A sensors are using 10353 system clock, as set in configuration\n");
else dev_info(g_dev_ptr,"10359 sensor clock failure, will use system clock from 10353 board\n"); else dev_info(g_dev_ptr,"10359 sensor clock failure, will use system clock from 10353 board\n");
#ifndef ADJUST_SDRAM_AT_SENSORPHASE
rslt = multisensor_pgm_sdram_phase (sensor_port, sensor, thispars, prevpars, frame16);
#endif
// Try to read chip version from each of the 3 possible sensors // Try to read chip version from each of the 3 possible sensors
dev_info(g_dev_ptr,"removing MRST from the sensor\n"); dev_info(g_dev_ptr,"removing MRST from the sensor\n");
// //
...@@ -1221,6 +1236,7 @@ Now overwrite sensor functions with it's own (originals (physical sensor ones) a ...@@ -1221,6 +1236,7 @@ Now overwrite sensor functions with it's own (originals (physical sensor ones) a
CCAM_ENDFRAMES_EN ; // Enable ending frame being compressed if no more data will be available (frame ended before specified number of blocks compressed) CCAM_ENDFRAMES_EN ; // Enable ending frame being compressed if no more data will be available (frame ended before specified number of blocks compressed)
#endif #endif
if (nupdate) setFramePars(sensor_port,thispars, nupdate, pars_to_update); // save changes to sensor register shadows if (nupdate) setFramePars(sensor_port,thispars, nupdate, pars_to_update); // save changes to sensor register shadows
dev_dbg(g_dev_ptr,"Done with multisensor_pgm_detectsensor thisFframe= 0x%lx hard frame = 0x%x\n", getThisFrameNumber(sensor_port), getHardFrameNumber(sensor_port,0));
return this_sensor_type; return this_sensor_type;
} }
...@@ -1488,9 +1504,9 @@ int multisensor_pgm_sensorphase(int sensor_port, ///< sensor port ...@@ -1488,9 +1504,9 @@ int multisensor_pgm_sensorphase(int sensor_port, ///< sensor port
long * cableDelay; long * cableDelay;
long * FPGADelay; long * FPGADelay;
int clk_period; int clk_period;
long sdram_chen=thispars->pars[P_M10359_REGS+I2C359_SDRAM_CHEN]; // long sdram_chen=thispars->pars[P_M10359_REGS+I2C359_SDRAM_CHEN];
int adjustSDRAMNeed=0; // int adjustSDRAMNeed=0;
int thisPhaseSDRAM=thispars->pars[P_MULTI_PHASE_SDRAM]; // int thisPhaseSDRAM=thispars->pars[P_MULTI_PHASE_SDRAM];
int thisPhase1= thispars->pars[P_MULTI_PHASE1]; int thisPhase1= thispars->pars[P_MULTI_PHASE1];
int thisPhase2= thispars->pars[P_MULTI_PHASE2]; int thisPhase2= thispars->pars[P_MULTI_PHASE2];
int thisPhase3= thispars->pars[P_MULTI_PHASE3]; int thisPhase3= thispars->pars[P_MULTI_PHASE3];
...@@ -1531,14 +1547,15 @@ int multisensor_pgm_sensorphase(int sensor_port, ///< sensor port ...@@ -1531,14 +1547,15 @@ int multisensor_pgm_sensorphase(int sensor_port, ///< sensor port
dev_dbg(g_dev_ptr,"cableDelay3=0x%lx FPGADelay3= 0x%lx sensorproc_phys->sensor.sensorDelay=0x%x, thisPhase3=0x%x\n",cableDelay[0] ,FPGADelay[0], sensorproc_phys->sensor.sensorDelay,thisPhase3); dev_dbg(g_dev_ptr,"cableDelay3=0x%lx FPGADelay3= 0x%lx sensorproc_phys->sensor.sensorDelay=0x%x, thisPhase3=0x%x\n",cableDelay[0] ,FPGADelay[0], sensorproc_phys->sensor.sensorDelay,thisPhase3);
// TODO: calculate SDRAM phase here too. // TODO: calculate SDRAM phase here too.
adjustSDRAMNeed=1; // adjustSDRAMNeed=1;
multi_phases_initialized=1; multi_phases_initialized=1;
} }
if (reset) { if (reset) {
MULTISENSOR_WRITE_I2C16(sensor_port, I2C359_DCM_SYSTEM, I2C359_DCM_RESET | I2C359_DCM_RESET90); MULTISENSOR_WRITE_I2C16(sensor_port, I2C359_DCM_SYSTEM, I2C359_DCM_RESET | I2C359_DCM_RESET90);
MULTISENSOR_WRITE_I2C16(sensor_port, I2C359_DCM_SDRAM, I2C359_DCM_RESET | I2C359_DCM_RESET90); // MULTISENSOR_WRITE_I2C16(sensor_port, I2C359_DCM_SDRAM, I2C359_DCM_RESET | I2C359_DCM_RESET90);
multisensor_initSDRAM(sensor_port, thispars); // init 10359 SDRAM // multisensor_initSDRAM(sensor_port, thispars); // init 10359 SDRAM
} }
#ifdef ADJUST_SDRAM_AT_SENSORPHASE
if ((thisPhaseSDRAM != prevpars->pars[P_MULTI_PHASE_SDRAM]) || adjustSDRAMNeed) { if ((thisPhaseSDRAM != prevpars->pars[P_MULTI_PHASE_SDRAM]) || adjustSDRAMNeed) {
if (adjustSDRAMNeed || (thisPhaseSDRAM & 0x200000)) { // at boot, after frequency change or manually requested (0x200000) if (adjustSDRAMNeed || (thisPhaseSDRAM & 0x200000)) { // at boot, after frequency change or manually requested (0x200000)
thisPhaseSDRAM=multisensor_adjustSDRAM (sensor_port, FPGA_DCM_RANGE); thisPhaseSDRAM=multisensor_adjustSDRAM (sensor_port, FPGA_DCM_RANGE);
...@@ -1559,7 +1576,7 @@ int multisensor_pgm_sensorphase(int sensor_port, ///< sensor port ...@@ -1559,7 +1576,7 @@ int multisensor_pgm_sensorphase(int sensor_port, ///< sensor port
dev_dbg(g_dev_ptr,"re-initializing SDRAM on 10359 after DCM reset\n"); dev_dbg(g_dev_ptr,"re-initializing SDRAM on 10359 after DCM reset\n");
multisensor_initSDRAM(sensor_port, thispars); // init 10359 SDRAM multisensor_initSDRAM(sensor_port, thispars); // init 10359 SDRAM
} }
// Test memory phase here // Test memory phase here
dev_dbg(g_dev_ptr,"\nMULTI_PHASE_SDRAM=%01x %04x\n", (rslt>>16), rslt & 0xffff); dev_dbg(g_dev_ptr,"\nMULTI_PHASE_SDRAM=%01x %04x\n", (rslt>>16), rslt & 0xffff);
if (thisPhaseSDRAM & 0x100000) { if (thisPhaseSDRAM & 0x100000) {
for (rslt=0;rslt<16;rslt++) { for (rslt=0;rslt<16;rslt++) {
...@@ -1576,6 +1593,7 @@ int multisensor_pgm_sensorphase(int sensor_port, ///< sensor port ...@@ -1576,6 +1593,7 @@ int multisensor_pgm_sensorphase(int sensor_port, ///< sensor port
} }
} }
} }
#endif
if (thisPhase1 != prevpars->pars[P_MULTI_PHASE1]) { if (thisPhase1 != prevpars->pars[P_MULTI_PHASE1]) {
resetThisDCM=reset || (thisPhase1 & 0x80000); resetThisDCM=reset || (thisPhase1 & 0x80000);
rslt= multisensor_set_phase (sensor_port, I2C359_DCM_SENSOR1, resetThisDCM, thisPhase1, prevpars->pars[P_MULTI_PHASE1]); rslt= multisensor_set_phase (sensor_port, I2C359_DCM_SENSOR1, resetThisDCM, thisPhase1, prevpars->pars[P_MULTI_PHASE1]);
...@@ -1593,12 +1611,77 @@ int multisensor_pgm_sensorphase(int sensor_port, ///< sensor port ...@@ -1593,12 +1611,77 @@ int multisensor_pgm_sensorphase(int sensor_port, ///< sensor port
rslt= multisensor_set_phase (sensor_port, I2C359_DCM_SENSOR3, resetThisDCM, thisPhase3, prevpars->pars[P_MULTI_PHASE3]); rslt= multisensor_set_phase (sensor_port, I2C359_DCM_SENSOR3, resetThisDCM, thisPhase3, prevpars->pars[P_MULTI_PHASE3]);
if ((rslt>=0) && (rslt != thisPhase3)) SETFRAMEPARS_SET(P_MULTI_PHASE3, rslt); if ((rslt>=0) && (rslt != thisPhase3)) SETFRAMEPARS_SET(P_MULTI_PHASE3, rslt);
} }
// MULTISENSOR_WRITE_I2C32_SHADOW(sensor_port, I2C359_SDRAM_CHEN, sdram_chen); // Restore 10359 SDRAM channels enable
if (nupdate) setFramePars(sensor_port,thispars, nupdate, pars_to_update); // save changes, schedule functions
return 0;
}
/** Adjust SDRAM phase - should be done when sensor is stopped, it is a long procedure*/
int multisensor_pgm_sdram_phase(int sensor_port, ///< sensor port number (0..3)
struct sensor_t * sensor, ///< sensor static parameters (capabilities)
struct framepars_t * thispars, ///< sensor current parameters
struct framepars_t * prevpars, ///< sensor previous parameters (not used here)
int frame16) ///< 4-bit (hardware) frame number parameters should
///< be applied to, negative - ASAP
///< @return always 0
{
long sdram_chen=thispars->pars[P_M10359_REGS+I2C359_SDRAM_CHEN];
int adjustSDRAMNeed=0;
int thisPhaseSDRAM=thispars->pars[P_MULTI_PHASE_SDRAM];
int reset = 1; // always reset
int resetThisDCM;
int rslt=0;
struct frameparspair_t pars_to_update[6]; // ??? needed, increase if more entries will be added
int nupdate=0;
if (reset) {
MULTISENSOR_WRITE_I2C16(sensor_port, I2C359_DCM_SDRAM, I2C359_DCM_RESET | I2C359_DCM_RESET90);
multisensor_initSDRAM(sensor_port, thispars); // init 10359 SDRAM
}
if ((thisPhaseSDRAM != prevpars->pars[P_MULTI_PHASE_SDRAM]) || adjustSDRAMNeed) {
if (adjustSDRAMNeed || (thisPhaseSDRAM & 0x200000)) { // at boot, after frequency change or manually requested (0x200000)
thisPhaseSDRAM=multisensor_adjustSDRAM (sensor_port, FPGA_DCM_RANGE);
if (thisPhaseSDRAM>=0) {
SETFRAMEPARS_SET(P_MULTI_PHASE_SDRAM, thisPhaseSDRAM);
dev_info(g_dev_ptr,"10359 SDRAM clock phase is set to %d/%s%d\n",
90*((thisPhaseSDRAM>>16) & 3),
(thisPhaseSDRAM & 0x8000)?"-":"+",
(thisPhaseSDRAM & 0x8000)?(0x10000-(thisPhaseSDRAM & 0xffff)):(thisPhaseSDRAM & 0xffff));
} else {
dev_warn (g_dev_ptr,"**** ERROR adjusting SDRAM clock phase in %s:%d:%s, result=0x%x\n",__FILE__,__LINE__,__FUNCTION__,thisPhaseSDRAM);
}
} else {
resetThisDCM=reset || (thisPhaseSDRAM & 0x80000);
rslt= multisensor_set_phase (sensor_port, I2C359_DCM_SDRAM, resetThisDCM, thisPhaseSDRAM, prevpars->pars[P_MULTI_PHASE_SDRAM]);
if ((rslt>=0) && (rslt != thisPhaseSDRAM)) SETFRAMEPARS_SET(P_MULTI_PHASE_SDRAM, rslt);
if (resetThisDCM) {
dev_dbg(g_dev_ptr,"re-initializing SDRAM on 10359 after DCM reset\n");
multisensor_initSDRAM(sensor_port, thispars); // init 10359 SDRAM
}
// Test memory phase here
dev_dbg(g_dev_ptr,"\nMULTI_PHASE_SDRAM=%01x %04x\n", (rslt>>16), rslt & 0xffff);
if (thisPhaseSDRAM & 0x100000) {
for (rslt=0;rslt<16;rslt++) {
multisensor_memphase_debug(sensor_port, -1);
}
} else {
multisensor_memphase_debug(sensor_port, 1);
#if 0
printk ("\n");
multisensor_memphase_debug(0);
printk ("\n");
multisensor_memphase_debug(0);
#endif
}
}
}
MULTISENSOR_WRITE_I2C32_SHADOW(sensor_port, I2C359_SDRAM_CHEN, sdram_chen); // Restore 10359 SDRAM channels enable MULTISENSOR_WRITE_I2C32_SHADOW(sensor_port, I2C359_SDRAM_CHEN, sdram_chen); // Restore 10359 SDRAM channels enable
if (nupdate) setFramePars(sensor_port,thispars, nupdate, pars_to_update); // save changes, schedule functions if (nupdate) setFramePars(sensor_port,thispars, nupdate, pars_to_update); // save changes, schedule functions
return 0; return 0;
} }
/** Set 10359A clock frequency (take care of 10359-0) */ /** Set 10359A clock frequency (take care of 10359-0) */
int multisensor_set_freq (int sensor_port, ///< sensor port number (0..3) int multisensor_set_freq (int sensor_port, ///< sensor port number (0..3)
int first, ///< was never programmed before int first, ///< was never programmed before
......
...@@ -1441,7 +1441,7 @@ int pgm_sensorin (int sensor_port, ///< sensor port number (0..3 ...@@ -1441,7 +1441,7 @@ int pgm_sensorin (int sensor_port, ///< sensor port number (0..3
x393_gamma_ctl_t gamma_ctl = {.d32=0}; x393_gamma_ctl_t gamma_ctl = {.d32=0};
int bayer; int bayer;
int n_scan_lines, n_ph_lines; int n_scan_lines; //, n_ph_lines;
int flips; int flips;
int bayer_modified; int bayer_modified;
x393_mcntrl_frame_start_dly_t start_dly ={.d32=0}; x393_mcntrl_frame_start_dly_t start_dly ={.d32=0};
...@@ -1529,8 +1529,8 @@ int pgm_sensorin (int sensor_port, ///< sensor port number (0..3 ...@@ -1529,8 +1529,8 @@ int pgm_sensorin (int sensor_port, ///< sensor port number (0..3
if (FRAMEPAR_MODIFIED(P_MEMSENSOR_DLY) && ((start_dly.start_dly = thispars->pars[P_MEMSENSOR_DLY]))){ if (FRAMEPAR_MODIFIED(P_MEMSENSOR_DLY) && ((start_dly.start_dly = thispars->pars[P_MEMSENSOR_DLY]))){
X393_SEQ_SEND1 (sensor_port, frame16, x393_sens_mcntrl_scanline_start_delay, start_dly); X393_SEQ_SEND1 (sensor_port, frame16, x393_sens_mcntrl_scanline_start_delay, start_dly);
dev_dbg(g_dev_ptr,"{%d} Setting sensor-to-memory frame sync delay to %ld (0x%lx)\n",sensor_port, start_dly.start_dly,start_dly.start_dly); dev_dbg(g_dev_ptr,"{%d} Setting sensor-to-memory frame sync delay to %d (0x%x)\n",sensor_port, start_dly.start_dly,start_dly.start_dly);
MDP(DBGB_PADD, sensor_port,"Setting sensor-to-memory frame sync delay to %ld (0x%lx)\n", start_dly.start_dly,start_dly.start_dly) MDP(DBGB_PADD, sensor_port,"Setting sensor-to-memory frame sync delay to %d (0x%x)\n", start_dly.start_dly,start_dly.start_dly)
} }
...@@ -2404,8 +2404,8 @@ int pgm_focusmode (int sensor_port, ///< sensor port number (0..3 ...@@ -2404,8 +2404,8 @@ int pgm_focusmode (int sensor_port, ///< sensor port number (0..3
///< be applied to, negative - ASAP ///< be applied to, negative - ASAP
///< @return OK - 0, <0 - error ///< @return OK - 0, <0 - error
{ {
unsigned long flags; // unsigned long flags;
int i; // int i;
// x393_cmprs_table_addr_t table_addr; // x393_cmprs_table_addr_t table_addr;
struct { struct {
short left; short left;
...@@ -2888,7 +2888,7 @@ int pgm_compstop (int sensor_port, ///< sensor port number (0..3 ...@@ -2888,7 +2888,7 @@ int pgm_compstop (int sensor_port, ///< sensor port number (0..3
disable_need, disable_need,
(frame16<0)? ASAP: ABSOLUTE, // how to apply commands - directly or through channel sequencer (frame16<0)? ASAP: ABSOLUTE, // how to apply commands - directly or through channel sequencer
frame16); frame16);
dev_dbg(g_dev_ptr,"{%d} X393_SEQ_SEND1(0x%x, 0x%x, x393_cmprs_control_reg, 0x%x)\n",sensor_port, sensor_port, frame16, cmprs_mode.d32); dev_dbg(g_dev_ptr,"{%d}@0x%lx: X393_SEQ_SEND1(0x%x, 0x%x, x393_cmprs_control_reg, 0x%x)\n",sensor_port, getThisFrameNumber(sensor_port), sensor_port, frame16, cmprs_mode.d32);
MDP(DBGB_PADD, sensor_port,"X393_SEQ_SEND1(0x%x, 0x%x, x393_cmprs_control_reg, 0x%x)\n", sensor_port, frame16, cmprs_mode.d32) MDP(DBGB_PADD, sensor_port,"X393_SEQ_SEND1(0x%x, 0x%x, x393_cmprs_control_reg, 0x%x)\n", sensor_port, frame16, cmprs_mode.d32)
return 0; return 0;
...@@ -2917,7 +2917,7 @@ int pgm_compctl (int sensor_port, ///< sensor port number (0..3 ...@@ -2917,7 +2917,7 @@ int pgm_compctl (int sensor_port, ///< sensor port number (0..3
int disable_need = 1; // TODO: Use some G_* parameter int disable_need = 1; // TODO: Use some G_* parameter
x393_cmprs_mode_t cmprs_mode = {.d32=0}; x393_cmprs_mode_t cmprs_mode = {.d32=0};
int reset_frame = 0; int reset_frame = 0;
int just_started = 0; // int just_started = 0;
dev_dbg(g_dev_ptr,"{%d} frame16=%d, prevpars->pars[P_COMPRESSOR_RUN]=%d, thispars->pars[P_COMPRESSOR_RUN]=%d \n", dev_dbg(g_dev_ptr,"{%d} frame16=%d, prevpars->pars[P_COMPRESSOR_RUN]=%d, thispars->pars[P_COMPRESSOR_RUN]=%d \n",
sensor_port,frame16, (int) prevpars->pars[P_COMPRESSOR_RUN], (int) thispars->pars[P_COMPRESSOR_RUN]); sensor_port,frame16, (int) prevpars->pars[P_COMPRESSOR_RUN], (int) thispars->pars[P_COMPRESSOR_RUN]);
MDP(DBGB_PSFN, sensor_port,"frame16=%d, prevpars->pars[P_COMPRESSOR_RUN]=%d, thispars->pars[P_COMPRESSOR_RUN]=%d \n", MDP(DBGB_PSFN, sensor_port,"frame16=%d, prevpars->pars[P_COMPRESSOR_RUN]=%d, thispars->pars[P_COMPRESSOR_RUN]=%d \n",
...@@ -2962,7 +2962,8 @@ int pgm_compctl (int sensor_port, ///< sensor port number (0..3 ...@@ -2962,7 +2962,8 @@ int pgm_compctl (int sensor_port, ///< sensor port number (0..3
X393_SEQ_SEND1 (sensor_port, frame16, x393_cmprs_control_reg, cmprs_mode); X393_SEQ_SEND1 (sensor_port, frame16, x393_cmprs_control_reg, cmprs_mode);
} }
dev_dbg(g_dev_ptr,"{%d} X393_SEQ_SEND1(0x%x, 0x%x, x393_cmprs_control_reg, 0x%x)\n",sensor_port, sensor_port, frame16, cmprs_mode.d32); dev_dbg(g_dev_ptr,"{%d}@0x%lx: X393_SEQ_SEND1(0x%x, 0x%x, x393_cmprs_control_reg, 0x%x)\n",sensor_port, getThisFrameNumber(sensor_port), sensor_port, frame16, cmprs_mode.d32);
MDP(DBGB_PADD, sensor_port,"X393_SEQ_SEND1(0x%x, 0x%x, x393_cmprs_control_reg, 0x%x)\n", sensor_port, frame16, cmprs_mode.d32) MDP(DBGB_PADD, sensor_port,"X393_SEQ_SEND1(0x%x, 0x%x, x393_cmprs_control_reg, 0x%x)\n", sensor_port, frame16, cmprs_mode.d32)
return 0; return 0;
......
...@@ -303,7 +303,9 @@ ...@@ -303,7 +303,9 @@
<li> bit 0 - "old" external mode (0 - internal, 1 - external ) <li> bit 0 - "old" external mode (0 - internal, 1 - external )
<li> bit 1 - enable(1) or disable(0) external trigger to stop clip <li> bit 1 - enable(1) or disable(0) external trigger to stop clip
<li> bit 2 - async (snapshot, ext trigger) mode, 0 - continuous NOTE: Only this bit is used now <li> bit 2 - async (snapshot, ext trigger) mode, 0 - continuous NOTE: Only this bit is used now
<li> bit 3 - no overlap, single frames: program - acquire/compress same frame</ul>*/ <li> bit 3 - no overlap, single frames: program - acquire/compress same frame
<li> bit 4 - global reset release (GRR) mode - (only when combined with bit 2)
</ul>*/
#define P_BGFRAME 16 ///< Background measurement mode - will use 16-bit mode and no FPN correction #define P_BGFRAME 16 ///< Background measurement mode - will use 16-bit mode and no FPN correction
//#define P_IMGSZMEM 17 ///< image size in video memory (calculated when channel 0 is programmed) NC393: Not used ??? //#define P_IMGSZMEM 17 ///< image size in video memory (calculated when channel 0 is programmed) NC393: Not used ???
//#define P_COMP_BAYER 17 ///< -> 119 derivative, readonly - calculated from P_BAYER and COMPMOD_BYRSH to separate sensor and compressor channels //#define P_COMP_BAYER 17 ///< -> 119 derivative, readonly - calculated from P_BAYER and COMPMOD_BYRSH to separate sensor and compressor channels
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment