#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_t * | hist_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_t * | ae_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 FPGA333_TABLE_ADDR_GAMMA 0x0400 |
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] |
static int autoexp__open | ( | struct inode * | inode, | |
struct file * | filp | |||
) | [static] |
static int autoexp__release | ( | struct inode * | inode, | |
struct file * | filp | |||
) | [static] |
void autoexp__vma_close | ( | struct vm_area_struct * | vma | ) | [static] |
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 | |||
) |
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] |
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] |
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] |
void hist__vma_close | ( | struct vm_area_struct * | vma | ) | [static] |
void hist__vma_open | ( | struct vm_area_struct * | vma | ) | [static] |
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.
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 | |||
) |
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.
unsigned short _gamma_table[256 *6] |
unsigned short _gamma_table_or[GAMMA_TABLE_SIZE] |
unsigned short _scale_blue = 0x0100 [static] |
unsigned short _scale_green = 0x0100 [static] |
unsigned short _scale_green1 = 0x0100 [static] |
unsigned short _scale_red = 0x0100 [static] |
struct autoexp_log_t ae_log_buf[LOG_C] [static] |
struct autoexp_log_t* ae_log_p = &ae_log_buf[LOG_C - 1] [static] |
struct file_operations autoexp__fops [static] |
Initial value:
{ owner: THIS_MODULE, open: autoexp__open, release: autoexp__release, write: autoexp__write, ioctl: autoexp__ioctl, mmap: autoexp__mmap, }
struct vm_operations_struct autoexp__vm_ops [static] |
int autoexp_conf_new = 1 |
atomic_t autoexp_enable |
atomic_t autoexp_on |
unsigned long* ccam_dma |
unsigned short gamma_table_1[256 *6] [static] |
unsigned short gamma_table_2[256 *6] [static] |
unsigned long gamma_table_to_fpga[256 *4] |
unsigned short gamma_tbl[_GAMMA_TABLE_SIZE *GAMMA_COUNT] [static] |
struct file_operations hist__fops [static] |
Initial value:
{ owner: THIS_MODULE, open: hist__open, release: hist__release, ioctl: hist__ioctl, mmap: hist__mmap, }
struct vm_operations_struct hist__vm_ops [static] |
Initial value:
{ .open = hist__vma_open, .close = hist__vma_close, }
atomic_t image_reprogrammed |
struct hist_sensor_t sensor_desc |
atomic_t sensor_refresh |
atomic_t sensor_window |
struct timeval tv_gamma_hb_0 [static] |
struct aexp_window_t window_sensor |