diff options
Diffstat (limited to 'Documentation/DocBook')
20 files changed, 1020 insertions, 264 deletions
diff --git a/Documentation/DocBook/kgdb.tmpl b/Documentation/DocBook/kgdb.tmpl index 5cff41a..55f12ac 100644 --- a/Documentation/DocBook/kgdb.tmpl +++ b/Documentation/DocBook/kgdb.tmpl @@ -4,7 +4,7 @@ <book id="kgdbOnLinux"> <bookinfo> - <title>Using kgdb and the kgdb Internals</title> + <title>Using kgdb, kdb and the kernel debugger internals</title> <authorgroup> <author> @@ -17,33 +17,8 @@ </affiliation> </author> </authorgroup> - - <authorgroup> - <author> - <firstname>Tom</firstname> - <surname>Rini</surname> - <affiliation> - <address> - <email>trini@kernel.crashing.org</email> - </address> - </affiliation> - </author> - </authorgroup> - - <authorgroup> - <author> - <firstname>Amit S.</firstname> - <surname>Kale</surname> - <affiliation> - <address> - <email>amitkale@linsyssoft.com</email> - </address> - </affiliation> - </author> - </authorgroup> - <copyright> - <year>2008</year> + <year>2008,2010</year> <holder>Wind River Systems, Inc.</holder> </copyright> <copyright> @@ -69,41 +44,76 @@ <chapter id="Introduction"> <title>Introduction</title> <para> - kgdb is a source level debugger for linux kernel. It is used along - with gdb to debug a linux kernel. The expectation is that gdb can - be used to "break in" to the kernel to inspect memory, variables - and look through call stack information similar to what an - application developer would use gdb for. It is possible to place - breakpoints in kernel code and perform some limited execution - stepping. + The kernel has two different debugger front ends (kdb and kgdb) + which interface to the debug core. It is possible to use either + of the debugger front ends and dynamically transition between them + if you configure the kernel properly at compile and runtime. + </para> + <para> + Kdb is simplistic shell-style interface which you can use on a + system console with a keyboard or serial console. You can use it + to inspect memory, registers, process lists, dmesg, and even set + breakpoints to stop in a certain location. Kdb is not a source + level debugger, although you can set breakpoints and execute some + basic kernel run control. Kdb is mainly aimed at doing some + analysis to aid in development or diagnosing kernel problems. You + can access some symbols by name in kernel built-ins or in kernel + modules if the code was built + with <symbol>CONFIG_KALLSYMS</symbol>. + </para> + <para> + Kgdb is intended to be used as a source level debugger for the + Linux kernel. It is used along with gdb to debug a Linux kernel. + The expectation is that gdb can be used to "break in" to the + kernel to inspect memory, variables and look through call stack + information similar to the way an application developer would use + gdb to debug an application. It is possible to place breakpoints + in kernel code and perform some limited execution stepping. </para> <para> - Two machines are required for using kgdb. One of these machines is a - development machine and the other is a test machine. The kernel - to be debugged runs on the test machine. The development machine - runs an instance of gdb against the vmlinux file which contains - the symbols (not boot image such as bzImage, zImage, uImage...). - In gdb the developer specifies the connection parameters and - connects to kgdb. The type of connection a developer makes with - gdb depends on the availability of kgdb I/O modules compiled as - builtin's or kernel modules in the test machine's kernel. + Two machines are required for using kgdb. One of these machines is + a development machine and the other is the target machine. The + kernel to be debugged runs on the target machine. The development + machine runs an instance of gdb against the vmlinux file which + contains the symbols (not boot image such as bzImage, zImage, + uImage...). In gdb the developer specifies the connection + parameters and connects to kgdb. The type of connection a + developer makes with gdb depends on the availability of kgdb I/O + modules compiled as built-ins or loadable kernel modules in the test + machine's kernel. </para> </chapter> <chapter id="CompilingAKernel"> - <title>Compiling a kernel</title> + <title>Compiling a kernel</title> + <para> + <itemizedlist> + <listitem><para>In order to enable compilation of kdb, you must first enable kgdb.</para></listitem> + <listitem><para>The kgdb test compile options are described in the kgdb test suite chapter.</para></listitem> + </itemizedlist> + </para> + <sect1 id="CompileKGDB"> + <title>Kernel config options for kgdb</title> <para> To enable <symbol>CONFIG_KGDB</symbol> you should first turn on "Prompt for development and/or incomplete code/drivers" (CONFIG_EXPERIMENTAL) in "General setup", then under the - "Kernel debugging" select "KGDB: kernel debugging with remote gdb". + "Kernel debugging" select "KGDB: kernel debugger". + </para> + <para> + While it is not a hard requirement that you have symbols in your + vmlinux file, gdb tends not to be very useful without the symbolic + data, so you will want to turn + on <symbol>CONFIG_DEBUG_INFO</symbol> which is called "Compile the + kernel with debug info" in the config menu. </para> <para> It is advised, but not required that you turn on the - CONFIG_FRAME_POINTER kernel option. This option inserts code to - into the compiled executable which saves the frame information in - registers or on the stack at different points which will allow a - debugger such as gdb to more accurately construct stack back traces - while debugging the kernel. + <symbol>CONFIG_FRAME_POINTER</symbol> kernel option which is called "Compile the + kernel with frame pointers" in the config menu. This option + inserts code to into the compiled executable which saves the frame + information in registers or on the stack at different points which + allows a debugger such as gdb to more accurately construct + stack back traces while debugging the kernel. </para> <para> If the architecture that you are using supports the kernel option @@ -116,38 +126,160 @@ this option. </para> <para> - Next you should choose one of more I/O drivers to interconnect debugging - host and debugged target. Early boot debugging requires a KGDB - I/O driver that supports early debugging and the driver must be - built into the kernel directly. Kgdb I/O driver configuration - takes place via kernel or module parameters, see following - chapter. + Next you should choose one of more I/O drivers to interconnect + debugging host and debugged target. Early boot debugging requires + a KGDB I/O driver that supports early debugging and the driver + must be built into the kernel directly. Kgdb I/O driver + configuration takes place via kernel or module parameters which + you can learn more about in the in the section that describes the + parameter "kgdboc". </para> - <para> - The kgdb test compile options are described in the kgdb test suite chapter. + <para>Here is an example set of .config symbols to enable or + disable for kgdb: + <itemizedlist> + <listitem><para># CONFIG_DEBUG_RODATA is not set</para></listitem> + <listitem><para>CONFIG_FRAME_POINTER=y</para></listitem> + <listitem><para>CONFIG_KGDB=y</para></listitem> + <listitem><para>CONFIG_KGDB_SERIAL_CONSOLE=y</para></listitem> + </itemizedlist> </para> - + </sect1> + <sect1 id="CompileKDB"> + <title>Kernel config options for kdb</title> + <para>Kdb is quite a bit more complex than the simple gdbstub + sitting on top of the kernel's debug core. Kdb must implement a + shell, and also adds some helper functions in other parts of the + kernel, responsible for printing out interesting data such as what + you would see if you ran "lsmod", or "ps". In order to build kdb + into the kernel you follow the same steps as you would for kgdb. + </para> + <para>The main config option for kdb + is <symbol>CONFIG_KGDB_KDB</symbol> which is called "KGDB_KDB: + include kdb frontend for kgdb" in the config menu. In theory you + would have already also selected an I/O driver such as the + CONFIG_KGDB_SERIAL_CONSOLE interface if you plan on using kdb on a + serial port, when you were configuring kgdb. + </para> + <para>If you want to use a PS/2-style keyboard with kdb, you would + select CONFIG_KDB_KEYBOARD which is called "KGDB_KDB: keyboard as + input device" in the config menu. The CONFIG_KDB_KEYBOARD option + is not used for anything in the gdb interface to kgdb. The + CONFIG_KDB_KEYBOARD option only works with kdb. + </para> + <para>Here is an example set of .config symbols to enable/disable kdb: + <itemizedlist> + <listitem><para># CONFIG_DEBUG_RODATA is not set</para></listitem> + <listitem><para>CONFIG_FRAME_POINTER=y</para></listitem> + <listitem><para>CONFIG_KGDB=y</para></listitem> + <listitem><para>CONFIG_KGDB_SERIAL_CONSOLE=y</para></listitem> + <listitem><para>CONFIG_KGDB_KDB=y</para></listitem> + <listitem><para>CONFIG_KDB_KEYBOARD=y</para></listitem> + </itemizedlist> + </para> + </sect1> </chapter> - <chapter id="EnableKGDB"> - <title>Enable kgdb for debugging</title> - <para> - In order to use kgdb you must activate it by passing configuration - information to one of the kgdb I/O drivers. If you do not pass any - configuration information kgdb will not do anything at all. Kgdb - will only actively hook up to the kernel trap hooks if a kgdb I/O - driver is loaded and configured. If you unconfigure a kgdb I/O - driver, kgdb will unregister all the kernel hook points. + <chapter id="kgdbKernelArgs"> + <title>Kernel Debugger Boot Arguments</title> + <para>This section describes the various runtime kernel + parameters that affect the configuration of the kernel debugger. + The following chapter covers using kdb and kgdb as well as + provides some examples of the configuration parameters.</para> + <sect1 id="kgdboc"> + <title>Kernel parameter: kgdboc</title> + <para>The kgdboc driver was originally an abbreviation meant to + stand for "kgdb over console". Today it is the primary mechanism + to configure how to communicate from gdb to kgdb as well as the + devices you want to use to interact with the kdb shell. + </para> + <para>For kgdb/gdb, kgdboc is designed to work with a single serial + port. It is intended to cover the circumstance where you want to + use a serial console as your primary console as well as using it to + perform kernel debugging. It is also possible to use kgdb on a + serial port which is not designated as a system console. Kgdboc + may be configured as a kernel built-in or a kernel loadable module. + You can only make use of <constant>kgdbwait</constant> and early + debugging if you build kgdboc into the kernel as a built-in. </para> + <sect2 id="kgdbocArgs"> + <title>kgdboc arguments</title> + <para>Usage: <constant>kgdboc=[kbd][[,]serial_device][,baud]</constant></para> + <sect3 id="kgdbocArgs1"> + <title>Using loadable module or built-in</title> <para> - All drivers can be reconfigured at run time, if - <symbol>CONFIG_SYSFS</symbol> and <symbol>CONFIG_MODULES</symbol> - are enabled, by echo'ing a new config string to - <constant>/sys/module/<driver>/parameter/<option></constant>. - The driver can be unconfigured by passing an empty string. You cannot - change the configuration while the debugger is attached. Make sure - to detach the debugger with the <constant>detach</constant> command - prior to trying unconfigure a kgdb I/O driver. + <orderedlist> + <listitem><para>As a kernel built-in:</para> + <para>Use the kernel boot argument: <constant>kgdboc=<tty-device>,[baud]</constant></para></listitem> + <listitem> + <para>As a kernel loadable module:</para> + <para>Use the command: <constant>modprobe kgdboc kgdboc=<tty-device>,[baud]</constant></para> + <para>Here are two examples of how you might formate the kgdboc + string. The first is for an x86 target using the first serial port. + The second example is for the ARM Versatile AB using the second + serial port. + <orderedlist> + <listitem><para><constant>kgdboc=ttyS0,115200</constant></para></listitem> + <listitem><para><constant>kgdboc=ttyAMA1,115200</constant></para></listitem> + </orderedlist> </para> + </listitem> + </orderedlist></para> + </sect3> + <sect3 id="kgdbocArgs2"> + <title>Configure kgdboc at runtime with sysfs</title> + <para>At run time you can enable or disable kgdboc by echoing a + parameters into the sysfs. Here are two examples:</para> + <orderedlist> + <listitem><para>Enable kgdboc on ttyS0</para> + <para><constant>echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc</constant></para></listitem> + <listitem><para>Disable kgdboc</para> + <para><constant>echo "" > /sys/module/kgdboc/parameters/kgdboc</constant></para></listitem> + </orderedlist> + <para>NOTE: You do not need to specify the baud if you are + configuring the console on tty which is already configured or + open.</para> + </sect3> + <sect3 id="kgdbocArgs3"> + <title>More examples</title> + <para>You can configure kgdboc to use the keyboard, and or a serial device + depending on if you are using kdb and or kgdb, in one of the + following scenarios. + <orderedlist> + <listitem><para>kdb and kgdb over only a serial port</para> + <para><constant>kgdboc=<serial_device>[,baud]</constant></para> + <para>Example: <constant>kgdboc=ttyS0,115200</constant></para> + </listitem> + <listitem><para>kdb and kgdb with keyboard and a serial port</para> + <para><constant>kgdboc=kbd,<serial_device>[,baud]</constant></para> + <para>Example: <constant>kgdboc=kbd,ttyS0,115200</constant></para> + </listitem> + <listitem><para>kdb with a keyboard</para> + <para><constant>kgdboc=kbd</constant></para> + </listitem> + </orderedlist> + </para> + </sect3> + <para>NOTE: Kgdboc does not support interrupting the target via the + gdb remote protocol. You must manually send a sysrq-g unless you + have a proxy that splits console output to a terminal program. + A console proxy has a separate TCP port for the debugger and a separate + TCP port for the "human" console. The proxy can take care of sending + the sysrq-g for you. + </para> + <para>When using kgdboc with no debugger proxy, you can end up + connecting the debugger at one of two entry points. If an + exception occurs after you have loaded kgdboc, a message should + print on the console stating it is waiting for the debugger. In + this case you disconnect your terminal program and then connect the + debugger in its place. If you want to interrupt the target system + and forcibly enter a debug session you have to issue a Sysrq + sequence and then type the letter <constant>g</constant>. Then + you disconnect the terminal session and connect gdb. Your options + if you don't like this are to hack gdb to send the sysrq-g for you + as well as on the initial connect, or to use a debugger proxy that + allows an unmodified gdb to do the debugging. + </para> + </sect2> + </sect1> <sect1 id="kgdbwait"> <title>Kernel parameter: kgdbwait</title> <para> @@ -162,103 +294,204 @@ </para> <para> The kernel will stop and wait as early as the I/O driver and - architecture will allow when you use this option. If you build the - kgdb I/O driver as a kernel module kgdbwait will not do anything. + architecture allows when you use this option. If you build the + kgdb I/O driver as a loadable kernel module kgdbwait will not do + anything. </para> </sect1> - <sect1 id="kgdboc"> - <title>Kernel parameter: kgdboc</title> - <para> - The kgdboc driver was originally an abbreviation meant to stand for - "kgdb over console". Kgdboc is designed to work with a single - serial port. It was meant to cover the circumstance - where you wanted to use a serial console as your primary console as - well as using it to perform kernel debugging. Of course you can - also use kgdboc without assigning a console to the same port. + <sect1 id="kgdbcon"> + <title>Kernel parameter: kgdbcon</title> + <para> The kgdbcon feature allows you to see printk() messages + inside gdb while gdb is connected to the kernel. Kdb does not make + use of the kgdbcon feature. + </para> + <para>Kgdb supports using the gdb serial protocol to send console + messages to the debugger when the debugger is connected and running. + There are two ways to activate this feature. + <orderedlist> + <listitem><para>Activate with the kernel command line option:</para> + <para><constant>kgdbcon</constant></para> + </listitem> + <listitem><para>Use sysfs before configuring an I/O driver</para> + <para> + <constant>echo 1 > /sys/module/kgdb/parameters/kgdb_use_con</constant> + </para> + <para> + NOTE: If you do this after you configure the kgdb I/O driver, the + setting will not take effect until the next point the I/O is + reconfigured. + </para> + </listitem> + </orderedlist> + <para>IMPORTANT NOTE: You cannot use kgdboc + kgdbcon on a tty that is an + active system console. An example incorrect usage is <constant>console=ttyS0,115200 kgdboc=ttyS0 kgdbcon</constant> + </para> + <para>It is possible to use this option with kgdboc on a tty that is not a system console. + </para> </para> - <sect2 id="UsingKgdboc"> - <title>Using kgdboc</title> - <para> - You can configure kgdboc via sysfs or a module or kernel boot line - parameter depending on if you build with CONFIG_KGDBOC as a module - or built-in. - <orderedlist> - <listitem><para>From the module load or build-in</para> - <para><constant>kgdboc=<tty-device>,[baud]</constant></para> + </sect1> + </chapter> + <chapter id="usingKDB"> + <title>Using kdb</title> <para> - The example here would be if your console port was typically ttyS0, you would use something like <constant>kgdboc=ttyS0,115200</constant> or on the ARM Versatile AB you would likely use <constant>kgdboc=ttyAMA0,115200</constant> + </para> + <sect1 id="quickKDBserial"> + <title>Quick start for kdb on a serial port</title> + <para>This is a quick example of how to use kdb.</para> + <para><orderedlist> + <listitem><para>Boot kernel with arguments: + <itemizedlist> + <listitem><para><constant>console=ttyS0,115200 kgdboc=ttyS0,115200</constant></para></listitem> + </itemizedlist></para> + <para>OR</para> + <para>Configure kgdboc after the kernel booted; assuming you are using a serial port console: + <itemizedlist> + <listitem><para><constant>echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc</constant></para></listitem> + </itemizedlist> </para> </listitem> - <listitem><para>From sysfs</para> - <para><constant>echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc</constant></para> + <listitem><para>Enter the kernel debugger manually or by waiting for an oops or fault. There are several ways you can enter the kernel debugger manually; all involve using the sysrq-g, which means you must have enabled CONFIG_MAGIC_SYSRQ=y in your kernel config.</para> + <itemizedlist> + <listitem><para>When logged in as root or with a super user session you can run:</para> + <para><constant>echo g > /proc/sysrq-trigger</constant></para></listitem> + <listitem><para>Example using minicom 2.2</para> + <para>Press: <constant>Control-a</constant></para> + <para>Press: <constant>f</constant></para> + <para>Press: <constant>g</constant></para> </listitem> - </orderedlist> - </para> - <para> - NOTE: Kgdboc does not support interrupting the target via the - gdb remote protocol. You must manually send a sysrq-g unless you - have a proxy that splits console output to a terminal problem and - has a separate port for the debugger to connect to that sends the - sysrq-g for you. + <listitem><para>When you have telneted to a terminal server that supports sending a remote break</para> + <para>Press: <constant>Control-]</constant></para> + <para>Type in:<constant>send break</constant></para> + <para>Press: <constant>Enter</constant></para> + <para>Press: <constant>g</constant></para> + </listitem> + </itemizedlist> + </listitem> + <listitem><para>From the kdb prompt you can run the "help" command to see a complete list of the commands that are available.</para> + <para>Some useful commands in kdb include: + <itemizedlist> + <listitem><para>lsmod -- Shows where kernel modules are loaded</para></listitem> + <listitem><para>ps -- Displays only the active processes</para></listitem> + <listitem><para>ps A -- Shows all the processes</para></listitem> + <listitem><para>summary -- Shows kernel version info and memory usage</para></listitem> + <listitem><para>bt -- Get a backtrace of the current process using dump_stack()</para></listitem> + <listitem><para>dmesg -- View the kernel syslog buffer</para></listitem> + <listitem><para>go -- Continue the system</para></listitem> + </itemizedlist> </para> - <para>When using kgdboc with no debugger proxy, you can end up - connecting the debugger for one of two entry points. If an - exception occurs after you have loaded kgdboc a message should print - on the console stating it is waiting for the debugger. In case you - disconnect your terminal program and then connect the debugger in - its place. If you want to interrupt the target system and forcibly - enter a debug session you have to issue a Sysrq sequence and then - type the letter <constant>g</constant>. Then you disconnect the - terminal session and connect gdb. Your options if you don't like - this are to hack gdb to send the sysrq-g for you as well as on the - initial connect, or to use a debugger proxy that allows an - unmodified gdb to do the debugging. + </listitem> + <listitem> + <para>When you are done using kdb you need to consider rebooting the + system or using the "go" command to resuming normal kernel + execution. If you have paused the kernel for a lengthy period of + time, applications that rely on timely networking or anything to do + with real wall clock time could be adversely affected, so you + should take this into consideration when using the kernel + debugger.</para> + </listitem> + </orderedlist></para> + </sect1> + <sect1 id="quickKDBkeyboard"> + <title>Quick start for kdb using a keyboard connected console</title> + <para>This is a quick example of how to use kdb with a keyboard.</para> + <para><orderedlist> + <listitem><para>Boot kernel with arguments: + <itemizedlist> + <listitem><para><constant>kgdboc=kbd</constant></para></listitem> + </itemizedlist></para> + <para>OR</para> + <para>Configure kgdboc after the kernel booted: + <itemizedlist> + <listitem><para><constant>echo kbd > /sys/module/kgdboc/parameters/kgdboc</constant></para></listitem> + </itemizedlist> </para> - </sect2> + </listitem> + <listitem><para>Enter the kernel debugger manually or by waiting for an oops or fault. There are several ways you can enter the kernel debugger manually; all involve using the sysrq-g, which means you must have enabled CONFIG_MAGIC_SYSRQ=y in your kernel config.</para> + <itemizedlist> + <listitem><para>When logged in as root or with a super user session you can run:</para> + <para><constant>echo g > /proc/sysrq-trigger</constant></para></listitem> + <listitem><para>Example using a laptop keyboard</para> + <para>Press and hold down: <constant>Alt</constant></para> + <para>Press and hold down: <constant>Fn</constant></para> + <para>Press and release the key with the label: <constant>SysRq</constant></para> + <para>Release: <constant>Fn</constant></para> + <para>Press and release: <constant>g</constant></para> + <para>Release: <constant>Alt</constant></para> + </listitem> + <listitem><para>Example using a PS/2 101-key keyboard</para> + <para>Press and hold down: <constant>Alt</constant></para> + <para>Press and release the key with the label: <constant>SysRq</constant></para> + <para>Press and release: <constant>g</constant></para> + <para>Release: <constant>Alt</constant></para> + </listitem> + </itemizedlist> + </listitem> + <listitem> + <para>Now type in a kdb command such as "help", "dmesg", "bt" or "go" to continue kernel execution.</para> + </listitem> + </orderedlist></para> </sect1> - <sect1 id="kgdbcon"> - <title>Kernel parameter: kgdbcon</title> - <para> - Kgdb supports using the gdb serial protocol to send console messages - to the debugger when the debugger is connected and running. There - are two ways to activate this feature. + </chapter> + <chapter id="EnableKGDB"> + <title>Using kgdb / gdb</title> + <para>In order to use kgdb you must activate it by passing + configuration information to one of the kgdb I/O drivers. If you + do not pass any configuration information kgdb will not do anything + at all. Kgdb will only actively hook up to the kernel trap hooks + if a kgdb I/O driver is loaded and configured. If you unconfigure + a kgdb I/O driver, kgdb will unregister all the kernel hook points. + </para> + <para> All kgdb I/O drivers can be reconfigured at run time, if + <symbol>CONFIG_SYSFS</symbol> and <symbol>CONFIG_MODULES</symbol> + are enabled, by echo'ing a new config string to + <constant>/sys/module/<driver>/parameter/<option></constant>. + The driver can be unconfigured by passing an empty string. You cannot + change the configuration while the debugger is attached. Make sure + to detach the debugger with the <constant>detach</constant> command + prior to trying to unconfigure a kgdb I/O driver. + </para> + <sect1 id="ConnectingGDB"> + <title>Connecting with gdb to a serial port</title> <orderedlist> - <listitem><para>Activate with the kernel command line option:</para> - <para><constant>kgdbcon</constant></para> + <listitem><para>Configure kgdboc</para> + <para>Boot kernel with arguments: + <itemizedlist> + <listitem><para><constant>kgdboc=ttyS0,115200</constant></para></listitem> + </itemizedlist></para> + <para>OR</para> + <para>Configure kgdboc after the kernel booted: + <itemizedlist> + <listitem><para><constant>echo ttyS0 > /sys/module/kgdboc/parameters/kgdboc</constant></para></listitem> + </itemizedlist></para> </listitem> - <listitem><para>Use sysfs before configuring an io driver</para> - <para> - <constant>echo 1 > /sys/module/kgdb/parameters/kgdb_use_con</constant> - </para> - <para> - NOTE: If you do this after you configure the kgdb I/O driver, the - setting will not take effect until the next point the I/O is - reconfigured. - </para> + <listitem> + <para>Stop kernel execution (break into the debugger)</para> + <para>In order to connect to gdb via kgdboc, the kernel must + first be stopped. There are several ways to stop the kernel which + include using kgdbwait as a boot argument, via a sysrq-g, or running + the kernel until it takes an exception where it waits for the + debugger to attach. + <itemizedlist> + <listitem><para>When logged in as root or with a super user session you can run:</para> + <para><constant>echo g > /proc/sysrq-trigger</constant></para></listitem> + <listitem><para>Example using minicom 2.2</para> + <para>Press: <constant>Control-a</constant></para> + <para>Press: <constant>f</constant></para> + <para>Press: <constant>g</constant></para> </listitem> - </orderedlist> - </para> - <para> - IMPORTANT NOTE: Using this option with kgdb over the console - (kgdboc) is not supported. + <listitem><para>When you have telneted to a terminal server that supports sending a remote break</para> + <para>Press: <constant>Control-]</constant></para> + <para>Type in:<constant>send break</constant></para> + <para>Press: <constant>Enter</constant></para> + <para>Press: <constant>g</constant></para> + </listitem> + </itemizedlist> </para> - </sect1> - </chapter> - <chapter id="ConnectingGDB"> - <title>Connecting gdb</title> - <para> - If you are using kgdboc, you need to have used kgdbwait as a boot - argument, issued a sysrq-g, or the system you are going to debug - has already taken an exception and is waiting for the debugger to - attach before you can connect gdb. - </para> - <para> - If you are not using different kgdb I/O driver other than kgdboc, - you should be able to connect and the target will automatically - respond. - </para> + </listitem> + <listitem> + <para>Connect from from gdb</para> <para> - Example (using a serial port): + Example (using a directly connected port): </para> <programlisting> % gdb ./vmlinux @@ -266,7 +499,7 @@ (gdb) target remote /dev/ttyS0 </programlisting> <para> - Example (kgdb to a terminal server on tcp port 2012): + Example (kgdb to a terminal server on TCP port 2012): </para> <programlisting> % gdb ./vmlinux @@ -283,6 +516,83 @@ communications. You do this prior to issuing the <constant>target remote</constant> command by typing in: <constant>set debug remote 1</constant> </para> + </listitem> + </orderedlist> + <para>Remember if you continue in gdb, and need to "break in" again, + you need to issue an other sysrq-g. It is easy to create a simple + entry point by putting a breakpoint at <constant>sys_sync</constant> + and then you can run "sync" from a shell or script to break into the + debugger.</para> + </sect1> + </chapter> + <chapter id="switchKdbKgdb"> + <title>kgdb and kdb interoperability</title> + <para>It is possible to transition between kdb and kgdb dynamically. + The debug core will remember which you used the last time and + automatically start in the same mode.</para> + <sect1> + <title>Switching between kdb and kgdb</title> + <sect2> + <title>Switching from kgdb to kdb</title> + <para> + There are two ways to switch from kgdb to kdb: you can use gdb to + issue a maintenance packet, or you can blindly type the command $3#33. + Whenever kernel debugger stops in kgdb mode it will print the + message <constant>KGDB or $3#33 for KDB</constant>. It is important + to note that you have to type the sequence correctly in one pass. + You cannot type a backspace or delete because kgdb will interpret + that as part of the debug stream. + <orderedlist> + <listitem><para>Change from kgdb to kdb by blindly typing:</para> + <para><constant>$3#33</constant></para></listitem> + <listitem><para>Change from kgdb to kdb with gdb</para> + <para><constant>maintenance packet 3</constant></para> + <para>NOTE: Now you must kill gdb. Typically you press control-z and + issue the command: kill -9 %</para></listitem> + </orderedlist> + </para> + </sect2> + <sect2> + <title>Change from kdb to kgdb</title> + <para>There are two ways you can change from kdb to kgdb. You can + manually enter kgdb mode by issuing the kgdb command from the kdb + shell prompt, or you can connect gdb while the kdb shell prompt is + active. The kdb shell looks for the typical first commands that gdb + would issue with the gdb remote protocol and if it sees one of those + commands it automatically changes into kgdb mode.</para> + <orderedlist> + <listitem><para>From kdb issue the command:</para> + <para><constant>kgdb</constant></para> + <para>Now disconnect your terminal program and connect gdb in its place</para></listitem> + <listitem><para>At the kdb prompt, disconnect the terminal program and connect gdb in its place.</para></listitem> + </orderedlist> + </sect2> + </sect1> + <sect1> + <title>Running kdb commands from gdb</title> + <para>It is possible to run a limited set of kdb commands from gdb, + using the gdb monitor command. You don't want to execute any of the + run control or breakpoint operations, because it can disrupt the + state of the kernel debugger. You should be using gdb for + breakpoints and run control operations if you have gdb connected. + The more useful commands to run are things like lsmod, dmesg, ps or + possibly some of the memory information commands. To see all the kdb + commands you can run <constant>monitor help</constant>.</para> + <para>Example: + <informalexample><programlisting> +(gdb) monitor ps +1 idle process (state I) and +27 sleeping system daemon (state M) processes suppressed, +use 'ps A' to see all. +Task Addr Pid Parent [*] cpu State Thread Command + +0xc78291d0 1 0 0 0 S 0xc7829404 init +0xc7954150 942 1 0 0 S 0xc7954384 dropbear +0xc78789c0 944 1 0 0 S 0xc7878bf4 sh +(gdb) + </programlisting></informalexample> + </para> + </sect1> </chapter> <chapter id="KGDBTestSuite"> <title>kgdb Test Suite</title> @@ -309,34 +619,36 @@ </para> </chapter> <chapter id="CommonBackEndReq"> - <title>KGDB Internals</title> + <title>Kernel Debugger Internals</title> <sect1 id="kgdbArchitecture"> <title>Architecture Specifics</title> <para> - Kgdb is organized into three basic components: + The kernel debugger is organized into a number of components: <orderedlist> - <listitem><para>kgdb core</para> + <listitem><para>The debug core</para> <para> - The kgdb core is found in kernel/kgdb.c. It contains: + The debug core is found in kernel/debugger/debug_core.c. It contains: <itemizedlist> - <listitem><para>All the logic to implement the gdb serial protocol</para></listitem> - <listitem><para>A generic OS exception handler which includes sync'ing the processors into a stopped state on an multi cpu system.</para></listitem> + <listitem><para>A generic OS exception handler which includes + sync'ing the processors into a stopped state on an multi-CPU + system.</para></listitem> <listitem><para>The API to talk to the kgdb I/O drivers</para></listitem> - <listitem><para>The API to make calls to the arch specific kgdb implementation</para></listitem> + <listitem><para>The API to make calls to the arch-specific kgdb implementation</para></listitem> <listitem><para>The logic to perform safe memory reads and writes to memory while using the debugger</para></listitem> <listitem><para>A full implementation for software breakpoints unless overridden by the arch</para></listitem> + <listitem><para>The API to invoke either the kdb or kgdb frontend to the debug core.</para></listitem> </itemizedlist> </para> </listitem> - <listitem><para>kgdb arch specific implementation</para> + <listitem><para>kgdb arch-specific implementation</para> <para> This implementation is generally found in arch/*/kernel/kgdb.c. As an example, arch/x86/kernel/kgdb.c contains the specifics to implement HW breakpoint as well as the initialization to dynamically register and unregister for the trap handlers on - this architecture. The arch specific portion implements: + this architecture. The arch-specific portion implements: <itemizedlist> - <listitem><para>contains an arch specific trap catcher which + <listitem><para>contains an arch-specific trap catcher which invokes kgdb_handle_exception() to start kgdb about doing its work</para></listitem> <listitem><para>translation to and from gdb specific packet format to pt_regs</para></listitem> @@ -347,11 +659,35 @@ </itemizedlist> </para> </listitem> + <listitem><para>gdbstub frontend (aka kgdb)</para> + <para>The gdbstub is located in kernel/debug/gdbstub.c. It contains:</para> + <itemizedlist> + <listitem><para>All the logic to implement the gdb serial protocol</para></listitem> + </itemizedlist> + </listitem> + <listitem><para>kdb frontend</para> + <para>The kdb debugger shell is broken down into a number of + components. The kdb core is located in kernel/debug/kdb. There + are a number of helper functions in some of the other kernel + components to make it possible for kdb to examine and report + information about the kernel without taking locks that could + cause a kernel deadlock. The kdb core contains implements the following functionality.</para> + <itemizedlist> + <listitem><para>A simple shell</para></listitem> + <listitem><para>The kdb core command set</para></listitem> + <listitem><para>A registration API to register additional kdb shell commands.</para> + <para>A good example of a self-contained kdb module is the "ftdump" command for dumping the ftrace buffer. See: kernel/trace/trace_kdb.c</para></listitem> + <listitem><para>The implementation for kdb_printf() which + emits messages directly to I/O drivers, bypassing the kernel + log.</para></listitem> + <listitem><para>SW / HW breakpoint management for the kdb shell</para></listitem> + </itemizedlist> + </listitem> <listitem><para>kgdb I/O driver</para> <para> - Each kgdb I/O driver has to provide an implemenation for the following: + Each kgdb I/O driver has to provide an implementation for the following: <itemizedlist> - <listitem><para>configuration via builtin or module</para></listitem> + <listitem><para>configuration via built-in or module</para></listitem> <listitem><para>dynamic configuration and kgdb hook registration calls</para></listitem> <listitem><para>read and write character interface</para></listitem> <listitem><para>A cleanup handler for unconfiguring from the kgdb core</para></listitem> @@ -416,15 +752,15 @@ underlying low level to the hardware driver having "polling hooks" which the to which the tty driver is attached. In the initial implementation of kgdboc it the serial_core was changed to expose a - low level uart hook for doing polled mode reading and writing of a + low level UART hook for doing polled mode reading and writing of a single character while in an atomic context. When kgdb makes an I/O request to the debugger, kgdboc invokes a call back in the serial - core which in turn uses the call back in the uart driver. It is - certainly possible to extend kgdboc to work with non-uart based + core which in turn uses the call back in the UART driver. It is + certainly possible to extend kgdboc to work with non-UART based consoles in the future. </para> <para> - When using kgdboc with a uart, the uart driver must implement two callbacks in the <constant>struct uart_ops</constant>. Example from drivers/8250.c:<programlisting> + When using kgdboc with a UART, the UART driver must implement two callbacks in the <constant>struct uart_ops</constant>. Example from drivers/8250.c:<programlisting> #ifdef CONFIG_CONSOLE_POLL .poll_get_char = serial8250_get_poll_char, .poll_put_char = serial8250_put_poll_char, @@ -434,7 +770,7 @@ <constant>#ifdef CONFIG_CONSOLE_POLL</constant>, as shown above. Keep in mind that polling hooks have to be implemented in such a way that they can be called from an atomic context and have to restore - the state of the uart chip on return such that the system can return + the state of the UART chip on return such that the system can return to normal when the debugger detaches. You need to be very careful with any kind of lock you consider, because failing here is most going to mean pressing the reset button. @@ -453,6 +789,10 @@ <itemizedlist> <listitem><para>Jason Wessel<email>jason.wessel@windriver.com</email></para></listitem> </itemizedlist> + In Jan 2010 this document was updated to include kdb. + <itemizedlist> + <listitem><para>Jason Wessel<email>jason.wessel@windriver.com</email></para></listitem> + </itemizedlist> </para> </chapter> </book> diff --git a/Documentation/DocBook/libata.tmpl b/Documentation/DocBook/libata.tmpl index ff3e5be..8c5411c 100644 --- a/Documentation/DocBook/libata.tmpl +++ b/Documentation/DocBook/libata.tmpl @@ -81,16 +81,14 @@ void (*port_disable) (struct ata_port *); </programlisting> <para> - Called from ata_bus_probe() and ata_bus_reset() error paths, - as well as when unregistering from the SCSI module (rmmod, hot - unplug). + Called from ata_bus_probe() error path, as well as when + unregistering from the SCSI module (rmmod, hot unplug). This function should do whatever needs to be done to take the port out of use. In most cases, ata_port_disable() can be used as this hook. </para> <para> Called from ata_bus_probe() on a failed probe. - Called from ata_bus_reset() on a failed bus reset. Called from ata_scsi_release(). </para> @@ -227,6 +225,18 @@ u8 (*sff_check_altstatus)(struct ata_port *ap); </sect2> + <sect2><title>Write specific ATA shadow register</title> + <programlisting> +void (*sff_set_devctl)(struct ata_port *ap, u8 ctl); + </programlisting> + + <para> + Write the device control ATA shadow register to the hardware. + Most drivers don't need to define this. + </para> + + </sect2> + <sect2><title>Select ATA device on bus</title> <programlisting> void (*sff_dev_select)(struct ata_port *ap, unsigned int device); @@ -477,7 +487,7 @@ void (*host_stop) (struct ata_host_set *host_set); allocates space for a legacy IDE PRD table and returns. </para> <para> - ->port_stop() is called after ->host_stop(). It's sole function + ->port_stop() is called after ->host_stop(). Its sole function is to release DMA/memory resources, now that they are no longer actively being used. Many drivers also free driver-private data from port at this time. diff --git a/Documentation/DocBook/media-entities.tmpl b/Documentation/DocBook/media-entities.tmpl index c725cb8..5d4d40f4 100644 --- a/Documentation/DocBook/media-entities.tmpl +++ b/Documentation/DocBook/media-entities.tmpl @@ -17,6 +17,7 @@ <!ENTITY VIDIOC-DBG-G-REGISTER "<link linkend='vidioc-dbg-g-register'><constant>VIDIOC_DBG_G_REGISTER</constant></link>"> <!ENTITY VIDIOC-DBG-S-REGISTER "<link linkend='vidioc-dbg-g-register'><constant>VIDIOC_DBG_S_REGISTER</constant></link>"> <!ENTITY VIDIOC-DQBUF "<link linkend='vidioc-qbuf'><constant>VIDIOC_DQBUF</constant></link>"> +<!ENTITY VIDIOC-DQEVENT "<link linkend='vidioc-dqevent'><constant>VIDIOC_DQEVENT</constant></link>"> <!ENTITY VIDIOC-ENCODER-CMD "<link linkend='vidioc-encoder-cmd'><constant>VIDIOC_ENCODER_CMD</constant></link>"> <!ENTITY VIDIOC-ENUMAUDIO "<link linkend='vidioc-enumaudio'><constant>VIDIOC_ENUMAUDIO</constant></link>"> <!ENTITY VIDIOC-ENUMAUDOUT "<link linkend='vidioc-enumaudioout'><constant>VIDIOC_ENUMAUDOUT</constant></link>"> @@ -60,6 +61,7 @@ <!ENTITY VIDIOC-REQBUFS "<link linkend='vidioc-reqbufs'><constant>VIDIOC_REQBUFS</constant></link>"> <!ENTITY VIDIOC-STREAMOFF "<link linkend='vidioc-streamon'><constant>VIDIOC_STREAMOFF</constant></link>"> <!ENTITY VIDIOC-STREAMON "<link linkend='vidioc-streamon'><constant>VIDIOC_STREAMON</constant></link>"> +<!ENTITY VIDIOC-SUBSCRIBE-EVENT "<link linkend='vidioc-subscribe-event'><constant>VIDIOC_SUBSCRIBE_EVENT</constant></link>"> <!ENTITY VIDIOC-S-AUDIO "<link linkend='vidioc-g-audio'><constant>VIDIOC_S_AUDIO</constant></link>"> <!ENTITY VIDIOC-S-AUDOUT "<link linkend='vidioc-g-audioout'><constant>VIDIOC_S_AUDOUT</constant></link>"> <!ENTITY VIDIOC-S-CROP "<link linkend='vidioc-g-crop'><constant>VIDIOC_S_CROP</constant></link>"> @@ -83,6 +85,7 @@ <!ENTITY VIDIOC-TRY-ENCODER-CMD "<link linkend='vidioc-encoder-cmd'><constant>VIDIOC_TRY_ENCODER_CMD</constant></link>"> <!ENTITY VIDIOC-TRY-EXT-CTRLS "<link linkend='vidioc-g-ext-ctrls'><constant>VIDIOC_TRY_EXT_CTRLS</constant></link>"> <!ENTITY VIDIOC-TRY-FMT "<link linkend='vidioc-g-fmt'><constant>VIDIOC_TRY_FMT</constant></link>"> +<!ENTITY VIDIOC-UNSUBSCRIBE-EVENT "<link linkend='vidioc-subscribe-event'><constant>VIDIOC_UNSUBSCRIBE_EVENT</constant></link>"> <!-- Types --> <!ENTITY v4l2-std-id "<link linkend='v4l2-std-id'>v4l2_std_id</link>"> @@ -141,6 +144,9 @@ <!ENTITY v4l2-enc-idx "struct <link linkend='v4l2-enc-idx'>v4l2_enc_idx</link>"> <!ENTITY v4l2-enc-idx-entry "struct <link linkend='v4l2-enc-idx-entry'>v4l2_enc_idx_entry</link>"> <!ENTITY v4l2-encoder-cmd "struct <link linkend='v4l2-encoder-cmd'>v4l2_encoder_cmd</link>"> +<!ENTITY v4l2-event "struct <link linkend='v4l2-event'>v4l2_event</link>"> +<!ENTITY v4l2-event-subscription "struct <link linkend='v4l2-event-subscription'>v4l2_event_subscription</link>"> +<!ENTITY v4l2-event-vsync "struct <link linkend='v4l2-event-vsync'>v4l2_event_vsync</link>"> <!ENTITY v4l2-ext-control "struct <link linkend='v4l2-ext-control'>v4l2_ext_control</link>"> <!ENTITY v4l2-ext-controls "struct <link linkend='v4l2-ext-controls'>v4l2_ext_controls</link>"> <!ENTITY v4l2-fmtdesc "struct <link linkend='v4l2-fmtdesc'>v4l2_fmtdesc</link>"> @@ -200,6 +206,7 @@ <!ENTITY sub-controls SYSTEM "v4l/controls.xml"> <!ENTITY sub-dev-capture SYSTEM "v4l/dev-capture.xml"> <!ENTITY sub-dev-codec SYSTEM "v4l/dev-codec.xml"> +<!ENTITY sub-dev-event SYSTEM "v4l/dev-event.xml"> <!ENTITY sub-dev-effect SYSTEM "v4l/dev-effect.xml"> <!ENTITY sub-dev-osd SYSTEM "v4l/dev-osd.xml"> <!ENTITY sub-dev-output SYSTEM "v4l/dev-output.xml"> @@ -292,6 +299,8 @@ <!ENTITY sub-v4l2grab-c SYSTEM "v4l/v4l2grab.c.xml"> <!ENTITY sub-videodev2-h SYSTEM "v4l/videodev2.h.xml"> <!ENTITY sub-v4l2 SYSTEM "v4l/v4l2.xml"> +<!ENTITY sub-dqevent SYSTEM "v4l/vidioc-dqevent.xml"> +<!ENTITY sub-subscribe-event SYSTEM "v4l/vidioc-subscribe-event.xml"> <!ENTITY sub-intro SYSTEM "dvb/intro.xml"> <!ENTITY sub-frontend SYSTEM "dvb/frontend.xml"> <!ENTITY sub-dvbproperty SYSTEM "dvb/dvbproperty.xml"> @@ -381,3 +390,5 @@ <!ENTITY reqbufs SYSTEM "v4l/vidioc-reqbufs.xml"> <!ENTITY s-hw-freq-seek SYSTEM "v4l/vidioc-s-hw-freq-seek.xml"> <!ENTITY streamon SYSTEM "v4l/vidioc-streamon.xml"> +<!ENTITY dqevent SYSTEM "v4l/vidioc-dqevent.xml"> +<!ENTITY subscribe_event SYSTEM "v4l/vidioc-subscribe-event.xml"> diff --git a/Documentation/DocBook/mtdnand.tmpl b/Documentation/DocBook/mtdnand.tmpl index 133cd6c..020ac80 100644 --- a/Documentation/DocBook/mtdnand.tmpl +++ b/Documentation/DocBook/mtdnand.tmpl @@ -269,7 +269,7 @@ static void board_hwcontrol(struct mtd_info *mtd, int cmd) information about the device. </para> <programlisting> -int __init board_init (void) +static int __init board_init (void) { struct nand_chip *this; int err = 0; diff --git a/Documentation/DocBook/sh.tmpl b/Documentation/DocBook/sh.tmpl index 0c3dc4c..d858d92 100644 --- a/Documentation/DocBook/sh.tmpl +++ b/Documentation/DocBook/sh.tmpl @@ -19,13 +19,17 @@ </authorgroup> <copyright> - <year>2008</year> + <year>2008-2010</year> <holder>Paul Mundt</holder> </copyright> <copyright> - <year>2008</year> + <year>2008-2010</year> <holder>Renesas Technology Corp.</holder> </copyright> + <copyright> + <year>2010</year> + <holder>Renesas Electronics Corp.</holder> + </copyright> <legalnotice> <para> @@ -77,7 +81,7 @@ </chapter> <chapter id="clk"> <title>Clock Framework Extensions</title> -!Iarch/sh/include/asm/clock.h +!Iinclude/linux/sh_clk.h </chapter> <chapter id="mach"> <title>Machine Specific Interfaces</title> diff --git a/Documentation/DocBook/v4l/compat.xml b/Documentation/DocBook/v4l/compat.xml index b9dbdf9..b42b935 100644 --- a/Documentation/DocBook/v4l/compat.xml +++ b/Documentation/DocBook/v4l/compat.xml @@ -2332,15 +2332,26 @@ more information.</para> </listitem> </orderedlist> </section> - </section> + <section> + <title>V4L2 in Linux 2.6.34</title> + <orderedlist> + <listitem> + <para>Added +<constant>V4L2_CID_IRIS_ABSOLUTE</constant> and +<constant>V4L2_CID_IRIS_RELATIVE</constant> controls to the + <link linkend="camera-controls">Camera controls class</link>. + </para> + </listitem> + </orderedlist> + </section> - <section id="other"> - <title>Relation of V4L2 to other Linux multimedia APIs</title> + <section id="other"> + <title>Relation of V4L2 to other Linux multimedia APIs</title> - <section id="xvideo"> - <title>X Video Extension</title> + <section id="xvideo"> + <title>X Video Extension</title> - <para>The X Video Extension (abbreviated XVideo or just Xv) is + <para>The X Video Extension (abbreviated XVideo or just Xv) is an extension of the X Window system, implemented for example by the XFree86 project. Its scope is similar to V4L2, an API to video capture and output devices for X clients. Xv allows applications to display @@ -2351,7 +2362,7 @@ capture or output still images in XPixmaps<footnote> extension available across many operating systems and architectures.</para> - <para>Because the driver is embedded into the X server Xv has a + <para>Because the driver is embedded into the X server Xv has a number of advantages over the V4L2 <link linkend="overlay">video overlay interface</link>. The driver can easily determine the overlay target, &ie; visible graphics memory or off-screen buffers for a @@ -2360,16 +2371,16 @@ overlay, scaling or color-keying, or the clipping functions of the video capture hardware, always in sync with drawing operations or windows moving or changing their stacking order.</para> - <para>To combine the advantages of Xv and V4L a special Xv + <para>To combine the advantages of Xv and V4L a special Xv driver exists in XFree86 and XOrg, just programming any overlay capable Video4Linux device it finds. To enable it <filename>/etc/X11/XF86Config</filename> must contain these lines:</para> - <para><screen> + <para><screen> Section "Module" Load "v4l" EndSection</screen></para> - <para>As of XFree86 4.2 this driver still supports only V4L + <para>As of XFree86 4.2 this driver still supports only V4L ioctls, however it should work just fine with all V4L2 devices through the V4L2 backward-compatibility layer. Since V4L2 permits multiple opens it is possible (if supported by the V4L2 driver) to capture @@ -2377,83 +2388,84 @@ video while an X client requested video overlay. Restrictions of simultaneous capturing and overlay are discussed in <xref linkend="overlay" /> apply.</para> - <para>Only marginally related to V4L2, XFree86 extended Xv to + <para>Only marginally related to V4L2, XFree86 extended Xv to support hardware YUV to RGB conversion and scaling for faster video playback, and added an interface to MPEG-2 decoding hardware. This API is useful to display images captured with V4L2 devices.</para> - </section> + </section> - <section> - <title>Digital Video</title> + <section> + <title>Digital Video</title> - <para>V4L2 does not support digital terrestrial, cable or + <para>V4L2 does not support digital terrestrial, cable or satellite broadcast. A separate project aiming at digital receivers exists. You can find its homepage at <ulink url="http://linuxtv.org">http://linuxtv.org</ulink>. The Linux DVB API has no connection to the V4L2 API except that drivers for hybrid hardware may support both.</para> - </section> + </section> - <section> - <title>Audio Interfaces</title> + <section> + <title>Audio Interfaces</title> - <para>[to do - OSS/ALSA]</para> + <para>[to do - OSS/ALSA]</para> + </section> </section> - </section> - <section id="experimental"> - <title>Experimental API Elements</title> + <section id="experimental"> + <title>Experimental API Elements</title> - <para>The following V4L2 API elements are currently experimental + <para>The following V4L2 API elements are currently experimental and may change in the future.</para> - <itemizedlist> - <listitem> - <para>Video Output Overlay (OSD) Interface, <xref + <itemizedlist> + <listitem> + <para>Video Output Overlay (OSD) Interface, <xref linkend="osd" />.</para> - </listitem> + </listitem> <listitem> - <para><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY</constant>, + <para><constant>V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY</constant>, &v4l2-buf-type;, <xref linkend="v4l2-buf-type" />.</para> - </listitem> - <listitem> - <para><constant>V4L2_CAP_VIDEO_OUTPUT_OVERLAY</constant>, + </listitem> + <listitem> + <para><constant>V4L2_CAP_VIDEO_OUTPUT_OVERLAY</constant>, &VIDIOC-QUERYCAP; ioctl, <xref linkend="device-capabilities" />.</para> - </listitem> - <listitem> - <para>&VIDIOC-ENUM-FRAMESIZES; and + </listitem> + <listitem> + <para>&VIDIOC-ENUM-FRAMESIZES; and &VIDIOC-ENUM-FRAMEINTERVALS; ioctls.</para> - </listitem> - <listitem> - <para>&VIDIOC-G-ENC-INDEX; ioctl.</para> - </listitem> - <listitem> - <para>&VIDIOC-ENCODER-CMD; and &VIDIOC-TRY-ENCODER-CMD; + </listitem> + <listitem> + <para>&VIDIOC-G-ENC-INDEX; ioctl.</para> + </listitem> + <listitem> + <para>&VIDIOC-ENCODER-CMD; and &VIDIOC-TRY-ENCODER-CMD; ioctls.</para> - </listitem> - <listitem> - <para>&VIDIOC-DBG-G-REGISTER; and &VIDIOC-DBG-S-REGISTER; + </listitem> + <listitem> + <para>&VIDIOC-DBG-G-REGISTER; and &VIDIOC-DBG-S-REGISTER; ioctls.</para> - </listitem> - <listitem> - <para>&VIDIOC-DBG-G-CHIP-IDENT; ioctl.</para> - </listitem> - </itemizedlist> - </section> + </listitem> + <listitem> + <para>&VIDIOC-DBG-G-CHIP-IDENT; ioctl.</para> + </listitem> + </itemizedlist> + </section> - <section id="obsolete"> - <title>Obsolete API Elements</title> + <section id="obsolete"> + <title>Obsolete API Elements</title> - <para>The following V4L2 API elements were superseded by new + <para>The following V4L2 API elements were superseded by new interfaces and should not be implemented in new drivers.</para> - <itemizedlist> - <listitem> - <para><constant>VIDIOC_G_MPEGCOMP</constant> and + <itemizedlist> + <listitem> + <para><constant>VIDIOC_G_MPEGCOMP</constant> and <constant>VIDIOC_S_MPEGCOMP</constant> ioctls. Use Extended Controls, <xref linkend="extended-controls" />.</para> - </listitem> - </itemizedlist> + </listitem> + </itemizedlist> + </section> </section> <!-- diff --git a/Documentation/DocBook/v4l/controls.xml b/Documentation/DocBook/v4l/controls.xml index f464506..8408caa 100644 --- a/Documentation/DocBook/v4l/controls.xml +++ b/Documentation/DocBook/v4l/controls.xml @@ -267,6 +267,12 @@ minimum value disables backlight compensation.</entry> <entry>Chroma automatic gain control.</entry> </row> <row> + <entry><constant>V4L2_CID_CHROMA_GAIN</constant></entry> + <entry>integer</entry> + <entry>Adjusts the Chroma gain control (for use when chroma AGC + is disabled).</entry> + </row> + <row> <entry><constant>V4L2_CID_COLOR_KILLER</constant></entry> <entry>boolean</entry> <entry>Enable the color killer (&ie; force a black & white image in case of a weak video signal).</entry> @@ -277,8 +283,15 @@ minimum value disables backlight compensation.</entry> <entry>Selects a color effect. Possible values for <constant>enum v4l2_colorfx</constant> are: <constant>V4L2_COLORFX_NONE</constant> (0), -<constant>V4L2_COLORFX_BW</constant> (1) and -<constant>V4L2_COLORFX_SEPIA</constant> (2).</entry> +<constant>V4L2_COLORFX_BW</constant> (1), +<constant>V4L2_COLORFX_SEPIA</constant> (2), +<constant>V4L2_COLORFX_NEGATIVE</constant> (3), +<constant>V4L2_COLORFX_EMBOSS</constant> (4), +<constant>V4L2_COLORFX_SKETCH</constant> (5), +<constant>V4L2_COLORFX_SKY_BLUE</constant> (6), +<constant>V4L2_COLORFX_GRASS_GREEN</constant> (7), +<constant>V4L2_COLORFX_SKIN_WHITEN</constant> (8) and +<constant>V4L2_COLORFX_VIVID</constant> (9).</entry> </row> <row> <entry><constant>V4L2_CID_ROTATE</constant></entry> @@ -1825,6 +1838,25 @@ wide-angle direction. The zoom speed unit is driver-specific.</entry> <row><entry></entry></row> <row> + <entry spanname="id"><constant>V4L2_CID_IRIS_ABSOLUTE</constant> </entry> + <entry>integer</entry> + </row><row><entry spanname="descr">This control sets the +camera's aperture to the specified value. The unit is undefined. +Larger values open the iris wider, smaller values close it.</entry> + </row> + <row><entry></entry></row> + + <row> + <entry spanname="id"><constant>V4L2_CID_IRIS_RELATIVE</constant> </entry> + <entry>integer</entry> + </row><row><entry spanname="descr">This control modifies the +camera's aperture by the specified amount. The unit is undefined. +Positive values open the iris one step further, negative values close +it one step further. This is a write-only control.</entry> + </row> + <row><entry></entry></row> + + <row> <entry spanname="id"><constant>V4L2_CID_PRIVACY</constant> </entry> <entry>boolean</entry> </row><row><entry spanname="descr">Prevent video from being acquired diff --git a/Documentation/DocBook/v4l/dev-event.xml b/Documentation/DocBook/v4l/dev-event.xml new file mode 100644 index 0000000..be5a98f --- /dev/null +++ b/Documentation/DocBook/v4l/dev-event.xml @@ -0,0 +1,31 @@ + <title>Event Interface</title> + + <para>The V4L2 event interface provides means for user to get + immediately notified on certain conditions taking place on a device. + This might include start of frame or loss of signal events, for + example. + </para> + + <para>To receive events, the events the user is interested in first must + be subscribed using the &VIDIOC-SUBSCRIBE-EVENT; ioctl. Once an event is + subscribed, the events of subscribed types are dequeueable using the + &VIDIOC-DQEVENT; ioctl. Events may be unsubscribed using + VIDIOC_UNSUBSCRIBE_EVENT ioctl. The special event type V4L2_EVENT_ALL may + be used to unsubscribe all the events the driver supports.</para> + + <para>The event subscriptions and event queues are specific to file + handles. Subscribing an event on one file handle does not affect + other file handles. + </para> + + <para>The information on dequeueable events is obtained by using select or + poll system calls on video devices. The V4L2 events use POLLPRI events on + poll system call and exceptions on select system call. </para> + + <!-- +Local Variables: +mode: sgml +sgml-parent-document: "v4l2.sgml" +indent-tabs-mode: nil +End: + --> diff --git a/Documentation/DocBook/v4l/io.xml b/Documentation/DocBook/v4l/io.xml index e870330..d424886 100644 --- a/Documentation/DocBook/v4l/io.xml +++ b/Documentation/DocBook/v4l/io.xml @@ -702,6 +702,16 @@ They can be both cleared however, then the buffer is in "dequeued" state, in the application domain to say so.</entry> </row> <row> + <entry><constant>V4L2_BUF_FLAG_ERROR</constant></entry> + <entry>0x0040</entry> + <entry>When this flag is set, the buffer has been dequeued + successfully, although the data might have been corrupted. + This is recoverable, streaming may continue as normal and + the buffer may be reused normally. + Drivers set this flag when the <constant>VIDIOC_DQBUF</constant> + ioctl is called.</entry> + </row> + <row> <entry><constant>V4L2_BUF_FLAG_KEYFRAME</constant></entry> <entry>0x0008</entry> <entry>Drivers set or clear this flag when calling the @@ -918,8 +928,8 @@ order</emphasis>.</para> <para>When the driver provides or accepts images field by field rather than interleaved, it is also important applications understand -how the fields combine to frames. We distinguish between top and -bottom fields, the <emphasis>spatial order</emphasis>: The first line +how the fields combine to frames. We distinguish between top (aka odd) and +bottom (aka even) fields, the <emphasis>spatial order</emphasis>: The first line of the top field is the first line of an interlaced frame, the first line of the bottom field is the second line of that frame.</para> @@ -972,12 +982,12 @@ between <constant>V4L2_FIELD_TOP</constant> and <row> <entry><constant>V4L2_FIELD_TOP</constant></entry> <entry>2</entry> - <entry>Images consist of the top field only.</entry> + <entry>Images consist of the top (aka odd) field only.</entry> </row> <row> <entry><constant>V4L2_FIELD_BOTTOM</constant></entry> <entry>3</entry> - <entry>Images consist of the bottom field only. + <entry>Images consist of the bottom (aka even) field only. Applications may wish to prevent a device from capturing interlaced images because they will have "comb" or "feathering" artefacts around moving objects.</entry> diff --git a/Documentation/DocBook/v4l/pixfmt.xml b/Documentation/DocBook/v4l/pixfmt.xml index 885968d..c4ad0a8 100644 --- a/Documentation/DocBook/v4l/pixfmt.xml +++ b/Documentation/DocBook/v4l/pixfmt.xml @@ -792,6 +792,18 @@ http://www.thedirks.org/winnov/</ulink></para></entry> <entry>'YYUV'</entry> <entry>unknown</entry> </row> + <row id="V4L2-PIX-FMT-Y4"> + <entry><constant>V4L2_PIX_FMT_Y4</constant></entry> + <entry>'Y04 '</entry> + <entry>Old 4-bit greyscale format. Only the least significant 4 bits of each byte are used, +the other bits are set to 0.</entry> + </row> + <row id="V4L2-PIX-FMT-Y6"> + <entry><constant>V4L2_PIX_FMT_Y6</constant></entry> + <entry>'Y06 '</entry> + <entry>Old 6-bit greyscale format. Only the least significant 6 bits of each byte are used, +the other bits are set to 0.</entry> + </row> </tbody> </tgroup> </table> diff --git a/Documentation/DocBook/v4l/v4l2.xml b/Documentation/DocBook/v4l/v4l2.xml index 060105a..9737243 100644 --- a/Documentation/DocBook/v4l/v4l2.xml +++ b/Documentation/DocBook/v4l/v4l2.xml @@ -401,6 +401,7 @@ and discussions on the V4L mailing list.</revremark> <section id="ttx"> &sub-dev-teletext; </section> <section id="radio"> &sub-dev-radio; </section> <section id="rds"> &sub-dev-rds; </section> + <section id="event"> &sub-dev-event; </section> </chapter> <chapter id="driver"> @@ -426,6 +427,7 @@ and discussions on the V4L mailing list.</revremark> &sub-cropcap; &sub-dbg-g-chip-ident; &sub-dbg-g-register; + &sub-dqevent; &sub-encoder-cmd; &sub-enumaudio; &sub-enumaudioout; @@ -467,6 +469,7 @@ and discussions on the V4L mailing list.</revremark> &sub-reqbufs; &sub-s-hw-freq-seek; &sub-streamon; + &sub-subscribe-event; <!-- End of ioctls. --> &sub-mmap; &sub-munmap; diff --git a/Documentation/DocBook/v4l/videodev2.h.xml b/Documentation/DocBook/v4l/videodev2.h.xml index 0683259..865b06d 100644 --- a/Documentation/DocBook/v4l/videodev2.h.xml +++ b/Documentation/DocBook/v4l/videodev2.h.xml @@ -1018,6 +1018,13 @@ enum <link linkend="v4l2-colorfx">v4l2_colorfx</link> { V4L2_COLORFX_NONE = 0, V4L2_COLORFX_BW = 1, V4L2_COLORFX_SEPIA = 2, + V4L2_COLORFX_NEGATIVE = 3, + V4L2_COLORFX_EMBOSS = 4, + V4L2_COLORFX_SKETCH = 5, + V4L2_COLORFX_SKY_BLUE = 6, + V4L2_COLORFX_GRASS_GREEN = 7, + V4L2_COLORFX_SKIN_WHITEN = 8, + V4L2_COLORFX_VIVID = 9. }; #define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) #define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) @@ -1271,6 +1278,9 @@ enum <link linkend="v4l2-exposure-auto-type">v4l2_exposure_auto_type</link> { #define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) +#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17) +#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18) + /* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) #define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) diff --git a/Documentation/DocBook/v4l/vidioc-dqevent.xml b/Documentation/DocBook/v4l/vidioc-dqevent.xml new file mode 100644 index 0000000..4e0a7cc --- /dev/null +++ b/Documentation/DocBook/v4l/vidioc-dqevent.xml @@ -0,0 +1,131 @@ +<refentry id="vidioc-dqevent"> + <refmeta> + <refentrytitle>ioctl VIDIOC_DQEVENT</refentrytitle> + &manvol; + </refmeta> + + <refnamediv> + <refname>VIDIOC_DQEVENT</refname> + <refpurpose>Dequeue event</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>ioctl</function></funcdef> + <paramdef>int <parameter>fd</parameter></paramdef> + <paramdef>int <parameter>request</parameter></paramdef> + <paramdef>struct v4l2_event +*<parameter>argp</parameter></paramdef> + </funcprototype> + </funcsynopsis> + </refsynopsisdiv> + + <refsect1> + <title>Arguments</title> + + <variablelist> + <varlistentry> + <term><parameter>fd</parameter></term> + <listitem> + <para>&fd;</para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>request</parameter></term> + <listitem> + <para>VIDIOC_DQEVENT</para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>argp</parameter></term> + <listitem> + <para></para> + </listitem> + </varlistentry> + </variablelist> + </refsect1> + + <refsect1> + <title>Description</title> + + <para>Dequeue an event from a video device. No input is required + for this ioctl. All the fields of the &v4l2-event; structure are + filled by the driver. The file handle will also receive exceptions + which the application may get by e.g. using the select system + call.</para> + + <table frame="none" pgwide="1" id="v4l2-event"> + <title>struct <structname>v4l2_event</structname></title> + <tgroup cols="4"> + &cs-str; + <tbody valign="top"> + <row> + <entry>__u32</entry> + <entry><structfield>type</structfield></entry> + <entry></entry> + <entry>Type of the event.</entry> + </row> + <row> + <entry>union</entry> + <entry><structfield>u</structfield></entry> + <entry></entry> + <entry></entry> + </row> + <row> + <entry></entry> + <entry>&v4l2-event-vsync;</entry> + <entry><structfield>vsync</structfield></entry> + <entry>Event data for event V4L2_EVENT_VSYNC. + </entry> + </row> + <row> + <entry></entry> + <entry>__u8</entry> + <entry><structfield>data</structfield>[64]</entry> + <entry>Event data. Defined by the event type. The union + should be used to define easily accessible type for + events.</entry> + </row> + <row> + <entry>__u32</entry> + <entry><structfield>pending</structfield></entry> + <entry></entry> + <entry>Number of pending events excluding this one.</entry> + </row> + <row> + <entry>__u32</entry> + <entry><structfield>sequence</structfield></entry> + <entry></entry> + <entry>Event sequence number. The sequence number is + incremented for every subscribed event that takes place. + If sequence numbers are not contiguous it means that + events have been lost. + </entry> + </row> + <row> + <entry>struct timespec</entry> + <entry><structfield>timestamp</structfield></entry> + <entry></entry> + <entry>Event timestamp.</entry> + </row> + <row> + <entry>__u32</entry> + <entry><structfield>reserved</structfield>[9]</entry> + <entry></entry> + <entry>Reserved for future extensions. Drivers must set + the array to zero.</entry> + </row> + </tbody> + </tgroup> + </table> + + </refsect1> +</refentry> +<!-- +Local Variables: +mode: sgml +sgml-parent-document: "v4l2.sgml" +indent-tabs-mode: nil +End: +--> diff --git a/Documentation/DocBook/v4l/vidioc-enuminput.xml b/Documentation/DocBook/v4l/vidioc-enuminput.xml index 71b868e..476fe1d 100644 --- a/Documentation/DocBook/v4l/vidioc-enuminput.xml +++ b/Documentation/DocBook/v4l/vidioc-enuminput.xml @@ -283,7 +283,7 @@ input/output interface to linux-media@vger.kernel.org on 19 Oct 2009. <entry>This input supports setting DV presets by using VIDIOC_S_DV_PRESET.</entry> </row> <row> - <entry><constant>V4L2_OUT_CAP_CUSTOM_TIMINGS</constant></entry> + <entry><constant>V4L2_IN_CAP_CUSTOM_TIMINGS</constant></entry> <entry>0x00000002</entry> <entry>This input supports setting custom video timings by using VIDIOC_S_DV_TIMINGS.</entry> </row> diff --git a/Documentation/DocBook/v4l/vidioc-qbuf.xml b/Documentation/DocBook/v4l/vidioc-qbuf.xml index b843bd7..ab691eb 100644 --- a/Documentation/DocBook/v4l/vidioc-qbuf.xml +++ b/Documentation/DocBook/v4l/vidioc-qbuf.xml @@ -111,7 +111,11 @@ from the driver's outgoing queue. They just set the and <structfield>reserved</structfield> fields of a &v4l2-buffer; as above, when <constant>VIDIOC_DQBUF</constant> is called with a pointer to this structure the driver fills the -remaining fields or returns an error code.</para> +remaining fields or returns an error code. The driver may also set +<constant>V4L2_BUF_FLAG_ERROR</constant> in the <structfield>flags</structfield> +field. It indicates a non-critical (recoverable) streaming error. In such case +the application may continue as normal, but should be aware that data in the +dequeued buffer might be corrupted.</para> <para>By default <constant>VIDIOC_DQBUF</constant> blocks when no buffer is in the outgoing queue. When the @@ -158,7 +162,13 @@ enqueue a user pointer buffer.</para> <para><constant>VIDIOC_DQBUF</constant> failed due to an internal error. Can also indicate temporary problems like signal loss. Note the driver might dequeue an (empty) buffer despite -returning an error, or even stop capturing.</para> +returning an error, or even stop capturing. Reusing such buffer may be unsafe +though and its details (e.g. <structfield>index</structfield>) may not be +returned either. It is recommended that drivers indicate recoverable errors +by setting the <constant>V4L2_BUF_FLAG_ERROR</constant> and returning 0 instead. +In that case the application should be able to safely reuse the buffer and +continue streaming. + </para> </listitem> </varlistentry> </variablelist> diff --git a/Documentation/DocBook/v4l/vidioc-queryctrl.xml b/Documentation/DocBook/v4l/vidioc-queryctrl.xml index 4876ff1..8e0e055 100644 --- a/Documentation/DocBook/v4l/vidioc-queryctrl.xml +++ b/Documentation/DocBook/v4l/vidioc-queryctrl.xml @@ -325,7 +325,7 @@ should be part of the control documentation.</entry> <entry>n/a</entry> <entry>This is not a control. When <constant>VIDIOC_QUERYCTRL</constant> is called with a control ID -equal to a control class code (see <xref linkend="ctrl-class" />), the +equal to a control class code (see <xref linkend="ctrl-class" />) + 1, the ioctl returns the name of the control class and this control type. Older drivers which do not support this feature return an &EINVAL;.</entry> diff --git a/Documentation/DocBook/v4l/vidioc-reqbufs.xml b/Documentation/DocBook/v4l/vidioc-reqbufs.xml index 1c08163..69800ae 100644 --- a/Documentation/DocBook/v4l/vidioc-reqbufs.xml +++ b/Documentation/DocBook/v4l/vidioc-reqbufs.xml @@ -61,7 +61,7 @@ fields of the <structname>v4l2_requestbuffers</structname> structure. They set the <structfield>type</structfield> field to the respective stream or buffer type, the <structfield>count</structfield> field to the desired number of buffers, <structfield>memory</structfield> -must be set to the requested I/O method and the reserved array +must be set to the requested I/O method and the <structfield>reserved</structfield> array must be zeroed. When the ioctl is called with a pointer to this structure the driver will attempt to allocate the requested number of buffers and it stores the actual number diff --git a/Documentation/DocBook/v4l/vidioc-subscribe-event.xml b/Documentation/DocBook/v4l/vidioc-subscribe-event.xml new file mode 100644 index 0000000..8b50179 --- /dev/null +++ b/Documentation/DocBook/v4l/vidioc-subscribe-event.xml @@ -0,0 +1,133 @@ +<refentry id="vidioc-subscribe-event"> + <refmeta> + <refentrytitle>ioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT</refentrytitle> + &manvol; + </refmeta> + + <refnamediv> + <refname>VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT</refname> + <refpurpose>Subscribe or unsubscribe event</refpurpose> + </refnamediv> + + <refsynopsisdiv> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>ioctl</function></funcdef> + <paramdef>int <parameter>fd</parameter></paramdef> + <paramdef>int <parameter>request</parameter></paramdef> + <paramdef>struct v4l2_event_subscription +*<parameter>argp</parameter></paramdef> + </funcprototype> + </funcsynopsis> + </refsynopsisdiv> + + <refsect1> + <title>Arguments</title> + + <variablelist> + <varlistentry> + <term><parameter>fd</parameter></term> + <listitem> + <para>&fd;</para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>request</parameter></term> + <listitem> + <para>VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT</para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>argp</parameter></term> + <listitem> + <para></para> + </listitem> + </varlistentry> + </variablelist> + </refsect1> + + <refsect1> + <title>Description</title> + + <para>Subscribe or unsubscribe V4L2 event. Subscribed events are + dequeued by using the &VIDIOC-DQEVENT; ioctl.</para> + + <table frame="none" pgwide="1" id="v4l2-event-subscription"> + <title>struct <structname>v4l2_event_subscription</structname></title> + <tgroup cols="3"> + &cs-str; + <tbody valign="top"> + <row> + <entry>__u32</entry> + <entry><structfield>type</structfield></entry> + <entry>Type of the event.</entry> + </row> + <row> + <entry>__u32</entry> + <entry><structfield>reserved</structfield>[7]</entry> + <entry>Reserved for future extensions. Drivers and applications + must set the array to zero.</entry> + </row> + </tbody> + </tgroup> + </table> + + <table frame="none" pgwide="1" id="event-type"> + <title>Event Types</title> + <tgroup cols="3"> + &cs-def; + <tbody valign="top"> + <row> + <entry><constant>V4L2_EVENT_ALL</constant></entry> + <entry>0</entry> + <entry>All events. V4L2_EVENT_ALL is valid only for + VIDIOC_UNSUBSCRIBE_EVENT for unsubscribing all events at once. + </entry> + </row> + <row> + <entry><constant>V4L2_EVENT_VSYNC</constant></entry> + <entry>1</entry> + <entry>This event is triggered on the vertical sync. + This event has &v4l2-event-vsync; associated with it. + </entry> + </row> + <row> + <entry><constant>V4L2_EVENT_EOS</constant></entry> + <entry>2</entry> + <entry>This event is triggered when the end of a stream is reached. + This is typically used with MPEG decoders to report to the application + when the last of the MPEG stream has been decoded. + </entry> + </row> + <row> + <entry><constant>V4L2_EVENT_PRIVATE_START</constant></entry> + <entry>0x08000000</entry> + <entry>Base event number for driver-private events.</entry> + </row> + </tbody> + </tgroup> + </table> + + <table frame="none" pgwide="1" id="v4l2-event-vsync"> + <title>struct <structname>v4l2_event_vsync</structname></title> + <tgroup cols="3"> + &cs-str; + <tbody valign="top"> + <row> + <entry>__u8</entry> + <entry><structfield>field</structfield></entry> + <entry>The upcoming field. See &v4l2-field;.</entry> + </row> + </tbody> + </tgroup> + </table> + + </refsect1> +</refentry> +<!-- +Local Variables: +mode: sgml +sgml-parent-document: "v4l2.sgml" +indent-tabs-mode: nil +End: +--> diff --git a/Documentation/DocBook/writing-an-alsa-driver.tmpl b/Documentation/DocBook/writing-an-alsa-driver.tmpl index 0d0f7b4..0ba149d 100644 --- a/Documentation/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/DocBook/writing-an-alsa-driver.tmpl @@ -5518,34 +5518,41 @@ struct _snd_pcm_runtime { ]]> </programlisting> </informalexample> + + For the raw data, <structfield>size</structfield> field must be + set properly. This specifies the maximum size of the proc file access. </para> <para> - The callback is much more complicated than the text-file - version. You need to use a low-level I/O functions such as + The read/write callbacks of raw mode are more direct than the text mode. + You need to use a low-level I/O functions such as <function>copy_from/to_user()</function> to transfer the data. <informalexample> <programlisting> <![CDATA[ - static long my_file_io_read(struct snd_info_entry *entry, + static ssize_t my_file_io_read(struct snd_info_entry *entry, void *file_private_data, struct file *file, char *buf, - unsigned long count, - unsigned long pos) + size_t count, + loff_t pos) { - long size = count; - if (pos + size > local_max_size) - size = local_max_size - pos; - if (copy_to_user(buf, local_data + pos, size)) + if (copy_to_user(buf, local_data + pos, count)) return -EFAULT; - return size; + return count; } ]]> </programlisting> </informalexample> + + If the size of the info entry has been set up properly, + <structfield>count</structfield> and <structfield>pos</structfield> are + guaranteed to fit within 0 and the given size. + You don't have to check the range in the callbacks unless any + other condition is required. + </para> </chapter> diff --git a/Documentation/DocBook/writing_usb_driver.tmpl b/Documentation/DocBook/writing_usb_driver.tmpl index eeff19c..bd97a13 100644 --- a/Documentation/DocBook/writing_usb_driver.tmpl +++ b/Documentation/DocBook/writing_usb_driver.tmpl @@ -342,7 +342,7 @@ static inline void skel_delete (struct usb_skel *dev) { kfree (dev->bulk_in_buffer); if (dev->bulk_out_buffer != NULL) - usb_buffer_free (dev->udev, dev->bulk_out_size, + usb_free_coherent (dev->udev, dev->bulk_out_size, dev->bulk_out_buffer, dev->write_urb->transfer_dma); usb_free_urb (dev->write_urb); |