vidioc-dbg-g-register.xml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <refentry id="vidioc-dbg-g-register">
  2. <refmeta>
  3. <refentrytitle>ioctl VIDIOC_DBG_G_REGISTER, VIDIOC_DBG_S_REGISTER</refentrytitle>
  4. &manvol;
  5. </refmeta>
  6. <refnamediv>
  7. <refname>VIDIOC_DBG_G_REGISTER</refname>
  8. <refname>VIDIOC_DBG_S_REGISTER</refname>
  9. <refpurpose>Read or write hardware registers</refpurpose>
  10. </refnamediv>
  11. <refsynopsisdiv>
  12. <funcsynopsis>
  13. <funcprototype>
  14. <funcdef>int <function>ioctl</function></funcdef>
  15. <paramdef>int <parameter>fd</parameter></paramdef>
  16. <paramdef>int <parameter>request</parameter></paramdef>
  17. <paramdef>struct v4l2_dbg_register *<parameter>argp</parameter></paramdef>
  18. </funcprototype>
  19. </funcsynopsis>
  20. <funcsynopsis>
  21. <funcprototype>
  22. <funcdef>int <function>ioctl</function></funcdef>
  23. <paramdef>int <parameter>fd</parameter></paramdef>
  24. <paramdef>int <parameter>request</parameter></paramdef>
  25. <paramdef>const struct v4l2_dbg_register
  26. *<parameter>argp</parameter></paramdef>
  27. </funcprototype>
  28. </funcsynopsis>
  29. </refsynopsisdiv>
  30. <refsect1>
  31. <title>Arguments</title>
  32. <variablelist>
  33. <varlistentry>
  34. <term><parameter>fd</parameter></term>
  35. <listitem>
  36. <para>&fd;</para>
  37. </listitem>
  38. </varlistentry>
  39. <varlistentry>
  40. <term><parameter>request</parameter></term>
  41. <listitem>
  42. <para>VIDIOC_DBG_G_REGISTER, VIDIOC_DBG_S_REGISTER</para>
  43. </listitem>
  44. </varlistentry>
  45. <varlistentry>
  46. <term><parameter>argp</parameter></term>
  47. <listitem>
  48. <para></para>
  49. </listitem>
  50. </varlistentry>
  51. </variablelist>
  52. </refsect1>
  53. <refsect1>
  54. <title>Description</title>
  55. <note>
  56. <title>Experimental</title>
  57. <para>This is an <link linkend="experimental">experimental</link>
  58. interface and may change in the future.</para>
  59. </note>
  60. <para>For driver debugging purposes these ioctls allow test
  61. applications to access hardware registers directly. Regular
  62. applications must not use them.</para>
  63. <para>Since writing or even reading registers can jeopardize the
  64. system security, its stability and damage the hardware, both ioctls
  65. require superuser privileges. Additionally the Linux kernel must be
  66. compiled with the <constant>CONFIG_VIDEO_ADV_DEBUG</constant> option
  67. to enable these ioctls.</para>
  68. <para>To write a register applications must initialize all fields
  69. of a &v4l2-dbg-register; except for <structfield>size</structfield> and call
  70. <constant>VIDIOC_DBG_S_REGISTER</constant> with a pointer to this
  71. structure. The <structfield>match.type</structfield> and
  72. <structfield>match.addr</structfield> or <structfield>match.name</structfield>
  73. fields select a chip on the TV
  74. card, the <structfield>reg</structfield> field specifies a register
  75. number and the <structfield>val</structfield> field the value to be
  76. written into the register.</para>
  77. <para>To read a register applications must initialize the
  78. <structfield>match.type</structfield>,
  79. <structfield>match.addr</structfield> or <structfield>match.name</structfield> and
  80. <structfield>reg</structfield> fields, and call
  81. <constant>VIDIOC_DBG_G_REGISTER</constant> with a pointer to this
  82. structure. On success the driver stores the register value in the
  83. <structfield>val</structfield> field and the size (in bytes) of the
  84. value in <structfield>size</structfield>.</para>
  85. <para>When <structfield>match.type</structfield> is
  86. <constant>V4L2_CHIP_MATCH_BRIDGE</constant>,
  87. <structfield>match.addr</structfield> selects the nth non-sub-device chip
  88. on the TV card. The number zero always selects the host chip, &eg; the
  89. chip connected to the PCI or USB bus. You can find out which chips are
  90. present with the &VIDIOC-DBG-G-CHIP-INFO; ioctl.</para>
  91. <para>When <structfield>match.type</structfield> is
  92. <constant>V4L2_CHIP_MATCH_SUBDEV</constant>,
  93. <structfield>match.addr</structfield> selects the nth sub-device.</para>
  94. <para>These ioctls are optional, not all drivers may support them.
  95. However when a driver supports these ioctls it must also support
  96. &VIDIOC-DBG-G-CHIP-INFO;. Conversely it may support
  97. <constant>VIDIOC_DBG_G_CHIP_INFO</constant> but not these ioctls.</para>
  98. <para><constant>VIDIOC_DBG_G_REGISTER</constant> and
  99. <constant>VIDIOC_DBG_S_REGISTER</constant> were introduced in Linux
  100. 2.6.21, but their API was changed to the one described here in kernel 2.6.29.</para>
  101. <para>We recommended the <application>v4l2-dbg</application>
  102. utility over calling these ioctls directly. It is available from the
  103. LinuxTV v4l-dvb repository; see <ulink
  104. url="http://linuxtv.org/repo/">http://linuxtv.org/repo/</ulink> for
  105. access instructions.</para>
  106. <!-- Note for convenience vidioc-dbg-g-chip-info.sgml
  107. contains a duplicate of this table. -->
  108. <table pgwide="1" frame="none" id="v4l2-dbg-match">
  109. <title>struct <structname>v4l2_dbg_match</structname></title>
  110. <tgroup cols="4">
  111. &cs-ustr;
  112. <tbody valign="top">
  113. <row>
  114. <entry>__u32</entry>
  115. <entry><structfield>type</structfield></entry>
  116. <entry>See <xref linkend="chip-match-types" /> for a list of
  117. possible types.</entry>
  118. </row>
  119. <row>
  120. <entry>union</entry>
  121. <entry>(anonymous)</entry>
  122. </row>
  123. <row>
  124. <entry></entry>
  125. <entry>__u32</entry>
  126. <entry><structfield>addr</structfield></entry>
  127. <entry>Match a chip by this number, interpreted according
  128. to the <structfield>type</structfield> field.</entry>
  129. </row>
  130. <row>
  131. <entry></entry>
  132. <entry>char</entry>
  133. <entry><structfield>name[32]</structfield></entry>
  134. <entry>Match a chip by this name, interpreted according
  135. to the <structfield>type</structfield> field. Currently unused.</entry>
  136. </row>
  137. </tbody>
  138. </tgroup>
  139. </table>
  140. <table pgwide="1" frame="none" id="v4l2-dbg-register">
  141. <title>struct <structname>v4l2_dbg_register</structname></title>
  142. <tgroup cols="4">
  143. <colspec colname="c1" />
  144. <colspec colname="c2" />
  145. <colspec colname="c4" />
  146. <tbody valign="top">
  147. <row>
  148. <entry>struct v4l2_dbg_match</entry>
  149. <entry><structfield>match</structfield></entry>
  150. <entry>How to match the chip, see <xref linkend="v4l2-dbg-match" />.</entry>
  151. </row>
  152. <row>
  153. <entry>__u32</entry>
  154. <entry><structfield>size</structfield></entry>
  155. <entry>The register size in bytes.</entry>
  156. </row>
  157. <row>
  158. <entry>__u64</entry>
  159. <entry><structfield>reg</structfield></entry>
  160. <entry>A register number.</entry>
  161. </row>
  162. <row>
  163. <entry>__u64</entry>
  164. <entry><structfield>val</structfield></entry>
  165. <entry>The value read from, or to be written into the
  166. register.</entry>
  167. </row>
  168. </tbody>
  169. </tgroup>
  170. </table>
  171. <!-- Note for convenience vidioc-dbg-g-chip-info.sgml
  172. contains a duplicate of this table. -->
  173. <table pgwide="1" frame="none" id="chip-match-types">
  174. <title>Chip Match Types</title>
  175. <tgroup cols="3">
  176. &cs-def;
  177. <tbody valign="top">
  178. <row>
  179. <entry><constant>V4L2_CHIP_MATCH_BRIDGE</constant></entry>
  180. <entry>0</entry>
  181. <entry>Match the nth chip on the card, zero for the
  182. bridge chip. Does not match sub-devices.</entry>
  183. </row>
  184. <row>
  185. <entry><constant>V4L2_CHIP_MATCH_SUBDEV</constant></entry>
  186. <entry>4</entry>
  187. <entry>Match the nth sub-device.</entry>
  188. </row>
  189. </tbody>
  190. </tgroup>
  191. </table>
  192. </refsect1>
  193. <refsect1>
  194. &return-value;
  195. <variablelist>
  196. <varlistentry>
  197. <term><errorcode>EPERM</errorcode></term>
  198. <listitem>
  199. <para>Insufficient permissions. Root privileges are required
  200. to execute these ioctls.</para>
  201. </listitem>
  202. </varlistentry>
  203. </variablelist>
  204. </refsect1>
  205. </refentry>