1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Software Defined Radio Interface (SDR)</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="LINUX MEDIA INFRASTRUCTURE API"><link rel="up" href="devices.html" title="Chapter&#160;4.&#160;Interfaces"><link rel="prev" href="rds.html" title="RDS Interface"><link rel="next" href="event.html" title="Event Interface"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Software Defined Radio Interface (SDR)</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="rds.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;4.&#160;Interfaces</th><td width="20%" align="right">&#160;<a accesskey="n" href="event.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sdr"></a>Software Defined Radio Interface (SDR)</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="sdr.html#idp1105978476">Querying Capabilities</a></span></dt><dt><span class="section"><a href="sdr.html#idp1106023364">Supplemental Functions</a></span></dt><dt><span class="section"><a href="sdr.html#idp1106026124">Data Format Negotiation</a></span></dt></dl></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Experimental</h3><p>This is an <a class="link" href="hist-v4l2.html#experimental" title="Experimental API Elements"> experimental </a>
2    interface and may change in the future.</p></div><p>
3SDR is an abbreviation of Software Defined Radio, the radio device
4which uses application software for modulation or demodulation. This interface
5is intended for controlling and data streaming of such devices.
6  </p><p>
7SDR devices are accessed through character device special files named
8<code class="filename">/dev/swradio0</code> to <code class="filename">/dev/swradio255</code>
9with major number 81 and dynamically allocated minor numbers 0 to 255.
10  </p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1105978476"></a>Querying Capabilities</h3></div></div></div><p>
11Devices supporting the SDR receiver interface set the
12<code class="constant">V4L2_CAP_SDR_CAPTURE</code> and
13<code class="constant">V4L2_CAP_TUNER</code> flag in the
14<em class="structfield"><code>capabilities</code></em> field of struct&#160;<a class="link" href="vidioc-querycap.html#v4l2-capability" title="Table&#160;A.93.&#160;struct v4l2_capability">v4l2_capability</a>
15returned by the <a class="link" href="vidioc-querycap.html" title="ioctl VIDIOC_QUERYCAP"><code class="constant">VIDIOC_QUERYCAP</code></a> ioctl. That flag means the device has an
16Analog to Digital Converter (ADC), which is a mandatory element for the SDR receiver.
17At least one of the read/write, streaming or asynchronous I/O methods must
18be supported.
19    </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1106023364"></a>Supplemental Functions</h3></div></div></div><p>
20SDR devices can support <a class="link" href="control.html" title="User Controls">controls</a>, and must
21support the <a class="link" href="tuner.html" title="Tuners and Modulators">tuner</a> ioctls. Tuner ioctls are used
22for setting the ADC sampling rate (sampling frequency) and the possible RF tuner
23frequency.
24    </p><p>
25The <code class="constant">V4L2_TUNER_ADC</code> tuner type is used for ADC tuners, and
26the <code class="constant">V4L2_TUNER_RF</code> tuner type is used for RF tuners. The
27tuner index of the RF tuner (if any) must always follow the ADC tuner index.
28Normally the ADC tuner is #0 and the RF tuner is #1.
29    </p><p>
30The <a class="link" href="vidioc-s-hw-freq-seek.html" title="ioctl VIDIOC_S_HW_FREQ_SEEK"><code class="constant">VIDIOC_S_HW_FREQ_SEEK</code></a> ioctl is not supported.
31    </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp1106026124"></a>Data Format Negotiation</h3></div></div></div><p>
32The SDR capture device uses the <a class="link" href="format.html" title="Data Formats">format</a> ioctls to
33select the capture format. Both the sampling resolution and the data streaming
34format are bound to that selectable format. In addition to the basic
35<a class="link" href="format.html" title="Data Formats">format</a> ioctls, the <a class="link" href="vidioc-enum-fmt.html" title="ioctl VIDIOC_ENUM_FMT"><code class="constant">VIDIOC_ENUM_FMT</code></a> ioctl
36must be supported as well.
37    </p><p>
38To use the <a class="link" href="format.html" title="Data Formats">format</a> ioctls applications set the
39<em class="structfield"><code>type</code></em> field of a struct&#160;<a class="link" href="vidioc-g-fmt.html#v4l2-format" title="Table&#160;A.72.&#160;struct v4l2_format">v4l2_format</a> to
40<code class="constant">V4L2_BUF_TYPE_SDR_CAPTURE</code> and use the struct&#160;<a class="link" href="sdr.html#v4l2-sdr-format" title="Table&#160;4.18.&#160;struct v4l2_sdr_format">v4l2_sdr_format</a>
41<em class="structfield"><code>sdr</code></em> member of the <em class="structfield"><code>fmt</code></em>
42union as needed per the desired operation.
43Currently there is two fields, <em class="structfield"><code>pixelformat</code></em> and
44<em class="structfield"><code>buffersize</code></em>, of struct struct&#160;<a class="link" href="sdr.html#v4l2-sdr-format" title="Table&#160;4.18.&#160;struct v4l2_sdr_format">v4l2_sdr_format</a> which are
45used. Content of the <em class="structfield"><code>pixelformat</code></em> is V4L2 FourCC
46code of the data format. The <em class="structfield"><code>buffersize</code></em> field is
47maximum buffer size in bytes required for data transfer, set by the driver in
48order to inform application.
49    </p><div class="table"><a name="v4l2-sdr-format"></a><p class="title"><b>Table&#160;4.18.&#160;struct <span class="structname">v4l2_sdr_format</span></b></p><div class="table-contents"><table summary="struct v4l2_sdr_format" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>pixelformat</code></em></td><td valign="top">
50The data format or type of compression, set by the application. This is a
51little endian <a class="link" href="vidioc-enum-fmt.html#v4l2-fourcc">four character code</a>.
52V4L2 defines SDR formats in <a class="xref" href="sdr-formats.html" title="SDR Formats">the section called &#8220;SDR Formats&#8221;</a>.
53           </td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>buffersize</code></em></td><td valign="top">
54Maximum size in bytes required for data. Value is set by the driver.
55           </td></tr><tr><td valign="top">__u8</td><td valign="top"><em class="structfield"><code>reserved[24]</code></em></td><td valign="top">This array is reserved for future extensions.
56Drivers and applications must set it to zero.</td></tr></tbody></table></div></div><br class="table-break"><p>
57An SDR device may support <a class="link" href="io.html#rw" title="Read/Write">read/write</a>
58and/or streaming (<a class="link" href="mmap.html" title="Streaming I/O (Memory Mapping)">memory mapping</a>
59or <a class="link" href="userp.html" title="Streaming I/O (User Pointers)">user pointer</a>) I/O.
60    </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="rds.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="devices.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="event.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">RDS Interface&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Event Interface</td></tr></table></div></body></html>
61