⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sn9c102.txt

📁 linux 内核源代码
💻 TXT
📖 第 1 页 / 共 2 页
字号:
			 SN9C1xx PC Camera Controllers				Driver for Linux			 =============================			       - Documentation -Index=====1.  Copyright2.  Disclaimer3.  License4.  Overview and features5.  Module dependencies6.  Module loading7.  Module parameters8.  Optional device control through "sysfs"9.  Supported devices10. Notes for V4L2 application developers11. Video frame formats12. Contact information13. Credits1. Copyright============Copyright (C) 2004-2007 by Luca Risolia <luca.risolia@studio.unibo.it>2. Disclaimer=============SONiX is a trademark of SONiX Technology Company Limited, inc.This software is not sponsored or developed by SONiX.3. License==========This program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe 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 ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.4. Overview and features========================This driver attempts to support the video interface of the devices assemblingthe SONiX SN9C101, SN9C102, SN9C103, SN9C105 and SN9C120 PC Camera Controllers("SN9C1xx" from now on).The driver relies on the Video4Linux2 and USB core modules. It has beendesigned to run properly on SMP systems as well.The latest version of the SN9C1xx driver can be found at the following URL:http://www.linux-projects.org/Some of the features of the driver are:- full compliance with the Video4Linux2 API (see also "Notes for V4L2  application developers" paragraph);- available mmap or read/poll methods for video streaming through isochronous  data transfers;- automatic detection of image sensor;- support for built-in microphone interface;- support for any window resolutions and optional panning within the maximum  pixel area of image sensor;- image downscaling with arbitrary scaling factors from 1, 2 and 4 in both  directions (see "Notes for V4L2 application developers" paragraph);- two different video formats for uncompressed or compressed data in low or  high compression quality (see also "Notes for V4L2 application developers"  and "Video frame formats" paragraphs);- full support for the capabilities of many of the possible image sensors that  can be connected to the SN9C1xx bridges, including, for instance, red, green,  blue and global gain adjustments and exposure (see "Supported devices"  paragraph for details);- use of default color settings for sunlight conditions;- dynamic I/O interface for both SN9C1xx and image sensor control and  monitoring (see "Optional device control through 'sysfs'" paragraph);- dynamic driver control thanks to various module parameters (see "Module  parameters" paragraph);- up to 64 cameras can be handled at the same time; they can be connected and  disconnected from the host many times without turning off the computer, if  the system supports hotplugging;- no known bugs.5. Module dependencies======================For it to work properly, the driver needs kernel support for Video4Linux andUSB.The following options of the kernel configuration file must be enabled andcorresponding modules must be compiled:	# Multimedia devices	#	CONFIG_VIDEO_DEV=mTo enable advanced debugging functionality on the device through /sysfs:	# Multimedia devices	#	CONFIG_VIDEO_ADV_DEBUG=y	# USB support	#	CONFIG_USB=mIn addition, depending on the hardware being used, the modules below arenecessary:	# USB Host Controller Drivers	#	CONFIG_USB_EHCI_HCD=m	CONFIG_USB_UHCI_HCD=m	CONFIG_USB_OHCI_HCD=mThe SN9C103, SN9c105 and SN9C120 controllers also provide a built-in microphoneinterface. It is supported by the USB Audio driver thanks to the ALSA API:	# Sound	#	CONFIG_SOUND=y	# Advanced Linux Sound Architecture	#	CONFIG_SND=m	# USB devices	#	CONFIG_SND_USB_AUDIO=mAnd finally:	# USB Multimedia devices	#	CONFIG_USB_SN9C102=m6. Module loading=================To use the driver, it is necessary to load the "sn9c102" module into memoryafter every other module required: "videodev", "v4l2_common", "compat_ioctl32","usbcore" and, depending on the USB host controller you have, "ehci-hcd","uhci-hcd" or "ohci-hcd".Loading can be done as shown below:	[root@localhost home]# modprobe sn9c102Note that the module is called "sn9c102" for historic reasons, althought itdoes not just support the SN9C102.At this point all the devices supported by the driver and connected to the USBports should be recognized. You can invoke "dmesg" to analyze kernel messagesand verify that the loading process has gone well:	[user@localhost home]$ dmesgor, to isolate all the kernel messages generated by the driver:	[user@localhost home]$ dmesg | grep sn9c1027. Module parameters====================Module parameters are listed below:-------------------------------------------------------------------------------Name:           video_nrType:           short array (min = 0, max = 64)Syntax:         <-1|n[,...]>Description:    Specify V4L2 minor mode number:		-1 = use next available		 n = use minor number n		You can specify up to 64 cameras this way.		For example:		video_nr=-1,2,-1 would assign minor number 2 to the second		recognized camera and use auto for the first one and for every		other camera.Default:        -1-------------------------------------------------------------------------------Name:           force_munmapType:           bool array (min = 0, max = 64)Syntax:         <0|1[,...]>Description:    Force the application to unmap previously mapped buffer memory		before calling any VIDIOC_S_CROP or VIDIOC_S_FMT ioctl's. Not		all the applications support this feature. This parameter is		specific for each detected camera.		0 = do not force memory unmapping		1 = force memory unmapping (save memory)Default:        0-------------------------------------------------------------------------------Name:           frame_timeoutType:           uint array (min = 0, max = 64)Syntax:         <0|n[,...]>Description:    Timeout for a video frame in seconds before returning an I/O		error; 0 for infinity. This parameter is specific for each		detected camera and can be changed at runtime thanks to the		/sys filesystem interface.Default:        2-------------------------------------------------------------------------------Name:           debugType:           ushortSyntax:         <n>Description:    Debugging information level, from 0 to 3:		0 = none (use carefully)		1 = critical errors		2 = significant informations		3 = more verbose messages		Level 3 is useful for testing only. It also shows some more		informations about the hardware being detected.		This parameter can be changed at runtime thanks to the /sys		filesystem interface.Default:        2-------------------------------------------------------------------------------8. Optional device control through "sysfs" [1]==========================================If the kernel has been compiled with the CONFIG_VIDEO_ADV_DEBUG option enabled,it is possible to read and write both the SN9C1xx and the image sensorregisters by using the "sysfs" filesystem interface.Every time a supported device is recognized, a write-only file named "green" iscreated in the /sys/class/video4linux/videoX directory. You can set the greenchannel's gain by writing the desired value to it. The value may range from 0to 15 for the SN9C101 or SN9C102 bridges, from 0 to 127 for the SN9C103,SN9C105 and SN9C120 bridges.Similarly, only for the SN9C103, SN9C105 and SN9C120 controllers, blue and redgain control files are available in the same directory, for which acceptedvalues may range from 0 to 127.There are other four entries in the directory above for each registered camera:"reg", "val", "i2c_reg" and "i2c_val". The first two files control theSN9C1xx bridge, while the other two control the sensor chip. "reg" and"i2c_reg" hold the values of the current register index where the followingreading/writing operations are addressed at through "val" and "i2c_val". Theiruse is not intended for end-users. Note that "i2c_reg" and "i2c_val" will notbe created if the sensor does not actually support the standard I2C protocol orits registers are not 8-bit long. Also, remember that you must be logged in asroot before writing to them.As an example, suppose we were to want to read the value contained in theregister number 1 of the sensor register table - which is usually the productidentifier - of the camera registered as "/dev/video0":	[root@localhost #] cd /sys/class/video4linux/video0	[root@localhost #] echo 1 > i2c_reg	[root@localhost #] cat i2c_valNote that "cat" will fail if sensor registers cannot be read.Now let's set the green gain's register of the SN9C101 or SN9C102 chips to 2:	[root@localhost #] echo 0x11 > reg	[root@localhost #] echo 2 > valNote that the SN9C1xx always returns 0 when some of its registers are read.To avoid race conditions, all the I/O accesses to the above files areserialized.The sysfs interface also provides the "frame_header" entry, which exports theframe header of the most recent requested and captured video frame. The headeris always 18-bytes long and is appended to every video frame by the SN9C1xxcontrollers. As an example, this additional information can be used by the userapplication for implementing auto-exposure features via software.The following table describes the frame header exported by the SN9C101 andSN9C102:Byte #  Value or bits Description------  ------------- -----------0x00    0xFF          Frame synchronisation pattern0x01    0xFF          Frame synchronisation pattern0x02    0x00          Frame synchronisation pattern0x03    0xC4          Frame synchronisation pattern0x04    0xC4          Frame synchronisation pattern0x05    0x96          Frame synchronisation pattern0x06    [3:0]         Read channel gain control = (1+R_GAIN/8)	[7:4]         Blue channel gain control = (1+B_GAIN/8)0x07    [ 0 ]         Compression mode. 0=No compression, 1=Compression enabled	[2:1]         Maximum scale factor for compression	[ 3 ]         1 = USB fifo(2K bytes) is full	[ 4 ]         1 = Digital gain is finish	[ 5 ]         1 = Exposure is finish	[7:6]         Frame index0x08    [7:0]         Y sum inside Auto-Exposure area (low-byte)0x09    [7:0]         Y sum inside Auto-Exposure area (high-byte)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -