#include <linux/module.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/time.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 <asm/system.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/delay.h>
#include <asm/uaccess.h>
#include <asm/elphel/c313a.h>
#include "cc3x3.h"
#include "cci2c.h"
#include "mt9x001.h"
#include "hist.h"
Include dependency graph for mt9x001.c:
Go to the source code of this file.
Defines | |
#define | MD9(x) |
#define | D(x) |
#define | MD7(x) |
#define | DEFAULT_XTRA 1000 |
Functions | |
int | init_mt9x001 (void) |
int | adjustBinning_mt9x001 (void) |
int | program_woi_mt9x001 (int nonstop) |
int | normalize_gain (int g) |
int | gain_mt9x001 (int g) |
int | program_gains_mt9x001 (void) |
void | check_fps (void) |
int | program_exposure_mt9x001 (void) |
long | max_ (long a, long b) |
Variables | |
frame_params_t | frame_params |
sensor_t | mt9m001 |
sensor_t | mt9d001 |
sensor_t | mt9t001 |
sensor_t | mt9p001 |
sensor_t | sensor |
static int | mt9t_broken = 0x00 |
static unsigned int | mt9m001_inits [] |
static unsigned int | mt9d001_inits [] |
static unsigned int | mt9t001_inits [] |
static unsigned int | mt9p001_inits [] |
#define MD9 | ( | x | ) |
******************************************************************************** ! FILE NAME : mt9x001.c ! DESCRIPTION: sensor support for Micron image sensors: ! MT9M001(1280x1024) ! MT9D001(1600x1200) ! MT9T001(2048x1536) ! MT9P001/MT9P031(2592x1944) ! ! Copyright (C) 2004-2007 Elphel, Inc. ! -----------------------------------------------------------------------------** ! ! This program is free software: you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation, either version 3 of the License, or ! (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program. If not, see <http://www.gnu.org/licenses/>. ! -----------------------------------------------------------------------------** !
Revision 1.2 2007/10/16 20:03:38 elphel cosmetic
Revision 1.1.1.1 2007/09/30 03:19:56 elphel This is a fresh tree based on elphel353-2.10
Revision 1.12 2007/09/30 03:19:56 elphel Cleanup, fixed broken acquisition of individual JPEG images into circbuf (in mode 7)
Revision 1.11 2007/09/19 04:22:33 elphel fixed debug output
Revision 1.10 2007/09/19 00:34:21 elphel support for frame rate limiting, disabled extra debug messages
Revision 1.9 2007/09/18 06:09:22 elphel support for merged P_FLIP, support fro P_FPSLM (fps limit mode) that allow to limit FPS (upper limit) and maintain FPS (lower limit) preventing exposure time to exceed one divided by fps limit
Revision 1.8 2007/09/12 18:05:35 spectr_rain empty log message ***
Revision 1.7 2007/08/17 10:23:19 spectr_rain switch to GPL3 license
Revision 1.6 2007/07/20 10:17:46 spectr_rain empty log message ***
Revision 1.10 2007/07/09 22:05:43 elphel minor sensor phase adjustment (constant so far)
Revision 1.9 2007/07/09 21:10:14 elphel Reducing EMI from the sensor front end cable by reducing the drive strengths on the lines. Improving phase adjustment (and phase error measurements) for the sensors. Dealing with the delayed (with respect to pixel data) line/frame valid signals in MT9P001 sensors
Revision 1.8 2007/07/09 05:15:17 elphel set slowest speed on the outputs to reduce EMI
Revision 1.7 2007/06/28 02:24:40 elphel Increased default frequency for 5MPix sensor to 96MHz
Revision 1.6 2007/06/18 07:57:24 elphel Fixed bug working with MT9P031 - added sensor reset/reinit after frequency change
Revision 1.5 2007/05/21 17:45:11 elphel boundary scan support, added 359/347 detection
Revision 1.4 2007/04/23 22:48:32 spectr_rain empty log message ***
Revision 1.3 2007/04/17 18:28:06 spectr_rain empty log message ***
Revision 1.2 2007/04/04 03:55:22 elphel Improved i2c, added i2c as character devices (to use from php)
Revision 1.1.1.1 2007/02/23 10:11:48 elphel initial import into CVS
Revision 1.12 2006/12/01 00:18:12 spectr_rain empty log message ***
Revision 1.11 2006/11/28 18:33:26 spectr_rain empty log message ***
Revision 1.9 2006/11/01 18:49:57 spectr_rain empty log message ***
Revision 1.8 2006/09/12 15:21:55 spectr_rain use ve for integration time if e == 0
Revision 1.7 2006/09/02 22:04:17 spectr_rain empty log message ***
Revision 1.6 2006/09/02 00:19:49 spectr_rain lock sensor while readrawimage
Revision 1.5 2006/07/17 12:22:42 spectr_rain enable autoexposition
Revision 1.4 2006/07/13 04:21:15 elphel mt9p031 now wants the same bayer as others - maybe DLYHOR bit was set earlier?
Revision 1.3 2006/07/12 19:32:49 spectr_rain fix Bayer pattern for less than 5MPx sensors
Revision 1.2 2006/07/12 06:03:16 elphel bug fix
Revision 1.1.1.1 2006/07/11 19:15:00 spectr_rain unwork with less than 5MPx Micron sensor, initial branch
Revision 1.25 2006/06/05 07:31:22 spectr_rain set blank vertical to 0 if pfh > 0
Revision 1.24 2006/02/16 03:37:06 elphel empty log message ***
Revision 1.23 2006/02/08 01:53:56 spectr_rain fix broken mutex in check of down_interruptible
Revision 1.22 2006/01/15 22:24:03 elphel bug fix, made binning a non-stop parameter
Revision 1.21 2006/01/15 13:03:27 spectr_rain fix deadlock
Revision 1.19 2006/01/12 03:52:14 elphel empty log message ***
Revision 1.18 2006/01/10 15:41:54 spectr_rain use gain compensation for color canal scale
Revision 1.17 2006/01/05 05:36:13 spectr_rain empty log message ***
Revision 1.15 2006/01/05 05:21:32 spectr_rain empty log message ***
Revision 1.14 2006/01/05 05:15:27 spectr_rain new sensitivity/scale iface
Revision 1.13 2006/01/05 00:01:21 elphel fixed hang-up - removed restarting a frame that was sometimes hanging a sensor until reset
Revision 1.12 2005/11/29 09:13:31 spectr_rain add autoexposure
Revision 1.11 2005/11/23 05:13:25 spectr_rain use exposition and gain with autoexposition
Revision 1.10 2005/11/22 09:21:01 elphel Fixed skipping of half frames, improved period calculation (not yet for binning modes)
Revision 1.9 2005/10/12 17:58:08 elphel fixed wrong fps reporting in mt9x001.c
Revision 1.8 2005/10/11 08:25:41 elphel fixed long exposures without slowing down sensor (especially for 3MPix sensor)
Revision 1.7 2005/09/15 22:46:51 elphel Fixed bug with 1.3MPix Micron sensor (introduced in previous release)
Revision 1.6 2005/09/10 23:33:22 elphel Support of realtime clock and timestamps in the images
Revision 1.5 2005/09/06 03:40:37 elphel changed parameters, added support for the photo-finish mode
Revision 1.4 2005/08/27 05:16:27 elphel binning
Revision 1.3 2005/08/27 00:46:39 elphel bayer control with &byr=
Revision 1.2 2005/05/10 21:08:49 elphel empty log message ***
int adjustBinning_mt9x001 | ( | void | ) |
Definition at line 593 of file mt9x001.c.
References bh, bv, dh, dv, get_imageParamsR(), MT9P_TYP, MT9T_TYP, P_BIN_HOR, P_BIN_VERT, P_DCM_HOR, P_DCM_VERT, P_SENSOR, and set_imageParamsR().
Referenced by programSensor().
void check_fps | ( | void | ) |
Definition at line 1018 of file mt9x001.c.
References max_(), MD9, P_MT9X001_HEIGHT, P_MT9X001_HORBLANK, P_MT9X001_SHTRWDTH, P_MT9X001_SHTRWDTHU, P_MT9X001_VERTBLANK, P_MT9X001_WIDTH, printk, and readSensorReg16().
Definition at line 882 of file mt9x001.c.
References sensor_t::maxGain256, and sensor.
Referenced by program_gains_mt9x001().
int init_mt9x001 | ( | void | ) |
Definition at line 444 of file mt9x001.c.
References sensor_t::i2c_addr, i2c_readData(), i2c_writeData(), MD7, memcpy(), mt9d001, mt9d001_inits, MT9D001_PARTID, MT9D_TYP, mt9m001, mt9m001_inits, MT9M001_PARTID, MT9M_TYP, mt9p001, mt9p001_inits, MT9P001_PARTID, MT9P_TYP, mt9t001, mt9t001_inits, MT9T001_PARTID, mt9t_broken, MT9T_TYP, MT9X001_I2C_ADDR, MT9X001_PARTIDMASK, P_MT9X001_CHIPVER, P_SENSOR, printk, readSensorReg16(), sensor, SENSOR_MT9X001, sensor_t::sensorType, set_imageParamsR(), set_sensor_i2c_addr(), and writeSensorReg16().
Referenced by init_sensor(), and programSensor().
long max_ | ( | long | a, | |
long | b | |||
) |
int program_exposure_mt9x001 | ( | void | ) |
Definition at line 937 of file mt9x001.c.
References dv, e, get_imageParamsR(), get_imageParamsW(), get_sensor_i2c_regs16(), sensor_t::maxShutter, sensor_t::maxVertBlank, MD7, MD9, sensor_t::minVertBlank, MT9P_TYP, MT9T_TYP, P_CLK_SENSOR, P_DCM_VERT, P_EXPOS, P_FP100S, P_FPSLM, P_MT9X001_HEIGHT, P_MT9X001_SHTRWDTH, P_MT9X001_SHTRWDTHU, P_MT9X001_VERTBLANK, P_PERIOD, P_SENSOR, P_TRIG, P_VEXPOS, P_VIRT_HEIGHT, P_VIRT_WIDTH, printk, sclk, sensor, set_imageParamsR(), vh, wh, and writeSensorReg16().
Referenced by program_sensor_exposition_just().
int program_gains_mt9x001 | ( | void | ) |
Definition at line 892 of file mt9x001.c.
References frame_params, frame_params_t::gain_b, frame_params_t::gain_g, frame_params_t::gain_gb, gain_mt9x001(), frame_params_t::gain_r, gb, get_imageParamsW(), gg, ggb, gr, sensor_t::maxGain256, normalize_gain(), P_GAINB, P_GAING, P_GAINGB, P_GAINR, P_MT9X001_BLUE, P_MT9X001_GREEN1, P_MT9X001_GREEN2, P_MT9X001_RED, sensor, set_imageParamsR(), and writeSensorReg16().
Referenced by programSensor().
Definition at line 614 of file mt9x001.c.
References bh, bv, sensor_t::clearHeight, sensor_t::clearLeft, sensor_t::clearTop, sensor_t::clearWidth, dh, dv, fclk, get_imageParamsR(), get_imageParamsW(), get_sensor_i2c_regs16(), sensor_t::margins, sensor_t::maxHorBlank, MD7, sensor_t::minHorBlank, MT9D_TYP, MT9M_TYP, MT9P_TYP, MT9T_TYP, P_BAYER, P_BIN_HOR, P_BIN_VERT, P_CLK_FPGA, P_CLK_SENSOR, P_DCM_HOR, P_DCM_VERT, P_FLIP, P_FPGA_XTRA, P_MT9X001_CAM, P_MT9X001_COLSTART, P_MT9X001_HEIGHT, P_MT9X001_HORBLANK, P_MT9X001_RAM, P_MT9X001_RMODE1, P_MT9X001_RMODE2, P_MT9X001_ROWSTART, P_MT9X001_WIDTH, P_OVERSIZE, P_PF_HEIGHT, P_SENSOR, P_TRIG, P_VIRT_WIDTH, P_WOI_HEIGHT, P_WOI_LEFT, P_WOI_TOP, pfh, sensor_t::pixelHeight, sensor_t::pixelWidth, printk, sclk, sensor, set_imageParamsR(), wh, wl, writeSensorReg16(), wt, ww, and xtra.
Referenced by programSensor().
struct frame_params_t frame_params |
// moved to circbuf.c, so now ccam_dma_buf_ptr will be available (external) instead static unsigned long ccam_dma_buf[CCAM_DMA_SIZE + PAGE_SIZE] __attribute__ ((aligned (PAGE_SIZE))); unsigned long *ccam_dma_buf_ptr = NULL; void init_ccam_dma_buf_ptr(void) { ccam_dma_buf_ptr = ccam_dma_buf; }
unsigned int mt9d001_inits[] [static] |
Initial value:
{ (P_MT9X001_CALTHRESH<<16) | 0xa39d, (P_MT9X001_CALCTRL<<16) | 0x8498 }
Definition at line 421 of file mt9x001.c.
Referenced by init_mt9x001().
unsigned int mt9m001_inits[] [static] |
unsigned int mt9p001_inits[] [static] |
Initial value:
{ (P_MT9X001_OUTCTRL<<16) | 0x2, (P_MT9X001_7F <<16) | 0x0 }
Definition at line 430 of file mt9x001.c.
Referenced by init_mt9x001().
unsigned int mt9t001_inits[] [static] |
int mt9t_broken = 0x00 [static] |