dev-sdr.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <title>Software Defined Radio Interface (SDR)</title>
  2. <note>
  3. <title>Experimental</title>
  4. <para>This is an <link linkend="experimental"> experimental </link>
  5. interface and may change in the future.</para>
  6. </note>
  7. <para>
  8. SDR is an abbreviation of Software Defined Radio, the radio device
  9. which uses application software for modulation or demodulation. This interface
  10. is intended for controlling and data streaming of such devices.
  11. </para>
  12. <para>
  13. SDR devices are accessed through character device special files named
  14. <filename>/dev/swradio0</filename> to <filename>/dev/swradio255</filename>
  15. with major number 81 and dynamically allocated minor numbers 0 to 255.
  16. </para>
  17. <section>
  18. <title>Querying Capabilities</title>
  19. <para>
  20. Devices supporting the SDR receiver interface set the
  21. <constant>V4L2_CAP_SDR_CAPTURE</constant> and
  22. <constant>V4L2_CAP_TUNER</constant> flag in the
  23. <structfield>capabilities</structfield> field of &v4l2-capability;
  24. returned by the &VIDIOC-QUERYCAP; ioctl. That flag means the device has an
  25. Analog to Digital Converter (ADC), which is a mandatory element for the SDR receiver.
  26. At least one of the read/write, streaming or asynchronous I/O methods must
  27. be supported.
  28. </para>
  29. </section>
  30. <section>
  31. <title>Supplemental Functions</title>
  32. <para>
  33. SDR devices can support <link linkend="control">controls</link>, and must
  34. support the <link linkend="tuner">tuner</link> ioctls. Tuner ioctls are used
  35. for setting the ADC sampling rate (sampling frequency) and the possible RF tuner
  36. frequency.
  37. </para>
  38. <para>
  39. The <constant>V4L2_TUNER_ADC</constant> tuner type is used for ADC tuners, and
  40. the <constant>V4L2_TUNER_RF</constant> tuner type is used for RF tuners. The
  41. tuner index of the RF tuner (if any) must always follow the ADC tuner index.
  42. Normally the ADC tuner is #0 and the RF tuner is #1.
  43. </para>
  44. <para>
  45. The &VIDIOC-S-HW-FREQ-SEEK; ioctl is not supported.
  46. </para>
  47. </section>
  48. <section>
  49. <title>Data Format Negotiation</title>
  50. <para>
  51. The SDR capture device uses the <link linkend="format">format</link> ioctls to
  52. select the capture format. Both the sampling resolution and the data streaming
  53. format are bound to that selectable format. In addition to the basic
  54. <link linkend="format">format</link> ioctls, the &VIDIOC-ENUM-FMT; ioctl
  55. must be supported as well.
  56. </para>
  57. <para>
  58. To use the <link linkend="format">format</link> ioctls applications set the
  59. <structfield>type</structfield> field of a &v4l2-format; to
  60. <constant>V4L2_BUF_TYPE_SDR_CAPTURE</constant> and use the &v4l2-sdr-format;
  61. <structfield>sdr</structfield> member of the <structfield>fmt</structfield>
  62. union as needed per the desired operation.
  63. Currently there is two fields, <structfield>pixelformat</structfield> and
  64. <structfield>buffersize</structfield>, of struct &v4l2-sdr-format; which are
  65. used. Content of the <structfield>pixelformat</structfield> is V4L2 FourCC
  66. code of the data format. The <structfield>buffersize</structfield> field is
  67. maximum buffer size in bytes required for data transfer, set by the driver in
  68. order to inform application.
  69. </para>
  70. <table pgwide="1" frame="none" id="v4l2-sdr-format">
  71. <title>struct <structname>v4l2_sdr_format</structname></title>
  72. <tgroup cols="3">
  73. &cs-str;
  74. <tbody valign="top">
  75. <row>
  76. <entry>__u32</entry>
  77. <entry><structfield>pixelformat</structfield></entry>
  78. <entry>
  79. The data format or type of compression, set by the application. This is a
  80. little endian <link linkend="v4l2-fourcc">four character code</link>.
  81. V4L2 defines SDR formats in <xref linkend="sdr-formats" />.
  82. </entry>
  83. </row>
  84. <row>
  85. <entry>__u32</entry>
  86. <entry><structfield>buffersize</structfield></entry>
  87. <entry>
  88. Maximum size in bytes required for data. Value is set by the driver.
  89. </entry>
  90. </row>
  91. <row>
  92. <entry>__u8</entry>
  93. <entry><structfield>reserved[24]</structfield></entry>
  94. <entry>This array is reserved for future extensions.
  95. Drivers and applications must set it to zero.</entry>
  96. </row>
  97. </tbody>
  98. </tgroup>
  99. </table>
  100. <para>
  101. An SDR device may support <link linkend="rw">read/write</link>
  102. and/or streaming (<link linkend="mmap">memory mapping</link>
  103. or <link linkend="userp">user pointer</link>) I/O.
  104. </para>
  105. </section>