/*
* SPCA5xx based usb camera driver (currently supports
* yuv native stream spca501a, spca501c, spca505, spca508, spca506
* jpeg native stream spca500, spca551, spca504a, spca504b, spca533a, spca536a, zc0301, zc0302, cx11646, sn9c102p
* bayer native stream spca561a, sn9c101, sn9c102, tv8532 ).
* Z-star Vimicro chips zc0301 zc0301P zc0302
* Sunplus spca501a, spca501c, spca505, spca508, spca506, spca500, spca551, spca504a, spca504b, spca533a, spca536a
* Sonix sn9c101, sn9c102, sn9c102p sn9c105 sn9c120
* Conexant cx11646
* Transvision tv_8532
* Etoms Et61x151 Et61x251
* Pixat Pac207-BCA-32
* SPCA5xx version by Michel Xhaard <mxhaard@users.sourceforge.net>
* Based on :
* SPCA50x version by Joel Crisp <cydergoth@users.sourceforge.net>
* OmniVision OV511 Camera-to-USB Bridge Driver
* Copyright (c) 1999-2000 Mark W. McClelland
* Kernel 2.6.x port Michel Xhaard && Reza Jelveh (feb 2004)
* Based on the Linux CPiA driver written by Peter Pregler,
* Scott J. Bertin and Johannes Erdfelt.
* 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 2 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, write to the Free Software Foundation,
* Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
static const char version[] = SPCA5XX_VERSION;
#include <linux/config.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/vmalloc.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include <linux/ctype.h>
#include <linux/pagemap.h>
#include <linux/usb.h>
#include <asm/io.h>
#include <asm/semaphore.h>
#include <asm/page.h>
#include <asm/uaccess.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
/* only on 2.6.x */
#include <linux/jiffies.h>
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
#include <linux/wrapper.h>
#endif
#include <linux/param.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
#include <linux/moduleparam.h>
#endif
#include "spca5xx.h"
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
# undef CONFIG_VIDEO_PROC_FS
# undef CONFIG_PROC_FS
#endif
//#define RH9_REMAP 1
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
#include "spcaCompat.h"
#ifndef pte_offset_kernel
# define pte_offset_kernel(dir, address) pte_offset(dir, address)
#endif
#endif
#include "spcadecoder.h"
#include "jpeg_qtables.h"
#define PROC_NAME_LEN 10 //length of the proc name
/* Video Size 640 x 480 x 4 bytes for RGB */
#define MAX_FRAME_SIZE (640 * 480 * 4)
#define MAX_DATA_SIZE (MAX_FRAME_SIZE + sizeof(struct timeval))
/* Hardware auto exposure / whiteness (PC-CAM 600) */
static int autoexpo = 1;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,5)
/* Video device number (-1 is first available) */
static int video_nr = -1;
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,5) */
/* 0=no debug messages
* 1=init/detection/unload and other significant messages,
* 2=some warning messages
* 3=config/control function calls
* 4=most function calls and data parsing messages
* 5=highly repetitive mesgs
* NOTE: This should be changed to 0, 1, or 2 for production kernels
*/
static int debug = 0;
/* Force image to be read in RGB instead of BGR. This option allow
* programs that expect RGB data (e.g. gqcam) to work with this driver. */
static int force_rgb = 0;
static int gamma = 3;
static int OffRed = 0;
static int OffBlue = 0;
static int OffGreen = 0;
static int GRed = 256;
static int GBlue = 256;
static int GGreen = 256;
static int usbgrabber = 0;
#ifdef SPCA50X_ENABLE_COMPRESSION
/* Enable compression. This is for experimentation only; compressed images
* still cannot be decoded yet. */
static int compress = 0;
#endif /* SPCA50X_ENABLE_COMPRESSION */
#ifdef SPCA5XX_ENABLE_REGISTERPLAY
static int RegAddress = 0;
static int RegValue = 0;
static int RegStrobe = 0;
#endif /* SPCA5XX_ENABLE_REGISTERPLAY */
/* Initial brightness & contrast (for debug purposes) */
static int bright = 0x80;
static int contrast = 0x60;
/* Parameter that enables you to set the minimal suitable bpp */
static int min_bpp = 0;
/* Parameter defines the average luminance that should be kept */
static int lum_level = 0x2d;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
module_param (autoexpo, int, 0644);
module_param (debug, int, 0644);
module_param (force_rgb, int, 0644);
module_param (gamma, int, 0644);
module_param (OffRed, int, 0644);
module_param (OffBlue, int, 0644);
module_param (OffGreen, int, 0644);
module_param (GRed, int, 0644);
module_param (GBlue, int, 0644);
module_param (GGreen, int, 0644);
#ifdef SPCA50X_ENABLE_COMPRESSION
module_param (compress, int, 0644);
#endif /* SPCA50X_ENABLE_COMPRESSION */
module_param (bright, int, 0444);
module_param (contrast, int, 0444);
module_param (min_bpp, int, 0444);
module_param (lum_level, int, 0444);
module_param (usbgrabber, int, 0444);
#ifdef SPCA5XX_ENABLE_REGISTERPLAY
module_param (RegAddress, int, 0644);
module_param (RegValue, int, 0644);
module_param (RegStrobe, int, 0644);
#endif /* SPCA5XX_ENABLE_REGISTERPLAY */
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9) */
MODULE_PARM (autoexpo, "i");
MODULE_PARM (debug, "i");
MODULE_PARM (force_rgb, "i");
MODULE_PARM (gamma, "i");
MODULE_PARM (OffRed, "i");
MODULE_PARM (OffBlue, "i");
MODULE_PARM (OffGreen, "i");
MODULE_PARM (GRed, "i");
MODULE_PARM (GBlue, "i");
MODULE_PARM (GGreen, "i");
#ifdef SPCA50X_ENABLE_COMPRESSION
MODULE_PARM (compress, "i");
#endif /* SPCA50X_ENABLE_COMPRESSION */
MODULE_PARM (bright, "i");
MODULE_PARM (contrast, "i");
MODULE_PARM (min_bpp, "i");
MODULE_PARM (lum_level, "0-255i");
MODULE_PARM (usbgrabber, "i");
#endif
/***************/
MODULE_PARM_DESC (autoexpo,
"Enable/Disable auto exposure (default=1: enabled) (PC-CAM 600/Zc03xx/spca561a/Etoms Only !!!)");
MODULE_PARM_DESC (debug,
"Debug level: 0=none, 1=init/detection, 2=warning, 3=config/control, 4=function call, 5=max");
MODULE_PARM_DESC (force_rgb, "Read RGB instead of BGR");
MODULE_PARM_DESC (gamma, "gamma setting range 0 to 7 3-> gamma=1");
MODULE_PARM_DESC (OffRed, "OffRed setting range -128 to 128");
MODULE_PARM_DESC (OffBlue, "OffBlue setting range -128 to 128");
MODULE_PARM_DESC (OffGreen, "OffGreen setting range -128 to 128");
MODULE_PARM_DESC (GRed, "Gain Red setting range 0 to 512 /256 ");
MODULE_PARM_DESC (GBlue, "Gain Blue setting range 0 to 512 /256 ");
MODULE_PARM_DESC (GGreen, "Gain Green setting range 0 to 512 /256 ");
#ifdef SPCA50X_ENABLE_COMPRESSION
MODULE_PARM_DESC (compress, "Turn on/off compression (not functional yet)");
#endif /* SPCA50X_ENABLE_COMPRESSION */
MODULE_PARM_DESC (bright, "Initial brightness factor (0-255) not know by all webcams !!");
MODULE_PARM_DESC (contrast, "Initial contrast factor (0-255) not know by all webcams !!");
MODULE_PARM_DESC (min_bpp,
"The minimal color depth that may be set (default 0)");
MODULE_PARM_DESC (lum_level,
"Luminance level for brightness autoadjustment (default 32)");
MODULE_PARM_DESC (usbgrabber,
"Is a usb grabber 0x0733:0x0430 ? (default 1) ");
#ifdef SPCA5XX_ENABLE_REGISTERPLAY
MODULE_PARM_DESC (RegAddress, "Register Address of PAC207");
MODULE_PARM_DESC (RegValue, "Register Value for PAC207");
MODULE_PARM_DESC (RegStrobe, "Strobe to read or write a register 1=write, 2=read");
#endif /* SPCA5XX_ENABLE_REGISTERPLAY */
/****************/
MODULE_AUTHOR
("Michel Xhaard <mxhaard@users.sourceforge.net> based on spca50x dri
spca5xx-source.tar.gz_linux spca source_spca_spca5xx-sour_spca5x
版权申诉
103 浏览量
2022-09-20
14:40:01
上传
评论
收藏 183KB GZ 举报
我虽横行却不霸道
- 粉丝: 73
- 资源: 1万+
最新资源
- 自己团队一直在用的,软件研发需求文档,里边是真实的一个项目 删除了部分
- 1dbe6d23f01723766a28768a6e079f38.PNG
- NASA的C语言编程规范
- 2024年4月中旬流通领域重要生产资料市场价格变动情况 .docx
- (自适应手机端)响应式家居建材类网站pbootcms模板 HTML5办公家具桌椅类网站源码下载.zip
- (自适应手机端)响应式环保科技公司网站pbootcms模板 HTML5蓝色环保机械设备网站源码下载.zip
- (自适应手机端)响应式茶叶茶道pbootcms网站模板 棕色复古茶具网站源码下载.zip
- 河北省 省科小申报材料清单
- MCGS物联助手-V3.1.11780-20240124手机版
- 比赛倒计时1.0.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈