Commit bf06826b authored by Andrey Filippov's avatar Andrey Filippov

debugging boson-related code

parent cc6a8f22
...@@ -2195,6 +2195,7 @@ static ssize_t store_frame2ts(struct device *dev, struct device_attribute *attr, ...@@ -2195,6 +2195,7 @@ static ssize_t store_frame2ts(struct device *dev, struct device_attribute *attr,
int mchn; int mchn;
u32 aframe=0; u32 aframe=0;
u32 period10ns; // trigger period in 10 ns increments u32 period10ns; // trigger period in 10 ns increments
u32 trig_decimate = 1;
u32 ts_pair[2]; u32 ts_pair[2];
s64 delta_ts; s64 delta_ts;
int delta_frame; int delta_frame;
...@@ -2216,7 +2217,8 @@ static ssize_t store_frame2ts(struct device *dev, struct device_attribute *attr, ...@@ -2216,7 +2217,8 @@ static ssize_t store_frame2ts(struct device *dev, struct device_attribute *attr,
} }
master_ts = ((long long) ts_pair[1]) * 1000000 + ts_pair[0]; // timestamp in microseconds master_ts = ((long long) ts_pair[1]) * 1000000 + ts_pair[0]; // timestamp in microseconds
if (aframe > 0) { // if 0 - keep last ts to be read if (aframe > 0) { // if 0 - keep last ts to be read
period10ns = aframepars[mchn][thisFrameNumber(mchn) & PARS_FRAMES_MASK].pars[P_TRIG_PERIOD]; trig_decimate = aframepars[mchn][thisFrameNumber(mchn) & PARS_FRAMES_MASK].pars[P_TRIG_DECIMATE] + 1;
period10ns = aframepars[mchn][thisFrameNumber(mchn) & PARS_FRAMES_MASK].pars[P_TRIG_PERIOD] * trig_decimate;
delta_frame = aframe - master_frame; delta_frame = aframe - master_frame;
delta_ts = ((long long) period10ns) * delta_frame * 2 + 1; // to round afrter division by 100 delta_ts = ((long long) period10ns) * delta_frame * 2 + 1; // to round afrter division by 100
dev_info(g_devfp_ptr,"delta_frame = %d, delta_ts = %lld us, period10ns=%d\n", delta_frame, delta_ts,period10ns); dev_info(g_devfp_ptr,"delta_frame = %d, delta_ts = %lld us, period10ns=%d\n", delta_frame, delta_ts,period10ns);
...@@ -2239,6 +2241,7 @@ static ssize_t store_ts2frame(struct device *dev, struct device_attribute *attr, ...@@ -2239,6 +2241,7 @@ static ssize_t store_ts2frame(struct device *dev, struct device_attribute *attr,
u32 ts_pair[2]; u32 ts_pair[2];
int mchn; int mchn;
u32 period10ns; // trigger period in 10 ns increments u32 period10ns; // trigger period in 10 ns increments
u32 trig_decimate = 1;
s64 delta_ts; s64 delta_ts;
s32 delta_frame; s32 delta_frame;
sscanf(buf, "%llu", &ts); sscanf(buf, "%llu", &ts);
...@@ -2259,7 +2262,8 @@ static ssize_t store_ts2frame(struct device *dev, struct device_attribute *attr, ...@@ -2259,7 +2262,8 @@ static ssize_t store_ts2frame(struct device *dev, struct device_attribute *attr,
} }
master_ts = ((long long) ts_pair[1]) * 1000000 + ts_pair[0]; // timestamp in microseconds master_ts = ((long long) ts_pair[1]) * 1000000 + ts_pair[0]; // timestamp in microseconds
if (ts) { // if ts 0 (or not specified, e.g. echo "" > ... , then keep last comprfessed frame and timestamp to be read out if (ts) { // if ts 0 (or not specified, e.g. echo "" > ... , then keep last comprfessed frame and timestamp to be read out
period10ns = aframepars[mchn][thisFrameNumber(mchn) & PARS_FRAMES_MASK].pars[P_TRIG_PERIOD]; trig_decimate = aframepars[mchn][thisFrameNumber(mchn) & PARS_FRAMES_MASK].pars[P_TRIG_DECIMATE] + 1;
period10ns = aframepars[mchn][thisFrameNumber(mchn) & PARS_FRAMES_MASK].pars[P_TRIG_PERIOD] * trig_decimate;
delta_ts = 100*(ts - master_ts) + (period10ns/2); // for rounding delta_ts = 100*(ts - master_ts) + (period10ns/2); // for rounding
// do_div(delta_ts, period10ns); // do_div(delta_ts, period10ns);
// delta_ts /= period10ns; // delta_ts /= period10ns;
...@@ -2276,6 +2280,8 @@ static ssize_t show_ts2frame(struct device *dev, struct device_attribute *attr, ...@@ -2276,6 +2280,8 @@ static ssize_t show_ts2frame(struct device *dev, struct device_attribute *attr,
return sprintf(buf,"%d", master_frame); return sprintf(buf,"%d", master_frame);
} }
/* /*
#define P_TRIG_DECIMATE 121 ///< Decimate trigger by (P_TRIG_DECIMATE + 1) - trigger sensor less frequent than incoming trigger
aframepars[sensor_port][(i+frame16) & PARS_FRAMES_MASK].pars[P_FRAME] = thisFrameNumber(sensor_port) + i;#define thisCompressorFrameNumber(p) GLOBALPARS(p,G_COMPRESSOR_FRAME) // Current compressed frame number (lags from thisFrameNumber) aframepars[sensor_port][(i+frame16) & PARS_FRAMES_MASK].pars[P_FRAME] = thisFrameNumber(sensor_port) + i;#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_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 #define thisCompressorTimestamp_usec(p) GLOBALPARS(p,G_COMPRESSOR_USEC) // Current compressed frame timestamp microseconds seconds
......
...@@ -2575,7 +2575,20 @@ int pgm_trigseq (int sensor_port, ///< sensor port number (0..3 ...@@ -2575,7 +2575,20 @@ int pgm_trigseq (int sensor_port, ///< sensor port number (0..3
dev_dbg(g_dev_ptr,"{%d} X3X3_SEQ_SEND1(0x%x, 0x%x, x393_camsync_trig_delay, 0x%x)\n", dev_dbg(g_dev_ptr,"{%d} X3X3_SEQ_SEND1(0x%x, 0x%x, x393_camsync_trig_delay, 0x%x)\n",
sensor_port, sensor_port, frame16, (int) thispars->pars[P_TRIG_DELAY]); sensor_port, sensor_port, frame16, (int) thispars->pars[P_TRIG_DELAY]);
} }
if (FRAMEPAR_MODIFIED(P_TRIG_DECIMATE)) {
if (unlikely(thispars->pars[P_TRIG_DECIMATE] > 65535)) { // Wrong value, restore old one
SETFRAMEPARS_SET(P_TRIG_DECIMATE,prevpars->pars[P_TRIG_DECIMATE]);
} else {
/// set_x393_camsync_trig_period(thispars->pars[P_TRIG_DECIMATE]);
/// dev_dbg(g_dev_ptr,"{%d} set_x393_camsync_trig_period(0x%lx)\n",sensor_port, thispars->pars[P_TRIG_DECIMATE]);
/// MDP(DBGB_PADD, sensor_port,"set_x393_camsync_trig_decimation(0x%lx)\n", thispars->pars[P_TRIG_DECIMATE])
X393_SEQ_SEND1 (sensor_port, frame16, x393_camsync_trig_decimation, thispars->pars[P_TRIG_DECIMATE]);
dev_dbg(g_dev_ptr,"{%d} X3X3_SEQ_SEND1(0x%x, 0x%x, x393_camsync_trig_decimation, 0x%x)\n",
sensor_port, sensor_port, frame16, (int) thispars->pars[P_TRIG_DECIMATE]);
}
}
// Next parameters are applicable only to master channel
if (!is_master){ if (!is_master){
dev_dbg(g_dev_ptr,"{%d} frame16=%d: nothing to do, master channel is %d\n",sensor_port,frame16, (int) thispars->pars[P_TRIG_MASTER]); dev_dbg(g_dev_ptr,"{%d} frame16=%d: nothing to do, master channel is %d\n",sensor_port,frame16, (int) thispars->pars[P_TRIG_MASTER]);
return 0; return 0;
...@@ -2642,6 +2655,8 @@ int pgm_trigseq (int sensor_port, ///< sensor port number (0..3 ...@@ -2642,6 +2655,8 @@ int pgm_trigseq (int sensor_port, ///< sensor port number (0..3
sensor_port, sensor_port, frame16, (int) thispars->pars[P_TRIG_PERIOD]); sensor_port, sensor_port, frame16, (int) thispars->pars[P_TRIG_PERIOD]);
} }
} }
/*
* P_TRIG_DECIMATE is per-channel, here only master channel remains
if (FRAMEPAR_MODIFIED(P_TRIG_DECIMATE)) { if (FRAMEPAR_MODIFIED(P_TRIG_DECIMATE)) {
if (unlikely(thispars->pars[P_TRIG_DECIMATE] > 65535)) { // Wrong value, restore old one if (unlikely(thispars->pars[P_TRIG_DECIMATE] > 65535)) { // Wrong value, restore old one
SETFRAMEPARS_SET(P_TRIG_DECIMATE,prevpars->pars[P_TRIG_DECIMATE]); SETFRAMEPARS_SET(P_TRIG_DECIMATE,prevpars->pars[P_TRIG_DECIMATE]);
...@@ -2654,6 +2669,7 @@ int pgm_trigseq (int sensor_port, ///< sensor port number (0..3 ...@@ -2654,6 +2669,7 @@ int pgm_trigseq (int sensor_port, ///< sensor port number (0..3
sensor_port, sensor_port, frame16, (int) thispars->pars[P_TRIG_DECIMATE]); sensor_port, sensor_port, frame16, (int) thispars->pars[P_TRIG_DECIMATE]);
} }
} }
*/
// P_EXTERN_TIMESTAMP changed? (0 - internal sequencer) // P_EXTERN_TIMESTAMP changed? (0 - internal sequencer)
......
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