#include <linux/types.h>
#include <asm/div64.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/autoconf.h>
#include <linux/vmalloc.h>
#include <asm/system.h>
#include <asm/byteorder.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/delay.h>
#include <asm/uaccess.h>
#include <asm/elphel/c313a.h>
#include <asm/elphel/exifa.h>
#include "fpgactrl.h"
#include "fpga_sdram.h"
#include "fpgaconfi2c.h"
#include "fpga_io.h"
#include "x3x3.h"
#include "framepars.h"
#include "sensor_common.h"
#include "gamma_tables.h"
#include "quantization_tables.h"
#include "latency.h"
#include "pgm_functions.h"
#include "cxdma.h"
#include "jpeghead.h"
Include dependency graph for pgm_functions.c:
Go to the source code of this file.
Defines | |
#define | MDF3(x) |
for div 64 optional debug output macros | |
#define | MDF9(x) |
#define | MDF16(x) |
#define | ELPHEL_DEBUG_THIS 0 |
#define | MDF1(x) |
#define | MD1(x) |
#define | MD12(x) |
#define | ENABLE_OLD_SENSORS 1 |
Functions | |
int | pgm_recalcseq (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
recalculate sequences/latencies, according to P_SKIP, P_TRIG | |
int | pgm_detectsensor (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
detect and initialize sensor and related data structures
| |
int | pgm_sensorphase (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
program sensor clock/phase | |
int | pgm_i2c (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
program i2c bytes/speed (may be per-frame?) | |
int | pgm_initsensor (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
TODO: Make sure sequencer and hardware i2c are running when needed. reset and init sensor (all is done in sensor-specific functions) resets sensor, reads sensor registers, schedules "secret" manufacturer's corrections to the registers (stops/re-enables hardware i2c). | |
int | pgm_afterinit (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
macros for the pgm_afterinit: update parameter, set parameter to value and update parameter, replacing zero with provided default restore image size, decimation,... after sensor reset or set them according to sensor capabilities if none were specified | |
int | pgm_window (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
program sensor WOI and mirroring Only validating, changing related parameters/scheduling actions, no hardware programming here | |
int | pgm_window_safe (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
int | pgm_window_common (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
int | pgm_exposure (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
program sensor exposure - nothing to be done here, all sensor-specific | |
int | pgm_gains (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
program analog gains (all is done in sensor-specific function) | |
int | pgm_triggermode (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
program sensor trigger mode (needs sensor-specific one too), programs timestamp mode (early/normal) | |
int | pgm_sensorin (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
program sensor input in FPGA (Bayer, 8/16 bits, FPN, test mode, number of lines) | |
int | pgm_sensorstop (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
stop acquisition from the sensor to the FPGA (start/single have latency of 2) | |
int | pgm_sensorrun (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
Start/single acquisition from the sensor to the FPGA (stop has latency of 1). | |
int | pgm_gamma (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
program gamma table Table with the same hash should be available in cache. It is very unlikely but is still possible that it can be pushed out - TODO: make it guaranteed. So normally new gamma table is set through a chracter device driver (with FPGA bit set to get locked?) and then pgm_gamma is activated when the P_GTAB_R (*_G,*_GB, *_B) are updated The scale part of these parameters (lower 16 bits) may be modified by white balancing code without loading a new table | |
int | pgm_hist (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
program histogram window (absolute from relative and window size) | |
int | pgm_aexp (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
program autoexposure mode TODO: Do something? | |
int | pgm_quality (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
program quantization table(s) | |
int | pgm_memsensor (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
program memory channels 0 (sensor->memory) and 1 (memory->FPN) | |
int | pgm_memcompressor (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
program memory channel 2 (memory->compressor) Prepare data (memory, number of tiles) - it will be sent to FPGA in pgm_comprestart Added re-read from memory option. If sensor is off - don't program dependency | |
int | pgm_limitfps (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
TODO: Program external trigger frequency to the same value! | |
int | pgm_compmode (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
program compressor modes (does not start/stop) will also program Huffman table to the FPGA if it was not programmed yet | |
int | pgm_focusmode (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
TODO: update it only when focus is enabled? not to recalculate it when not needed? | |
int | pgm_trigseq (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
can not use sequencer as data is more than 24 bit wide | |
int | pgm_irq (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
program smart IRQ mode (needs to be on, at least bit 0) "smart" IRQ modes: +1 - wait for VACT in early compressor_done, +2 - wait for dma fifo ready | |
int | pgm_comprestart (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
restart after changing geometry (recognizes ASAP and programs memory channel 2 then) data for the CHN2 should be available (prepared) | |
int | pgm_compstop (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
stop compressor when changing geometry | |
int | pgm_compctl (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
only start/stop/single (after explicitly changed, not when geometry was changed) | |
int | pgm_gammaload (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
load gamma tables to FPGA (prepare if not yet). pgm_gamma should prepare table and set onchange_gammaload (in ASAP mode) parameters are for the next after the current page, gamma tables will become active after vsync | |
int | pgm_sensorregs (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
program sensor registers (probably just those that are manually set) seems nothing to do here - all in the sensor-specific function | |
int | pgm_prescal (struct sensor_t *sensor, struct framepars_t *thispars, struct framepars_t *prevpars, int frame8) |
TODO: Add P,Q,X0,Y0,E parameters and trigger recalcualtion when WOI is changed. | |
int | init_pgm_proc (void) |
extern struct sensorproc_t * sensorproc; | |
int | add_sensor_proc (int index, int(*sens_func)(struct sensor_t *, struct framepars_t *, struct framepars_t *, int)) |
initialize array of functions that program different acquisition parameters (some are sensor dependent) |
#define ELPHEL_DEBUG_THIS 0 |
Definition at line 173 of file pgm_functions.c.
#define ENABLE_OLD_SENSORS 1 |
#define MD1 | ( | x | ) |
Definition at line 182 of file pgm_functions.c.
#define MD12 | ( | x | ) |
Definition at line 183 of file pgm_functions.c.
#define MDF1 | ( | x | ) |
Definition at line 181 of file pgm_functions.c.
#define MDF16 | ( | x | ) |
#define MDF3 | ( | x | ) |
#define MDF9 | ( | x | ) |
Definition at line 171 of file pgm_functions.c.
Referenced by pgm_compctl(), pgm_compmode(), pgm_limitfps(), and pgm_memcompressor().
int add_sensor_proc | ( | int | index, | |
int(*)(struct sensor_t *, struct framepars_t *, struct framepars_t *, int) | sens_func | |||
) |
initialize array of functions that program different acquisition parameters (some are sensor dependent)
index | function index (internally 32 is added to distinguish from the common (not sensor-specific) functions | |
sens_func | pointer to a sensor-specific function |
Definition at line 267 of file pgm_functions.c.
References MDF1, sensorproc_t::pgm_func, printk, and sensorproc.
Referenced by mt9x001_pgm_detectsensor().
int init_pgm_proc | ( | void | ) |
extern struct sensorproc_t * sensorproc;
recalculate sequences/latencies, according to P_SKIP, P_TRIG
detect sensor type, sets sensor structure (capabilities), function pointers
program sensor clock/phase
program i2c
resets sensor, reads sensor registers, schedules "secret" manufacturer's corrections to the registers (stops/re-enables hardware i2c)
restore image size, decimation,... after sensor reset or set them according to sensor capabilities if none were specified
program sensor WOI and mirroring (flipping)
program sensor WOI and mirroring (flipping) - lower latency, no bad frames
program exposure
program analog gains
program sensor trigger mode
program sensor input in FPGA (Bayer, 8/16 bits, ??)
Stop acquisition from the sensor to the FPGA (start has latency of 2)
Start/single acquisition from the sensor to the FPGA (stop has latency of 1)
program gamma table
program histogram window
program autoexposure mode
program quantization table(s)
program memory channels 0 (sensor->memory) and 1 (memory->FPN)
program memory channel 2 (memory->compressor)
check compressor will keep up, limit sensor FPS if needed
program compressor modes
program focus modes
program sequencer (int/ext)
program smart IRQ mode
restart after changing geometry (recognizes ASAP and programs memory channel 2 then)
stop compressor when changing geometry
only start/stop/single (after explicitly changed, not when geometry was changed)
write gamma tables (should be prepared). Maybe - just last byte, to activate?
write sensor registers (only changed from outside the driver as they may have different latencies)?
change scales for per-color digital gains, apply vignetting correction
Definition at line 223 of file pgm_functions.c.
References MDF1, onchange_aexp, onchange_afterinit, onchange_compctl, onchange_compmode, onchange_comprestart, onchange_compstop, onchange_detectsensor, onchange_exposure, onchange_focusmode, onchange_gains, onchange_gamma, onchange_gammaload, onchange_hist, onchange_i2c, onchange_initsensor, onchange_irq, onchange_limitfps, onchange_memcompressor, onchange_memsensor, onchange_prescal, onchange_quality, onchange_recalcseq, onchange_sensorin, onchange_sensorphase, onchange_sensorregs, onchange_sensorrun, onchange_sensorstop, onchange_triggermode, onchange_trigseq, onchange_window, onchange_window_safe, pgm_aexp(), pgm_afterinit(), pgm_compctl(), pgm_compmode(), pgm_comprestart(), pgm_compstop(), pgm_detectsensor(), pgm_exposure(), pgm_focusmode(), sensorproc_t::pgm_func, pgm_gains(), pgm_gamma(), pgm_gammaload(), pgm_hist(), pgm_i2c(), pgm_initsensor(), pgm_irq(), pgm_limitfps(), pgm_memcompressor(), pgm_memsensor(), pgm_prescal(), pgm_quality(), pgm_recalcseq(), pgm_sensorin(), pgm_sensorphase(), pgm_sensorregs(), pgm_sensorrun(), pgm_sensorstop(), pgm_triggermode(), pgm_trigseq(), pgm_window(), pgm_window_safe(), printk, and sensorproc.
Referenced by image_acq_init().
int pgm_aexp | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
program autoexposure mode TODO: Do something?
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
Definition at line 1114 of file pgm_functions.c.
Referenced by init_pgm_proc().
int pgm_afterinit | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
macros for the pgm_afterinit: update parameter, set parameter to value and update parameter, replacing zero with provided default restore image size, decimation,... after sensor reset or set them according to sensor capabilities if none were specified
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) (not used here) |
20 needed, increase if more entries will be added
Setup WOI. If size is zero - use maximal that sensor can, in non-zero - just refresh so appropriate actions will be scheduled on chnange
were zeroes
FLIPH==0 will use sensor board default flip
FLIPV==0 will use sensor board default flip
histogram 50% width (0x10000 - 100%)
histogram 50% height
histogram 50% left (middle)
histogram 50% top (middle)
Set analog gains to 1.0 if not set otherwise
gain ==1.0
gain ==1.0
gain ==1.0
gain ==1.0
Exposure use non-zero P_EXPOS, then P_VEXPOS, then P_EXPOS=10ms
set exposure to 0.01 sec
set trigger mode (or should it alway be internal after init?)
something else to add? NOTE: Only sensor parameters, erased when it is reset - other parameters should not chnage here NOTE: increase pars_to_update[24] size if needed
save changes, schedule functions
Definition at line 452 of file pgm_functions.c.
References FRAMEPAIR_FORCE_NEW, MDF3, P_BAYER, P_BIN_HOR, P_BIN_VERT, P_DCM_HOR, P_DCM_VERT, P_EXPOS, P_FLIPH, P_FLIPV, P_GAINB, P_GAING, P_GAINGB, P_GAINR, P_HISTWND_RHEIGHT, P_HISTWND_RLEFT, P_HISTWND_RTOP, P_HISTWND_RWIDTH, P_TRIG, P_VEXPOS, P_WOI_HEIGHT, P_WOI_LEFT, P_WOI_TOP, P_WOI_WIDTH, framepars_t::pars, printk, sensor, setFramePars(), SETFRAMEPARS_SET, SETFRAMEPARS_UPDATE, and SETFRAMEPARS_UPDATE_SET.
Referenced by init_pgm_proc().
int pgm_compctl | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
only start/stop/single (after explicitly changed, not when geometry was changed)
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
wrong frame
just started
reset memory controller for the channel2 to the start of the frame
enable memory channel2 (NOTE: wnen is it disabled? does it need to be disabled?)
set number of tiles to compressor
changed or single
Definition at line 1596 of file pgm_functions.c.
References COMPCMD_RUN, COMPCMD_SINGLE, COMPCMD_STOP, COMPRESSOR_RUN_CONT, COMPRESSOR_RUN_SINGLE, COMPRESSOR_RUN_STOP, MDF3, MDF9, P_COMPRESSOR_RUN, P_SDRAM_CHN20, P_SDRAM_CHN21, P_SDRAM_CHN22, P_TILES, framepars_t::pars, PARS_FRAMES, printk, X313_CHN_EN_D, x313_dma_start(), x313_is_dma_on(), X313_SEQ_ASAP, X313_SEQ_FRAME0, X313_WA_COMP_CMD, X313_WA_MCUNUM, X313_WA_SD_MODE, X313_WA_SDCH2_CTL0, X313_WA_SDCH2_CTL1, X313_WA_SDCH2_CTL2, and X3X3_SEQ_SEND1.
Referenced by init_pgm_proc().
int pgm_compmode | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
program compressor modes (does not start/stop) will also program Huffman table to the FPGA if it was not programmed yet
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
wrong frame
2 needed, increase if more entries will be added
QTAB is programmed separately demosaic mode - is it changed?
Bayer shift changed? (additional bayer shift, separate from the gamma-tables one)
Tile shift changed? (position of the 16x16, 18x8 or 20x20 inside 20x20 overlapping tile - dx==dy (diagonal), 0..4)
DC subtraction modse changed? (mostly FPGA debug feature, normally should be on - average block level to bypass DCT conversion)
Did focus show mode change? (do it here, not with other focus parameters that can not be set through the sequencer (writing tables could break writing gamma/quntization/whatever tables
enqueue it for the compressor
color saturation changed?
compressor quantizer zero bin mode changed? Quantizer tuning - bits 0..7 - zero bin, 15:8 - quantizer bias
save changes, schedule functions
Definition at line 1263 of file pgm_functions.c.
References COLORMODE_COLOR, COLORMODE_COLOR20, COLORMODE_JP4, COLORMODE_JP46, COLORMODE_JP46DC, COLORMODE_JP4DC, COLORMODE_JP4DIFF, COLORMODE_JP4DIFF2, COLORMODE_JP4HDR, COLORMODE_JP4HDR2, COLORMODE_MONO4, COLORMODE_MONO6, COMPCMD_BAYERSHIFT, COMPCMD_DCSUB, COMPCMD_DEMOS, COMPCMD_FOCUS, COMPCMD_TILESHIFT, csb, csr, DEFAULT_COLOR_SATURATION_BLUE, DEFAULT_COLOR_SATURATION_RED, DEMOS_COLOR18, DEMOS_COLOR20, DEMOS_JP4, DEMOS_JP46, DEMOS_JP46DC, DEMOS_JP4DC, DEMOS_JP4DIFF, DEMOS_JP4DIFF2, DEMOS_JP4HDR, DEMOS_JP4HDR2, DEMOS_MONO4, DEMOS_MONO6, FRAMEPAR_MODIFIED, jpeg_htable_fpga_pgm(), jpeg_htable_is_programmed(), MDF3, MDF9, P_COLOR, P_COLOR_SATURATION_BLUE, P_COLOR_SATURATION_RED, P_COMPMOD_BYRSH, P_COMPMOD_DCSUB, P_COMPMOD_TILSH, P_FOCUS_SHOW, P_ZBINROUND, framepars_t::pars, PARS_FRAMES, printk, setFramePars(), SETFRAMEPARS_SET, X313_SEQ_ASAP, X313_SEQ_FRAME0, X313_WA_COLOR_SAT, X313_WA_COMP_CMD, X313_WA_QUANTIZER_MODE, and X3X3_SEQ_SEND1.
Referenced by init_pgm_proc().
int pgm_comprestart | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
restart after changing geometry (recognizes ASAP and programs memory channel 2 then) data for the CHN2 should be available (prepared)
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
wrong frame
does it need to be be started (nothing do be done to stop)
does not need comporessor to be started
reset memory controller for the channel2 to the start of the frame
enable memory channel2
set number of tiles to compressor
start the compressor
Definition at line 1543 of file pgm_functions.c.
References COMPCMD_RUN, COMPCMD_SINGLE, MDF3, P_COMPRESSOR_RUN, P_SDRAM_CHN20, P_SDRAM_CHN21, P_SDRAM_CHN22, P_TILES, framepars_t::pars, PARS_FRAMES, printk, X313_CHN_EN_D, X313_SEQ_ASAP, X313_SEQ_FRAME0, X313_WA_COMP_CMD, X313_WA_MCUNUM, X313_WA_SD_MODE, X313_WA_SDCH2_CTL0, X313_WA_SDCH2_CTL1, X313_WA_SDCH2_CTL2, and X3X3_SEQ_SEND1.
Referenced by init_pgm_proc().
int pgm_compstop | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
stop compressor when changing geometry
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
wrong frame (can be only -1 or 0..7)
Definition at line 1577 of file pgm_functions.c.
References COMPCMD_STOP, MDF3, PARS_FRAMES, printk, X313_SEQ_ASAP, X313_SEQ_FRAME0, X313_WA_COMP_CMD, and X3X3_SEQ_SEND1.
Referenced by init_pgm_proc().
int pgm_detectsensor | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
detect and initialize sensor and related data structures
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to. Only -1 (ASAP) is allowed here |
can only work in ASAP mode
Sensor is already detected - do not bother (to re-detect it P_SENSOR should be set to 0)
no other initializations, just the senor-related stuff (starting with lowest sensor clock) stop hardware i2c controller, so it will not get stuck when waiting for !busy
NOTE: disabling interrupts here !!!
TODO: Add 10347 detection here // if (IS_KAI11000) return init_KAI11000(); Need to set slow clock
using clock driver data, not thispars
just in case - read the actual fpga clock frequency and store it (no actions)
FPGA DCM can fail after clock change, needs to be reset
setting reasonable state of the control signals
set negative MRST polarity
apply clock before removing MRS
first trying MT9P001 that does not need converter
temporary - disabling old sensors
enable output for power converter signals This should be done first!!! printk ("Will Turn DC power for the sensor after 1 sec delay...\n"); udelay (1000000); turning on DC-DC converter may cause system to reboot because of a power spike, so start slow
invert MRST for other sensors
to prevent from initializing again
Maybe get rid of duplicates?
Maybe get rid of duplicates?
Schedule i2c speed/byte width setup
SCL period in ns, (standard i2c - 2500)
force i2c
force i2c
restore/set sensor clock
will schedule clock/phase adjustment
will schedule clock/phase adjustment
smart IRQ mode programming (and enable interrupts)
NOTE: sensor detected - enabling camera interrupts here (actual interrupts will start later) Here interrupts are disabled - with camera_interrupts (0) earlier in this function)
Definition at line 284 of file pgm_functions.c.
References camera_interrupts(), CCAM_ARST_OFF, CCAM_CNVEN_OFF, CCAM_CNVEN_ON, CCAM_DCLK_ON, CCAM_MRST_OFF, CCAM_MRST_ON, CCAM_NEGRST, CCAM_POSRST, CCAM_TIMESTAMP_NORMAL, CCAM_TRIG_INT, getClockFreq(), MDF1, MDF3, mt9x001_pgm_detectsensor(), P_CLK_FPGA, P_CLK_SENSOR, P_SENSOR, framepars_t::pars, port_csp0_addr, printk, sensor, setClockFreq(), setFramePar(), udelay, X313_WA_DCDC, and X3X3_RSTSENSDCM.
Referenced by init_pgm_proc().
int pgm_exposure | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
program sensor exposure - nothing to be done here, all sensor-specific
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
Definition at line 578 of file pgm_functions.c.
Referenced by init_pgm_proc().
int pgm_focusmode | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
TODO: update it only when focus is enabled? not to recalculate it when not needed?
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) Only ASAP is supported here |
now can only programm in immediate mode by writing the table
calculate absolute window from the relative, apply limits
save intermediate/readonly parameters
Definition at line 1358 of file pgm_functions.c.
References CX313_FPGA_TABLES_FOCUSPARS, fpga_table_write_nice(), FRAMEPAR_MODIFIED, MDF3, P_ACTUAL_HEIGHT, P_ACTUAL_WIDTH, P_FOCUS_FILTER, P_FOCUS_HEIGHT, P_FOCUS_LEFT, P_FOCUS_SHOW1, P_FOCUS_TOP, P_FOCUS_TOTWIDTH, P_FOCUS_WIDTH, P_RFOCUS_HEIGHT, P_RFOCUS_LEFT, P_RFOCUS_TOP, P_RFOCUS_WIDTH, framepars_t::pars, printk, setFramePars(), and frameparspair_t::val.
Referenced by init_pgm_proc().
int pgm_gains | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
program analog gains (all is done in sensor-specific function)
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
TODO: seems nothing to do here - all in the sensor-specific function
Definition at line 860 of file pgm_functions.c.
Referenced by init_pgm_proc().
int pgm_gamma | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
program gamma table Table with the same hash should be available in cache. It is very unlikely but is still possible that it can be pushed out - TODO: make it guaranteed. So normally new gamma table is set through a chracter device driver (with FPGA bit set to get locked?) and then pgm_gamma is activated when the P_GTAB_R (*_G,*_GB, *_B) are updated The scale part of these parameters (lower 16 bits) may be modified by white balancing code without loading a new table
will be programmed not earlier than 1 frame ahead of the current to prevent condition when earlier frame is programmed after the later one (not possible because of just two tables in the FPGA - current and shadow, switching when the last table word is written
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
wrong frame
Not needed - now it can be done in advance (just prepare cache). Later it will be done again and actually programmed (1 frame ahead of time)
return if too early TODO: still calculate FPGA table , but not load it if too early?
4 needed
modified for this color
frame8 - one ahead of the current do not lock yet
increases nupdate
restore failed components
Definition at line 1000 of file pgm_functions.c.
References color, ERR_PGM_TRYAGAINLATER, GAMMA_MODE_HARDWARE, get_locked_hash32(), getThisFrameNumber(), MDF16, MDF3, P_FRAME, P_GTAB_R, framepars_t::pars, PARS_FRAMES, PARS_FRAMES_MASK, printk, set_gamma_table(), and SETFRAMEPARS_SET.
Referenced by init_pgm_proc().
int pgm_gammaload | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
load gamma tables to FPGA (prepare if not yet). pgm_gamma should prepare table and set onchange_gammaload (in ASAP mode) parameters are for the next after the current page, gamma tables will become active after vsync
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
4 needed, increase if more entries will be added
NOTE: Yes, ASAP, but - 1 frame ahead
only can work in ASAP mode
code currently does not allow to overwrite just 1 table - only all 4
Normally, nothing will be calculated in the next set_gamma_table() call
frame8 - one ahead of the current
now gtable will be old one if result <=0 get_gamma_fpga(color) can return 0 only if nothing yet was programmed
restore to the locked table
save changes, schedule functions
Definition at line 1650 of file pgm_functions.c.
References color, CX313_FPGA_TABLES_GAMMA, fpga_table_write_nice(), framepars, GAMMA_MODE_HARDWARE, GAMMA_MODE_LOCK, get_gamma_fpga(), get_locked_hash32(), getThisFrameNumber(), MDF16, MDF3, P_FRAME, P_GTAB_R, framepars_t::pars, PARS_FRAMES_MASK, printk, set_gamma_table(), setFramePars(), and SETFRAMEPARS_SET.
Referenced by init_pgm_proc().
int pgm_hist | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
program histogram window (absolute from relative and window size)
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
wrong frame
calculate absolute window from the relative, apply limits
set these values to FPGA
save intermediate/readonly parameters
Definition at line 1053 of file pgm_functions.c.
References height, MDF3, P_ACTUAL_HEIGHT, P_ACTUAL_WIDTH, P_HISTWND_HEIGHT, P_HISTWND_LEFT, P_HISTWND_RHEIGHT, P_HISTWND_RLEFT, P_HISTWND_RTOP, P_HISTWND_RWIDTH, P_HISTWND_TOP, P_HISTWND_WIDTH, framepars_t::pars, PARS_FRAMES, printk, setFramePars(), frameparspair_t::val, width, X313_SEQ_ASAP, X313_SEQ_FRAME0, X313_WA_HIST_HEIGHT, X313_WA_HIST_LEFT, X313_WA_HIST_TOP, X313_WA_HIST_WIDTH, and X3X3_SEQ_SEND1.
Referenced by init_pgm_proc().
int pgm_i2c | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
program i2c bytes/speed (may be per-frame?)
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
wrong frame
Definition at line 591 of file pgm_functions.c.
References MDF3, P_I2C_BYTES, P_I2C_QPERIOD, framepars_t::pars, PARS_FRAMES, printk, X313_I2C_CMD, X313_SEQ_ASAP, X313_SEQ_FRAME0, X3X3_SEQ_SEND1, X3X3_SET_I2C_BYTES, and X3X3_SET_I2C_DLY.
Referenced by init_pgm_proc().
int pgm_initsensor | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
TODO: Make sure sequencer and hardware i2c are running when needed. reset and init sensor (all is done in sensor-specific functions) resets sensor, reads sensor registers, schedules "secret" manufacturer's corrections to the registers (stops/re-enables hardware i2c).
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
should be ASAP
TODO: seems nothing to do here - all in the sensor-specific function:
Definition at line 425 of file pgm_functions.c.
Referenced by init_pgm_proc().
int pgm_irq | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
program smart IRQ mode (needs to be on, at least bit 0) "smart" IRQ modes: +1 - wait for VACT in early compressor_done, +2 - wait for dma fifo ready
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
wrong frame
temporary make "smart" IRQ always enabled (otherwise FPGA bug fix needed) X3X3_SEQ_SEND1(fpga_addr, X313_WA_SMART_IRQ, (2 | ((thispars->pars[P_IRQ_SMART] & 1)?1:0)) | \ (8 | ((thispars->pars[P_IRQ_SMART] & 2)?4:0)));
Definition at line 1472 of file pgm_functions.c.
References MDF3, P_IRQ_SMART, framepars_t::pars, PARS_FRAMES, printk, X313_SEQ_ASAP, X313_SEQ_FRAME0, X313_WA_SMART_IRQ, and X3X3_SEQ_SEND1.
Referenced by init_pgm_proc().
int pgm_limitfps | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
TODO: Program external trigger frequency to the same value!
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
Calculate minimal frame period compressor can handle, apply requested fps, limit/program the sequencer
wrong frame
4 needed, increase if more entries will be added
number of FPGA clock cycles per frame;
number of pixel clock periods needed for the compressor (or user limit)
number of tiles
now - blocks per frame
define P_CLK_FPGA, define P_CLK_SENSOR 27-28 bits, cycles - 24-25 bits TODO: fix long long
? fp1000s= 10*sclk/(pix_period/100);
is there limit set for the FPS?
125 <<3 = 1000
set it (and propagate to the later frames)
no upper limit
set it (and propagate to the later frames)
Now see if the sequencer period needs to be adjusted
set it (and propagate to the later frames)
set it (and propagate to the later frames)
save changes, schedule functions
That's all - sensor or sequencer will be programmed later using the parameters specified here
Definition at line 763 of file pgm_functions.c.
References async, COLORMODE_COLOR, COLORMODE_COLOR20, COLORMODE_JP46, COLORMODE_JP46DC, COLORMODE_MONO6, MDF3, MDF9, P_CLK_FPGA, P_CLK_SENSOR, P_COLOR, P_FP1000SLIM, P_FPGA_XTRA, P_TILES, P_TRIG, framepars_t::pars, PARS_FRAMES, and printk.
Referenced by init_pgm_proc().
int pgm_memcompressor | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
program memory channel 2 (memory->compressor) Prepare data (memory, number of tiles) - it will be sent to FPGA in pgm_comprestart Added re-read from memory option. If sensor is off - don't program dependency
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
wrong frame
number of lines it the whole frame
now - always X313_MAP_FRAME
will be programmed with "depend==1", so it will not be possible to re-read from memory this way
Definition at line 1226 of file pgm_functions.c.
References MDF3, MDF9, P_ACTUAL_HEIGHT, P_ACTUAL_WIDTH, P_IMGSZMEM, P_PAGE_READ, P_PF_HEIGHT, P_SDRAM_CHN20, P_SDRAM_CHN21, P_SDRAM_CHN22, P_SENSOR_RUN, P_TILES, framepars_t::pars, PARS_FRAMES, printk, sa, SENSOR_RUN_STOP, setFramePars(), frameparspair_t::val, X313_MAP_FRAME, X313_MARGINS, X313_SDCHAN_REG0, X313_SDCHAN_REG1, and X313_SDCHAN_REG2.
Referenced by init_pgm_proc().
int pgm_memsensor | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
program memory channels 0 (sensor->memory) and 1 (memory->FPN)
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
wrong frame
programm channel1 (FPN). Will not enable if not needed (imageParamsR[P_FPN]==0)
not a photofinish
program memory channel1
enable channel1 for reading SDRAM
wait ready later... ???
Program channel 0 (sensor->memory) goodEOL=0; // last 8/16 blocks of pixels in each scanline are bad (only 2 are actually written) if 8-bit mode we'll need to update ntilex. fpga tries to write 2 bytes more (but not crossing the page boundaries GoodEOL - if image width is multiple of 512 pixels 1 extra block (16 pixels) needs to be written to memory (and padlen will be more by 512 bytes (256 words) due to FPGA controller implementation (it writes extra 4 pixels for the margins, but not when it crosses 512 byte boundary) When reading 20x20 macroblocks to the compressor, such exception is not needed, it crosses page boundaries when needed
in 16-bit mode ntilex will stay the same
if (imageParamsR[P_OVERLAP]>=(imageParamsR[P_ACTUAL_HEIGHT]+2)) imageParamsR[P_OVERLAP]=imageParamsR[P_ACTUAL_HEIGHT]+1; rotten code, left as a comment
ntiley will be twice bigger for synch. mode)
TODO:fix it to be able to use two (or larger) frame buffer
set it (and propagate to the later frames)
now - always X313_MAP_FRAME
dependency - source
number of scan lines to read from sensor - program in pgm_sensorin
Definition at line 1150 of file pgm_functions.c.
References MDF3, P_ACTUAL_HEIGHT, P_ACTUAL_WIDTH, P_BGFRAME, P_BITS, P_FPNM, P_FPNS, P_IMGSZMEM, P_OVERLAP, P_PAGE_ACQ, P_PF_HEIGHT, framepars_t::pars, PARS_FRAMES, printk, sa, setFramePar(), X313_CHN_DIS_D, X313_CHN_EN_D, X313_MAP_FPN, X313_MAP_FRAME, X313_MARGINS, X313_SDCHAN_REG0, X313_SDCHAN_REG1, X313_SDCHAN_REG2, X313_SEQ_ASAP, X313_SEQ_FRAME0, X313_WA_SD_MODE, X313_WA_SDCH0_CTL0, X313_WA_SDCH0_CTL1, X313_WA_SDCH0_CTL2, X313_WA_SDCH1_CTL0, X313_WA_SDCH1_CTL1, X313_WA_SDCH1_CTL2, and X3X3_SEQ_SEND1.
Referenced by init_pgm_proc().
int pgm_prescal | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
TODO: Add P,Q,X0,Y0,E parameters and trigger recalcualtion when WOI is changed.
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
wrong frame
Definition at line 1713 of file pgm_functions.c.
References FRAMEPAR_MODIFIED, MDF3, P_DGAINB, P_DGAING, P_DGAINGB, P_DGAINR, P_VIGNET_AX, P_VIGNET_AY, P_VIGNET_BX, P_VIGNET_BY, P_VIGNET_C, P_VIGNET_SHL, P_VIGNET_ZERIN, P_VIGNET_ZEROUT, framepars_t::pars, PARS_FRAMES, printk, X313_LENS_AX, X313_LENS_AY, X313_LENS_BX, X313_LENS_BY, X313_LENS_C, X313_LENS_FATZERO_IN, X313_LENS_FATZERO_OUT, X313_LENS_POSTSCALE, X313_LENS_SCALES, X313_SEQ_ASAP, X313_SEQ_FRAME0, X313_WA_LENSCORR, and X3X3_SEQ_SEND1.
Referenced by init_pgm_proc().
int pgm_quality | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
program quantization table(s)
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
wrong frame
calculate quality tables - find already programmed FPGA page or calculates/programms a new one set_qtable_fpga returns table page (0..7) or -1 - invalid q
Definition at line 1128 of file pgm_functions.c.
References COMPCMD_QTAB, MDF3, P_COMPMOD_QTAB, P_QUALITY, framepars_t::pars, PARS_FRAMES, printk, set_qtable_fpga(), X313_SEQ_ASAP, X313_SEQ_FRAME0, X313_WA_COMP_CMD, and X3X3_SEQ_SEND1.
Referenced by init_pgm_proc().
int pgm_recalcseq | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
recalculate sequences/latencies, according to P_SKIP, P_TRIG
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
TODO: modify storage of async mode, safe
continuous/safe - 1, continuous/no skip - 2, async/safe - 3, async/no skip - 4, nooverlap - 5
not the ASAP only mode
moved all these parameters to "frame zero" (static)
Definition at line 1498 of file pgm_functions.c.
References ahead_tab, async, d, G_CALLNASAP, G_CALLNEXT, GLOBALPARS, MDF3, P_SKIP_FRAMES, P_TRIG, framepars_t::pars, printk, and frameparspair_t::val.
Referenced by init_pgm_proc().
int pgm_sensorin | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
program sensor input in FPGA (Bayer, 8/16 bits, FPN, test mode, number of lines)
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
wrong frame
Set FPN mode (P_FPGATEST - currently only LSB is processed)
Program number of scan lines to acquire
Bayer phase changed?
NOTE: hardware bayer
Definition at line 893 of file pgm_functions.c.
References FRAMEPAR_MODIFIED, MDF3, P_ACTUAL_HEIGHT, P_BAYER, P_BITS, P_FLIPH, P_FLIPV, P_FPGATEST, P_FPNM, P_FPNS, P_OVERLAP, P_PF_HEIGHT, P_SHIFTL, framepars_t::pars, PARS_FRAMES, printk, sensor, X313_MARGINS, X313_SENSFPN_D, X313_SEQ_ASAP, X313_SEQ_FRAME0, X313_WA_DCR0, X313_WA_NLINES, X313_WA_SENSFPN, X353_DCR0, and X3X3_SEQ_SEND1.
Referenced by init_pgm_proc().
int pgm_sensorphase | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
program sensor clock/phase
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) can only work in ASAP mode |
??? needed, increase if more entries will be added
can only work in ASAP mode
using clock driver data, not thispars
if it failed to setup frequency - use the old one
Make Xilinx Spartan DCM happy (it does not like changing input clock)
TODO: if (thispars->pars[]!=getClockFreq(1); /// using clock driver data, not thispars set HACT PHASE here - 90 deg. increment - seems like a bug in MT9P001 sensors - horisontal (and vert.) sync has different phase than data
this is just internal to FPGA - no need to reset sensor because of this (possible) change
Manual phase adjustment - idea for implementing automatic one turn sensor phase here TODO need to add finding the correct phase - may be found once for sensor+fpga_image+frequency and saved to measure correctly phase you need to give enough time for each measurement (sensor should output some image data, preferrably test pattern so bit2 for 12-bit 5MPix (bit 0 for older 10-bit) will have all the combinations of 0 after 1, 1 after 0 procedure will be: 1: set/change phase (may watch DCM state) 2: X3X3_SENSDCM_NOP to reset error counters (error is a mismatch between data at strobe and two aux. ones - 1/4Tclk early and 1/4Tclk late) 3: wait for some data to pass through (at least one sensor line) read X313_SENSOR_PHASE if it is <2 (MSB=0) the phase is correct and no changes are needed (with 96MHz and slow outputs that will not be the case at any phase) if there is an error, look at the LSB that shows direction to change. Start with 90 degrees until there will be "right" transition, i.e. while X3X3_SENSDCM_INC90 the LSB will change from 1 to 0 (don't remember to exit if MSB=0) Then reverse direction and go with X3X3_SENSDCM_DEC until the LSB will be 1 again (or MSB=0). That will be the right phase
sensor->sensorPhase, sensor->sensorPhase90 are copied to thispars->pars[P_SENSOR_PHASE] in pgm_detectsensor() if thispars->pars[P_SENSOR_PHASE] was zero (to give a chance to initscript to change it). So here we do not have to deal with sensor->sensorPhase and sensor->sensorPhase90 if (thispars->pars[P_SENSOR_PHASE]==0) - don't set phase - if 0 phase is really needed - use 0x40000
start from zero phase
make it signed
(0..3) 90-degree shift (fpcf -w 8 80)
save changes, schedule functions
Definition at line 512 of file pgm_functions.c.
References CCAM_SET_HACT_PHASE, getClockFreq(), MD12, MDF3, onchange_initsensor, P_CLK_SENSOR, P_SENSOR_PHASE, framepars_t::pars, printk, schedule_this_pgm_func(), sensor, SENSOR_NEED_RESET_CLK, SENSOR_NEED_RESET_PHASE, setClockFreq(), setFramePars(), SETFRAMEPARS_SET, udelay, X3X3_RSTSENSDCM, X3X3_SENSDCM_DEC, X3X3_SENSDCM_INC, and X3X3_SENSDCM_INC90.
Referenced by init_pgm_proc().
int pgm_sensorregs | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
program sensor registers (probably just those that are manually set) seems nothing to do here - all in the sensor-specific function
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
Definition at line 1699 of file pgm_functions.c.
Referenced by init_pgm_proc().
int pgm_sensorrun | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
Start/single acquisition from the sensor to the FPGA (stop has latency of 1).
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
wrong frame
Definition at line 937 of file pgm_functions.c.
References MDF3, P_SENSOR_RUN, framepars_t::pars, PARS_FRAMES, printk, X313_SEQ_ASAP, X313_SEQ_FRAME0, X313_WA_TRIG, and X3X3_SEQ_SEND1.
Referenced by init_pgm_proc().
int pgm_sensorstop | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
stop acquisition from the sensor to the FPGA (start/single have latency of 2)
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
wrong frame
Definition at line 963 of file pgm_functions.c.
References MDF3, P_SENSOR_RUN, framepars_t::pars, PARS_FRAMES, printk, X313_SEQ_ASAP, X313_SEQ_FRAME0, X313_WA_TRIG, and X3X3_SEQ_SEND1.
Referenced by init_pgm_proc().
int pgm_triggermode | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
program sensor trigger mode (needs sensor-specific one too), programs timestamp mode (early/normal)
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
wrong frame
Definition at line 874 of file pgm_functions.c.
References async, MDF3, P_EARLY_TIMESTAMP, P_TRIG, framepars_t::pars, PARS_FRAMES, printk, X313_SEQ_ASAP, X313_SEQ_FRAME0, X313_WA_DCR0, X313_WA_DCR1, X353_DCR0, X353_DCR1, and X3X3_SEQ_SEND1.
Referenced by init_pgm_proc().
int pgm_trigseq | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
can not use sequencer as data is more than 24 bit wide
sensor | pointer to sensor static parameters (capabilities) | |
thispars | pointer to sensor current parameters | |
prevpars | pointer to sensor previous parameters (not used here) | |
frame8 | short (hardware) frame number parameters should be applied to (or "-1" - ASAP) |
wrong frame
ASAP only mode
Trigger condition changed? (0 - internal sequencer)
Trigger delay changed?
Sequencer output word changed? (to which outputs it is sent and what polarity)
Sequencer period changed? (0 - stopped, <256 - single trigger, >=256 - start repetitive)
Definition at line 1426 of file pgm_functions.c.
References FRAMEPAR_MODIFIED, MDF3, P_TRIG_CONDITION, P_TRIG_DELAY, P_TRIG_OUT, P_TRIG_PERIOD, framepars_t::pars, PARS_FRAMES, port_csp0_addr, printk, X313_WA_CAMSYNCDLY, X313_WA_CAMSYNCOUT, X313_WA_CAMSYNCPER, and X313_WA_CAMSYNCTRIG.
Referenced by init_pgm_proc().
int pgm_window | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
program sensor WOI and mirroring Only validating, changing related parameters/scheduling actions, no hardware programming here
As different sensors may produce "bad frames" for differnt WOI changes (i.e. MT9P001 seems to do fine with FLIP, but not WOI_WIDTH) pgm_window and pgm_window_safe will do the same - they will just be called with different latencies and with compressor stopped)
Definition at line 613 of file pgm_functions.c.
References MDF3, pgm_window_common(), printk, and sensor.
Referenced by init_pgm_proc().
int pgm_window_common | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) | [inline] |
Definition at line 621 of file pgm_functions.c.
References bh, bv, COLORMODE_MONO4, COLORMODE_MONO6, dh, dv, FRAMEPAR_MODIFIED, height, MDF3, P_ACTUAL_HEIGHT, P_ACTUAL_WIDTH, P_BIN_HOR, P_BIN_VERT, P_COLOR, P_DCM_HOR, P_DCM_VERT, P_FLIPH, P_FLIPV, P_OVERSIZE, P_PF_HEIGHT, P_SENSOR_PIXH, P_SENSOR_PIXV, P_WOI_HEIGHT, P_WOI_LEFT, P_WOI_TOP, P_WOI_WIDTH, framepars_t::pars, pfh, printk, sensor, setFramePars(), SETFRAMEPARS_SET, width, X313_MARGINS, X313_MAXHEIGHT, X313_TILEHOR, X313_TILEVERT, and X313_TIMESTAMPLEN.
Referenced by pgm_window(), and pgm_window_safe().
int pgm_window_safe | ( | struct sensor_t * | sensor, | |
struct framepars_t * | thispars, | |||
struct framepars_t * | prevpars, | |||
int | frame8 | |||
) |
Definition at line 617 of file pgm_functions.c.
References MDF3, pgm_window_common(), printk, and sensor.
Referenced by init_pgm_proc().