1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><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 4. 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> </td><th width="60%" align="center">Chapter 4. Interfaces</th><td width="20%" align="right"> <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#id-1.4.7.13.5">Querying Capabilities</a></span></dt><dt><span class="section"><a href="sdr.html#id-1.4.7.13.6">Supplemental Functions</a></span></dt><dt><span class="section"><a href="sdr.html#id-1.4.7.13.7">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="id-1.4.7.13.5"></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 <a class="link" href="vidioc-querycap.html#v4l2-capability" title="Table A.93. 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. 17 </p><p> 18Devices supporting the SDR transmitter interface set the 19<code class="constant">V4L2_CAP_SDR_OUTPUT</code> and 20<code class="constant">V4L2_CAP_MODULATOR</code> flag in the 21<em class="structfield"><code>capabilities</code></em> field of struct <a class="link" href="vidioc-querycap.html#v4l2-capability" title="Table A.93. struct v4l2_capability">v4l2_capability</a> 22returned 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 23Digital to Analog Converter (DAC), which is a mandatory element for the SDR transmitter. 24 </p><p> 25At least one of the read/write, streaming or asynchronous I/O methods must 26be supported. 27 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="id-1.4.7.13.6"></a>Supplemental Functions</h3></div></div></div><p> 28SDR devices can support <a class="link" href="control.html" title="User Controls">controls</a>, and must 29support the <a class="link" href="tuner.html" title="Tuners and Modulators">tuner</a> ioctls. Tuner ioctls are used 30for setting the ADC/DAC sampling rate (sampling frequency) and the possible 31radio frequency (RF). 32 </p><p> 33The <code class="constant">V4L2_TUNER_SDR</code> tuner type is used for setting SDR 34device ADC/DAC frequency, and the <code class="constant">V4L2_TUNER_RF</code> 35tuner type is used for setting radio frequency. 36The tuner index of the RF tuner (if any) must always follow the SDR tuner index. 37Normally the SDR tuner is #0 and the RF tuner is #1. 38 </p><p> 39The <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. 40 </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="id-1.4.7.13.7"></a>Data Format Negotiation</h3></div></div></div><p> 41The SDR device uses the <a class="link" href="format.html" title="Data Formats">format</a> ioctls to 42select the capture and output format. Both the sampling resolution and the data 43streaming format are bound to that selectable format. In addition to the basic 44<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 45must be supported as well. 46 </p><p> 47To use the <a class="link" href="format.html" title="Data Formats">format</a> ioctls applications set the 48<em class="structfield"><code>type</code></em> field of a struct <a class="link" href="vidioc-g-fmt.html#v4l2-format" title="Table A.72. struct v4l2_format">v4l2_format</a> to 49<code class="constant">V4L2_BUF_TYPE_SDR_CAPTURE</code> or 50<code class="constant">V4L2_BUF_TYPE_SDR_OUTPUT</code> and use the struct <a class="link" href="sdr.html#v4l2-sdr-format" title="Table 4.18. struct v4l2_sdr_format">v4l2_sdr_format</a> 51<em class="structfield"><code>sdr</code></em> member of the <em class="structfield"><code>fmt</code></em> 52union as needed per the desired operation. 53Currently there is two fields, <em class="structfield"><code>pixelformat</code></em> and 54<em class="structfield"><code>buffersize</code></em>, of struct struct <a class="link" href="sdr.html#v4l2-sdr-format" title="Table 4.18. struct v4l2_sdr_format">v4l2_sdr_format</a> which are 55used. Content of the <em class="structfield"><code>pixelformat</code></em> is V4L2 FourCC 56code of the data format. The <em class="structfield"><code>buffersize</code></em> field is 57maximum buffer size in bytes required for data transfer, set by the driver in 58order to inform application. 59 </p><div class="table"><a name="v4l2-sdr-format"></a><p class="title"><b>Table 4.18. 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"> 60The data format or type of compression, set by the application. This is a 61little endian <a class="link" href="vidioc-enum-fmt.html#v4l2-fourcc">four character code</a>. 62V4L2 defines SDR formats in <a class="xref" href="sdr-formats.html" title="SDR Formats">the section called “SDR Formats”</a>. 63 </td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>buffersize</code></em></td><td valign="top"> 64Maximum size in bytes required for data. Value is set by the driver. 65 </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. 66Drivers and applications must set it to zero.</td></tr></tbody></table></div></div><br class="table-break"><p> 67An SDR device may support <a class="link" href="io.html#rw" title="Read/Write">read/write</a> 68and/or streaming (<a class="link" href="mmap.html" title="Streaming I/O (Memory Mapping)">memory mapping</a> 69or <a class="link" href="userp.html" title="Streaming I/O (User Pointers)">user pointer</a>) I/O. 70 </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> </td><td width="20%" align="center"><a accesskey="u" href="devices.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="event.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">RDS Interface </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Event Interface</td></tr></table></div></body></html> 71