os/linux-2.6-tag--devboard-R2_10-4/arch/cris/arch-v32/drivers/elphel/mt9x001.c File Reference

#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 Documentation

#define D ( x   ) 

Definition at line 245 of file mt9x001.c.

#define DEFAULT_XTRA   1000

Definition at line 249 of file mt9x001.c.

#define MD7 ( x   ) 

Definition at line 247 of file mt9x001.c.

#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/>. ! -----------------------------------------------------------------------------** !

Log
mt9x001.c,v
! Revision 1.10 2008/07/23 02:24:57 elphel ! typo ! ! Revision 1.9 2008/05/02 15:13:35 elphel ! switch to hardware i2c write,added related sensor parameters ! ! Revision 1.8 2008/05/01 01:28:57 elphel ! hardware i2c control - macros, variables ! ! Revision 1.7 2008/03/20 22:29:30 elphel ! added trigger-related code and parameters ! ! Revision 1.6 2008/02/12 21:53:20 elphel ! Modified I2c to support multiple buses, added raw access (no address registers) and per-slave protection bitmasks ! ! Revision 1.5 2008/02/05 18:28:59 spectr_rain ! correct timing for MT9P sensor with binning and skipping 1,2,4 ! ! Revision 1.4 2007/12/27 14:27:43 spectr_rain ! fixed FPS, correct work with the skipping - TODO - check the binning ! ! Revision 1.3 2007/10/16 23:17:51 elphel ! cosmetic !

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 ***

Definition at line 243 of file mt9x001.c.


Function Documentation

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().

int gain_mt9x001 ( int  g  ) 

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 
)

Definition at line 1013 of file mt9x001.c.

Referenced by check_fps().

int normalize_gain ( int  g  ) 

Definition at line 874 of file mt9x001.c.

Referenced by program_gains_mt9x001().

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().

int program_woi_mt9x001 ( int  nonstop  ) 

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().


Variable Documentation

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; }

Definition at line 716 of file cc353.c.

struct sensor_t mt9d001

Definition at line 292 of file mt9x001.c.

Referenced by init_mt9x001().

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().

struct sensor_t mt9m001

Definition at line 253 of file mt9x001.c.

Referenced by init_mt9x001().

unsigned int mt9m001_inits[] [static]

Initial value:

 
  {
  }

Definition at line 417 of file mt9x001.c.

Referenced by init_mt9x001().

struct sensor_t mt9p001

Definition at line 369 of file mt9x001.c.

Referenced by init_mt9x001().

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().

struct sensor_t mt9t001

Definition at line 330 of file mt9x001.c.

Referenced by init_mt9x001().

unsigned int mt9t001_inits[] [static]

Initial value:

 
  {
  }

Definition at line 426 of file mt9x001.c.

Referenced by init_mt9x001().

int mt9t_broken = 0x00 [static]

Definition at line 409 of file mt9x001.c.

Referenced by init_mt9x001().

struct sensor_t sensor

Definition at line 639 of file cc353.c.


Generated on Thu Aug 7 16:20:36 2008 for elphel by  doxygen 1.5.1