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

#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/interrupt.h>
#include <linux/time.h>
#include <asm/system.h>
#include <asm/arch/hwregs/intr_vect.h>
#include <asm/arch/hwregs/intr_vect_defs.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/delay.h>
#include <asm/uaccess.h>
#include <asm/arch/cache.h>
#include <asm/elphel/c313a.h>
#include <asm/elphel/exifa.h>
#include "fpgactrl.h"
#include "fpga_sdram.h"
#include "x3x3.h"
#include "cc3x3.h"
#include "cxsdram.h"
#include "cci2c.h"
#include "cxdma.h"
#include "circbuf.h"
#include "fpgaconfi2c.h"
#include "hist.h"
#include "exif353.h"

Include dependency graph for cc353.c:

Go to the source code of this file.

Data Structures

struct  meta_offsets_t

Defines

#define USE_HARDWARE_I2C   y
#define MCPpresent()   0
#define MCP_open(inode, filp)   -1
#define MCP_lseek(file, offset, orig)   0
#define MCP_read(file, buf, count, off)   0
#define MCP_write(file, buf, count, off)   0
#define MD1(x)
#define MD12(x)
#define MD13(x)
#define MD20(x)
#define MD11(x)
 where jpeg_rp is modified?
#define MD10(x)
#define MD9(x)
#define MD8(x)
#define MD7(x)
 camSeqStartClip
#define MD6(x)
#define MD2(x)
 programSensor(nonstop)
#define D(x)
#define D1(x)
#define D2(x)
#define D3(x)
#define D4(x)
#define D5(x)   printk("%s:%d:",__FILE__,__LINE__);x
#define CMOSCAM_MAJOR   126
#define MY_MODULE_DESCRIPTION   "Elphel model 353 camera driver"
#define CMOSCAM_DRIVER_NAME   "CMOS/MCP camera 353 driver\n"
#define X313_ACQUIRE_STOP   port_csp0_addr[X313_WA_TRIG]=0
#define X313_ACQUIRE_ONCE   port_csp0_addr[X313_WA_TRIG]=(imageParamsR[P_TRIG] & 1)?6:4
#define X313_ACQUIRE_INTERNAL   port_csp0_addr[X313_WA_TRIG]=4
#define X313_ACQUIRE_EXTERNAL   port_csp0_addr[X313_WA_TRIG]=6
#define X313_ACQUIRE_ON   port_csp0_addr[X313_WA_TRIG]=5
#define EN_INTERRUPT(x)   port_csp0_addr[X313_WA_IRQM]= (intm_shadow |= (1<< x ))
#define DIS_INTERRUPT(x)   port_csp0_addr[X313_WA_IRQM]= (intm_shadow &= ~(1<< x ))
#define DIS_INTERRUPTS   port_csp0_addr[X313_WA_IRQM]= (intm_shadow = 0)
#define PROGRAM_FPN(t, s, m, d, l)
#define PROGRAM_CLK_EN(x)   X313_SETFIELD(CLKEN, x )
#define CCAM_DONOTUSEAUX   (ccam_cr_shadow & X313_MASK(KAI11000))
#define CCAM_ARO_ON   ccamCROr( X313_BITS(ARO,1) )
#define CCAM_ARO_OFF   ccamCRAnd(~X313_BITS(ARO,1) )
#define CCAM_DCLK_OFF   ccamCROr( X313_BITS(DCLKMODE,1) )
#define CCAM_DCLK_ON   ccamCRAnd(~X313_BITS(DCLKMODE,1) )
#define CCAM_ARST_OFF   ccamCROr( X313_BITS(ARST,1) )
#define CCAM_ARST_ON   ccamCRAnd(~X313_BITS(ARST,1) )
#define CCAM_MRST_OFF   ccamCROr( X313_BITS(MRST,1) )
#define CCAM_MRST_ON   ccamCRAnd(~X313_BITS(MRST,1) )
#define CCAM_NEGRST   ccamCROr( X313_BITS(NEGRST,1) )
#define CCAM_POSRST   ccamCRAnd(~X313_BITS(NEGRST,1) )
#define CCAM_CNVEN_OFF   ccamCRAnd(~X313_BITS(CNVEN,1) )
#define CCAM_TRIG_INT   ccamCRAnd(~X313_BITS(TRIGSRC,1) )
 Sensor (MT9X001) trigger source selection (internal/external).
#define CCAM_TRIG_EXT   ccamCROr( X313_BITS(TRIGSRC,1) )
#define CCAM_TIMESTAMP_NORMAL   ccamCRAnd(~X313_BITS(EARLYTRIG,1) )
 early/normal timestamp in async mode
#define CCAM_TIMESTAMP_EARLY   ccamCROr( X313_BITS(EARLYTRIG,1) )
#define CCAM_SET_HACT_PHASE(x)   ccamCRAndOr(~X313_MASK(HACT_PHASE), X313_BITS(HACT_PHASE, (x)))
#define CCAM_CNVEN_ON   printk ("\r\n*** Maybe fatal for MT9P001 !!! Set CONFIG_ETRAX_ELPHEL_FORCE_MT9P001 if troubleshooting MT9P001 ***\r\n");ccamCROr( X313_BITS(CNVEN,1) )
#define X313_MAXMINOR   15
#define SCALE_MIN   0x040
#define SCALE_MAX   0x400
#define nint_vact   0
#define nint_xint   1
#define nint_xferovr   2
#define nint_done   3
#define nint_eot   4
#define nint_overrun   5
#define nint_done_input   6
#define nint_done_compress   7
#define nint_smart   8
#define MAXEXPOSURE   60000
#define SIMPLE_IRQ   y
#define CONFIG_ETRAX_ELPHEL_AUTOEXP   y
#define OLD_CAMSEQSTOP   0
 Called from programSensor() if frame format is changed (needed to restart compressor).
#define ENABLE_OLD_SENSORS   1
#define PROGRAM_SENSOR_DIS_IRQ   0
#define CX313_FPGA_HISTOGRAM_SIZE   0x400

Functions

static DECLARE_MUTEX (sensor_lock)
unsigned long gain_balance (unsigned long *scale, unsigned long gain)
void dumpFrameParams (struct frame_params_t *fp, const char *title)
static unsigned long imageParamsR[P_NUMBER *4] __attribute__ ((aligned(PAGE_SIZE)))
static int getCamSeqState (void)
static int getCamSeqCount (void)
static void setCamSeqState (int v)
static void setCamSeqCount (int v)
static void initCamIRQs (void)
static int camSeqStart (void)
static irqreturn_t camSeq_interrupt (int irq, void *dev_id)
static int x313_JPEG_cmd_wrapper (int arg)
static int ccam_DMA_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
 to combine calls to x313_JPEG_cmd(arg) and some other action to be calles from ioctl, as before and lseek (,,2)
static int cmoscam_open (struct inode *inode, struct file *filp)
static int cmoscam_release (struct inode *inode, struct file *filp)
static int cmoscam_ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
static loff_t cmoscam_lseek (struct file *file, loff_t offset, int orig)
static ssize_t cmoscam_read (struct file *file, char *buf, size_t count, loff_t *off)
static ssize_t cmoscam_write (struct file *file, const char *buf, size_t count, loff_t *off)
static int cmoscam_mmap (struct file *file, struct vm_area_struct *vma)
static unsigned int cmoscam_poll (struct file *file, poll_table *wait)
static int __init cmoscam_init (void)
static int init_sensor (void)
static int programSensor (int nonstop)
static int init_FPGA (void)
static void camSeq_dump (void)
void adjust_fps_2_compressor (void)
void x313_tables_gammainitlinear (void)
loff_t x313_tables_lseek (struct file *file, loff_t offset, int orig)
ssize_t x313_tables_write (struct file *file, const char *buf, size_t count, loff_t *off)
ssize_t x313_tables_read (struct file *file, char *buf, size_t count, loff_t *off)
loff_t x313_histogram_lseek (struct file *file, loff_t offset, int orig)
ssize_t x313_histogram_read (struct file *file, char *buf, size_t count, loff_t *off)
int write_gamma_fpga (unsigned short gamma_table[1028])
loff_t x313_gamma_lseek (struct file *file, loff_t offset, int orig)
ssize_t x313_gamma_read (struct file *file, char *buf, size_t count, loff_t *off)
ssize_t x313_gamma_write (struct file *file, const char *buf, size_t count, loff_t *off)
loff_t x313_senspars_lseek (struct file *file, loff_t offset, int orig)
ssize_t x313_senspars_read (struct file *file, char *buf, size_t count, loff_t *off)
ssize_t x313_senspars_write (struct file *file, const char *buf, size_t count, loff_t *off)
int x313_senspars_mmap (struct file *file, struct vm_area_struct *vma)
void x313_program_focus (int totalwidth)
 HACK: programming focus filter parameters, will likely change. Should be called after the image width is already known.
static void startAcquire (void)
void tasklet_irq_f (unsigned long arg)
 DECLARE_TASKLET (tasklet_vact, tasklet_irq_f, IRQ_SRC_VACT)
 DECLARE_TASKLET (tasklet_done_compress, tasklet_irq_f, IRQ_SRC_DONE_COMPRESS)
void compressorSingle (void)
void compressorRun (void)
void compressorStop (void)
void updateJPEG_wp (void)
 uses fpga transfer counter to update JPEG_wp. Should be called before any compressorStop
void resetPointers (void)
void advance_imageParamsR (void)
void add_frame_params (void)
void ch0_lock (void)
int camSeqGetJPEG_wp (void)
int camSeqGetJPEG_rp (void)
void camSeqSetJPEG_rp (int p)
int camSeqStartClip (int nfr, int len)
 only "n, -1" and "0, -1" are updated to include CCD so far
void camSeqStop (void)
int get_sensor_i2c_regs16 (int n)
unsigned char get_sensor_i2c_regs (int n)
unsigned long get_imageParamsR (int n)
unsigned long get_imageParamsW (int n)
unsigned char get_sensor_i2c_addr (void)
void set_sensor_i2c_regs (int n, unsigned char d)
void set_imageParamsR (int n, unsigned long d)
void set_imageParamsW (int n, unsigned long d)
void set_sensor_i2c_addr (unsigned char d)
void ccamCRAnd (unsigned long d)
void ccamCROr (unsigned long d)
void ccamCRXor (unsigned long d)
void ccamCRAndOr (unsigned long d_and, unsigned long d_or)
unsigned long ccamGetCR (void)
void writeSensorDefaults (unsigned long *data, int count)
int readSensorReg (unsigned int ra, int mode)
int writeSensorReg (unsigned int ra, unsigned char rd, int uncond)
int readSensorReg16 (unsigned char ra, int mode)
int writeSensorReg16 (unsigned char ra, int rd, int uncond)
int writeSensorRegFF (unsigned char ra, int rd, int uncond)
static int program_KAI11000 (void)
void exposition_unlock (void)
int program_sensor_exposition (void)
int program_sensor_exposition_just (void)
 This program returns -1 for all not yet suported (re-supported ) sensors.
void program_trigger (void)
 program trigger parameters
void program_i2c (void)
void program_smart_irq (void)
void program_early_timestamp (void)
int flush_par_cache (void)
void init_autoexp_struct (void)
 module_init (cmoscam_init)
 MODULE_LICENSE ("GPL")
 MODULE_AUTHOR ("Andrey Filippov <andrey@elphel.com>.")
 MODULE_DESCRIPTION (MY_MODULE_DESCRIPTION)
 MODULE_DESCRIPTION ("Elphel Model 353 camera driver")

Variables

static const char cmoscam_name [] = "cmoscam353"
sensor_t sensor
unsigned short gamma_tables_soft [1028]
int gamma_tables_changed = 0
static unsigned long default_common []
gains_t gains
frame_params_t frame_params
unsigned long * frame_params_ul = (unsigned long *) &frame_params
unsigned short * exif_index = (unsigned short * ) &frame_params.meta_index
static struct meta_offsets_t meta_offsets
char * exif_meta_time_string
static int minors [X313_MAXMINOR+1]
static unsigned char sensor_i2c_addr
static unsigned short sensor_i2c_regs16 [0x100]
unsigned char * sensor_i2c_regs
unsigned long * imageParamsW = &imageParamsR[P_NUMBER]
unsigned long * imageParamsR_PREV = &imageParamsR[2*P_NUMBER]
unsigned long * imageParamsR_PREV_PREV = &imageParamsR[3*P_NUMBER]
autoexp_tautoexp_state = NULL
autoexp_tautoexp_set = NULL
aexp_window_taexp_window = NULL
aexp_window_taexp_window_set = NULL
static int jpeg_sdram_ctl0
volatile unsigned long ccam_cr_shadow = 0
static struct file_operations cmoscam_fops
static volatile unsigned long intm_shadow = 0
static volatile int camSeqCount
static volatile int camSeqState
static volatile int JPEG_wp
static volatile int JPEG_rp
static volatile int JPEG_len
static unsigned long DMA_buf_start
static volatile int JPEG_nfr
static volatile int JPEG_lfr
static volatile int dbg_20
static volatile int dbg_28
wait_queue_head_t x313_wait_queue
unsigned long ccam_dma_length
static int fpga_counter_prev = 0
static int JPEG_wp_prev = 0
int slock
wait_queue_head_t vack_wait_queue
sensor_t kai11002
unsigned long fpga_tables_buffer [CX313_FPGA_TABLES_SIZE]
 Moved to c313a.h.


Define Documentation

#define CCAM_ARO_OFF   ccamCRAnd(~X313_BITS(ARO,1) )

Definition at line 556 of file cc353.c.

#define CCAM_ARO_ON   ccamCROr( X313_BITS(ARO,1) )

Definition at line 554 of file cc353.c.

#define CCAM_ARST_OFF   ccamCROr( X313_BITS(ARST,1) )

Definition at line 566 of file cc353.c.

Referenced by init_sensor(), and programSensor().

#define CCAM_ARST_ON   ccamCRAnd(~X313_BITS(ARST,1) )

Definition at line 568 of file cc353.c.

#define CCAM_CNVEN_OFF   ccamCRAnd(~X313_BITS(CNVEN,1) )

Definition at line 582 of file cc353.c.

#define CCAM_CNVEN_ON   printk ("\r\n*** Maybe fatal for MT9P001 !!! Set CONFIG_ETRAX_ELPHEL_FORCE_MT9P001 if troubleshooting MT9P001 ***\r\n");ccamCROr( X313_BITS(CNVEN,1) )

Definition at line 614 of file cc353.c.

Referenced by init_sensor().

#define CCAM_DCLK_OFF   ccamCROr( X313_BITS(DCLKMODE,1) )

Definition at line 560 of file cc353.c.

#define CCAM_DCLK_ON   ccamCRAnd(~X313_BITS(DCLKMODE,1) )

Definition at line 562 of file cc353.c.

#define CCAM_DONOTUSEAUX   (ccam_cr_shadow & X313_MASK(KAI11000))

Definition at line 551 of file cc353.c.

Referenced by cmoscam_open().

#define CCAM_MRST_OFF   ccamCROr( X313_BITS(MRST,1) )

Definition at line 571 of file cc353.c.

Referenced by init_sensor(), and programSensor().

#define CCAM_MRST_ON   ccamCRAnd(~X313_BITS(MRST,1) )

Definition at line 573 of file cc353.c.

Referenced by programSensor().

#define CCAM_NEGRST   ccamCROr( X313_BITS(NEGRST,1) )

Definition at line 576 of file cc353.c.

Referenced by init_sensor().

#define CCAM_POSRST   ccamCRAnd(~X313_BITS(NEGRST,1) )

Definition at line 578 of file cc353.c.

Referenced by init_sensor().

#define CCAM_SET_HACT_PHASE ( x   )     ccamCRAndOr(~X313_MASK(HACT_PHASE), X313_BITS(HACT_PHASE, (x)))

Definition at line 602 of file cc353.c.

Referenced by programSensor().

#define CCAM_TIMESTAMP_EARLY   ccamCROr( X313_BITS(EARLYTRIG,1) )

Definition at line 594 of file cc353.c.

Referenced by program_early_timestamp().

#define CCAM_TIMESTAMP_NORMAL   ccamCRAnd(~X313_BITS(EARLYTRIG,1) )

early/normal timestamp in async mode

Definition at line 592 of file cc353.c.

Referenced by program_early_timestamp().

#define CCAM_TRIG_EXT   ccamCROr( X313_BITS(TRIGSRC,1) )

Definition at line 588 of file cc353.c.

Referenced by programSensor().

#define CCAM_TRIG_INT   ccamCRAnd(~X313_BITS(TRIGSRC,1) )

Sensor (MT9X001) trigger source selection (internal/external).

Definition at line 586 of file cc353.c.

Referenced by programSensor().

#define CMOSCAM_DRIVER_NAME   "CMOS/MCP camera 353 driver\n"

Definition at line 473 of file cc353.c.

Referenced by cmoscam_init().

#define CMOSCAM_MAJOR   126

Definition at line 467 of file cc353.c.

Referenced by cmoscam_init().

#define CONFIG_ETRAX_ELPHEL_AUTOEXP   y

#define CX313_FPGA_HISTOGRAM_SIZE   0x400

Definition at line 3810 of file cc353.c.

Referenced by x313_histogram_lseek(), and x313_histogram_read().

#define D ( x   ) 

Definition at line 458 of file cc353.c.

#define D1 ( x   ) 

Definition at line 459 of file cc353.c.

#define D2 ( x   ) 

Definition at line 460 of file cc353.c.

#define D3 ( x   ) 

Definition at line 461 of file cc353.c.

#define D4 ( x   ) 

Definition at line 462 of file cc353.c.

#define D5 ( x   )     printk("%s:%d:",__FILE__,__LINE__);x

Definition at line 464 of file cc353.c.

#define DIS_INTERRUPT ( x   )     port_csp0_addr[X313_WA_IRQM]= (intm_shadow &= ~(1<< x ))

Definition at line 498 of file cc353.c.

#define DIS_INTERRUPTS   port_csp0_addr[X313_WA_IRQM]= (intm_shadow = 0)

Definition at line 499 of file cc353.c.

Referenced by camSeq_interrupt(), camSeqStop(), and initCamIRQs().

#define EN_INTERRUPT ( x   )     port_csp0_addr[X313_WA_IRQM]= (intm_shadow |= (1<< x ))

Definition at line 497 of file cc353.c.

Referenced by camSeq_interrupt(), camSeqStart(), camSeqStartClip(), and startAcquire().

#define ENABLE_OLD_SENSORS   1

#define MAXEXPOSURE   60000

Definition at line 889 of file cc353.c.

#define MCP_lseek ( file,
offset,
orig   )     0

Definition at line 379 of file cc353.c.

Referenced by cmoscam_lseek().

#define MCP_open ( inode,
filp   )     -1

Definition at line 378 of file cc353.c.

Referenced by cmoscam_open().

#define MCP_read ( file,
buf,
count,
off   )     0

Definition at line 380 of file cc353.c.

Referenced by cmoscam_read().

#define MCP_write ( file,
buf,
count,
off   )     0

Definition at line 383 of file cc353.c.

Referenced by cmoscam_write().

 
#define MCPpresent (  )     0

Definition at line 377 of file cc353.c.

#define MD1 ( x   ) 

Definition at line 425 of file cc353.c.

#define MD10 ( x   ) 

Definition at line 438 of file cc353.c.

Referenced by circbuf_all_lseek(), circbuf_all_mmap(), circbuf_all_open(), circbuf_all_poll(), circbuf_all_read(), circbuf_all_release(), circbuf_all_write(), circbuf_open(), circbuf_poll(), circbufValidPointer(), init_sensor(), and programSensor().

#define MD11 ( x   ) 

where jpeg_rp is modified?

Definition at line 435 of file cc353.c.

Referenced by camSeqStop(), circbuf_lseek(), circbufValidPointer(), programSensor(), and x313_JPEG_cmd().

#define MD12 ( x   ) 

Definition at line 426 of file cc353.c.

Referenced by camSeqStop(), circbuf_lseek(), programSensor(), x313_dma_start(), and x313_dma_stop().

#define MD13 ( x   ) 

Definition at line 427 of file cc353.c.

Referenced by jpeg_set_quality(), programSensor(), and x313_dma_update_jpeg_header().

#define MD2 ( x   ) 

programSensor(nonstop)

Definition at line 455 of file cc353.c.

#define MD20 ( x   ) 

Definition at line 428 of file cc353.c.

Referenced by program_i2c().

#define MD6 ( x   ) 

Definition at line 451 of file cc353.c.

Referenced by ccam_DMA_ioctl(), programSensor(), x313_dma_update_jpeg_header(), x313_JPEG_cmd(), x313_JPEG_cmd_wrapper(), and x313_senspars_mmap().

#define MD7 ( x   ) 

camSeqStartClip

Definition at line 448 of file cc353.c.

Referenced by camSeqStartClip(), circbuf_mmap(), init_mt9x001(), init_sensor(), program_exposure_mt9x001(), program_woi_mt9x001(), readSensorReg(), writeSensorDefaults(), and x313_dma_init().

#define MD8 ( x   ) 

Definition at line 444 of file cc353.c.

Referenced by programSensor(), readSensorReg16(), writeSensorReg(), writeSensorReg16(), x313_dma_update_jpeg_header(), x313_JPEG_cmd(), and x313_setDMABuffer().

#define MD9 ( x   ) 

Definition at line 440 of file cc353.c.

Referenced by adjust_fps_2_compressor(), check_fps(), program_exposure_mt9x001(), programSensor(), setJPEGHeader(), and x313_dma_read().

#define MY_MODULE_DESCRIPTION   "Elphel model 353 camera driver"

Definition at line 472 of file cc353.c.

#define nint_done   3

Definition at line 880 of file cc353.c.

#define nint_done_compress   7

Definition at line 885 of file cc353.c.

Referenced by camSeq_interrupt(), and camSeqStartClip().

#define nint_done_input   6

Definition at line 884 of file cc353.c.

#define nint_eot   4

Definition at line 882 of file cc353.c.

#define nint_overrun   5

Definition at line 883 of file cc353.c.

#define nint_smart   8

Definition at line 886 of file cc353.c.

#define nint_vact   0

Definition at line 877 of file cc353.c.

Referenced by camSeq_interrupt(), camSeqStart(), and camSeqStartClip().

#define nint_xferovr   2

Definition at line 879 of file cc353.c.

Referenced by startAcquire().

#define nint_xint   1

Definition at line 878 of file cc353.c.

#define OLD_CAMSEQSTOP   0

Called from programSensor() if frame format is changed (needed to restart compressor).

Definition at line 1500 of file cc353.c.

#define PROGRAM_CLK_EN ( x   )     X313_SETFIELD(CLKEN, x )

Definition at line 539 of file cc353.c.

Referenced by init_sensor(), and programSensor().

#define PROGRAM_FPN ( t,
s,
m,
d,
 ) 

Value:

port_csp0_addr[X313_WA_SENSFPN]=    \
                                        (((t) & 1) << 10) | \
                                        (((s) & 7) << 7) | \
                                        (((m) & 7) << 4) | \
                                        (((d) & 1) << 3) | \
                                        (((l) & 7) << 0)

Definition at line 512 of file cc353.c.

Referenced by programSensor().

#define PROGRAM_SENSOR_DIS_IRQ   0

Definition at line 2137 of file cc353.c.

#define SCALE_MAX   0x400

Definition at line 708 of file cc353.c.

Referenced by programSensor().

#define SCALE_MIN   0x040

Definition at line 707 of file cc353.c.

Referenced by programSensor().

#define SIMPLE_IRQ   y

Definition at line 1124 of file cc353.c.

#define USE_HARDWARE_I2C   y

*************************************************************************** ! FILE NAME : cc353.c ! DESCRIPTION: TBD ! Copyright (C) 2002-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
cc353.c,v
! Revision 1.32 2008/07/23 02:27:12 elphel ! fixed hardware i2c bug - now 3MPix seem to work ! ! Revision 1.31 2008/05/02 15:16:58 elphel ! changed to hardware i2c writes, added P_OVERSIZE parameter to be able to read sensor with the dark pixels ! ! Revision 1.30 2008/05/01 01:28:57 elphel ! hardware i2c control - macros, variables ! ! Revision 1.29 2008/04/25 21:30:12 elphel ! implemented frame delay for the parameters, made Exif exposure to match the frame it is applied to ! ! Revision 1.28 2008/04/20 06:49:40 elphel ! cleanup, bug fixes ! ! Revision 1.27 2008/04/16 20:33:23 elphel ! driver cleanup, removed some duplicate actions, working on better recovery after parameter modification ! ! Revision 1.26 2008/04/11 22:57:02 elphel ! added "histogram" tasklet on/off control, removed extra local_irq_disable() ! ! Revision 1.25 2008/04/07 09:09:31 elphel ! Changes to handle Exif ! ! Revision 1.24 2008/03/20 22:29:30 elphel ! added trigger-related code and parameters ! ! Revision 1.23 2008/02/12 21:53:19 elphel ! Modified I2c to support multiple buses, added raw access (no address registers) and per-slave protection bitmasks ! ! Revision 1.22 2008/02/01 04:52:08 elphel ! Fixed focus visualization code in FPGA and related software ! ! Revision 1.21 2008/01/27 06:25:30 elphel ! driver update for focus processing ! ! Revision 1.20 2008/01/25 07:15:15 elphel ! 7.1.7.8 - added fpga code FPGA code (and related software) to facilitate focusing ! ! Revision 1.19 2008/01/12 06:53:23 elphel ! 7.1.7.2 - added elphel_autoexposure_get() function to elphel php extension ! ! Revision 1.18 2008/01/11 07:49:12 elphel ! added setting the autoexposure parameters for PHP ! ! Revision 1.17 2008/01/11 01:28:23 elphel ! 7.1.7.1 - working on autoexposure to make it use the same P_* parameters. ! ! Revision 1.16 2008/01/10 02:45:02 elphel ! Fixed wrong frame time calculation ! ! Revision 1.15 2008/01/07 08:56:44 elphel ! Temporary fix to "broken" images ! ! Revision 1.14 2007/12/13 06:47:55 elphel ! Fixed my stupid cache/mmap bug I blamed Axis for ! ! Revision 1.13 2007/12/13 02:47:15 elphel ! Fixed old driver bug (related to sensor reset), changed cache_flush for PHP extension ! ! Revision 1.12 2007/12/09 05:58:54 elphel ! comments ! ! Revision 1.11 2007/12/05 22:01:21 elphel ! added handling etrax fs mmap cach problem when communicating between PHP extension and the driver ! ! Revision 1.10 2007/12/03 08:28:46 elphel ! Multiple changes, mostly cleanup ! ! Revision 1.9 2007/11/30 06:46:12 elphel ! added mmap to parameters array, starting programSensor(nonstop) from overloaded lseek (,,SEEK_END) ! ! Revision 1.8 2007/11/14 00:57:04 spectr_rain ! fix FPS on streamer interface ! ! Revision 1.7 2007/11/04 05:49:31 elphel ! fixed mmap/caching bug - (that seems to be a known Axis one) ! ! Revision 1.6 2007/11/01 18:59:37 elphel ! debugging mmap/caching problems ! ! Revision 1.5 2007/10/27 00:55:32 elphel ! untested revision - need to go ! ! Revision 1.4 2007/10/16 20:04:38 elphel ! debug for sensor phase, starting programSensor from write php ! ! Revision 1.3 2007/10/11 06:41:35 elphel ! Added support for lseek - ioctl alternatives to control compressor/image acquisition to circbuf ! ! Revision 1.2 2007/10/10 23:33:32 elphel ! fixed bugs found by Spectr ! ! Revision 1.1.1.1 2007/10/02 21:09:15 elphel ! This is a fresh tree based on elphel353-2.10 ! ! Revision 1.16 2007/10/02 19:39:55 elphel ! Bug fix, added notes for the future ! ! Revision 1.15 2007/09/30 07:07:27 elphel ! only disabled debug output ! ! Revision 1.14 2007/09/30 03:19:56 elphel ! Cleanup, fixed broken acquisition of individual JPEG images into circbuf (in mode 7) ! ! Revision 1.13 2007/09/29 18:33:29 elphel ! Split cxdma.c - /dev/circbuf is now in a separate circbuf.c file. New device driver does not support ioctl, so some curernt applications are updated to use other drivers to control the camera ! ! Revision 1.11 2007/09/19 17:47:30 elphel ! P_FPSLM is updated in non-stop mode (so it can be updated and read back from the camera in camvc) ! ! Revision 1.10 2007/09/19 00:34:20 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/08/27 04:46:16 elphel ! Restoring JP4 format (option "j" in ccam.cgi "opt=" parameter). FPGA code for this mode is not fixed yet (but it does something different than in modes color & mono). ! ! Revision 1.7 2007/08/17 10:23:17 spectr_rain ! switch to GPL3 license ! ! Revision 1.6 2007/07/20 10:17:44 spectr_rain ! *** empty log message *** ! ! Revision 1.14 2007/07/13 20:54:07 elphel ! fixed operation of 10347 board to match changes in FPGA/drivers made fro EMI reduction of the 353 cameras ! ! Revision 1.13 2007/07/10 06:08:14 elphel ! Adding possibility to read/write sensor parameters, increasing number from 64 to 1024. ! Now writing to first 4096 bytes of the /dev/sensorpars will write imageParams array, reading from the same first 4096 bytes will read imageParams array, next 4096 bytes - imageParamsW ! ! Revision 1.12 2007/07/10 00:12:21 elphel ! Fixed bug that zeroed sensor.margins ! ! Revision 1.11 2007/07/09 21:10:13 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.10 2007/06/28 02:27:05 elphel ! 1) Added code to enable communication with sensor board FPGA over longer cable ! 2) Rewrote the histogram module to support 96MHz. It now uses doubled pixel clock. ! ! Revision 1.9 2007/06/18 07:57:24 elphel ! Fixed bug working with MT9P031 - added sensor reset/reinit after frequency change ! ! Revision 1.8 2007/04/19 20:15:25 elphel ! added KAI-11000/KAI-11002 basic support ! ! Revision 1.7 2007/04/18 21:13:36 spectr_rain ! *** empty log message *** ! ! Revision 1.6 2007/04/18 21:02:06 elphel ! working on KAI-11002 support ! ! Revision 1.5 2007/04/09 17:32:23 spectr_rain ! enable gamms, scale and histograms ! ! Revision 1.4 2007/04/05 21:00:28 spectr_rain ! remove trigger check in IRQ handler ! ! Revision 1.3 2007/04/04 03:55:22 elphel ! Improved i2c, added i2c as character devices (to use from php) ! ! Revision 1.2 2007/03/25 10:14:23 elphel ! Accommodating 10359 board ! ! Revision 1.1.1.1 2007/02/23 10:11:48 elphel ! initial import into CVS ! ! Revision 1.16 2006/11/28 18:33:26 spectr_rain ! *** empty log message *** ! ! Revision 1.15 2006/11/27 17:35:32 spectr_rain ! *** empty log message *** ! ! Revision 1.14 2006/11/24 22:59:49 spectr_rain ! fix output data counter from FPGA ! ! Revision 1.13 2006/11/01 18:49:57 spectr_rain ! *** empty log message *** ! ! Revision 1.12 2006/09/19 16:22:14 spectr_rain ! *** empty log message *** ! ! Revision 1.11 2006/09/02 22:04:17 spectr_rain ! *** empty log message *** ! ! Revision 1.10 2006/09/02 00:19:49 spectr_rain ! lock sensor while readrawimage ! ! Revision 1.9 2006/09/01 18:54:40 spectr_rain ! some fixes for /dev/ccam_img (image.raw) ! ! Revision 1.8 2006/08/30 15:56:20 spectr_rain ! unlock manual exposition when autoexp disabled ! ! Revision 1.7 2006/08/29 18:06:58 spectr_rain ! 6.5.2 ! ! Revision 1.5 2006/07/17 12:22:42 spectr_rain ! enable autoexposition ! ! Revision 1.4 2006/07/12 23:02:00 spectr_rain ! disable gistogramm tables apply ! ! Revision 1.3 2006/07/12 07:06:43 elphel ! fixed a bug introduced in 333 code (was not in 313/323) that make driver be satisfied with no-sensor and do not try to reinit it during each file open. ! ! Revision 1.2 2006/07/12 06:03:16 elphel ! bug fix ! ! Revision 1.1.1.1 2006/07/11 19:15:02 spectr_rain ! unwork with less than 5MPx Micron sensor, initial branch ! ! Revision 1.26 2006/02/22 18:03:56 spectr_rain ! restore normal autoexp work in continuous mode ! ! Revision 1.25 2006/02/22 09:06:46 elphel ! Made ccam.cgi return last image from the buffer when streamer is running. Same as acquireing image, with "-" in the options, i.e. "admin-bin/ccam.cgi?opt=vhcxy-" (all parameters will be ignored) ! ! Revision 1.24 2006/02/22 05:07:51 elphel ! seems it was an error - closing /dev/circbuf was zeroing minors[p] - it did not let access to circular buffer while streamer was running ! ! Revision 1.23 2006/02/12 17:35:00 spectr_rain ! fix mutex deadlock ! ! Revision 1.22 2006/02/08 01:53:56 spectr_rain ! fix broken mutex in check of down_interruptible ! ! Revision 1.21 2006/02/03 20:40:40 spectr_rain ! use one gain for all colors ! ! Revision 1.20 2006/01/22 09:18:40 elphel ! fixed problem with "gamma" gains - when {r,b}scale was <1.0, it reduced the other gains proportionally but still left this one, so effectively it was changing scale to the square of the value ! ! Revision 1.19 2006/01/17 06:44:49 elphel ! 1. changed interrupt tasklets call - no deadlocks since ! 2. fixed bug so resetting sensor is possible (ccam.cgi?resetsensor=1) ! ! Revision 1.18 2006/01/12 15:35:29 spectr_rain ! change color canal scale limits ! ! Revision 1.17 2006/01/11 12:43:56 spectr_rain ! *** empty log message *** ! ! Revision 1.16 2006/01/11 12:19:54 spectr_rain ! add IO_CCAM_PINS_(READ|WRITE) ioctl ! ! Revision 1.15 2006/01/05 05:35:19 spectr_rain ! *** empty log message *** ! ! Revision 1.14 2006/01/05 05:13:12 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 2006/01/02 23:21:24 elphel ! modified with/for Kodak sensor ! ! Revision 1.11 2005/12/15 05:18:13 elphel ! FPGA to accommodate USB controller, vector interrupts, 6 i/o pins contorl ! ! Revision 1.10 2005/11/29 23:43:24 spectr_rain ! fix autoexpose with streamers ! ! Revision 1.9 2005/11/29 09:13:00 spectr_rain ! add autoexposure ! ! Revision 1.8 2005/11/23 05:11:47 spectr_rain ! add done_compress IRQ bottom half ! ! Revision 1.7 2005/09/10 23:33:22 elphel ! Support of realtime clock and timestamps in the images ! ! Revision 1.6 2005/09/06 03:40:37 elphel ! changed parameters, added support for the photo-finish mode ! ! Revision 1.5 2005/08/27 05:16:27 elphel ! binning ! ! Revision 1.4 2005/08/27 00:46:39 elphel ! bayer control with &byr= ! ! Revision 1.3 2005/08/26 02:59:06 elphel ! working on histogram ! ! Revision 1.2 2005/05/10 21:08:49 elphel ! *** empty log message *** !

Definition at line 316 of file cc353.c.

#define X313_ACQUIRE_EXTERNAL   port_csp0_addr[X313_WA_TRIG]=6

Definition at line 479 of file cc353.c.

#define X313_ACQUIRE_INTERNAL   port_csp0_addr[X313_WA_TRIG]=4

Definition at line 478 of file cc353.c.

Referenced by startAcquire().

#define X313_ACQUIRE_ON   port_csp0_addr[X313_WA_TRIG]=5

Definition at line 480 of file cc353.c.

Referenced by camSeqStartClip().

#define X313_ACQUIRE_ONCE   port_csp0_addr[X313_WA_TRIG]=(imageParamsR[P_TRIG] & 1)?6:4

Definition at line 477 of file cc353.c.

Referenced by startAcquire().

#define X313_ACQUIRE_STOP   port_csp0_addr[X313_WA_TRIG]=0

Definition at line 476 of file cc353.c.

Referenced by camSeqStop().

#define X313_MAXMINOR   15

Definition at line 626 of file cc353.c.


Function Documentation

static unsigned long imageParamsR [P_NUMBER * 4] __attribute__ ( (aligned(PAGE_SIZE))   )  [static]

void add_frame_params ( void   )  [inline]

Definition at line 1091 of file cc353.c.

References advance_imageParamsR(), ccam_dma_buf_ptr, CCAM_DMA_SIZE, CCAM_MMAP_META, circbuf_wait_queue, encode_time(), Exif_Image_DateTime, exif_index, Exif_Photo_DateTimeOriginal, frame_params, meta_offsets_t::Image_DateTime, memcpy(), meta_offsets, meta_offsets_t::Photo_DateTimeOriginal, store_meta(), and write_meta_irq().

Referenced by camSeq_interrupt().

void adjust_fps_2_compressor ( void   ) 

Definition at line 2910 of file cc353.c.

References imageParamsR, MD9, P_CLK_FPGA, P_FP100S, P_FPGA_XTRA, P_FPSLM, P_TILES, and printk.

Referenced by program_sensor_exposition_just().

void advance_imageParamsR ( void   )  [inline]

=========================================================================================== ! Is called from the interrupt service routine - it generates the last (just) acquired frame ! length word in front of compressed data, copies current acquisition parameters to the ! 32-6=26 bytes before the frame (-32..-6 bytes from the begfinning of the frame) ! JPEG_wp is set to the start of the next frame. ! ! As this function is called after compression of each frame some of the activity ! in cxdma353.c may be removed !===========================================================================================

is it still used anywhere??

Definition at line 1079 of file cc353.c.

References Exif_Image_FrameNumber, Exif_Photo_ExposureTime, frame_params_t::exposure, frame_params, meta_offsets_t::Image_FrameNumber, imageParamsR, meta_offsets, P_EXPOS, P_FRAME, meta_offsets_t::Photo_ExposureTime, and putlong_meta_irq().

Referenced by add_frame_params(), and camSeq_interrupt().

static void camSeq_dump ( void   )  [static]

Definition at line 1306 of file cc353.c.

References printk.

Referenced by ccam_DMA_ioctl(), and x313_JPEG_cmd_wrapper().

static irqreturn_t camSeq_interrupt ( int  irq,
void *  dev_id 
) [static]

Definition at line 1126 of file cc353.c.

References add_frame_params(), advance_imageParamsR(), CAMSEQ_DONE, CAMSEQ_JPEG, CAMSEQ_RUN, CAMSEQ_SINGLE, CAMSEQ_STOP, CAMSEQ_WAIT_F, CCAM_DMA_SIZE, ch0_lock(), compressorRun(), compressorSingle(), compressorStop(), DIS_INTERRUPTS, EN_INTERRUPT, imageParamsR, nint_done_compress, nint_vact, P_CAMSEQCOUNT, P_CAMSEQSTATE, P_TASKLET_CTL, startAcquire(), updateJPEG_wp(), X313_CHN0_BOUND, X313_IRQSTATE, X313_POSTINIT_SDCHAN, and X313_SR.

Referenced by cmoscam_init().

int camSeqGetJPEG_rp ( void   ) 

Definition at line 1338 of file cc353.c.

Referenced by circbuf_lseek(), x313_dma_save_jpeg(), x313_DMA_size(), X313_dma_update(), and x313_JPEG_cmd().

int camSeqGetJPEG_wp ( void   ) 

Definition at line 1337 of file cc353.c.

Referenced by circbuf_lseek(), circbuf_poll(), circbufValidPointer(), get_image_time(), x313_dma_restore_jpeg(), x313_dma_save_jpeg(), x313_DMA_size(), X313_dma_update(), and x313_JPEG_cmd().

void camSeqSetJPEG_rp ( int  p  ) 

Definition at line 1339 of file cc353.c.

Referenced by circbuf_lseek(), x313_dma_forget_jpeg(), x313_dma_restore_jpeg(), and X313_dma_update().

static int camSeqStart ( void   )  [static]

Definition at line 1291 of file cc353.c.

References CAMSEQ_DONE, CAMSEQ_READY, CAMSEQ_SKIP, EN_INTERRUPT, getCamSeqCount(), getCamSeqState(), MD1, nint_vact, printk, setCamSeqState(), and startAcquire().

Referenced by ccam_DMA_ioctl().

int camSeqStartClip ( int  nfr,
int  len 
)

only "n, -1" and "0, -1" are updated to include CCD so far

0, 0 - reread n, l - both restrictions n,-1 - n frames, any length -1, l - any n, fixed length 0,-1 - start constant compressing -1, 0 - end constant compressing (will need to wait for the state to be "DONE") if "end" and it was'n running - acquire 1 full buffer

stop and wasn't running - acquire 1 full buffer (nfr == -2 - will not restart)

NOTE: here it is important to start from the beginning of the buffer

make it invalid - why? First we'll fix dealing with invalid JPEG_rp, then - remove this operator.

start constant compression (after skipping 2 "bad" frames)

already acquiring/compressing? hello -z -> 7

do we need to reset everything - maybe just contunue?

copied from camSeq_interrupt this sequence is normally executed _after_ the first frame, but we do not want to waste first frame here

already acquiring/compressing? hello -z -> 7

copied from camSeq_interrupt this sequence is normally executed _after_ the first frame, but we do not want to waste first frame here

(0,0) - just reread from memory

Definition at line 1360 of file cc353.c.

Referenced by ccam_DMA_ioctl(), and x313_JPEG_cmd().

void camSeqStop ( void   ) 

Definition at line 1506 of file cc353.c.

Referenced by ccam_DMA_ioctl(), initCamIRQs(), programSensor(), x313_dma_reset_jpeg(), and x313_JPEG_cmd().

static int ccam_DMA_ioctl ( struct inode *  inode,
struct file *  file,
unsigned int  cmd,
unsigned long  arg 
) [static]

to combine calls to x313_JPEG_cmd(arg) and some other action to be calles from ioctl, as before and lseek (,,2)

using dummy read after potential write - see c353.h

update at once, reset compressor and circbuf pointers

update immediately, non-stop mode, keep circbuf poinetrs

Definition at line 3451 of file cc353.c.

References CAMSEQ_DONE, camSeq_dump(), CAMSEQ_JPEG, camSeqStart(), camSeqStartClip(), camSeqStop(), CCAM_ADDR, CCAM_CTRL, CCAM_DMA_CMD_START, CCAM_DMA_CMD_STOP, CCAM_RPARS, CCAM_WPARS, getCamSeqCount(), getCamSeqState(), imageParamsR, IO_CCAM_CR_MODIFY, IO_CCAM_DMA, IO_CCAM_JPEG, IO_CCAM_JPEG_CTRL, IO_CCAM_JPEG_GET_L, IO_CCAM_JPEG_GET_N, IO_CCAM_JPEG_QUALITY, IO_CCAM_MONITOR_SEQ, IO_CCAM_PINS_READ, IO_CCAM_PINS_WRITE, IO_CCAM_SET_EXT_EXPOSURE, JPEG_CMD_DUMP, JPEG_CMD_L_DONE, JPEG_CMD_N_DONE, local_irq_restore, local_irq_save, MD, MD1, MD6, P_PAGE_ACQ, P_PAGE_READ, P_PARS_CHANGED, P_QUALITY, P_UPDATE, port_csp0_addr, printk, programSensor(), x313_dma_start(), x313_dma_stop(), x313_dma_update_jpeg_header(), x313_f_invalidate(), X313_IOPINS, x313_JPEG_cmd(), x313_JPEG_cmd_wrapper(), x313_JPEG_ctrl(), and X313_WA_WCTL.

Referenced by cmoscam_ioctl().

void ccamCRAnd ( unsigned long  d  ) 

Definition at line 1561 of file cc353.c.

void ccamCRAndOr ( unsigned long  d_and,
unsigned long  d_or 
)

Definition at line 1583 of file cc353.c.

Referenced by init_sensor(), and programSensor().

void ccamCROr ( unsigned long  d  ) 

Definition at line 1568 of file cc353.c.

Referenced by cmoscam_open().

void ccamCRXor ( unsigned long  d  ) 

Definition at line 1575 of file cc353.c.

unsigned long ccamGetCR ( void   ) 

Definition at line 1591 of file cc353.c.

void ch0_lock ( void   ) 

Definition at line 455 of file cxsdram.c.

Referenced by camSeq_interrupt().

static int __init cmoscam_init ( void   )  [static]

Definition at line 1758 of file cc353.c.

References camSeq_interrupt(), CMOSCAM_DRIVER_NAME, CMOSCAM_MAJOR, cmoscam_name, init_autoexp_struct(), init_ccam_dma_buf_ptr(), init_waitqueue_head, KERN_ERR, printk, and x313_dma_init().

static int cmoscam_ioctl ( struct inode *  inode,
struct file *  filp,
unsigned int  cmd,
unsigned long  arg 
) [static]

Definition at line 3153 of file cc353.c.

References ccam_DMA_ioctl(), CMOSCAM_MINOR_CIRCBUF, CMOSCAM_MINOR_DMA, CMOSCAM_MINOR_FPN, CMOSCAM_MINOR_FRAME, CMOSCAM_MINOR_I2C, CMOSCAM_MINOR_JPEAGHEAD, CMOSCAM_MINOR_MCP, CMOSCAM_MINOR_SENSPARS, i2c_ioctl(), and init_FPGA().

static loff_t cmoscam_lseek ( struct file *  file,
loff_t  offset,
int  orig 
) [static]

Definition at line 3177 of file cc353.c.

References CAMSEQ_RUN, CAMSEQ_SINGLE, CAMSEQ_STOP, CMOSCAM_MINOR_DMA, CMOSCAM_MINOR_FPN, CMOSCAM_MINOR_FRAME, CMOSCAM_MINOR_GAMMA, CMOSCAM_MINOR_HISTOGRAM, CMOSCAM_MINOR_MCP, CMOSCAM_MINOR_RWTABLES, CMOSCAM_MINOR_SENSPARS, getCamSeqState(), MCP_lseek, x313_dma_lseek(), x313_fpn_lseek(), x313_frame_lseek(), x313_gamma_lseek(), x313_histogram_lseek(), x313_senspars_lseek(), and x313_tables_lseek().

static int cmoscam_mmap ( struct file *  file,
struct vm_area_struct *  vma 
) [static]

Definition at line 3235 of file cc353.c.

References CMOSCAM_MINOR_SENSPARS, and x313_senspars_mmap().

static int cmoscam_open ( struct inode *  inode,
struct file *  filp 
) [static]

Definition at line 2964 of file cc353.c.

References CAMSEQ_RUN, CAMSEQ_STOP, CCAM_DONOTUSEAUX, ccamCROr(), CMOSCAM_MINOR_CIRCBUF, CMOSCAM_MINOR_DMA, CMOSCAM_MINOR_FPN, CMOSCAM_MINOR_FRAME, CMOSCAM_MINOR_GAMMA, CMOSCAM_MINOR_HISTOGRAM, CMOSCAM_MINOR_I2C, CMOSCAM_MINOR_JPEAGHEAD, CMOSCAM_MINOR_LOCK, CMOSCAM_MINOR_MCP, CMOSCAM_MINOR_RWTABLES, CMOSCAM_MINOR_SENSORJTAGFPGA, CMOSCAM_MINOR_SENSPARS, CMOSCAM_MINOR_UNLOCK, cmoscam_open_dma(), D1, gamma_tables_changed, getCamSeqState(), init_FPGA(), MCP_open, MD, port_csp0_addr, printk, X313_BITS, x313_fpn_open(), x313_frame_open(), X313_MASK, and X313_WA_SDCH0_CTL2.

static unsigned int cmoscam_poll ( struct file *  file,
poll_table *  wait 
) [static]

Definition at line 3241 of file cc353.c.

References CMOSCAM_MINOR_CIRCBUF, CMOSCAM_MINOR_DMA, imageParamsR, and P_CIRCBUFWP.

static ssize_t cmoscam_read ( struct file *  file,
char *  buf,
size_t  count,
loff_t *  off 
) [static]

Definition at line 3199 of file cc353.c.

References CMOSCAM_MINOR_DMA, CMOSCAM_MINOR_FPN, CMOSCAM_MINOR_FRAME, CMOSCAM_MINOR_GAMMA, CMOSCAM_MINOR_HISTOGRAM, CMOSCAM_MINOR_MCP, CMOSCAM_MINOR_RWTABLES, CMOSCAM_MINOR_SENSPARS, MCP_read, x313_dma_read(), x313_fpn_read(), x313_frame_read(), x313_gamma_read(), x313_histogram_read(), x313_senspars_read(), and x313_tables_read().

static int cmoscam_release ( struct inode *  inode,
struct file *  filp 
) [static]

Definition at line 3098 of file cc353.c.

References CMOSCAM_MINOR_CIRCBUF, CMOSCAM_MINOR_DMA, CMOSCAM_MINOR_FPN, CMOSCAM_MINOR_FRAME, CMOSCAM_MINOR_GAMMA, CMOSCAM_MINOR_HISTOGRAM, CMOSCAM_MINOR_I2C, CMOSCAM_MINOR_JPEAGHEAD, CMOSCAM_MINOR_LOCK, CMOSCAM_MINOR_MCP, CMOSCAM_MINOR_RWTABLES, CMOSCAM_MINOR_SENSORJTAGFPGA, CMOSCAM_MINOR_SENSPARS, CMOSCAM_MINOR_UNLOCK, D, gamma_tables_changed, gamma_tables_soft, MD, printk, write_gamma_fpga(), x313_fpn_release(), and x313_frame_release().

static ssize_t cmoscam_write ( struct file *  file,
const char *  buf,
size_t  count,
loff_t *  off 
) [static]

Definition at line 3215 of file cc353.c.

References CMOSCAM_MINOR_DMA, CMOSCAM_MINOR_FPN, CMOSCAM_MINOR_GAMMA, CMOSCAM_MINOR_JPEAGHEAD, CMOSCAM_MINOR_MCP, CMOSCAM_MINOR_RWTABLES, CMOSCAM_MINOR_SENSORJTAGFPGA, CMOSCAM_MINOR_SENSPARS, MCP_write, x313_dma_write(), x313_fpn_write(), x313_gamma_write(), x313_senspars_write(), and x313_tables_write().

void compressorRun ( void   )  [inline]

Definition at line 1025 of file cc353.c.

References COMPRESSOR_CMD_RUN, imageParamsR, P_COMPRESSOR_CMD, port_csp0_addr, X313_CHN_EN, x313_get_JPEG_ctrl(), and X313_WA_COMP_CMD.

Referenced by camSeq_interrupt(), and camSeqStartClip().

void compressorSingle ( void   )  [inline]

============================================================================ ! FPGA compressor maintains the 24-bit counter that is incremented ! with each 32 compressed bytes transferred to the system memory, rolling ! over 1<<24. ! When the compressor is reset, this counter is reset too(*), but the actual ! memory pointer (maintained in the CPU) is reset separately, so when ! frames are acquired in mode 7 (not continuous compression), this pointer ! will be reset before each frame transfer, while the DMA pointer continues ! (*) counter is reset when bit 5 (|0x20) written to ! port_csp0_addr[X313_WA_COMP_CMD] is zero, it is set in x313_get_JPEG_ctrl() !============================================================================

needed to clear bit 7 - it was set, so "single" worked as "start"

start compressing 1 frame (will stop automatically)

enable SDRAM channel 2

Definition at line 1018 of file cc353.c.

References COMPRESSOR_CMD_RUN, COMPRESSOR_CMD_SINGLE, imageParamsR, P_COMPRESSOR_CMD, port_csp0_addr, X313_CHN_EN, x313_get_JPEG_ctrl(), and X313_WA_COMP_CMD.

Referenced by camSeq_interrupt(), and camSeqStartClip().

void compressorStop ( void   )  [inline]

Definition at line 1031 of file cc353.c.

References imageParamsR, P_COMPRESSOR_CMD, port_csp0_addr, X313_CHN_DIS, and X313_WA_COMP_CMD.

Referenced by camSeq_interrupt(), and camSeqStop().

static DECLARE_MUTEX ( sensor_lock   )  [static]

DECLARE_TASKLET ( tasklet_done_compress  ,
tasklet_irq_f  ,
IRQ_SRC_DONE_COMPRESS   
)

DECLARE_TASKLET ( tasklet_vact  ,
tasklet_irq_f  ,
IRQ_SRC_VACT   
)

void dumpFrameParams ( struct frame_params_t fp,
const char *  title 
)

Definition at line 750 of file cc353.c.

Referenced by circbufValidPointer(), init_sensor(), and programSensor().

void exposition_unlock ( void   ) 

Definition at line 2871 of file cc353.c.

Referenced by autoexp__ioctl(), and set2state().

int flush_par_cache ( void   ) 

Definition at line 3295 of file cc353.c.

References ccam_dma_buf_ptr, and P_NUMBER.

Referenced by x313_senspars_lseek().

unsigned long gain_balance ( unsigned long *  scale,
unsigned long  gain 
)

unsigned long get_imageParamsR ( int  n  ) 

Definition at line 1551 of file cc353.c.

Referenced by adjustBinning_mt9x001(), autoexp__ioctl(), exposition_unlock(), get_image_exp(), program_exposure_mt9x001(), program_woi_mt9x001(), programSensor(), stream__ioctl(), update_JPEG_quality(), window2state(), x313_dma_update_jpeg_header(), x313_frame_lseek(), x313_frame_open(), x313_frame_read(), and x313_frame_readline().

unsigned long get_imageParamsW ( int  n  ) 

Definition at line 1552 of file cc353.c.

Referenced by program_exposure_mt9x001(), program_gains_mt9x001(), program_woi_mt9x001(), stream__ioctl(), and x313_dma_update_jpeg_header().

unsigned char get_sensor_i2c_addr ( void   ) 

Definition at line 1553 of file cc353.c.

unsigned char get_sensor_i2c_regs ( int  n  ) 

Definition at line 1550 of file cc353.c.

int get_sensor_i2c_regs16 ( int  n  ) 

Definition at line 1549 of file cc353.c.

Referenced by program_exposure_mt9x001(), program_woi_mt9x001(), readSensorReg16(), and writeSensorReg16().

static int getCamSeqCount ( void   )  [static]

Definition at line 1245 of file cc353.c.

Referenced by camSeqStart(), and ccam_DMA_ioctl().

static int getCamSeqState ( void   )  [static]

Definition at line 1275 of file cc353.c.

References CAMSEQ_ACQUIRE, CAMSEQ_READY, CAMSEQ_WAIT_F, CAMSEQ_WAIT_T, local_irq_restore, local_irq_save, and X313_SR.

Referenced by camSeqStart(), camSeqStartClip(), camSeqStop(), ccam_DMA_ioctl(), cmoscam_lseek(), cmoscam_open(), and programSensor().

void init_autoexp_struct ( void   ) 

Definition at line 3886 of file cc353.c.

Referenced by cmoscam_init().

static int init_FPGA ( void   )  [static]

Definition at line 1786 of file cc353.c.

References D5, fpga_initSDRAM(), getClockFreq(), imageParamsR, init_sensor(), initCamIRQs(), P_CLK_FPGA, P_CLK_SENSOR, port_csp0_addr, printk, setClockFreq(), udelay, X313__RA__MODEL, X313_CHN0_USED, X313_IS_SDRAM_ON, and x313_tables_gammainitlinear().

Referenced by cmoscam_ioctl(), cmoscam_open(), and x313_senspars_lseek().

int init_sensor ( void   )  [static]

Definition at line 1885 of file cc353.c.

References CCAM_ARST_OFF, CCAM_CNVEN_ON, CCAM_MRST_OFF, CCAM_NEGRST, CCAM_POSRST, ccamCRAndOr(), default_common, dumpFrameParams(), frame_params, sensor_t::i2c_bytes, sensor_t::i2c_period, sensor_t::imageHeight, imageParamsR, sensor_t::imageWidth, init_mt9x001(), IS_KAI11000, kai11002, sensor_t::margins, MD10, MD7, memcpy(), sensor_t::nomClockFreq, P_CLK_FPGA, P_CLK_SENSOR, P_FRAME, P_I2C_BYTES, P_I2C_QPERIOD, P_IRQ_SMART, P_SENSOR, P_SENSOR_HEIGHT, P_SENSOR_WIDTH, P_SKIP_FRAMES, P_VIDEO, P_WOI_HEIGHT, P_WOI_WIDTH, port_csp0_addr, printk, PROGRAM_CLK_EN, program_i2c(), program_smart_irq(), programSensor(), sensor, SENSOR_NONE, sensor_t::sensorType, set_sensor_i2c_addr(), udelay, writeSensorDefaults(), and X313_WA_DCDC.

Referenced by init_FPGA().

static void initCamIRQs ( void   )  [static]

Definition at line 1257 of file cc353.c.

References CAMSEQ_OFF, camSeqStop(), DIS_INTERRUPTS, printk, resetPointers(), and setCamSeqState().

Referenced by init_FPGA().

MODULE_AUTHOR ( "Andrey Filippov <andrey@elphel.com>."   ) 

MODULE_DESCRIPTION ( "Elphel Model 353 camera driver  ) 

MODULE_DESCRIPTION ( MY_MODULE_DESCRIPTION   ) 

module_init ( cmoscam_init   ) 

MODULE_LICENSE ( "GPL"   ) 

void program_early_timestamp ( void   ) 

Definition at line 3288 of file cc353.c.

Referenced by programSensor(), and x313_senspars_lseek().

void program_i2c ( void   ) 

Definition at line 3275 of file cc353.c.

Referenced by init_sensor(), and x313_senspars_lseek().

static int program_KAI11000 ( void   )  [static]

Definition at line 2133 of file cc353.c.

References printk.

Referenced by programSensor().

int program_sensor_exposition ( void   ) 

Definition at line 2876 of file cc353.c.

Referenced by hist_irq(), and hist_irq__().

int program_sensor_exposition_just ( void   ) 

This program returns -1 for all not yet suported (re-supported ) sensors.

Just a placeholder TODO: put something meaningful here

Definition at line 2922 of file cc353.c.

Referenced by program_sensor_exposition(), programSensor(), and stream__ioctl().

void program_smart_irq ( void   ) 

Definition at line 3282 of file cc353.c.

Referenced by init_sensor(), and x313_senspars_lseek().

void program_trigger ( void   ) 

program trigger parameters

overloaded lseek for SEEK_END with offset>0 Will execute JPEG commands (1..0xf) as with ioctl

Definition at line 3267 of file cc353.c.

Referenced by x313_senspars_lseek().

static int programSensor ( int  nonstop  )  [static]

Definition at line 2138 of file cc353.c.

References adjustBinning_mt9x001(), bh, frame_params_t::black, frame_params_t::bscale, bv, CAMSEQ_OFF, CAMSEQ_READY, camSeqStop(), CCAM_ARST_OFF, CCAM_MRST_OFF, CCAM_MRST_ON, CCAM_SET_HACT_PHASE, CCAM_TRIG_EXT, CCAM_TRIG_INT, ccamCRAndOr(), sensor_t::clearHeight, sensor_t::clearWidth, frame_params_t::color, frame_params_t::colorsat, sensor_t::dcmHor, sensor_t::dcmVert, DEFAULT_COLOR_SATURATION_BLUE, DEFAULT_COLOR_SATURATION_RED, dh, dumpFrameParams(), dv, hist_sensor_t::exposure, sensor_t::flips, frame_params, gains, frame_params_t::gamma, get_imageParamsR(), getCamSeqState(), sensor_t::hact_delay, frame_params_t::height, hist_image_exp(), hist_image_size(), hist_sensor_lock(), hist_sensor_unlock(), sensor_t::imageHeight, imageParamsR, sensor_t::imageWidth, init_mt9x001(), JPEG_CTRL_MONOCHROME, JPEG_CTRL_NOMOSAIC, local_irq_restore, local_irq_save, sensor_t::margins, sensor_t::maxClockFreq, MD1, MD10, MD11, MD12, MD13, MD2, MD6, MD8, MD9, sensor_t::minHeight, sensor_t::minWidth, P_ACTUAL_HEIGHT, P_ACTUAL_WIDTH, P_AUXCM, P_BAYER, P_BGFRAME, P_BIN_HOR, P_BIN_VERT, P_BITS, P_BSCALE, P_CLK_FPGA, P_CLK_SENSOR, P_COLOR, P_COLOR_SATURATION_BLUE, P_COLOR_SATURATION_RED, P_DCM_HOR, P_DCM_VERT, P_DMA_VALID, P_EXPOS, P_FLIP, P_FPGA_XTRA, P_FPNM, P_FPNS, P_FPSLM, P_FRAMESYNC_DLY, P_GAMMA, P_GSCALE, P_MCLK, P_OVERLAP, P_OVERSIZE, P_PAGE_ACQ, P_PARS_CHANGED, P_PERIOD, P_PF_HEIGHT, P_PGMSENSRSLT, P_PIXEL_HIGH, P_PIXEL_LOW, P_RSCALE, P_SENSOR, P_SENSOR_PHASE, P_SHIFTL, P_SKIP_FRAMES, P_TASKLET_CTL, P_TILES, P_TRIG, P_UPDATE, P_VEXPOS, P_VIRTTRIG, P_WOI_HEIGHT, P_WOI_LEFT, P_WOI_TOP, P_WOI_WIDTH, pfh, sensor_t::pixelHeight, sensor_t::pixelWidth, port_csp0_addr, printk, PROGRAM_CLK_EN, program_early_timestamp(), PROGRAM_FPN, program_gains_mt9x001(), program_KAI11000(), program_sensor_exposition_just(), program_woi_mt9x001(), frame_params_t::rscale, SCALE_MAX, SCALE_MIN, sensor, SENSOR_IBIS51300, SENSOR_KAC1310, SENSOR_KAC5000, SENSOR_KAI11000, SENSOR_MASK, SENSOR_MT9X001, SENSOR_MT9Y001, SENSOR_NONE, SENSOR_ZR32112, SENSOR_ZR32212, sensor_t::sensorPhase, sensor_t::sensorPhase90, set_gamma(), set_imageParamsW(), setCamSeqCount(), setCamSeqState(), setClockFreq(), udelay, gains_t::used, frame_params_t::width, X313_BITS, X313_CHN0_SET_USED, X313_CHN_EN, x313_get_JPEG_ctrl(), X313_INIT_SDCHAN, x313_JPEG_ctrl(), X313_MAP_FPN, X313_MASK, x313_program_focus(), X313_SR, X313_TIMESTAMPLEN, X313_WA_COLOR_SAT, X313_WA_FRAMESYNC_DLY, X313_WA_MCUNUM, X313_WA_NLINES, X313_WA_SDCH2_CTL1, X313_WA_SDCH2_CTL2, and X313_WA_VIRTTRIG.

Referenced by ccam_DMA_ioctl(), init_sensor(), x313_JPEG_cmd_wrapper(), and x313_senspars_write().

int readSensorReg ( unsigned int  ra,
int  mode 
)

Definition at line 1608 of file cc353.c.

int readSensorReg16 ( unsigned char  ra,
int  mode 
)

Definition at line 1661 of file cc353.c.

Referenced by check_fps(), and init_mt9x001().

void resetPointers ( void   ) 

Definition at line 1056 of file cc353.c.

References imageParamsR, P_CIRCBUFRP, P_CIRCBUFWP, P_FREECIRCBUF, and P_JPEG_WP.

Referenced by camSeqStartClip(), and initCamIRQs().

void set_imageParamsR ( int  n,
unsigned long  d 
)

Definition at line 1555 of file cc353.c.

Referenced by adjustBinning_mt9x001(), init_mt9x001(), program_exposure_mt9x001(), program_gains_mt9x001(), program_woi_mt9x001(), stream__ioctl(), stream__release(), update_JPEG_quality(), and x313_setDMABuffer().

void set_imageParamsW ( int  n,
unsigned long  d 
)

Definition at line 1556 of file cc353.c.

Referenced by exposition_unlock(), program_sensor_exposition(), programSensor(), and stream__ioctl().

void set_sensor_i2c_addr ( unsigned char  d  ) 

Definition at line 1557 of file cc353.c.

Referenced by init_mt9x001(), and init_sensor().

void set_sensor_i2c_regs ( int  n,
unsigned char  d 
)

Definition at line 1554 of file cc353.c.

static void setCamSeqCount ( int  v  )  [static]

Definition at line 1252 of file cc353.c.

References imageParamsR, and P_CAMSEQCOUNT.

Referenced by camSeqStartClip(), and programSensor().

static void setCamSeqState ( int  v  )  [static]

Definition at line 1246 of file cc353.c.

References imageParamsR, MD, P_CAMSEQCOUNT, P_CAMSEQSTATE, and printk.

Referenced by camSeqStart(), camSeqStartClip(), camSeqStop(), initCamIRQs(), and programSensor().

static void startAcquire ( void   )  [inline, static]

Definition at line 944 of file cc353.c.

References CAMSEQ_WAIT_F, EN_INTERRUPT, imageParamsR, nint_xferovr, P_BGFRAME, P_CAMSEQCOUNT, P_CAMSEQSTATE, X313_ACQUIRE_INTERNAL, and X313_ACQUIRE_ONCE.

Referenced by camSeq_interrupt(), and camSeqStart().

void tasklet_irq_f ( unsigned long  arg  ) 

Definition at line 991 of file cc353.c.

References hist_irq().

void updateJPEG_wp ( void   )  [inline]

uses fpga transfer counter to update JPEG_wp. Should be called before any compressorStop

number of 32-byte chunks transferred since compressor was reset

using macro defined in x353.h that makes a dummy read (reads after writes can be wrong)

Transferred since last JPEG_wp update (or counetr reset)

counts in 32-byte ( 8 of 32bit words) chunks

this is not cache-safe

P_* should be in the same 32-byte cache line

Definition at line 1038 of file cc353.c.

References CCAM_DMA_SIZE, imageParamsR, P_CIRCBUFRP, P_CIRCBUFSIZE, P_CIRCBUFWP, P_FOCUS_VALUE, P_FREECIRCBUF, P_JPEG_WP, X313_HIGHFREQ, and X313_XFERCNTR.

Referenced by camSeq_interrupt().

int write_gamma_fpga ( unsigned short  gamma_table[1028]  ) 

Definition at line 3607 of file cc353.c.

References CX313_FPGA_TABLES_GAMMA, gamma_tables_changed, port_csp0_addr, printk, X313_WA_COMP_TA, and X313_WA_COMP_TD.

Referenced by cmoscam_release(), and x313_tables_gammainitlinear().

void writeSensorDefaults ( unsigned long *  data,
int  count 
)

Definition at line 1593 of file cc353.c.

Referenced by init_sensor().

int writeSensorReg ( unsigned int  ra,
unsigned char  rd,
int  uncond 
)

Definition at line 1630 of file cc353.c.

int writeSensorReg16 ( unsigned char  ra,
int  rd,
int  uncond 
)

Definition at line 1681 of file cc353.c.

Referenced by camSeqStartClip(), init_mt9x001(), program_exposure_mt9x001(), program_gains_mt9x001(), and program_woi_mt9x001().

int writeSensorRegFF ( unsigned char  ra,
int  rd,
int  uncond 
)

Definition at line 1716 of file cc353.c.

loff_t x313_gamma_lseek ( struct file *  file,
loff_t  offset,
int  orig 
)

Definition at line 3645 of file cc353.c.

Referenced by cmoscam_lseek().

ssize_t x313_gamma_read ( struct file *  file,
char *  buf,
size_t  count,
loff_t *  off 
)

Definition at line 3682 of file cc353.c.

References D, gamma_tables_soft, and printk.

Referenced by cmoscam_read().

ssize_t x313_gamma_write ( struct file *  file,
const char *  buf,
size_t  count,
loff_t *  off 
)

Definition at line 3698 of file cc353.c.

References D, gamma_tables_changed, gamma_tables_soft, and printk.

Referenced by cmoscam_write().

loff_t x313_histogram_lseek ( struct file *  file,
loff_t  offset,
int  orig 
)

Definition at line 3812 of file cc353.c.

References CX313_FPGA_HISTOGRAM_SIZE.

Referenced by cmoscam_lseek().

ssize_t x313_histogram_read ( struct file *  file,
char *  buf,
size_t  count,
loff_t *  off 
)

Definition at line 3856 of file cc353.c.

References CX313_FPGA_HISTOGRAM_SIZE, D, port_csp0_addr, port_csp4_addr, printk, X313_WA_COMP_TA, and X3X3_AFTERWRITE.

Referenced by cmoscam_read().

static int x313_JPEG_cmd_wrapper ( int  arg  )  [static]

Definition at line 3439 of file cc353.c.

References camSeq_dump(), cmd, imageParamsR, JPEG_CMD_DUMP, JPEG_CMD_L_DONE, JPEG_CMD_N_DONE, MD6, P_PARS_CHANGED, printk, PROGRAM_SENSOR_0, PROGRAM_SENSOR_1, programSensor(), and x313_JPEG_cmd().

Referenced by ccam_DMA_ioctl(), and x313_senspars_lseek().

void x313_program_focus ( int  totalwidth  ) 

HACK: programming focus filter parameters, will likely change. Should be called after the image width is already known.

open fpga for writing table(s)

will autoincrement address

there is a one write pipeline, any write to fpga to actually do the last write to table

Definition at line 2071 of file cc353.c.

References CX313_FPGA_TABLES_FOCUSPARS, imageParamsR, local_irq_restore, local_irq_save, P_FOCUS_FILTER, P_FOCUS_HEIGHT, P_FOCUS_LEFT, P_FOCUS_SHOW, P_FOCUS_SHOW1, P_FOCUS_TOP, P_FOCUS_TOTWIDTH, P_FOCUS_WIDTH, port_csp0_addr, x313_get_JPEG_ctrl(), x313_JPEG_ctrl(), X313_WA_COMP_TA, and X313_WA_COMP_TD.

Referenced by programSensor().

loff_t x313_senspars_lseek ( struct file *  file,
loff_t  offset,
int  orig 
)

Definition at line 3302 of file cc353.c.

References flush_par_cache(), get_autoexposure_parameters(), imageParamsR, init_FPGA(), LSEEK_AUTOEXP_GET, LSEEK_AUTOEXP_SET, LSEEK_CAMSEQSTATE, LSEEK_EARLY_TIMESTAMP_PGM, LSEEK_FLUSH_CACHE, LSEEK_GET_FPGA_TIME, LSEEK_I2C_PGM, LSEEK_INIT_SENSOR, LSEEK_IRQ_SMART_PGM, LSEEK_RESET_SENSOR, LSEEK_SET_FPGA_TIME, LSEEK_TRIGGER_PGM, P_MICROSECONDS, P_NUMBER, P_SECONDS, P_SENSOR, program_early_timestamp(), program_i2c(), program_smart_irq(), program_trigger(), set_autoexposure_parameters(), X313_CHN0_SET_UNUSED, X313_GET_FPGA_TIME, x313_JPEG_cmd_wrapper(), and X313_SET_FPGA_TIME.

Referenced by cmoscam_lseek().

int x313_senspars_mmap ( struct file *  file,
struct vm_area_struct *  vma 
)

Definition at line 3422 of file cc353.c.

References imageParamsR, MD6, and printk.

Referenced by cmoscam_mmap().

ssize_t x313_senspars_read ( struct file *  file,
char *  buf,
size_t  count,
loff_t *  off 
)

Definition at line 3375 of file cc353.c.

References imageParamsR, P_NUMBER, and printk.

Referenced by cmoscam_read().

ssize_t x313_senspars_write ( struct file *  file,
const char *  buf,
size_t  count,
loff_t *  off 
)

Definition at line 3390 of file cc353.c.

References D, imageParamsR, local_irq_restore, local_irq_save, P_NUMBER, P_UPDATE, printk, and programSensor().

Referenced by cmoscam_write().

void x313_tables_gammainitlinear ( void   ) 

Definition at line 3632 of file cc353.c.

References gamma_tables_changed, gamma_tables_soft, and write_gamma_fpga().

Referenced by init_FPGA().

loff_t x313_tables_lseek ( struct file *  file,
loff_t  offset,
int  orig 
)

Definition at line 3718 of file cc353.c.

References CX313_FPGA_TABLES_SIZE.

Referenced by cmoscam_lseek().

ssize_t x313_tables_read ( struct file *  file,
char *  buf,
size_t  count,
loff_t *  off 
)

Definition at line 3790 of file cc353.c.

References CX313_FPGA_TABLES_SIZE, D, and printk.

Referenced by cmoscam_read().

ssize_t x313_tables_write ( struct file *  file,
const char *  buf,
size_t  count,
loff_t *  off 
)

Definition at line 3756 of file cc353.c.

References CX313_FPGA_TABLES_SIZE, D, local_irq_restore, local_irq_save, port_csp0_addr, printk, X313_WA_COMP_TA, and X313_WA_COMP_TD.

Referenced by cmoscam_write().


Variable Documentation

struct aexp_window_t* aexp_window = NULL

Definition at line 796 of file cc353.c.

Referenced by hist_irq(), hist_irq__(), and init_autoexp_struct().

struct aexp_window_t* aexp_window_set = NULL

Definition at line 797 of file cc353.c.

Referenced by autoexp__ioctl(), hist__ioctl(), hist_irq(), hist_irq__(), init_autoexp_struct(), and window2state().

struct autoexp_t* autoexp_set = NULL

Definition at line 795 of file cc353.c.

struct autoexp_t* autoexp_state = NULL

Definition at line 794 of file cc353.c.

Referenced by autoexp__ioctl(), hist__init(), hist__open(), hist_image_exp(), hist_sensor_lock(), init_autoexp_struct(), set2state(), and window2state().

volatile int camSeqCount [static]

Definition at line 924 of file cc353.c.

volatile int camSeqState [static]

Definition at line 925 of file cc353.c.

volatile unsigned long ccam_cr_shadow = 0

Definition at line 802 of file cc353.c.

Referenced by fpga_io_ioctl(), il_ccamCRAnd(), il_ccamCRAndOr(), and il_ccamCROr().

unsigned long ccam_dma_length

Definition at line 279 of file cxdma.c.

struct file_operations cmoscam_fops [static]

Initial value:

Definition at line 861 of file cc353.c.

const char cmoscam_name[] = "cmoscam353" [static]

Definition at line 468 of file cc353.c.

Referenced by cmoscam_init().

volatile int dbg_20 [static]

Definition at line 936 of file cc353.c.

volatile int dbg_28 [static]

Definition at line 937 of file cc353.c.

unsigned long default_common[] [static]

Definition at line 646 of file cc353.c.

Referenced by init_sensor().

unsigned long DMA_buf_start [static]

Definition at line 931 of file cc353.c.

unsigned short* exif_index = (unsigned short * ) &frame_params.meta_index

Definition at line 741 of file cc353.c.

Referenced by add_frame_params().

char* exif_meta_time_string

Definition at line 749 of file cc353.c.

int fpga_counter_prev = 0 [static]

Definition at line 1000 of file cc353.c.

unsigned long fpga_tables_buffer[CX313_FPGA_TABLES_SIZE]

Moved to c313a.h.

Definition at line 3601 of file cc353.c.

struct frame_params_t frame_params

Initial value:

{
   .exposure=0,       
 .width=0,          
 .height=0,         
 .colorsat=  DEFAULT_COLOR_SATURATION_BLUE | (DEFAULT_COLOR_SATURATION_RED << 16), 
 .color=0,          
 .quality=50,       
 .gamma=100,        
 .black=0,          
 .rscale=0,         
 .bscale=0,         

 .gain_r=0,         
 .gain_g=0,         
 .gain_b=0,         
 .gain_gb=0,        
 .meta_index =0,     

 .signffff=0xffff,   
                                             
 {.timestamp_sec=0},  
 .timestamp_usec=0  
}
// 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.

Referenced by add_frame_params(), advance_imageParamsR(), init_sensor(), program_gains_mt9x001(), programSensor(), sendImage(), and update_JPEG_quality().

unsigned long* frame_params_ul = (unsigned long *) &frame_params

Definition at line 739 of file cc353.c.

struct gains_t gains

Initial value:

 {
        .red = 0x100,
        .green = 0x100,
        .blue = 0x100,
}

Definition at line 710 of file cc353.c.

Referenced by programSensor().

int gamma_tables_changed = 0

Definition at line 641 of file cc353.c.

Referenced by cmoscam_open(), cmoscam_release(), write_gamma_fpga(), x313_gamma_write(), and x313_tables_gammainitlinear().

unsigned short gamma_tables_soft[1028]

Definition at line 640 of file cc353.c.

Referenced by cmoscam_release(), x313_gamma_read(), x313_gamma_write(), and x313_tables_gammainitlinear().

unsigned long* imageParamsR_PREV = &imageParamsR[2*P_NUMBER]

Definition at line 789 of file cc353.c.

unsigned long* imageParamsR_PREV_PREV = &imageParamsR[3*P_NUMBER]

Definition at line 790 of file cc353.c.

unsigned long* imageParamsW = &imageParamsR[P_NUMBER]

Definition at line 788 of file cc353.c.

volatile unsigned long intm_shadow = 0 [static]

Definition at line 920 of file cc353.c.

volatile int JPEG_len [static]

Definition at line 928 of file cc353.c.

volatile int JPEG_lfr [static]

Definition at line 934 of file cc353.c.

volatile int JPEG_nfr [static]

Definition at line 933 of file cc353.c.

volatile int JPEG_rp [static]

Definition at line 927 of file cc353.c.

int jpeg_sdram_ctl0 [static]

Definition at line 800 of file cc353.c.

volatile int JPEG_wp [static]

Definition at line 926 of file cc353.c.

int JPEG_wp_prev = 0 [static]

Definition at line 1001 of file cc353.c.

struct sensor_t kai11002

Definition at line 1849 of file cc353.c.

Referenced by init_sensor().

struct meta_offsets_t meta_offsets [static]

Referenced by add_frame_params(), and advance_imageParamsR().

int minors[X313_MAXMINOR+1] [static]

Definition at line 775 of file cc353.c.

Referenced by fpga_clock_init(), fpga_clock_open(), fpga_clock_release(), fpga_init(), fpga_jtag_init(), fpga_jtag_open(), fpga_jtag_release(), fpga_open(), and fpga_release().

struct sensor_t sensor

Definition at line 639 of file cc353.c.

Referenced by gain_mt9x001(), init_mt9x001(), init_sensor(), program_exposure_mt9x001(), program_gains_mt9x001(), program_woi_mt9x001(), and programSensor().

unsigned char sensor_i2c_addr [static]

Definition at line 777 of file cc353.c.

unsigned char* sensor_i2c_regs

Definition at line 781 of file cc353.c.

unsigned short sensor_i2c_regs16[0x100] [static]

Definition at line 780 of file cc353.c.

int slock

Definition at line 452 of file cxsdram.c.

Referenced by ch0_dis(), and ch0_en().

wait_queue_head_t vack_wait_queue

Definition at line 453 of file cxsdram.c.

wait_queue_head_t x313_wait_queue

Definition at line 943 of file cc353.c.


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