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

#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/wait.h>
#include <asm/unistd.h>
#include <asm/semaphore.h>
#include <asm/atomic.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/vmalloc.h>
#include <linux/rwsem.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/time.h>
#include <asm/io.h>
#include <asm/page.h>
#include "fpgactrl.h"
#include <asm/elphel/c313a.h>
#include <asm/elphel/hist.h>
#include <asm/elphel/autoexp.h>
#include "cc3x3.h"
#include "cxdma.h"
#include "x3x3.h"
#include "hist.h"
#include "fpga_io.h"

Include dependency graph for hist353.c:

Go to the source code of this file.

Data Structures

struct  gamma_t
struct  buf_t
struct  autoexp_context_t

Defines

#define HIST_MAJOR   130
#define AUTOEXP_MAJOR   131
#define MD1(x)
#define BUF_C   2
#define HIST_TABLE_SIZE   (256 * 4 * sizeof(u32))
#define HIST_EXP_MAX_START   4000
#define HIST_OVEREXP_MAX_START   50
#define HIST_EXP_START   1000
#define GAMMA_COUNT   200
#define GAMMA_TABLE_SIZE   257
#define _GAMMA_TABLE_SIZE   257
#define STEP_INIT   0x00
#define STEP_1   0x01
#define STEP_2   0x02
#define STEP_3   0x03
#define STEP_4   0x04
#define _WRITE_GAMMA   0x10
#define _WRITE_GAMMA_BUF   (2 + _GAMMA_TABLE_SIZE * 2)
#define FPGA333_TABLE_ADDR_GAMMA   0x0400
 we need to balance difference between 2 greens, it is large!

Functions

 DECLARE_MUTEX (ae_log_lock)
 DECLARE_MUTEX (sensor_lock)
 DECLARE_MUTEX (iface_lock)
 DECLARE_WAIT_QUEUE_HEAD (wq_hist)
 DECLARE_MUTEX (autoexp_iface_lock)
 DECLARE_MUTEX (gamma_lock)
static unsigned short gamma_table[256 *6] __attribute__ ((aligned(PAGE_SIZE)))
 DECLARE_MUTEX (hist0_lock)
 DECLARE_MUTEX (autoexp_conf_lock)
int tv_less (struct timeval *tv_1, struct timeval *tv_2)
 use autoexp_state->
 DECLARE_MUTEX (image_lock)
static int hist__open (struct inode *inode, struct file *filp)
static int hist__release (struct inode *inode, struct file *filp)
static int hist__ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
static int hist__mmap (struct file *filp, struct vm_area_struct *vma)
static int autoexp__open (struct inode *inode, struct file *filp)
static int autoexp__release (struct inode *inode, struct file *filp)
static ssize_t autoexp__write (struct file *filp, const char *buf, size_t count, loff_t *offp)
static int autoexp__ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
static int autoexp__mmap (struct file *filp, struct vm_area_struct *vma)
static int __init hist__init (void)
static void __exit hist__exit (void)
 module_init (hist__init)
 module_exit (hist__exit)
static void hist__vma_open (struct vm_area_struct *vma)
static void hist__vma_close (struct vm_area_struct *vma)
void hist_irq (unsigned long src)
void hist_irq__ (unsigned long src)
hist_sensor_thist_sensor_lock (void)
void hist_sensor_unlock (void)
void hist_image_exp (unsigned long exp)
void hist_image_size (unsigned long width, unsigned long height)
void window2state (void)
void get_autoexposure_parameters (void)
 copy and use parameters from autoexp_set
void set2state (void)
 copy autoexp_set parameters to autoexp_state
void set_autoexposure_parameters (void)
 copy and use parameters from autoexp_set
void __add_gamma (unsigned short index, unsigned short *table)
static int fill_buffer (int c_query, const char *buf, size_t count, size_t *offset, struct autoexp_context_t *c)
static void autoexp__vma_close (struct vm_area_struct *vma)
unsigned long gamma_v (unsigned long index, unsigned short *table)
void set_gamma (unsigned long __gamma, unsigned long black, unsigned long scale_red, unsigned long scale_green, unsigned long scale_blue, unsigned long scale_green1)

Variables

static struct autoexp_log_t ae_log_buf [LOG_C]
static struct autoexp_log_tae_log_p = &ae_log_buf[LOG_C - 1]
static unsigned ae_log_c = 0
atomic_t sensor_refresh
atomic_t autoexp_on
atomic_t autoexp_enable
static int first_exp = 0
gamma_t gamma [BUF_C]
static unsigned short gamma_table_1 [256 *6]
static unsigned short gamma_table_2 [256 *6]
static unsigned long c_gamma = 0
static unsigned long c_hist = 0
timeval tv_gamma
buf_t buf [BUF_C]
static struct timeval tv_gamma_hb_0
int autoexp_conf_new = 1
static unsigned short gamma_tbl [_GAMMA_TABLE_SIZE *GAMMA_COUNT]
static unsigned short * gamma_ptr = NULL
aexp_window_t window_sensor
 use external aexp_window
atomic_t image_new
 use external aexp_window_set
atomic_t image_reprogrammed
atomic_t sensor_window
hist_sensor_t sensor_desc
static struct file_operations hist__fops
static struct file_operations autoexp__fops
static struct vm_operations_struct hist__vm_ops
unsigned long * ccam_dma
static struct vm_operations_struct autoexp__vm_ops
static unsigned long _gamma = 0xFFFFFFFF
static unsigned long _black = 0x00
static unsigned short _scale_red = 0x0100
static unsigned short _scale_green = 0x0100
static unsigned short _scale_blue = 0x0100
static unsigned short _scale_green1 = 0x0100
unsigned short _gamma_table_or [GAMMA_TABLE_SIZE]
unsigned short _gamma_table [256 *6]
unsigned long gamma_table_to_fpga [256 *4]


Define Documentation

#define _GAMMA_TABLE_SIZE   257

Definition at line 183 of file hist353.c.

#define _WRITE_GAMMA   0x10

Definition at line 1026 of file hist353.c.

#define _WRITE_GAMMA_BUF   (2 + _GAMMA_TABLE_SIZE * 2)

Definition at line 1027 of file hist353.c.

#define AUTOEXP_MAJOR   131

Definition at line 70 of file hist353.c.

#define BUF_C   2

Definition at line 97 of file hist353.c.

#define FPGA333_TABLE_ADDR_GAMMA   0x0400

we need to balance difference between 2 greens, it is large!

Definition at line 1243 of file hist353.c.

#define GAMMA_COUNT   200

Definition at line 180 of file hist353.c.

#define GAMMA_TABLE_SIZE   257

Definition at line 182 of file hist353.c.

#define HIST_EXP_MAX_START   4000

Definition at line 133 of file hist353.c.

#define HIST_EXP_START   1000

Definition at line 135 of file hist353.c.

#define HIST_MAJOR   130

Definition at line 69 of file hist353.c.

#define HIST_OVEREXP_MAX_START   50

Definition at line 134 of file hist353.c.

#define HIST_TABLE_SIZE   (256 * 4 * sizeof(u32))

Definition at line 131 of file hist353.c.

#define MD1 ( x   ) 

Definition at line 76 of file hist353.c.

#define STEP_1   0x01

Definition at line 539 of file hist353.c.

#define STEP_2   0x02

Definition at line 540 of file hist353.c.

#define STEP_3   0x03

Definition at line 541 of file hist353.c.

#define STEP_4   0x04

Definition at line 542 of file hist353.c.

#define STEP_INIT   0x00

Definition at line 538 of file hist353.c.


Function Documentation

void __add_gamma ( unsigned short  index,
unsigned short *  table 
)

Definition at line 1000 of file hist353.c.

References GAMMA_COUNT, gamma_ptr, GAMMA_TABLE_SIZE, and printk.

static unsigned short gamma_table [256 * 6] __attribute__ ( (aligned(PAGE_SIZE))   )  [static]

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

Definition at line 1091 of file hist353.c.

References _WRITE_GAMMA, ae_log_buf, ae_log_c, ae_log_p, aexp_window_set, autoexp_conf_new, autoexp_enable, autoexp_set, autoexp_state, autoexp_context_t::c, autoexp_t::exp, autoexp_t::exp_max, exposition_unlock(), get_imageParamsR(), GFP_KERNEL, aexp_window_t::height, autoexp_t::height, HIST_NOT_CHANGE, IOC_AUTOEXP_GAMMA_TABLE, IOC_AUTOEXP_GET, IOC_AUTOEXP_GET_LOG, IOC_AUTOEXP_SET, kmalloc, aexp_window_t::left, autoexp_t::left, LOG_C, autoexp_t::on, autoexp_t::overexp_max, P_EXPOS, printk, autoexp_t::s_index, autoexp_t::s_percent, set2state(), autoexp_t::skip_pmax, autoexp_t::skip_pmin, autoexp_t::skip_t, aexp_window_t::top, autoexp_t::top, aexp_window_t::width, autoexp_t::width, and window2state().

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

Definition at line 1210 of file hist353.c.

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

Definition at line 1037 of file hist353.c.

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

Definition at line 1042 of file hist353.c.

References kfree.

void autoexp__vma_close ( struct vm_area_struct *  vma  )  [static]

Definition at line 1226 of file hist353.c.

static ssize_t autoexp__write ( struct file *  filp,
const char *  buf,
size_t  count,
loff_t *  offp 
) [static]

Definition at line 1061 of file hist353.c.

References __add_gamma(), _WRITE_GAMMA, _WRITE_GAMMA_BUF, autoexp_context_t::c, and fill_buffer().

DECLARE_MUTEX ( image_lock   ) 

DECLARE_MUTEX ( autoexp_conf_lock   ) 

DECLARE_MUTEX ( hist0_lock   ) 

DECLARE_MUTEX ( gamma_lock   ) 

DECLARE_MUTEX ( autoexp_iface_lock   ) 

DECLARE_MUTEX ( iface_lock   ) 

DECLARE_MUTEX ( sensor_lock   ) 

DECLARE_MUTEX ( ae_log_lock   ) 

DECLARE_WAIT_QUEUE_HEAD ( wq_hist   ) 

static int fill_buffer ( int  c_query,
const char *  buf,
size_t  count,
size_t *  offset,
struct autoexp_context_t c 
) [static]

Definition at line 1048 of file hist353.c.

References autoexp_context_t::buf, and autoexp_context_t::buf_fill.

unsigned long gamma_v ( unsigned long  index,
unsigned short *  table 
)

Definition at line 1247 of file hist353.c.

void get_autoexposure_parameters ( void   ) 

copy and use parameters from autoexp_set

Definition at line 935 of file hist353.c.

References window2state().

static void __exit hist__exit ( void   )  [static]

Definition at line 364 of file hist353.c.

References HIST_MAJOR, and printk.

static int __init hist__init ( void   )  [static]

Definition at line 266 of file hist353.c.

References AUTOEXP_MAJOR, autoexp_set, autoexp_state, buf_t::buf, buf, BUF_C, autoexp_t::exp, autoexp_t::exp_max, gamma, gamma_table_1, gamma_table_2, autoexp_t::height, HIST_EXP_MAX_START, HIST_EXP_START, HIST_MAJOR, HIST_OVEREXP_MAX_START, KERN_ERR, autoexp_t::left, autoexp_t::on, autoexp_t::overexp_max, printk, autoexp_t::s_index, autoexp_t::s_percent, sensor_refresh, autoexp_t::skip_pmax, autoexp_t::skip_pmin, autoexp_t::skip_t, autoexp_t::top, buf_t::tv, and autoexp_t::width.

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

Definition at line 404 of file hist353.c.

References ae_log_buf, ae_log_c, ae_log_p, aexp_window_set, autoexp_set, buf, BUF_C, autoexp_t::exp, hist_sensor_t::exposure, first_exp, aexp_window_t::height, HIST_NOT_CHANGE, IOC_HIST_GET, IOC_HIST_SET, IOC_HIST_SET_LOG, aexp_window_t::left, log(), LOG_C, memcpy(), port_csp0_addr, REZ_HIST_CONF, REZ_HIST_TABLE, sensor_desc, sensor_refresh, aexp_window_t::top, buf_t::tv, and aexp_window_t::width.

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

Definition at line 501 of file hist353.c.

References buf_t::buf, hist__vma_open(), and buf_t::tv.

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

Definition at line 382 of file hist353.c.

References autoexp_enable, autoexp_on, autoexp_state, autoexp_t::on, and printk.

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

Definition at line 392 of file hist353.c.

References autoexp_enable, autoexp_on, and printk.

void hist__vma_close ( struct vm_area_struct *  vma  )  [static]

Definition at line 525 of file hist353.c.

References buf_t::lock, and buf_t::tv.

void hist__vma_open ( struct vm_area_struct *  vma  )  [static]

Definition at line 522 of file hist353.c.

void hist_image_exp ( unsigned long  exp  ) 

Definition at line 906 of file hist353.c.

References autoexp_set, autoexp_state, autoexp_t::exp, and first_exp.

void hist_image_size ( unsigned long  width,
unsigned long  height 
)

Definition at line 914 of file hist353.c.

References aexp_window_t::height, image_new, sensor_window, aexp_window_t::width, and window_sensor.

void hist_irq ( unsigned long  src  ) 

Definition at line 546 of file hist353.c.

References aexp_window, aexp_window_set, autoexp_enable, gamma_t::buf, buf_t::buf, buf, BUF_C, c_hist, gamma, aexp_window_t::height, image_new, aexp_window_t::left, buf_t::lock, memcpy(), OFFSET_HIST_C, port_csp0_addr, port_csp4_addr, program_sensor_exposition(), sensor_refresh, sensor_window, STEP_1, STEP_2, STEP_3, STEP_4, STEP_INIT, aexp_window_t::top, gamma_t::tv, buf_t::tv, tv_less(), aexp_window_t::width, and window_sensor.

void hist_irq__ ( unsigned long  src  ) 

Definition at line 706 of file hist353.c.

References aexp_window, aexp_window_set, autoexp_enable, gamma_t::buf, buf_t::buf, buf, BUF_C, c_hist, gamma, aexp_window_t::height, image_new, image_reprogrammed, IRQ_SRC_VACT, aexp_window_t::left, buf_t::lock, memcpy(), OFFSET_HIST_C, port_csp0_addr, port_csp4_addr, printk, program_sensor_exposition(), sensor_refresh, STEP_1, STEP_2, STEP_3, STEP_4, STEP_INIT, aexp_window_t::top, gamma_t::tv, buf_t::tv, tv_less(), aexp_window_t::width, and window_sensor.

struct hist_sensor_t* hist_sensor_lock ( void   ) 

Definition at line 889 of file hist353.c.

References autoexp_enable, autoexp_state, autoexp_t::exp, hist_sensor_t::exposure, first_exp, and sensor_desc.

void hist_sensor_unlock ( void   ) 

Definition at line 902 of file hist353.c.

module_exit ( hist__exit   ) 

module_init ( hist__init   ) 

void set2state ( void   ) 

copy autoexp_set parameters to autoexp_state

Definition at line 945 of file hist353.c.

References autoexp_conf_new, autoexp_enable, autoexp_set, autoexp_state, autoexp_t::exp_max, exposition_unlock(), HIST_NOT_CHANGE, autoexp_t::on, autoexp_t::overexp_max, autoexp_t::s_index, autoexp_t::s_percent, autoexp_t::skip_pmax, autoexp_t::skip_pmin, and autoexp_t::skip_t.

void set_autoexposure_parameters ( void   ) 

copy and use parameters from autoexp_set

copy autoexp_set parameters to autoexp_state

Definition at line 974 of file hist353.c.

References set2state().

void set_gamma ( unsigned long  __gamma,
unsigned long  black,
unsigned long  scale_red,
unsigned long  scale_green,
unsigned long  scale_blue,
unsigned long  scale_green1 
)

Definition at line 1271 of file hist353.c.

References _GAMMA_TABLE_SIZE, c_gamma, FPGA333_TABLE_ADDR_GAMMA, fpga_table_write(), gamma_ptr, GAMMA_TABLE_SIZE, gamma_v(), MD1, memcpy(), memset(), OFFSET_GAMMA_C, and printk.

int tv_less ( struct timeval *  tv_1,
struct timeval *  tv_2 
)

use autoexp_state->

Definition at line 171 of file hist353.c.

void window2state ( void   ) 

Definition at line 926 of file hist353.c.

References aexp_window_set, autoexp_state, autoexp_t::exp, get_imageParamsR(), aexp_window_t::height, autoexp_t::height, aexp_window_t::left, autoexp_t::left, P_EXPOS, aexp_window_t::top, autoexp_t::top, aexp_window_t::width, and autoexp_t::width.


Variable Documentation

unsigned long _black = 0x00 [static]

Definition at line 1236 of file hist353.c.

unsigned long _gamma = 0xFFFFFFFF [static]

Definition at line 1235 of file hist353.c.

unsigned short _gamma_table[256 *6]

Definition at line 1268 of file hist353.c.

unsigned short _gamma_table_or[GAMMA_TABLE_SIZE]

Definition at line 1267 of file hist353.c.

unsigned short _scale_blue = 0x0100 [static]

Definition at line 1240 of file hist353.c.

unsigned short _scale_green = 0x0100 [static]

Definition at line 1239 of file hist353.c.

unsigned short _scale_green1 = 0x0100 [static]

Definition at line 1241 of file hist353.c.

unsigned short _scale_red = 0x0100 [static]

Definition at line 1238 of file hist353.c.

struct autoexp_log_t ae_log_buf[LOG_C] [static]

Definition at line 83 of file hist353.c.

unsigned ae_log_c = 0 [static]

Definition at line 85 of file hist353.c.

struct autoexp_log_t* ae_log_p = &ae_log_buf[LOG_C - 1] [static]

Definition at line 84 of file hist353.c.

struct file_operations autoexp__fops [static]

Initial value:

Definition at line 257 of file hist353.c.

struct vm_operations_struct autoexp__vm_ops [static]

Initial value:

 {
        .close = autoexp__vma_close,
}

Definition at line 1206 of file hist353.c.

int autoexp_conf_new = 1

Definition at line 138 of file hist353.c.

atomic_t autoexp_enable

Definition at line 91 of file hist353.c.

atomic_t autoexp_on

Definition at line 90 of file hist353.c.

struct buf_t buf[BUF_C]

Definition at line 122 of file hist353.c.

unsigned long c_gamma = 0 [static]

Definition at line 109 of file hist353.c.

unsigned long c_hist = 0 [static]

Definition at line 110 of file hist353.c.

unsigned long* ccam_dma

Definition at line 158 of file circbuf.c.

Referenced by get_image_time().

int first_exp = 0 [static]

Definition at line 93 of file hist353.c.

struct gamma_t gamma[BUF_C]

Definition at line 103 of file hist353.c.

unsigned short* gamma_ptr = NULL [static]

Definition at line 187 of file hist353.c.

unsigned short gamma_table_1[256 *6] [static]

Definition at line 106 of file hist353.c.

unsigned short gamma_table_2[256 *6] [static]

Definition at line 107 of file hist353.c.

unsigned long gamma_table_to_fpga[256 *4]

Definition at line 1269 of file hist353.c.

unsigned short gamma_tbl[_GAMMA_TABLE_SIZE *GAMMA_COUNT] [static]

Definition at line 185 of file hist353.c.

struct file_operations hist__fops [static]

Initial value:

 {
        owner:          THIS_MODULE,
        open:           hist__open,
        release:        hist__release,
        ioctl:          hist__ioctl,
        mmap:           hist__mmap,
}

Definition at line 243 of file hist353.c.

struct vm_operations_struct hist__vm_ops [static]

Initial value:

 {
        .open = hist__vma_open,
        .close = hist__vma_close,
}

Definition at line 496 of file hist353.c.

atomic_t image_new

use external aexp_window_set

Definition at line 227 of file hist353.c.

atomic_t image_reprogrammed

Definition at line 228 of file hist353.c.

struct hist_sensor_t sensor_desc

Definition at line 232 of file hist353.c.

atomic_t sensor_refresh

Definition at line 88 of file hist353.c.

atomic_t sensor_window

Definition at line 230 of file hist353.c.

struct timeval tv_gamma

Definition at line 114 of file hist353.c.

struct timeval tv_gamma_hb_0 [static]

Definition at line 125 of file hist353.c.

struct aexp_window_t window_sensor

Initial value:

 {
        .width = 0,
        .height = 0,
}
use external aexp_window

Definition at line 213 of file hist353.c.


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