os/linux-2.6-tag--devboard-R2_10-4/arch/cris/arch-v32/drivers/elphel/cc3x3.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 cc3x3.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 cc3x3.c.

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

Definition at line 554 of file cc3x3.c.

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

Definition at line 566 of file cc3x3.c.

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

Definition at line 568 of file cc3x3.c.

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

Definition at line 582 of file cc3x3.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 cc3x3.c.

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

Definition at line 560 of file cc3x3.c.

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

Definition at line 562 of file cc3x3.c.

#define CCAM_DONOTUSEAUX   (ccam_cr_shadow & X313_MASK(KAI11000))

Definition at line 551 of file cc3x3.c.

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

Definition at line 571 of file cc3x3.c.

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

Definition at line 573 of file cc3x3.c.

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

Definition at line 576 of file cc3x3.c.

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

Definition at line 578 of file cc3x3.c.

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

Definition at line 602 of file cc3x3.c.

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

Definition at line 594 of file cc3x3.c.

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

early/normal timestamp in async mode

Definition at line 592 of file cc3x3.c.

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

Definition at line 588 of file cc3x3.c.

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

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

Definition at line 586 of file cc3x3.c.

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

Definition at line 473 of file cc3x3.c.

#define CMOSCAM_MAJOR   126

Definition at line 467 of file cc3x3.c.

#define CONFIG_ETRAX_ELPHEL_AUTOEXP   y

#define CX313_FPGA_HISTOGRAM_SIZE   0x400

Definition at line 3810 of file cc3x3.c.

#define D ( x   ) 

Definition at line 458 of file cc3x3.c.

#define D1 ( x   ) 

Definition at line 459 of file cc3x3.c.

#define D2 ( x   ) 

Definition at line 460 of file cc3x3.c.

#define D3 ( x   ) 

Definition at line 461 of file cc3x3.c.

#define D4 ( x   ) 

Definition at line 462 of file cc3x3.c.

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

Definition at line 464 of file cc3x3.c.

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

Definition at line 498 of file cc3x3.c.

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

Definition at line 499 of file cc3x3.c.

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

Definition at line 497 of file cc3x3.c.

#define ENABLE_OLD_SENSORS   1

#define MAXEXPOSURE   60000

Definition at line 889 of file cc3x3.c.

#define MCP_lseek ( file,
offset,
orig   )     0

Definition at line 379 of file cc3x3.c.

#define MCP_open ( inode,
filp   )     -1

Definition at line 378 of file cc3x3.c.

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

Definition at line 380 of file cc3x3.c.

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

Definition at line 383 of file cc3x3.c.

 
#define MCPpresent (  )     0

Definition at line 377 of file cc3x3.c.

#define MD1 ( x   ) 

Definition at line 425 of file cc3x3.c.

#define MD10 ( x   ) 

Definition at line 438 of file cc3x3.c.

#define MD11 ( x   ) 

where jpeg_rp is modified?

Definition at line 435 of file cc3x3.c.

#define MD12 ( x   ) 

Definition at line 426 of file cc3x3.c.

#define MD13 ( x   ) 

Definition at line 427 of file cc3x3.c.

#define MD2 ( x   ) 

programSensor(nonstop)

Definition at line 455 of file cc3x3.c.

#define MD20 ( x   ) 

Definition at line 428 of file cc3x3.c.

#define MD6 ( x   ) 

Definition at line 451 of file cc3x3.c.

#define MD7 ( x   ) 

camSeqStartClip

Definition at line 448 of file cc3x3.c.

#define MD8 ( x   ) 

Definition at line 444 of file cc3x3.c.

#define MD9 ( x   ) 

Definition at line 440 of file cc3x3.c.

#define MY_MODULE_DESCRIPTION   "Elphel model 353 camera driver"

Definition at line 472 of file cc3x3.c.

#define nint_done   3

Definition at line 880 of file cc3x3.c.

#define nint_done_compress   7

Definition at line 885 of file cc3x3.c.

#define nint_done_input   6

Definition at line 884 of file cc3x3.c.

#define nint_eot   4

Definition at line 882 of file cc3x3.c.

#define nint_overrun   5

Definition at line 883 of file cc3x3.c.

#define nint_smart   8

Definition at line 886 of file cc3x3.c.

#define nint_vact   0

Definition at line 877 of file cc3x3.c.

#define nint_xferovr   2

Definition at line 879 of file cc3x3.c.

#define nint_xint   1

Definition at line 878 of file cc3x3.c.

#define OLD_CAMSEQSTOP   0

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

Definition at line 1500 of file cc3x3.c.

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

Definition at line 539 of file cc3x3.c.

#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 cc3x3.c.

#define PROGRAM_SENSOR_DIS_IRQ   0

Definition at line 2137 of file cc3x3.c.

#define SCALE_MAX   0x400

Definition at line 708 of file cc3x3.c.

#define SCALE_MIN   0x040

Definition at line 707 of file cc3x3.c.

#define SIMPLE_IRQ   y

Definition at line 1124 of file cc3x3.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 cc3x3.c.

#define X313_ACQUIRE_EXTERNAL   port_csp0_addr[X313_WA_TRIG]=6

Definition at line 479 of file cc3x3.c.

#define X313_ACQUIRE_INTERNAL   port_csp0_addr[X313_WA_TRIG]=4

Definition at line 478 of file cc3x3.c.

#define X313_ACQUIRE_ON   port_csp0_addr[X313_WA_TRIG]=5

Definition at line 480 of file cc3x3.c.

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

Definition at line 477 of file cc3x3.c.

#define X313_ACQUIRE_STOP   port_csp0_addr[X313_WA_TRIG]=0

Definition at line 476 of file cc3x3.c.

#define X313_MAXMINOR   15

Definition at line 626 of file cc3x3.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 cc3x3.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().

void adjust_fps_2_compressor ( void   ) 

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

static void camSeq_dump ( void   )  [static]

Definition at line 1306 of file cc3x3.c.

References printk.

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

Definition at line 1126 of file cc3x3.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.

int camSeqGetJPEG_rp ( void   ) 

Definition at line 1338 of file cc3x3.c.

int camSeqGetJPEG_wp ( void   ) 

Definition at line 1337 of file cc3x3.c.

void camSeqSetJPEG_rp ( int  p  ) 

Definition at line 1339 of file cc3x3.c.

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

static int camSeqStart ( void   )  [static]

Definition at line 1291 of file cc3x3.c.

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

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 cc3x3.c.

References CAMSEQ_DONE, CAMSEQ_JPEG, CAMSEQ_READY, CAMSEQ_RUN, CAMSEQ_SINGLE, CAMSEQ_STOP, CCAM_DMA_SIZE, compressorRun(), compressorSingle(), EN_INTERRUPT, getCamSeqState(), imageParamsR, IS_KAI11000, local_irq_restore, local_irq_save, MD1, MD7, nint_done_compress, nint_vact, P_CIRCBUFRP, P_CIRCBUFWP, P_FREECIRCBUF, P_JPEG_WP, P_SKIP_FRAMES, printk, resetPointers(), setCamSeqCount(), setCamSeqState(), writeSensorReg16(), X313_ACQUIRE_ON, X313_CHN_DIS, x313_dma_reset_chain(), x313_dma_start(), and X313_POSTINIT_SDCHAN.

void camSeqStop ( void   ) 

Definition at line 1506 of file cc3x3.c.

References CAMSEQ_READY, compressorStop(), DIS_INTERRUPTS, getCamSeqState(), imageParamsR, MD1, MD11, MD12, P_COMPRESSOR_CMD, printk, setCamSeqState(), X313_ACQUIRE_STOP, and x313_dma_stop().

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

void ccamCRAnd ( unsigned long  d  ) 

Definition at line 1561 of file cc3x3.c.

References local_irq_restore, local_irq_save, port_csp0_addr, and X313_WA_WCTL.

void ccamCRAndOr ( unsigned long  d_and,
unsigned long  d_or 
)

Definition at line 1583 of file cc3x3.c.

References local_irq_restore, local_irq_save, port_csp0_addr, and X313_WA_WCTL.

void ccamCROr ( unsigned long  d  ) 

Definition at line 1568 of file cc3x3.c.

References local_irq_restore, local_irq_save, port_csp0_addr, and X313_WA_WCTL.

void ccamCRXor ( unsigned long  d  ) 

Definition at line 1575 of file cc3x3.c.

References local_irq_restore, local_irq_save, port_csp0_addr, and X313_WA_WCTL.

unsigned long ccamGetCR ( void   ) 

Definition at line 1591 of file cc3x3.c.

void ch0_lock ( void   ) 

Definition at line 455 of file cxsdram.c.

References port_csp0_addr.

static int __init cmoscam_init ( void   )  [static]

Definition at line 1758 of file cc3x3.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 cc3x3.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 cc3x3.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 cc3x3.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 cc3x3.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 cc3x3.c.

References CMOSCAM_MINOR_CIRCBUF, CMOSCAM_MINOR_DMA, 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 cc3x3.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 cc3x3.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 cc3x3.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 cc3x3.c.

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

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 cc3x3.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.

void compressorStop ( void   )  [inline]

Definition at line 1031 of file cc3x3.c.

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

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 cc3x3.c.

References frame_params_t::black, frame_params_t::bscale, frame_params_t::color, frame_params_t::colorsat, DEFAULT_COLOR_SATURATION_BLUE, DEFAULT_COLOR_SATURATION_RED, frame_params_t::exposure, frame_params_t::gain_b, frame_params_t::gain_g, frame_params_t::gain_gb, frame_params_t::gain_r, frame_params_t::gamma, frame_params_t::height, frame_params_t::meta_index, printk, frame_params_t::quality, frame_params_t::rscale, frame_params_t::signffff, frame_params_t::timestamp_sec, frame_params_t::timestamp_usec, and frame_params_t::width.

void exposition_unlock ( void   ) 

Definition at line 2871 of file cc3x3.c.

References get_imageParamsR(), P_EXPOS, P_VEXPOS, and set_imageParamsW().

int flush_par_cache ( void   ) 

Definition at line 3295 of file cc3x3.c.

References ccam_dma_buf_ptr, and P_NUMBER.

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

unsigned long get_imageParamsR ( int  n  ) 

Definition at line 1551 of file cc3x3.c.

References imageParamsR.

unsigned long get_imageParamsW ( int  n  ) 

Definition at line 1552 of file cc3x3.c.

unsigned char get_sensor_i2c_addr ( void   ) 

Definition at line 1553 of file cc3x3.c.

unsigned char get_sensor_i2c_regs ( int  n  ) 

Definition at line 1550 of file cc3x3.c.

int get_sensor_i2c_regs16 ( int  n  ) 

Definition at line 1549 of file cc3x3.c.

static int getCamSeqCount ( void   )  [static]

Definition at line 1245 of file cc3x3.c.

static int getCamSeqState ( void   )  [static]

Definition at line 1275 of file cc3x3.c.

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

void init_autoexp_struct ( void   ) 

Definition at line 3886 of file cc3x3.c.

References aexp_window, aexp_window_set, autoexp_set, autoexp_state, imageParamsR, P_AEXPWND, and P_AUTOEXP.

static int init_FPGA ( void   )  [static]

Definition at line 1786 of file cc3x3.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().

int init_sensor ( void   )  [static]

Definition at line 1885 of file cc3x3.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.

static void initCamIRQs ( void   )  [static]

Definition at line 1257 of file cc3x3.c.

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

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 cc3x3.c.

References CCAM_TIMESTAMP_EARLY, CCAM_TIMESTAMP_NORMAL, imageParamsR, and P_EARLY_TIMESTAMP.

void program_i2c ( void   ) 

Definition at line 3275 of file cc3x3.c.

References imageParamsR, MD20, P_I2C_BYTES, P_I2C_QPERIOD, port_csp0_addr, and printk.

static int program_KAI11000 ( void   )  [static]

Definition at line 2133 of file cc3x3.c.

References printk.

int program_sensor_exposition ( void   ) 

Definition at line 2876 of file cc3x3.c.

References hist_sensor_t::exposure, hist_sensor_lock(), hist_sensor_unlock(), P_VEXPOS, program_sensor_exposition_just(), and set_imageParamsW().

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 cc3x3.c.

References adjust_fps_2_compressor(), imageParamsR, P_SENSOR, program_exposure_mt9x001(), SENSOR_KAC1310, SENSOR_KAC5000, SENSOR_KAI11000, SENSOR_MASK, SENSOR_MT9X001, SENSOR_MT9Y001, SENSOR_ZR32112, and SENSOR_ZR32212.

void program_smart_irq ( void   ) 

Definition at line 3282 of file cc3x3.c.

References imageParamsR, P_IRQ_SMART, and port_csp0_addr.

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 cc3x3.c.

References imageParamsR, P_TRIG_CONDITION, P_TRIG_DELAY, P_TRIG_OUT, P_TRIG_PERIOD, and port_csp0_addr.

static int programSensor ( int  nonstop  )  [static]

Definition at line 2138 of file cc3x3.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.

int readSensorReg ( unsigned int  ra,
int  mode 
)

Definition at line 1608 of file cc3x3.c.

References i2c_readData(), i2c_writeData(), local_irq_restore, local_irq_save, MD7, and printk.

int readSensorReg16 ( unsigned char  ra,
int  mode 
)

Definition at line 1661 of file cc3x3.c.

References get_sensor_i2c_regs16(), i2c_readData(), i2c_writeData(), local_irq_restore, local_irq_save, MD8, and printk.

void resetPointers ( void   ) 

Definition at line 1056 of file cc3x3.c.

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

void set_imageParamsR ( int  n,
unsigned long  d 
)

Definition at line 1555 of file cc3x3.c.

References imageParamsR.

void set_imageParamsW ( int  n,
unsigned long  d 
)

Definition at line 1556 of file cc3x3.c.

void set_sensor_i2c_addr ( unsigned char  d  ) 

Definition at line 1557 of file cc3x3.c.

void set_sensor_i2c_regs ( int  n,
unsigned char  d 
)

Definition at line 1554 of file cc3x3.c.

static void setCamSeqCount ( int  v  )  [static]

Definition at line 1252 of file cc3x3.c.

References imageParamsR, and P_CAMSEQCOUNT.

static void setCamSeqState ( int  v  )  [static]

Definition at line 1246 of file cc3x3.c.

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

static void startAcquire ( void   )  [inline, static]

Definition at line 944 of file cc3x3.c.

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

void tasklet_irq_f ( unsigned long  arg  ) 

Definition at line 991 of file cc3x3.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 cc3x3.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.

int write_gamma_fpga ( unsigned short  gamma_table[1028]  ) 

void writeSensorDefaults ( unsigned long *  data,
int  count 
)

Definition at line 1593 of file cc3x3.c.

References imageParamsR, MD7, P_PARS_CHANGED, and printk.

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

Definition at line 1630 of file cc3x3.c.

References i2c_writeData(), local_irq_restore, local_irq_save, MD8, and printk.

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

Definition at line 1681 of file cc3x3.c.

References get_sensor_i2c_regs16(), i2c_writeData(), local_irq_restore, local_irq_save, MD8, and printk.

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

Definition at line 1716 of file cc3x3.c.

References i2c_writeData(), int, local_irq_restore, local_irq_save, MD, and printk.

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_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 
)

static int x313_JPEG_cmd_wrapper ( int  arg  )  [static]

Definition at line 3439 of file cc3x3.c.

References camSeq_dump(), cmd, 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().

void x313_program_focus ( int  totalwidth  ) 

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

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

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

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 
)

void x313_tables_gammainitlinear ( void   ) 

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

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

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


Variable Documentation

struct aexp_window_t* aexp_window = NULL

Definition at line 796 of file cc3x3.c.

struct aexp_window_t* aexp_window_set = NULL

Definition at line 797 of file cc3x3.c.

struct autoexp_t* autoexp_set = NULL

Definition at line 795 of file cc3x3.c.

struct autoexp_t* autoexp_state = NULL

Definition at line 794 of file cc3x3.c.

volatile int camSeqCount [static]

Definition at line 924 of file cc3x3.c.

volatile int camSeqState [static]

Definition at line 925 of file cc3x3.c.

volatile unsigned long ccam_cr_shadow = 0

Definition at line 802 of file cc3x3.c.

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 cc3x3.c.

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

Definition at line 468 of file cc3x3.c.

volatile int dbg_20 [static]

Definition at line 936 of file cc3x3.c.

volatile int dbg_28 [static]

Definition at line 937 of file cc3x3.c.

unsigned long default_common[] [static]

Definition at line 646 of file cc3x3.c.

unsigned long DMA_buf_start [static]

Definition at line 931 of file cc3x3.c.

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

Definition at line 741 of file cc3x3.c.

char* exif_meta_time_string

Definition at line 749 of file cc3x3.c.

int fpga_counter_prev = 0 [static]

Definition at line 1000 of file cc3x3.c.

unsigned long fpga_tables_buffer[CX313_FPGA_TABLES_SIZE]

Moved to c313a.h.

Definition at line 3601 of file cc3x3.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 cc3x3.c.

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

Definition at line 739 of file cc3x3.c.

struct gains_t gains

Initial value:

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

Definition at line 710 of file cc3x3.c.

int gamma_tables_changed = 0

Definition at line 641 of file cc3x3.c.

unsigned short gamma_tables_soft[1028]

Definition at line 640 of file cc3x3.c.

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

Definition at line 789 of file cc3x3.c.

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

Definition at line 790 of file cc3x3.c.

unsigned long* imageParamsW = &imageParamsR[P_NUMBER]

Definition at line 788 of file cc3x3.c.

volatile unsigned long intm_shadow = 0 [static]

Definition at line 920 of file cc3x3.c.

volatile int JPEG_len [static]

Definition at line 928 of file cc3x3.c.

volatile int JPEG_lfr [static]

Definition at line 934 of file cc3x3.c.

volatile int JPEG_nfr [static]

Definition at line 933 of file cc3x3.c.

volatile int JPEG_rp [static]

Definition at line 927 of file cc3x3.c.

int jpeg_sdram_ctl0 [static]

Definition at line 800 of file cc3x3.c.

volatile int JPEG_wp [static]

Definition at line 926 of file cc3x3.c.

int JPEG_wp_prev = 0 [static]

Definition at line 1001 of file cc3x3.c.

struct sensor_t kai11002

Definition at line 1849 of file cc3x3.c.

struct meta_offsets_t meta_offsets [static]

int minors[X313_MAXMINOR+1] [static]

Definition at line 775 of file cc3x3.c.

struct sensor_t sensor

Definition at line 639 of file cc3x3.c.

unsigned char sensor_i2c_addr [static]

Definition at line 777 of file cc3x3.c.

unsigned char* sensor_i2c_regs

Definition at line 781 of file cc3x3.c.

unsigned short sensor_i2c_regs16[0x100] [static]

Definition at line 780 of file cc3x3.c.

int slock

Definition at line 452 of file cxsdram.c.

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 cc3x3.c.


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