/* 393: sFrameParsAll is an array of 4per-port structures */
/* 393: sFrameParsAll is an array of 4per-port structures */
staticstructframepars_all_tsFrameParsAll[SENSOR_PORTS]__attribute__((aligned(PAGE_SIZE)));///< Sensor Parameters, currently 16 pages all and 2048 pages some, static struct
staticstructframepars_all_tsFrameParsAll[SENSOR_PORTS]__attribute__((aligned(PAGE_SIZE)));///< Sensor Parameters, currently 16 pages all and 2048 pages some, static struct
unsignedlongframeParsInitialized[SENSOR_PORTS];// set to 0 at startup, 1 after initialization that is triggered by setParsAtomic()
unsignedintframeParsInitialized[SENSOR_PORTS];// set to 0 at startup, 1 after initialization that is triggered by setParsAtomic()
#define thisFrameNumber(p) GLOBALPARS(p,G_THIS_FRAME) // Current frame number (may lag from the hardware)
#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 thisCompressorFrameNumber(p) GLOBALPARS(p,G_COMPRESSOR_FRAME) // Current compressed frame number (lags from thisFrameNumber)
...
@@ -146,6 +147,16 @@ unsigned long *amultiSensIndex[SENSOR_PORTS]; // index for per-se
...
@@ -146,6 +147,16 @@ unsigned long *amultiSensIndex[SENSOR_PORTS]; // index for per-se
unsignedlong*amultiSensRvrsIndex[SENSOR_PORTS];// reverse index (to parent) for the multiSensIndex
unsignedlong*amultiSensRvrsIndex[SENSOR_PORTS];// reverse index (to parent) for the multiSensIndex
wait_queue_head_taframepars_wait_queue[SENSOR_PORTS];// used to wait for the frame to be acquired
wait_queue_head_taframepars_wait_queue[SENSOR_PORTS];// used to wait for the frame to be acquired
staticDEFINE_SPINLOCK(framepars_lock_0);///<
staticDEFINE_SPINLOCK(framepars_lock_1);///<
staticDEFINE_SPINLOCK(framepars_lock_2);///<
staticDEFINE_SPINLOCK(framepars_lock_3);///<
/** Define array of pointers to locks - hardware allows concurrent writes to different ports tables */
initMultiPars(sensor_port);// initialize structures for individual per-sensor parameters. Now only works for sensor registers using G_MULTI_REGSM. Should be called after/during sensor detection
initMultiPars(sensor_port);// initialize structures for individual per-sensor parameters. Now only works for sensor registers using G_MULTI_REGSM. Should be called after/during sensor detection
frameParsInitialized[sensor_port]=1;
frameParsInitialized[sensor_port]=1;
dev_dbg(g_devfp_ptr,"%s port %d: DONE, frameParsInitialized[%d]=%d\n",__func__,sensor_port,sensor_port,frameParsInitialized[sensor_port]);
spin_unlock_bh(framepars_locks[sensor_port]);
dev_dbg(g_devfp_ptr,"%s port %d: DONE, frameParsInitialized[%d]=%ld\n",__func__,sensor_port,sensor_port,frameParsInitialized[sensor_port]);
}
}
/**
/**
...
@@ -438,19 +451,20 @@ inline void set_imageParamsR_all(int sensor_port, int n, unsigned long
...
@@ -438,19 +451,20 @@ inline void set_imageParamsR_all(int sensor_port, int n, unsigned long
*/
*/
voidupdateInterFrame(intsensor_port,///< Sensor port number (0..3)
voidupdateInterFrame(intsensor_port,///< Sensor port number (0..3)
intframe16,///< number of frame just compressed (lower 4 bits, from FPGA), always >= sensor frame number,
u32compressed_frame,///< number of frame just compressed
///< interrupt should be processed after frame sync interrupt
///< interrupt should be processed after frame sync interrupt
structinterframe_params_t*interframe_pars)///< pointer to the area in circbuf to save parameters
structinterframe_params_t*interframe_pars)///< pointer to the area in circbuf to save parameters
// pastParsIndex = (thisFrameNumber(sensor_port) - 1) & PASTPARS_SAVE_ENTRIES_MASK; // copying from what was past frame that might include histogram data
// pastParsIndex = (thisFrameNumber(sensor_port) - 1) & PASTPARS_SAVE_ENTRIES_MASK; // copying from what was past frame that might include histogram data
pastParsIndex=compressed_frame&PASTPARS_SAVE_ENTRIES_MASK;// copying from what was past frame that might include histogram data
pastParsIndex=compressed_frame&PASTPARS_SAVE_ENTRIES_MASK;// copying from what was past frame that might include histogram data
...
@@ -566,14 +580,12 @@ void updateFramePars(int sensor_port, int frame16)
...
@@ -566,14 +580,12 @@ void updateFramePars(int sensor_port, int frame16)
}
}
}
}
/**
/** Process parameters that are overdue or due in ASAP mode (not through the sequencer)
* @brief process parameters that are overdue or due in ASAP mode (not through the sequencer)
* Called twice from processPars - at the beginning and at the end to finish off any derivatives (needed?)
* Called twice from processPars - at the beginning and at the end to finish off any derivatives (needed?)
* @param sensor_port sensor port number (0..3)
* Should never be called from outside processPars() where there is a per-port lock */
* @param sensorproc
inlinevoid_processParsASAP(intsensor_port,///< sensor port number (0..3)
* @param frame16
structsensorproc_t*sensorproc,///< per-port array of sensor capabilities and 32+32 on-change functions
*/
intframe16)///< Hardware sequencer frame number, or -1 for ASAP
@@ -882,14 +972,14 @@ int setFrameParsAtomic(int sensor_port, unsigned long frameno, int maxLatency, i
...
@@ -882,14 +972,14 @@ int setFrameParsAtomic(int sensor_port, unsigned long frameno, int maxLatency, i
D5(printk(" set GLOBALPARS(0x%x)=0x%lx\n",index,val));
D5(printk(" set GLOBALPARS(0x%x)=0x%lx\n",index,val));
}elseif(pars[npar].num&FRAMEPAIR_FRAME_FUNC){
}elseif(pars[npar].num&FRAMEPAIR_FRAME_FUNC){
funcs2call[index]=val;
funcs2call[index]=val;
D5(printk(" set funcs2call[0x%x]=0x%lx\n",index,val));
dev_dbg(g_devfp_ptr,"port= %d, set funcs2call[0x%x]=0x%lx\n",index,val,sensor_port);
// } else if ((frameno !=findex_prev) && (frameno != findex_future)) { // do not write parameters in the future otherwise
// } else if ((frameno !=findex_prev) && (frameno != findex_future)) { // do not write parameters in the future otherwise
}elseif((frame16!=findex_future)||((pars[npar].num&FRAMEPAIR_JUST_THIS)==0)){// do not write "JUST_THIS" parameters in the future otherwise they'll stick
}elseif((frame16!=findex_future)||((pars[npar].num&FRAMEPAIR_JUST_THIS)==0)){// do not write "JUST_THIS" parameters in the future otherwise they'll stick
if(pars[npar].num&FRAMEPAIR_MASK_BYTES){// combine new value with the old one
if(pars[npar].num&FRAMEPAIR_MASK_BYTES){// combine new value with the old one
processPars(sensor_port,&asensorproc[sensor_port],thisFrameNumber(sensor_port)&PARS_FRAMES_MASK,0);//maxahead=0, the rest will be processed after frame sync, from the tasklet
// processPars(sensor_port, &asensorproc[sensor_port], thisFrameNumber(sensor_port) & PARS_FRAMES_MASK, 0); //maxahead=0, the rest will be processed after frame sync, from the tasklet
// Already having lock, call inner function. When called from tasklet, it will have to acquire lock
_processPars(sensor_port,&asensorproc[sensor_port],thisFrameNumber(sensor_port)&PARS_FRAMES_MASK,0);//maxahead=0, the rest will be processed after frame sync, from the tasklet
@@ -40,28 +40,32 @@ unsigned long getThisFrameNumber (int sensor_port); /// just return current thi
...
@@ -40,28 +40,32 @@ unsigned long getThisFrameNumber (int sensor_port); /// just return current thi
/// Return - 0 if OK, -ERR_FRAMEPARS_TOOEARLY or -ERR_FRAMEPARS_TOOLATE if it is too early or too late to set parameters (numPars may be 0 to just test)
/// Return - 0 if OK, -ERR_FRAMEPARS_TOOEARLY or -ERR_FRAMEPARS_TOOLATE if it is too early or too late to set parameters (numPars may be 0 to just test)
///
///
/// NOTE: When writing parameter to P_SENSOR_RUN or P_COMPRESSOR_RUN "*_RUN_SINGLE", first write "*SENSOR_RUN_STOP" (it will propagate to all next frames) and then
/// NOTE: When writing parameter to P_SENSOR_RUN or P_COMPRESSOR_RUN "*_RUN_SINGLE", first write "*SENSOR_RUN_STOP" (it will propagate to all next frames) and then
/// write "*_RUN_SINGLE", to (P_*_RUN | FRAMEPAIR_JUST_THIS) - then this *_RUN_SINGLE will not propagate to the next frames (they will stay stopped)
// write "*_RUN_SINGLE", to (P_*_RUN | FRAMEPAIR_JUST_THIS) - then this *_RUN_SINGLE will not propagate to the next frames (they will stay stopped)
/// TODO: Make (an "unlimited") future commands que based on lists and a tree frame index
// TODO: Make (an "unlimited") future commands que based on lists and a tree frame index