93d22486f20c677f9f30982ea39e80e4d1467131
[linux-2.6-microblaze.git] / Documentation / DocBook / media / dvb / frontend.xml
1 <title>DVB Frontend API</title>
2
3 <para>The DVB frontend API was designed to support three types of delivery systems:</para>
4 <itemizedlist>
5     <listitem>Terrestrial systems: DVB-T, DVB-T2, ATSC, ATSC M/H, ISDB-T, DVB-H, DTMB, CMMB</listitem>
6     <listitem>Cable systems: DVB-C Annex A/C, ClearQAM (DVB-C Annex B), ISDB-C</listitem>
7     <listitem>Satellital systems: DVB-S, DVB-S2, DVB Turbo, ISDB-S, DSS</listitem>
8 </itemizedlist>
9 <para>The DVB frontend controls several sub-devices including:</para>
10 <itemizedlist>
11     <listitem>Tuner</listitem>,
12     <listitem>Digital TV demodulator</listitem>
13     <listitem>Low noise amplifier (LNA)</listitem>
14     <listitem>Satellite Equipment Control (SEC) hardware (only for Satellite).</listitem>
15 </itemizedlist>
16 <para>The frontend can be accessed through
17     <emphasis role="bold">/dev/dvb/adapter?/frontend?</emphasis>. Data types and
18     ioctl definitions can be accessed by including
19     <emphasis role="bold">linux/dvb/frontend.h</emphasis> in your application.
20 </para>
21
22 <para>NOTE: Transmission via the internet (DVB-IP)
23     is not yet handled by this API but a future extension is possible.</para>
24 <para>On Satellital systems, the API support for the Satellite Equipment Control
25     (SEC) allows to power control and to send/receive signals to control the
26     antenna subsystem, selecting the polarization and choosing the Intermediate
27     Frequency IF) of the Low Noise Block Converter Feed Horn (LNBf). It
28     supports the DiSEqC and V-SEC protocols. The DiSEqC (digital SEC)
29 specification is available at
30 <ulink url="http://www.eutelsat.com/satellites/4_5_5.html">Eutelsat</ulink>.</para>
31
32 <section id="query-dvb-frontend-info">
33 <title>Querying frontend information</title>
34
35 <para>Usually, the first thing to do when the frontend is opened is to
36     check the frontend capabilities. This is done using <link linkend="FE_GET_INFO">FE_GET_INFO</link>. This ioctl will enumerate
37     the DVB API version and other characteristics about the frontend, and
38     can be opened either in read only or read/write mode.</para>
39 </section>
40
41 <section id="dvb-fe-read-status">
42 <title>Querying frontend status and statistics</title>
43
44 <para>Once <link linkend="FE_GET_PROPERTY"><constant>FE_SET_PROPERTY</constant></link>
45     is called, the frontend will run a kernel thread that will periodically
46     check for the tuner lock status and provide statistics about the quality
47     of the signal.</para>
48 <para>The information about the frontend tuner locking status can be queried
49     using <link linkend="FE_READ_STATUS">FE_READ_STATUS</link>.</para>
50 <para>Signal statistics are provided via <link linkend="FE_GET_PROPERTY"><constant>FE_GET_PROPERTY</constant></link>.
51     Please notice that several statistics require the demodulator to be fully
52     locked (e. g. with FE_HAS_LOCK bit set). See
53     <xref linkend="frontend-stat-properties">Frontend statistics indicators</xref>
54     for more details.</para>
55 </section>
56
57 &sub-dvbproperty;
58
59 <section id="fe-code-rate-t">
60 <title>frontend code rate</title>
61 <para>The possible values for the <constant>fec_inner</constant> field used on
62 <link linkend="dvb-qpsk-parameters"><constant>struct dvb_qpsk_parameters</constant></link> and
63 <link linkend="dvb-qam-parameters"><constant>struct dvb_qam_parameters</constant></link> are:
64 </para>
65 <programlisting>
66 typedef enum fe_code_rate {
67         FEC_NONE = 0,
68         FEC_1_2,
69         FEC_2_3,
70         FEC_3_4,
71         FEC_4_5,
72         FEC_5_6,
73         FEC_6_7,
74         FEC_7_8,
75         FEC_8_9,
76         FEC_AUTO,
77         FEC_3_5,
78         FEC_9_10,
79 } fe_code_rate_t;
80 </programlisting>
81 <para>which correspond to error correction rates of 1/2, 2/3, etc., no error correction or auto
82 detection.
83 </para>
84 </section>
85
86
87 <section>
88 <title>More OFDM parameters</title>
89
90 <section id="fe-guard-interval-t">
91 <title>frontend guard inverval</title>
92 <programlisting>
93 typedef enum fe_guard_interval {
94         GUARD_INTERVAL_1_32,
95         GUARD_INTERVAL_1_16,
96         GUARD_INTERVAL_1_8,
97         GUARD_INTERVAL_1_4,
98         GUARD_INTERVAL_AUTO,
99         GUARD_INTERVAL_1_128,
100         GUARD_INTERVAL_19_128,
101         GUARD_INTERVAL_19_256,
102 } fe_guard_interval_t;
103 </programlisting>
104 </section>
105
106 <section id="fe-hierarchy-t">
107 <title>frontend hierarchy</title>
108 <programlisting>
109 typedef enum fe_hierarchy {
110          HIERARCHY_NONE,
111          HIERARCHY_1,
112          HIERARCHY_2,
113          HIERARCHY_4,
114          HIERARCHY_AUTO
115  } fe_hierarchy_t;
116 </programlisting>
117 </section>
118
119 </section>
120
121 <section id="frontend_fcalls">
122 <title>Frontend Function Calls</title>
123
124 <section id="frontend_f_open">
125 <title>open()</title>
126 <para>DESCRIPTION</para>
127 <informaltable><tgroup cols="1"><tbody><row>
128 <entry align="char">
129 <para>This system call opens a named frontend device (/dev/dvb/adapter0/frontend0)
130  for subsequent use. Usually the first thing to do after a successful open is to
131  find out the frontend type with <link linkend="FE_GET_INFO">FE_GET_INFO</link>.</para>
132 <para>The device can be opened in read-only mode, which only allows monitoring of
133  device status and statistics, or read/write mode, which allows any kind of use
134  (e.g. performing tuning operations.)
135 </para>
136 <para>In a system with multiple front-ends, it is usually the case that multiple devices
137  cannot be open in read/write mode simultaneously. As long as a front-end
138  device is opened in read/write mode, other open() calls in read/write mode will
139  either fail or block, depending on whether non-blocking or blocking mode was
140  specified. A front-end device opened in blocking mode can later be put into
141  non-blocking mode (and vice versa) using the F_SETFL command of the fcntl
142  system call. This is a standard system call, documented in the Linux manual
143  page for fcntl. When an open() call has succeeded, the device will be ready
144  for use in the specified mode. This implies that the corresponding hardware is
145  powered up, and that other front-ends may have been powered down to make
146  that possible.</para>
147 </entry>
148  </row></tbody></tgroup></informaltable>
149
150 <para>SYNOPSIS</para>
151 <informaltable><tgroup cols="1"><tbody><row><entry
152  align="char">
153 <para>int open(const char &#x22C6;deviceName, int flags);</para>
154 </entry>
155  </row></tbody></tgroup></informaltable>
156 <para>PARAMETERS
157 </para>
158 <informaltable><tgroup cols="2"><tbody><row><entry
159  align="char">
160 <para>const char
161  *deviceName</para>
162 </entry><entry
163  align="char">
164 <para>Name of specific video device.</para>
165 </entry>
166  </row><row><entry
167  align="char">
168 <para>int flags</para>
169 </entry><entry
170  align="char">
171 <para>A bit-wise OR of the following flags:</para>
172 </entry>
173  </row><row><entry
174  align="char">
175 </entry><entry
176  align="char">
177 <para>O_RDONLY read-only access</para>
178 </entry>
179  </row><row><entry
180  align="char">
181 </entry><entry
182  align="char">
183 <para>O_RDWR read/write access</para>
184 </entry>
185  </row><row><entry
186  align="char">
187 </entry><entry
188  align="char">
189 <para>O_NONBLOCK open in non-blocking mode</para>
190 </entry>
191  </row><row><entry
192  align="char">
193 </entry><entry
194  align="char">
195 <para>(blocking mode is the default)</para>
196 </entry>
197  </row></tbody></tgroup></informaltable>
198 <para>RETURN VALUE</para>
199 <informaltable><tgroup cols="2"><tbody><row><entry
200  align="char">
201 <para>ENODEV</para>
202 </entry><entry
203  align="char">
204 <para>Device driver not loaded/available.</para>
205 </entry>
206  </row><row><entry
207  align="char">
208 <para>EINTERNAL</para>
209 </entry><entry
210  align="char">
211 <para>Internal error.</para>
212 </entry>
213  </row><row><entry
214  align="char">
215 <para>EBUSY</para>
216 </entry><entry
217  align="char">
218 <para>Device or resource busy.</para>
219 </entry>
220  </row><row><entry
221  align="char">
222 <para>EINVAL</para>
223 </entry><entry
224  align="char">
225 <para>Invalid argument.</para>
226 </entry>
227  </row></tbody></tgroup></informaltable>
228 </section>
229
230 <section id="frontend_f_close">
231 <title>close()</title>
232 <para>DESCRIPTION
233 </para>
234 <informaltable><tgroup cols="1"><tbody><row><entry
235  align="char">
236 <para>This system call closes a previously opened front-end device. After closing
237  a front-end device, its corresponding hardware might be powered down
238  automatically.</para>
239 </entry>
240  </row></tbody></tgroup></informaltable>
241 <para>SYNOPSIS
242 </para>
243 <informaltable><tgroup cols="1"><tbody><row><entry
244  align="char">
245 <para>int close(int fd);</para>
246 </entry>
247  </row></tbody></tgroup></informaltable>
248 <para>PARAMETERS
249 </para>
250 <informaltable><tgroup cols="2"><tbody><row><entry
251  align="char">
252 <para>int fd</para>
253 </entry><entry
254  align="char">
255 <para>File descriptor returned by a previous call to open().</para>
256 </entry>
257  </row></tbody></tgroup></informaltable>
258 <para>RETURN VALUE</para>
259 <informaltable><tgroup cols="2"><tbody><row><entry
260  align="char">
261 <para>EBADF</para>
262 </entry><entry
263  align="char">
264 <para>fd is not a valid open file descriptor.</para>
265 </entry>
266  </row></tbody></tgroup></informaltable>
267 </section>
268
269 &sub-fe-get-info;
270 &sub-fe-read-status;
271 &sub-fe-get-property;
272 &sub-fe-diseqc-reset-overload;
273 &sub-fe-diseqc-send-master-cmd;
274 &sub-fe-diseqc-recv-slave-reply;
275 &sub-fe-diseqc-send-burst;
276 &sub-fe-set-tone;
277 &sub-fe-set-voltage;
278 &sub-fe-enable-high-lnb-voltage;
279 &sub-fe-set-frontend-tune-mode;
280
281 </section>
282
283 <section id="frontend_legacy_dvbv3_api">
284 <title>DVB Frontend legacy API (a. k. a. DVBv3)</title>
285 <para>The usage of this API is deprecated, as it doesn't support all digital
286     TV standards, doesn't provide good statistics measurements and provides
287     incomplete information. This is kept only to support legacy applications.</para>
288
289 &sub-frontend_legacy_api;
290 </section>