This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
void | init_framepars_ptr (void) |
TODO: init framepars (zero parameters) before initscripts (not when detecting the sensors) - then initscript will be able to overwrite some. | |
void | initSequencers (void) |
Reset hardware sequencers (i2c, command) and initialize framepars structure. | |
void | initGlobalPars (void) |
Move to sensorcommon? currently it is used through frameparsall file (lseek). | |
void | initFramePars (void) |
resets all global parameters but debug mask (if ELPHEL_DEBUG) | |
void | resetFrameNumber (void) |
initialize all parameters, set thisFrameNumber to frame8 (read from hardware, usually 0 after resetting i2c and cmd_seq) | |
unsigned long | get_imageParamsThis (int n) |
reset this frame number (called from initFramePars(), also can be used to avoid frame number integer overflow) | |
unsigned long | get_imageParamsPrev (int n) |
reads parameters from the previous frame (matching hardware index) - used to determine if historam was needed | |
void | set_imageParamsThis (int n, unsigned long d) |
writes read-only parameter to the current frame (does not propagate to next frames as setFramePar() does) In most cases you really need to use setFramePar() instead; | |
unsigned long | get_globalParam (int n) |
reads global (not related to particular frames) parameters | |
void | set_globalParam (int n, unsigned long d) |
sets global (not related to particular frames) parameters | |
void | set_imageParamsR_all (int n, unsigned long d) |
set same parameters in all frames currently used only in compressor reset | |
void | updateFramePars (int frame8, struct interframe_params_t *frame_pars) |
++++++++++++++++++++++++++++++++++++++++++ called from ISR - advance thisFrameNumber to match hardware frame8, copy parameters as needed. before: (thisFrameNumber mod8 pointed to current (for the software) parameters frame (now behind by at least 1, maybe 2) (thisFrameNumber-1) mod 8 - oldest with parameters preserved, also containes histograms results (+image timestamp, size?) subset of that frame data is copied to pastpars (thisFrameNumber-2) mod 8 - farthest in the future frame after: thisFrameNumber matches hardware pointer | |
int | setFrameParsStatic (int numPars, struct frameparspair_t *pars) |
Set parameters that will never change (usually after sensor discovery). | |
unsigned long | getThisFrameNumber (void) |
just return current thisFrameNumber | |
int | setFrameParsAtomic (unsigned long frameno, int maxLatency, int numPars, struct frameparspair_t *pars) |
TODO: Make (an "unlimited") future commands que based on lists and a tree frame index. | |
int | setFramePar (struct framepars_t *this_framepars, unsigned long mindex, unsigned long val) |
set output/calculated parameter and propogate changes - will not trigger any actions | |
int | setFramePars (struct framepars_t *this_framepars, int numPars, struct frameparspair_t *pars) |
same for several pars at once | |
void | schedule_pgm_func (int frame8, int func_num) |
schedule pgm_func to be executed for selected frame | |
void | schedule_this_pgm_func (struct framepars_t *this_framepars, int func_num) |
schedule pgm_func to be executed for the current frame | |
void | processParsASAP (struct sensorproc_t *sensorproc, int frame8) |
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?) | |
void | processParsSeq (struct sensorproc_t *sensorproc, int frame8, int maxahead) |
Next 5 should go in that sequence. | |
void | processPars (struct sensorproc_t *sensorproc, int frame8, int maxahead) |
Program image acquisition, according to the parameters changed Called from ISR? | |
Variables | |
framepars_t * | framepars |
| |
framepars_past_t * | pastpars |
getting rid of static to be able to use extern | |
unsigned long * | globalPars |
each parameter has a 32-bit mask of what pgm_function to call - other fields not used | |
wait_queue_head_t | framepars_wait_queue |
parameters that are not frame-related, their changes do not initiate any actions so they can be mmaped for both |
unsigned long get_globalParam | ( | int | n | ) | [inline] |
reads global (not related to particular frames) parameters
n | number of a parameter to read (numbers start from FRAMEPAR_GLOBALS) |
Definition at line 370 of file framepars.c.
References GLOBALPARS.
Referenced by camSeqSetJPEG_rp(), setFrameParsAtomic(), tasklet_fpga_function(), updateFramePars(), updateIRQ_Exif(), updateIRQ_interframe(), updateIRQCircbuf(), and updateIRQJPEG_wp().
unsigned long get_imageParamsPrev | ( | int | n | ) | [inline] |
reads parameters from the previous frame (matching hardware index) - used to determine if historam was needed
n | number of a parameter to read |
Definition at line 350 of file framepars.c.
References framepars, PARS_FRAMES_MASK, and thisFrameNumber.
Referenced by tasklet_fpga_function().
unsigned long get_imageParamsThis | ( | int | n | ) | [inline] |
reset this frame number (called from initFramePars(), also can be used to avoid frame number integer overflow)
n | number of a parameter to read |
Definition at line 341 of file framepars.c.
References framepars, framepars_t::pars, PARS_FRAMES_MASK, and thisFrameNumber.
unsigned long getThisFrameNumber | ( | void | ) |
just return current thisFrameNumber
Definition at line 672 of file framepars.c.
References thisFrameNumber.
Referenced by framepars_lseek(), framepars_write(), histograms_lseek(), pgm_gamma(), pgm_gammaload(), stream__ioctl(), stream__release(), and tasklet_fpga_function().
void init_framepars_ptr | ( | void | ) |
TODO: init framepars (zero parameters) before initscripts (not when detecting the sensors) - then initscript will be able to overwrite some.
each parameter has a 32-bit mask of what pgm_function to call - other fields not used
parameters that are not frame-related, their changes do not initiate any actions so they can be mmaped for both
Definition at line 276 of file framepars.c.
References framepars_all_t::framePars, framepars, frameparsall, framepars_all_t::func2call, funcs2call, framepars_all_t::globalPars, globalPars, framepars_t::pars, framepars_all_t::pastPars, and pastpars.
Referenced by framepars_init().
void initFramePars | ( | void | ) |
resets all global parameters but debug mask (if ELPHEL_DEBUG)
initialize frameParsDeps.pars masks:
by default each "manual" write to any of 256 registers will trigger pgm_sensorreg function
Definition at line 317 of file framepars.c.
References framepars, frameParsInitialized, funcs2call, memset(), ONCHANGE_SENSORREGS, P_SENSOR_NUMREGS, P_SENSOR_REGS, param_depend_tab, and resetFrameNumber().
Referenced by initSequencers().
void initGlobalPars | ( | void | ) |
Move to sensorcommon? currently it is used through frameparsall file (lseek).
Definition at line 330 of file framepars.c.
References ELPHEL_DEBUG_STARTUP, G_DEBUG, GLOBALPARS, globalPars, MDF, memset(), and printk.
Referenced by framepars_init(), and framepars_lseek().
void initSequencers | ( | void | ) |
Reset hardware sequencers (i2c, command) and initialize framepars structure.
Definition at line 294 of file framepars.c.
References initFramePars(), MDF2, printk, X3X3_I2C_RESET_WAIT, and X3X3_SEQ_RESET.
Referenced by framepars_lseek(), and setFrameParsAtomic().
void processPars | ( | struct sensorproc_t * | sensorproc, | |
int | frame8, | |||
int | maxahead | |||
) |
Program image acquisition, according to the parameters changed Called from ISR?
sensorproc | pointer to sensor static parameters and functions | |
frame8 | current hardware frame number | |
maxahead | maximal number of frames to program ahead of the current (make it P_* parameter ?) |
first - do all ASAP tasks (they should not be done ahead of the corresponding interrupt!)
now - the rest commands that use FPGA queues for the i2c/sequencer commands, executed at frame syncs for jobahead =0 it is still possible to have some functions in ASAP mode with non-zero latency
re-test ASAP tasks - they might appear as a result of other commands executed
Definition at line 632 of file framepars.c.
References PARS_FRAMES_MASK, processParsASAP(), processParsSeq(), and sensorproc.
Referenced by framepars_lseek(), and setFrameParsAtomic().
void processParsASAP | ( | struct sensorproc_t * | sensorproc, | |
int | frame8 | |||
) | [inline] |
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?)
sensorproc | ||
frame8 |
considering parameter "pars_ahead" of the (frame8+job_ahead) mod 8
current frame for which parameters are considered
maybe - drop calculation for each function, move it to pgm_* where needed?
do all ASAP tasks (they should not be done ahead of the corresponding interrupt!) Now try overdue functions with latencies >=1 and try them in ASAP mode
none, *1, *2,*3,*4
skip zeros - todo will stay current (.functions will not change
now (todo & mask) !=0
only sensor-specific function, nothing to do common to all sensors
sensor - specific functions, called after the main ones
Nothing to do with errors here - just report?
Definition at line 489 of file framepars.c.
References framepars, framepars_t::functions, G_CALLNASAP, GLOBALPARS, mask, MDF6, PARS_FRAMES_MASK, sensorproc_t::pgm_func, printk, sensorproc_t::sensor, and sensorproc.
Referenced by processPars().
void processParsSeq | ( | struct sensorproc_t * | sensorproc, | |
int | frame8, | |||
int | maxahead | |||
) | [inline] |
Next 5 should go in that sequence.
doing job "job_ahead" ahead of needed
considering parameter "pars_ahead" of the (frame8+job_ahead) mod 8
current frame for which parameters are considered
maybe - drop calculation fpr each function, move it to pgm_* where needed?
sequencer frame for which pgm_* function should schedule data
use 5 if maxahead >5
commands that use FPGA queues for the i2c/sequencer commands, executed at frame syncs Modifying - as soon as found the frame to process with non-zero masked .functions - process all functions for that frame with appropriate sequencer frame. For now - scan p_nasap[i] to find latency - improve that later
Check if at least one function is needed for frame_proc
all, *1, *2,*3,*4 - for all will have G_CALLNASAP twice
p_nasap[pars_ahead] & ///all, *1, *2,*3,*4 - for all will have G_CALLNASAP twice
eliminate ASAP-only function
skip zeros - todo will stay current (.functions will not change)
now (todo & mask) !=0 find the right latency
this_ahead==1..5
NOTE: Was (frame8+job_ahead +1) & PARS_FRAMES_MASK
only sensor-specific function, nothing to do common to all sensors
sensor - specific functions, called after the main ones
mark it done
Definition at line 551 of file framepars.c.
References framepars, framepars_t::functions, G_CALLNASAP, GLOBALPARS, mask, MDF6, min, PARS_FRAMES, PARS_FRAMES_MASK, sensorproc_t::pgm_func, printk, sensorproc_t::sensor, and sensorproc.
Referenced by processPars().
void resetFrameNumber | ( | void | ) |
initialize all parameters, set thisFrameNumber to frame8 (read from hardware, usually 0 after resetting i2c and cmd_seq)
initialize frameParsDeps.pars masks:
Definition at line 305 of file framepars.c.
References framepars, MDF2, P_FRAME, PARS_FRAMES, PARS_FRAMES_MASK, printk, thisFrameNumber, and X3X3_I2C_FRAME.
Referenced by framepars_lseek(), and initFramePars().
void schedule_pgm_func | ( | int | frame8, | |
int | func_num | |||
) |
schedule pgm_func to be executed for selected frame
frame8 | frame number (3-bit) to schedule a function for | |
func_num | function number to schedule |
Definition at line 651 of file framepars.c.
References framepars, framepars_t::functions, MDF1, PARS_FRAMES_MASK, and printk.
void schedule_this_pgm_func | ( | struct framepars_t * | this_framepars, | |
int | func_num | |||
) |
schedule pgm_func to be executed for the current frame
this_framepars | pointer to frame parameters structure | |
func_num | number of function to schedule |
Definition at line 661 of file framepars.c.
References framepars, framepars_t::functions, MDF1, P_FRAME, framepars_t::pars, PARS_FRAMES_MASK, and printk.
Referenced by pgm_sensorphase().
void set_globalParam | ( | int | n, | |
unsigned long | d | |||
) | [inline] |
sets global (not related to particular frames) parameters
n | number of a parameter to set (numbers start from FRAMEPAR_GLOBALS) | |
d | data to write to the selected parameter |
Definition at line 379 of file framepars.c.
References GLOBALPARS.
Referenced by camSeqSetJPEG_rp(), updateIRQ_interframe(), updateIRQCircbuf(), updateIRQFocus(), updateIRQJPEG_wp(), and x313_setDMABuffer().
void set_imageParamsR_all | ( | int | n, | |
unsigned long | d | |||
) | [inline] |
set same parameters in all frames currently used only in compressor reset
n | number of a parameter to set | |
d | data to write to the selected parameter |
Definition at line 389 of file framepars.c.
References framepars, and PARS_FRAMES.
Referenced by reset_compressor().
void set_imageParamsThis | ( | int | n, | |
unsigned long | d | |||
) | [inline] |
writes read-only parameter to the current frame (does not propagate to next frames as setFramePar() does) In most cases you really need to use setFramePar() instead;
n | number of a parameter to set | |
d | data to write to the selected parameter |
Definition at line 361 of file framepars.c.
References framepars, framepars_t::pars, PARS_FRAMES_MASK, and thisFrameNumber.
Referenced by updateIRQFocus().
int setFramePar | ( | struct framepars_t * | this_framepars, | |
unsigned long | mindex, | |||
unsigned long | val | |||
) |
set output/calculated parameter and propogate changes - will not trigger any actions
this_framepars | pointer to the current parameters structure | |
mindex | parameter number (with optional modifiers in high bits) | |
val | parameter value to set |
ignore frame logic, set "static" parameters to frame 0
combine new value with the old one
write to func_proc[] instead
do not write "JUST_THIS" parameters in the future otherwise they'll stick
combine new value with the old one
Set this parameter for specified frame, (for now - unconditionally mark as modified, even if the value is the same as it was - CHANGED!
Mark which functions will be needed to process the parameters
Write parameter to the next frames up to the one that have the same parameter already modified
for " regular parameters "modified since" do not include the target frame itself, for "JUST_THIS" - does
Mark this parameter in all previous frames as "modified since" TODO: consider alternative way - first iterate through all parameters, build masks, then apply them
NOTE: frame8 is modified here
error - trying to write "just this" to the "future" - that would stick if allowed
Definition at line 814 of file framepars.c.
References D1I, ELP_KERR, ERR_FRAMEPARS_BADINDEX, ERR_FRAMEPARS_TOOEARLY, flags, FRAMEPAIR_FORCE_NEW, FRAMEPAIR_FORCE_PROC, FRAMEPAIR_FRAME_FUNC, FRAMEPAIR_FRAME_MASK_NEW, FRAMEPAIR_JUST_THIS, FRAMEPAIR_MASK_BYTES, FRAMEPAR_GLOBALS, framepars, funcs2call, framepars_t::functions, GLOBALPARS, local_irq_restore, local_irq_save, framepars_t::mod, framepars_t::mod32, framepars_t::modsince, framepars_t::modsince32, P_FRAME, P_MAX_GPAR, P_MAX_PAR, framepars_t::pars, PARS_FRAMES_MASK, printk, and thisFrameNumber.
Referenced by histograms_lseek(), mt9x001_pgm_detectsensor(), mt9x001_pgm_triggermode(), pgm_detectsensor(), pgm_memsensor(), stream__ioctl(), and stream__release().
int setFramePars | ( | struct framepars_t * | this_framepars, | |
int | numPars, | |||
struct frameparspair_t * | pars | |||
) |
same for several pars at once
this_framepars | pointer to the current parameters structure | |
numPars | number of parameters to set | |
pars | array of parameters (number/value pairs). Parameter numbers accept modifiers |
ignore frame logic, set "static" parameters to frame 0
combine new value with the old one
do not write "JUST_THIS" parameters in the future otherwise they'll stick
combine new value with the old one
Set this parameter for specified frame, (for now - unconditionally mark as modified, even if the value is the same as it was - CHANGED!
Mark which functions will be needed to process the parameters
Write parameter to the next frames up to the one that have the same parameter already modified (only if not FRAMEPAIR_JUST_THIS)
for " regular parameters "modified since" do not include the target frame itself, for "JUST_THIS" - does
Mark this parameter in all previous frames as "modified since" TODO: consider alternative way - first iterate through all parameters, build masks, then apply them
NOTE: frame8 is modified here
error - trying to write "just this" to the "future" - that would stick if allowed
Definition at line 895 of file framepars.c.
References D1I, ELP_KERR, ERR_FRAMEPARS_BADINDEX, ERR_FRAMEPARS_TOOEARLY, flags, FRAMEPAIR_FORCE_NEW, FRAMEPAIR_FORCE_PROC, FRAMEPAIR_FRAME_FUNC, FRAMEPAIR_FRAME_MASK_NEW, FRAMEPAIR_JUST_THIS, FRAMEPAIR_MASK_BYTES, FRAMEPAR_GLOBALS, framepars, funcs2call, framepars_t::functions, GLOBALPARS, local_irq_restore, local_irq_save, framepars_t::mod, framepars_t::mod32, framepars_t::modsince, framepars_t::modsince32, num, P_FRAME, P_MAX_GPAR, P_MAX_PAR, framepars_t::pars, PARS_FRAMES_MASK, printk, and thisFrameNumber.
Referenced by mt9x001_pgm_gains(), mt9x001_pgm_initsensor(), mt9x001_pgm_limitfps(), mt9x001_pgm_window_common(), pgm_afterinit(), pgm_compmode(), pgm_focusmode(), pgm_gammaload(), pgm_hist(), pgm_memcompressor(), pgm_sensorphase(), and pgm_window_common().
int setFrameParsAtomic | ( | unsigned long | frameno, | |
int | maxLatency, | |||
int | numPars, | |||
struct frameparspair_t * | pars | |||
) |
TODO: Make (an "unlimited") future commands que based on lists and a tree frame index.
frameno | absolute (full) frame number parameters should be applied to | |
maxLatency | maximal command latency (parameters should be set not less than maxLatency ahead of the current frame) maxLatency < 0 - don't check latency (i.e.only commands that are not releted to particular frames) | |
numPars | number of parameters to set (0 is OK to just test if it is too early/too late) | |
pars | array of parameters (number/value pairs). FRAMEPAIR_FORCE_NEW modifier to parameter number |
Will call initFramePars(); and initialize functions
actually - fartherst in the future??
not too late, not too early, go ahead
ignore frame logic, set "static" parameters to frame 0
combine new value with the old one
do not write "JUST_THIS" parameters in the future otherwise they'll stick
combine new value with the old one
Set this parameter for specified frame
Mark which functions will be needed to process the parameters
Write parameter to the next frames up to the one that have the same parameter already modified (only if not FRAMEPAIR_JUST_THIS)
for " regular parameters "modified since" do not include the target frame itself, for "JUST_THIS" - does
Mark this parameter in all previous frames as "modified since" TODO: consider alternative way - first iterate through all parameters, build masks, then apply them
NOTE: frame8 is modified here
error - trying to write "just this" to the "future" - that would stick if allowed
Try to process parameters immediately after written. If 0, only non-ASAP will be processed to prevent effects of uncertainty of when was it called relative to frame sync Changed to all (don't care about uncertainty - they will trigger only if it is too late or during sensor detection/initialization)
maxahead=0, the rest will be processed after frame sync, from the tasklet
Definition at line 705 of file framepars.c.
References D1I, D5, ELP_KERR, ERR_FRAMEPARS_BADINDEX, ERR_FRAMEPARS_TOOEARLY, ERR_FRAMEPARS_TOOLATE, flags, FRAMEPAIR_FORCE_NEW, FRAMEPAIR_FRAME_FUNC, FRAMEPAIR_FRAME_MASK_NEW, FRAMEPAIR_JUST_THIS, FRAMEPAIR_MASK_BYTES, FRAMEPAR_GLOBALS, framepars, frameParsInitialized, funcs2call, framepars_t::functions, G_TASKLET_CTL, get_globalParam(), GLOBALPARS, initSequencers(), local_irq_restore, local_irq_save, MDF2, MDF5, framepars_t::mod, framepars_t::mod32, framepars_t::modsince, framepars_t::modsince32, num, P_MAX_GPAR, P_MAX_PAR, framepars_t::pars, PARS_FRAMES, PARS_FRAMES_MASK, printk, processPars(), PROFILE_NOW, sensorproc, TASKLET_CTL_NOSAME, and thisFrameNumber.
Referenced by framepars_write().
int setFrameParsStatic | ( | int | numPars, | |
struct frameparspair_t * | pars | |||
) |
Set parameters that will never change (usually after sensor discovery).
numPars | number of parameters to set | |
pars | array of parameters (number/value pairs) |
Definition at line 683 of file framepars.c.
References ERR_FRAMEPARS_BADINDEX, framepars, num, P_MAX_PAR, framepars_t::pars, and PARS_FRAMES.
void updateFramePars | ( | int | frame8, | |
struct interframe_params_t * | interframe_pars | |||
) |
++++++++++++++++++++++++++++++++++++++++++ called from ISR - advance thisFrameNumber to match hardware frame8, copy parameters as needed. before: (thisFrameNumber mod8 pointed to current (for the software) parameters frame (now behind by at least 1, maybe 2) (thisFrameNumber-1) mod 8 - oldest with parameters preserved, also containes histograms results (+image timestamp, size?) subset of that frame data is copied to pastpars (thisFrameNumber-2) mod 8 - farthest in the future frame after: thisFrameNumber matches hardware pointer
interframe_pars | pointer to structure (between frames in the frame buffer) to save a pointer to past parameters pass NULL if compressor was off (or no time to copy?) |
before update: framepars[findex_prev] holds previous frame data (oldest availble) framepars[findex_future] holds fartherst in the future one after update: framepars[findex_prev] holds fartherst in the future one ("this" will become "prev")
copy subset of the parameters to the long buffer of past parameters. TODO: fill Exif also here? TODO:DONE: Change - make pastpars be save for all frames, not just compressed ones With PASTPARS_SAVE_ENTRIES being multiple of PARS_FRAMES - make it possible to calculate past_index from thisFrameNumber
copying from what was past frame that might include histogram data
Now update interframe_pars (interframe area) used to create JPEG headers. Interframe area survives exactly as long as the frames themselves (not like pastpars)
frame was compressed, not just vsync
TODO: get rid of *_prev, use it for the future.
will leave some gaps, but copy [P_ACTUAL_WIDTH]
NOTE: P_ACTUAL_WIDTH,P_QUALITY copied with memcpy
copy parameters from findex_future (old "fartherst in the future") to findex_prev (new "fartherst in the future") if it was changed since
mark as not "modified since" (yet)
mark as not "modified since" super index
clear "modified" and flags on the brand new future frame
.mod[0]-.mod[30], .mod32
No functions yet needed on the brand new frame
that will be the full frame number
NOTE: Handle past due - copy functions, and mod if functions were non-zero
Some functions were not yet processed (past due)
Definition at line 405 of file framepars.c.
References framepars, framepars_t::functions, G_TASKLET_CTL, get_globalParam(), MDF, MDF7, memcpy(), memset(), framepars_t::mod32, framepars_t::modsince, framepars_t::modsince32, P_ACTUAL_HEIGHT, P_COLOR, P_COMPMOD_BYRSH, P_FRAME, P_GTAB_R, framepars_t::pars, PARS_FRAMES_MASK, PARS_SAVE_COPY, PARS_SAVE_FROM, pastpars, PASTPARS_SAVE_ENTRIES_MASK, printk, TASKLET_CTL_IGNPAST, and thisFrameNumber.
Referenced by elphel_FPGA_interrupt().
struct framepars_t* framepars |
Definition at line 254 of file framepars.c.
Referenced by framepars_lseek(), get_imageParamsPrev(), get_imageParamsThis(), histograms_lseek(), init_framepars_ptr(), initFramePars(), pgm_gammaload(), processParsASAP(), processParsSeq(), reset_compressor(), resetFrameNumber(), schedule_pgm_func(), schedule_this_pgm_func(), set_imageParamsR_all(), set_imageParamsThis(), setFramePar(), setFramePars(), setFrameParsAtomic(), setFrameParsStatic(), stream__ioctl(), stream__release(), tasklet_fpga_function(), and updateFramePars().
wait_queue_head_t framepars_wait_queue |
parameters that are not frame-related, their changes do not initiate any actions so they can be mmaped for both
Definition at line 259 of file framepars.c.
Referenced by elphel_FPGA_interrupt(), framepars_init(), and framepars_lseek().
unsigned long* globalPars |
struct framepars_past_t* pastpars |
getting rid of static to be able to use extern
Definition at line 255 of file framepars.c.
Referenced by createDefaultConfig(), init_framepars_ptr(), and updateFramePars().