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