Commit cc6a8f22 authored by Andrey Filippov's avatar Andrey Filippov

synchronizing cameras

parent 567a278f
This diff is collapsed.
This diff is collapsed.
...@@ -10,6 +10,10 @@ extern struct common_pars_t *common_pars; ...@@ -10,6 +10,10 @@ extern struct common_pars_t *common_pars;
extern unsigned long *aglobalPars[SENSOR_PORTS]; extern unsigned long *aglobalPars[SENSOR_PORTS];
extern unsigned long *amultiSensIndex[SENSOR_PORTS]; extern unsigned long *amultiSensIndex[SENSOR_PORTS];
extern unsigned long *amultiSensRvrsIndex[SENSOR_PORTS]; extern unsigned long *amultiSensRvrsIndex[SENSOR_PORTS];
#define thisFrameNumber(p) GLOBALPARS(p,G_THIS_FRAME) // Current frame number (may lag from the hardware)
#define thisCompressorFrameNumber(p) GLOBALPARS(p,G_COMPRESSOR_FRAME) // Current compressed frame number (lags from thisFrameNumber)
#define thisCompressorTimestamp_sec(p) GLOBALPARS(p,G_COMPRESSOR_SEC) // Current compressed frame timestamp seconds
#define thisCompressorTimestamp_usec(p) GLOBALPARS(p,G_COMPRESSOR_USEC) // Current compressed frame timestamp microseconds seconds
extern wait_queue_head_t aframepars_wait_queue[SENSOR_PORTS]; extern wait_queue_head_t aframepars_wait_queue[SENSOR_PORTS];
///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
void init_framepars_ptr(int sensor_port); void init_framepars_ptr(int sensor_port);
......
...@@ -364,6 +364,7 @@ loff_t jpeghead_lseek(struct file *file, loff_t offset, int orig, ...@@ -364,6 +364,7 @@ loff_t jpeghead_lseek(struct file *file, loff_t offset, int orig,
file->f_pos = jpeghead_priv[chn].jpeg_h_sz + offset; file->f_pos = jpeghead_priv[chn].jpeg_h_sz + offset;
} else { } else {
file->f_pos = 0; // reset it to 0 anyway file->f_pos = 0; // reset it to 0 anyway
// frame_length = timestamp_sec (same field). Should it be fixed below?
if ((fp->signffff != MARKER_FFFF) || // signature is overwritten if ((fp->signffff != MARKER_FFFF) || // signature is overwritten
((fp->timestamp_sec) & X313_LENGTH_MASK)) return -EINVAL; //! acquisition of this frame is not done yet - length word high byte is non-zero ((fp->timestamp_sec) & X313_LENGTH_MASK)) return -EINVAL; //! acquisition of this frame is not done yet - length word high byte is non-zero
if ((offset & 0x1f) == 0x2) if ((offset & 0x1f) == 0x2)
......
...@@ -1348,7 +1348,7 @@ int pgm_triggermode(int sensor_port, ///< sensor port number (0..3 ...@@ -1348,7 +1348,7 @@ int pgm_triggermode(int sensor_port, ///< sensor port number (0..3
x393_camsync_mode_t camsync_mode = {.d32=0}; x393_camsync_mode_t camsync_mode = {.d32=0};
int is_master = (thispars->pars[P_TRIG_MASTER] == sensor_port)? 1 : 0; int is_master = (thispars->pars[P_TRIG_MASTER] == sensor_port)? 1 : 0;
dev_dbg(g_dev_ptr,"{%d} frame16=%d, is_master=%d\n",sensor_port,frame16, is_master); dev_dbg(g_dev_ptr,"{%d} frame16=%d, is_master=%d, this_frame=%ld\n",sensor_port,frame16, is_master, getThisFrameNumber(sensor_port));
MDP(DBGB_PSFN, sensor_port,"frame16=%d\n",frame16) MDP(DBGB_PSFN, sensor_port,"frame16=%d\n",frame16)
if (frame16 >= PARS_FRAMES) return -1; // wrong frame if (frame16 >= PARS_FRAMES) return -1; // wrong frame
camsync_mode.trig = (thispars->pars[P_TRIG] & 4)?1:0; camsync_mode.trig = (thispars->pars[P_TRIG] & 4)?1:0;
...@@ -1382,6 +1382,8 @@ int pgm_triggermode(int sensor_port, ///< sensor port number (0..3 ...@@ -1382,6 +1382,8 @@ int pgm_triggermode(int sensor_port, ///< sensor port number (0..3
for (i=0; i<SENSOR_PORTS; i++) if (i != sensor_port) { for (i=0; i<SENSOR_PORTS; i++) if (i != sensor_port) {
common_pars->updated[i] = 1; common_pars->updated[i] = 1;
} }
} else {
dev_dbg(g_dev_ptr,"{%d} No change to common trigger mode, old=0x%lx, new=0x%lx\n",sensor_port,common_pars->trig_mode,thispars->pars[P_TRIG]);
} }
return 0; return 0;
......
...@@ -516,6 +516,9 @@ inline void updateIRQ_Exif(struct jpeg_ptr_t *jptr, ///< pointer ...@@ -516,6 +516,9 @@ inline void updateIRQ_Exif(struct jpeg_ptr_t *jptr, ///< pointer
// int frame_index = frame & PASTPARS_SAVE_ENTRIES_MASK; // int frame_index = frame & PASTPARS_SAVE_ENTRIES_MASK;
// NC393: current parameters are valid at compressor done interrupt (after frame sync interrupts latest valid is new frame number - 2 // NC393: current parameters are valid at compressor done interrupt (after frame sync interrupts latest valid is new frame number - 2
if (index_time<0) index_time+=get_globalParam (sensor_port, G_CIRCBUFSIZE)>>2; if (index_time<0) index_time+=get_globalParam (sensor_port, G_CIRCBUFSIZE)>>2;
thisCompressorTimestamp_sec(sensor_port) = ccam_dma_buf_ptr[sensor_port][index_time];
thisCompressorTimestamp_usec(sensor_port) = ccam_dma_buf_ptr[sensor_port][index_time+1];
// struct exif_datetime_t // struct exif_datetime_t
// calculates datetime([20] and subsec[7], returns pointer to char[27] // calculates datetime([20] and subsec[7], returns pointer to char[27]
exif_meta_time_string=encode_time(time_buff, ccam_dma_buf_ptr[sensor_port][index_time], ccam_dma_buf_ptr[sensor_port][index_time+1]); exif_meta_time_string=encode_time(time_buff, ccam_dma_buf_ptr[sensor_port][index_time], ccam_dma_buf_ptr[sensor_port][index_time+1]);
......
...@@ -802,7 +802,11 @@ ...@@ -802,7 +802,11 @@
#define G_HIST_Y_FRAME (FRAMEPAR_GLOBALS + 102) ///< last frame for which Y histogram was calculated (uses 4 locations) #define G_HIST_Y_FRAME (FRAMEPAR_GLOBALS + 102) ///< last frame for which Y histogram was calculated (uses 4 locations)
#define G_HIST_C_FRAME (FRAMEPAR_GLOBALS + 106) ///< last frame for which C histograms were calculated (uses 4 locations) #define G_HIST_C_FRAME (FRAMEPAR_GLOBALS + 106) ///< last frame for which C histograms were calculated (uses 4 locations)
#define G_HIST_SHIFT (FRAMEPAR_GLOBALS + 107) ///< debug feature - add 0..15 to the histogram frame to read DMA memory // FIXME: overlap?
//#define G_HIST_SHIFT (FRAMEPAR_GLOBALS + 107) ///< debug feature - add 0..15 to the histogram frame to read DMA memory
#define G_COMPRESSOR_SEC (FRAMEPAR_GLOBALS + 110) ///< last compressed frame timestamp seconds (use with G_COMPRESSOR_FRAME)
#define G_COMPRESSOR_USEC (FRAMEPAR_GLOBALS + 111) ///< last compressed frame timestamp microseconds
#define G_HIST_SHIFT (FRAMEPAR_GLOBALS + 112) ///< debug feature - add 0..15 to the histogram frame to read DMA memory
#define G_SENSOR_CALIB (FRAMEPAR_GLOBALS + 1024) ///< 1024 Array of sensor calibration data, sensor dependent.For Micron it is 256*4 actual gains in 8.16 format #define G_SENSOR_CALIB (FRAMEPAR_GLOBALS + 1024) ///< 1024 Array of sensor calibration data, sensor dependent.For Micron it is 256*4 actual gains in 8.16 format
///< Only first 96 for each color are used ///< Only first 96 for each color are used
...@@ -1397,10 +1401,13 @@ struct p_names_t { ...@@ -1397,10 +1401,13 @@ struct p_names_t {
G_NAME_ENTRY(PROFILING_EN), \ G_NAME_ENTRY(PROFILING_EN), \
G_NAME_ENTRY(TEMPERATURE01), \ G_NAME_ENTRY(TEMPERATURE01), \
G_NAME_ENTRY(TEMPERATURE23), \ G_NAME_ENTRY(TEMPERATURE23), \
G_NAME_ENTRY(COMPRESSOR_SEC), \
G_NAME_ENTRY(COMPRESSOR_USEC), \
G_NAME_ENTRY(SENSOR_CALIB), \ G_NAME_ENTRY(SENSOR_CALIB), \
G_NAME_ENTRY(HIST_SHIFT) \ G_NAME_ENTRY(HIST_SHIFT) \
}; };
#define ONCHANGE_NAME_ENTRY(y) { onchange_##y, #y } #define ONCHANGE_NAME_ENTRY(y) { onchange_##y, #y }
#define DEFINE_ONCHANGE_NAMES(x) struct p_names_t x[]= { \ #define DEFINE_ONCHANGE_NAMES(x) struct p_names_t x[]= { \
ONCHANGE_NAME_ENTRY(recalcseq), \ ONCHANGE_NAME_ENTRY(recalcseq), \
......
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