xref: /linux-6.15/include/uapi/linux/dvb/frontend.h (revision e65faec5)
1 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
2 /*
3  * frontend.h
4  *
5  * Copyright (C) 2000 Marcus Metzler <[email protected]>
6  *		    Ralph  Metzler <[email protected]>
7  *		    Holger Waechtler <[email protected]>
8  *		    Andre Draszik <[email protected]>
9  *		    for convergence integrated media GmbH
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public License
13  * as published by the Free Software Foundation; either version 2.1
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  *
25  */
26 
27 #ifndef _DVBFRONTEND_H_
28 #define _DVBFRONTEND_H_
29 
30 #include <linux/types.h>
31 
32 /**
33  * enum fe_caps - Frontend capabilities
34  *
35  * @FE_IS_STUPID:			There's something wrong at the
36  *					frontend, and it can't report its
37  *					capabilities.
38  * @FE_CAN_INVERSION_AUTO:		Can auto-detect frequency spectral
39  *					band inversion
40  * @FE_CAN_FEC_1_2:			Supports FEC 1/2
41  * @FE_CAN_FEC_2_3:			Supports FEC 2/3
42  * @FE_CAN_FEC_3_4:			Supports FEC 3/4
43  * @FE_CAN_FEC_4_5:			Supports FEC 4/5
44  * @FE_CAN_FEC_5_6:			Supports FEC 5/6
45  * @FE_CAN_FEC_6_7:			Supports FEC 6/7
46  * @FE_CAN_FEC_7_8:			Supports FEC 7/8
47  * @FE_CAN_FEC_8_9:			Supports FEC 8/9
48  * @FE_CAN_FEC_AUTO:			Can auto-detect FEC
49  * @FE_CAN_QPSK:			Supports QPSK modulation
50  * @FE_CAN_QAM_16:			Supports 16-QAM modulation
51  * @FE_CAN_QAM_32:			Supports 32-QAM modulation
52  * @FE_CAN_QAM_64:			Supports 64-QAM modulation
53  * @FE_CAN_QAM_128:			Supports 128-QAM modulation
54  * @FE_CAN_QAM_256:			Supports 256-QAM modulation
55  * @FE_CAN_QAM_AUTO:			Can auto-detect QAM modulation
56  * @FE_CAN_TRANSMISSION_MODE_AUTO:	Can auto-detect transmission mode
57  * @FE_CAN_BANDWIDTH_AUTO:		Can auto-detect bandwidth
58  * @FE_CAN_GUARD_INTERVAL_AUTO:		Can auto-detect guard interval
59  * @FE_CAN_HIERARCHY_AUTO:		Can auto-detect hierarchy
60  * @FE_CAN_8VSB:			Supports 8-VSB modulation
61  * @FE_CAN_16VSB:			Supporta 16-VSB modulation
62  * @FE_HAS_EXTENDED_CAPS:		Unused
63  * @FE_CAN_MULTISTREAM:			Supports multistream filtering
64  * @FE_CAN_TURBO_FEC:			Supports "turbo FEC" modulation
65  * @FE_CAN_2G_MODULATION:		Supports "2nd generation" modulation,
66  *					e. g. DVB-S2, DVB-T2, DVB-C2
67  * @FE_NEEDS_BENDING:			Unused
68  * @FE_CAN_RECOVER:			Can recover from a cable unplug
69  *					automatically
70  * @FE_CAN_MUTE_TS:			Can stop spurious TS data output
71  */
72 enum fe_caps {
73 	FE_IS_STUPID			= 0,
74 	FE_CAN_INVERSION_AUTO		= 0x1,
75 	FE_CAN_FEC_1_2			= 0x2,
76 	FE_CAN_FEC_2_3			= 0x4,
77 	FE_CAN_FEC_3_4			= 0x8,
78 	FE_CAN_FEC_4_5			= 0x10,
79 	FE_CAN_FEC_5_6			= 0x20,
80 	FE_CAN_FEC_6_7			= 0x40,
81 	FE_CAN_FEC_7_8			= 0x80,
82 	FE_CAN_FEC_8_9			= 0x100,
83 	FE_CAN_FEC_AUTO			= 0x200,
84 	FE_CAN_QPSK			= 0x400,
85 	FE_CAN_QAM_16			= 0x800,
86 	FE_CAN_QAM_32			= 0x1000,
87 	FE_CAN_QAM_64			= 0x2000,
88 	FE_CAN_QAM_128			= 0x4000,
89 	FE_CAN_QAM_256			= 0x8000,
90 	FE_CAN_QAM_AUTO			= 0x10000,
91 	FE_CAN_TRANSMISSION_MODE_AUTO	= 0x20000,
92 	FE_CAN_BANDWIDTH_AUTO		= 0x40000,
93 	FE_CAN_GUARD_INTERVAL_AUTO	= 0x80000,
94 	FE_CAN_HIERARCHY_AUTO		= 0x100000,
95 	FE_CAN_8VSB			= 0x200000,
96 	FE_CAN_16VSB			= 0x400000,
97 	FE_HAS_EXTENDED_CAPS		= 0x800000,
98 	FE_CAN_MULTISTREAM		= 0x4000000,
99 	FE_CAN_TURBO_FEC		= 0x8000000,
100 	FE_CAN_2G_MODULATION		= 0x10000000,
101 	FE_NEEDS_BENDING		= 0x20000000,
102 	FE_CAN_RECOVER			= 0x40000000,
103 	FE_CAN_MUTE_TS			= 0x80000000
104 };
105 
106 /*
107  * DEPRECATED: Should be kept just due to backward compatibility.
108  */
109 enum fe_type {
110 	FE_QPSK,
111 	FE_QAM,
112 	FE_OFDM,
113 	FE_ATSC
114 };
115 
116 /**
117  * struct dvb_frontend_info - Frontend properties and capabilities
118  *
119  * @name:			Name of the frontend
120  * @type:			**DEPRECATED**.
121  *				Should not be used on modern programs,
122  *				as a frontend may have more than one type.
123  *				In order to get the support types of a given
124  *				frontend, use :c:type:`DTV_ENUM_DELSYS`
125  *				instead.
126  * @frequency_min:		Minimal frequency supported by the frontend.
127  * @frequency_max:		Minimal frequency supported by the frontend.
128  * @frequency_stepsize:		All frequencies are multiple of this value.
129  * @frequency_tolerance:	Frequency tolerance.
130  * @symbol_rate_min:		Minimal symbol rate, in bauds
131  *				(for Cable/Satellite systems).
132  * @symbol_rate_max:		Maximal symbol rate, in bauds
133  *				(for Cable/Satellite systems).
134  * @symbol_rate_tolerance:	Maximal symbol rate tolerance, in ppm
135  *				(for Cable/Satellite systems).
136  * @notifier_delay:		**DEPRECATED**. Not used by any driver.
137  * @caps:			Capabilities supported by the frontend,
138  *				as specified in &enum fe_caps.
139  *
140  * .. note:
141  *
142  *    #. The frequencies are specified in Hz for Terrestrial and Cable
143  *       systems.
144  *    #. The frequencies are specified in kHz for Satellite systems.
145  */
146 struct dvb_frontend_info {
147 	char       name[128];
148 	enum fe_type type;	/* DEPRECATED. Use DTV_ENUM_DELSYS instead */
149 	__u32      frequency_min;
150 	__u32      frequency_max;
151 	__u32      frequency_stepsize;
152 	__u32      frequency_tolerance;
153 	__u32      symbol_rate_min;
154 	__u32      symbol_rate_max;
155 	__u32      symbol_rate_tolerance;
156 	__u32      notifier_delay;		/* DEPRECATED */
157 	enum fe_caps caps;
158 };
159 
160 /**
161  * struct dvb_diseqc_master_cmd - DiSEqC master command
162  *
163  * @msg:
164  *	DiSEqC message to be sent. It contains a 3 bytes header with:
165  *	framing + address + command, and an optional argument
166  *	of up to 3 bytes of data.
167  * @msg_len:
168  *	Length of the DiSEqC message. Valid values are 3 to 6.
169  *
170  * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for
171  * the possible messages that can be used.
172  */
173 struct dvb_diseqc_master_cmd {
174 	__u8 msg[6];
175 	__u8 msg_len;
176 };
177 
178 /**
179  * struct dvb_diseqc_slave_reply - DiSEqC received data
180  *
181  * @msg:
182  *	DiSEqC message buffer to store a message received via DiSEqC.
183  *	It contains one byte header with: framing and
184  *	an optional argument of up to 3 bytes of data.
185  * @msg_len:
186  *	Length of the DiSEqC message. Valid values are 0 to 4,
187  *	where 0 means no message.
188  * @timeout:
189  *	Return from ioctl after timeout ms with errorcode when
190  *	no message was received.
191  *
192  * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for
193  * the possible messages that can be used.
194  */
195 struct dvb_diseqc_slave_reply {
196 	__u8 msg[4];
197 	__u8 msg_len;
198 	int  timeout;
199 };
200 
201 /**
202  * enum fe_sec_voltage - DC Voltage used to feed the LNBf
203  *
204  * @SEC_VOLTAGE_13:	Output 13V to the LNBf
205  * @SEC_VOLTAGE_18:	Output 18V to the LNBf
206  * @SEC_VOLTAGE_OFF:	Don't feed the LNBf with a DC voltage
207  */
208 enum fe_sec_voltage {
209 	SEC_VOLTAGE_13,
210 	SEC_VOLTAGE_18,
211 	SEC_VOLTAGE_OFF
212 };
213 
214 /**
215  * enum fe_sec_tone_mode - Type of tone to be send to the LNBf.
216  * @SEC_TONE_ON:	Sends a 22kHz tone burst to the antenna.
217  * @SEC_TONE_OFF:	Don't send a 22kHz tone to the antenna (except
218  *			if the ``FE_DISEQC_*`` ioctls are called).
219  */
220 enum fe_sec_tone_mode {
221 	SEC_TONE_ON,
222 	SEC_TONE_OFF
223 };
224 
225 /**
226  * enum fe_sec_mini_cmd - Type of mini burst to be sent
227  *
228  * @SEC_MINI_A:		Sends a mini-DiSEqC 22kHz '0' Tone Burst to select
229  *			satellite-A
230  * @SEC_MINI_B:		Sends a mini-DiSEqC 22kHz '1' Data Burst to select
231  *			satellite-B
232  */
233 enum fe_sec_mini_cmd {
234 	SEC_MINI_A,
235 	SEC_MINI_B
236 };
237 
238 /**
239  * enum fe_status - Enumerates the possible frontend status.
240  * @FE_NONE:		The frontend doesn't have any kind of lock.
241  *			That's the initial frontend status
242  * @FE_HAS_SIGNAL:	Has found something above the noise level.
243  * @FE_HAS_CARRIER:	Has found a signal.
244  * @FE_HAS_VITERBI:	FEC inner coding (Viterbi, LDPC or other inner code).
245  *			is stable.
246  * @FE_HAS_SYNC:	Synchronization bytes was found.
247  * @FE_HAS_LOCK:	Digital TV were locked and everything is working.
248  * @FE_TIMEDOUT:	Fo lock within the last about 2 seconds.
249  * @FE_REINIT:		Frontend was reinitialized, application is recommended
250  *			to reset DiSEqC, tone and parameters.
251  */
252 enum fe_status {
253 	FE_NONE			= 0x00,
254 	FE_HAS_SIGNAL		= 0x01,
255 	FE_HAS_CARRIER		= 0x02,
256 	FE_HAS_VITERBI		= 0x04,
257 	FE_HAS_SYNC		= 0x08,
258 	FE_HAS_LOCK		= 0x10,
259 	FE_TIMEDOUT		= 0x20,
260 	FE_REINIT		= 0x40,
261 };
262 
263 /**
264  * enum fe_spectral_inversion - Type of inversion band
265  *
266  * @INVERSION_OFF:	Don't do spectral band inversion.
267  * @INVERSION_ON:	Do spectral band inversion.
268  * @INVERSION_AUTO:	Autodetect spectral band inversion.
269  *
270  * This parameter indicates if spectral inversion should be presumed or
271  * not. In the automatic setting (``INVERSION_AUTO``) the hardware will try
272  * to figure out the correct setting by itself. If the hardware doesn't
273  * support, the %dvb_frontend will try to lock at the carrier first with
274  * inversion off. If it fails, it will try to enable inversion.
275  */
276 enum fe_spectral_inversion {
277 	INVERSION_OFF,
278 	INVERSION_ON,
279 	INVERSION_AUTO
280 };
281 
282 /**
283  * enum fe_code_rate - Type of Forward Error Correction (FEC)
284  *
285  *
286  * @FEC_NONE: No Forward Error Correction Code
287  * @FEC_1_2:  Forward Error Correction Code 1/2
288  * @FEC_2_3:  Forward Error Correction Code 2/3
289  * @FEC_3_4:  Forward Error Correction Code 3/4
290  * @FEC_4_5:  Forward Error Correction Code 4/5
291  * @FEC_5_6:  Forward Error Correction Code 5/6
292  * @FEC_6_7:  Forward Error Correction Code 6/7
293  * @FEC_7_8:  Forward Error Correction Code 7/8
294  * @FEC_8_9:  Forward Error Correction Code 8/9
295  * @FEC_AUTO: Autodetect Error Correction Code
296  * @FEC_3_5:  Forward Error Correction Code 3/5
297  * @FEC_9_10: Forward Error Correction Code 9/10
298  * @FEC_2_5:  Forward Error Correction Code 2/5
299  * @FEC_1_3:  Forward Error Correction Code 1/3
300  * @FEC_1_4:  Forward Error Correction Code 1/4
301  * @FEC_5_9:  Forward Error Correction Code 5/9
302  * @FEC_7_9:  Forward Error Correction Code 7/9
303  * @FEC_8_15:  Forward Error Correction Code 8/15
304  * @FEC_11_15: Forward Error Correction Code 11/15
305  * @FEC_13_18: Forward Error Correction Code 13/18
306  * @FEC_9_20:  Forward Error Correction Code 9/20
307  * @FEC_11_20: Forward Error Correction Code 11/20
308  * @FEC_23_36: Forward Error Correction Code 23/36
309  * @FEC_25_36: Forward Error Correction Code 25/36
310  * @FEC_13_45: Forward Error Correction Code 13/45
311  * @FEC_26_45: Forward Error Correction Code 26/45
312  * @FEC_28_45: Forward Error Correction Code 28/45
313  * @FEC_32_45: Forward Error Correction Code 32/45
314  * @FEC_77_90: Forward Error Correction Code 77/90
315  *
316  * Please note that not all FEC types are supported by a given standard.
317  */
318 enum fe_code_rate {
319 	FEC_NONE = 0,
320 	FEC_1_2,
321 	FEC_2_3,
322 	FEC_3_4,
323 	FEC_4_5,
324 	FEC_5_6,
325 	FEC_6_7,
326 	FEC_7_8,
327 	FEC_8_9,
328 	FEC_AUTO,
329 	FEC_3_5,
330 	FEC_9_10,
331 	FEC_2_5,
332 	FEC_1_3,
333 	FEC_1_4,
334 	FEC_5_9,
335 	FEC_7_9,
336 	FEC_8_15,
337 	FEC_11_15,
338 	FEC_13_18,
339 	FEC_9_20,
340 	FEC_11_20,
341 	FEC_23_36,
342 	FEC_25_36,
343 	FEC_13_45,
344 	FEC_26_45,
345 	FEC_28_45,
346 	FEC_32_45,
347 	FEC_77_90,
348 };
349 
350 /**
351  * enum fe_modulation - Type of modulation/constellation
352  * @QPSK:	QPSK modulation
353  * @QAM_16:	16-QAM modulation
354  * @QAM_32:	32-QAM modulation
355  * @QAM_64:	64-QAM modulation
356  * @QAM_128:	128-QAM modulation
357  * @QAM_256:	256-QAM modulation
358  * @QAM_AUTO:	Autodetect QAM modulation
359  * @VSB_8:	8-VSB modulation
360  * @VSB_16:	16-VSB modulation
361  * @PSK_8:	8-PSK modulation
362  * @APSK_16:	16-APSK modulation
363  * @APSK_32:	32-APSK modulation
364  * @DQPSK:	DQPSK modulation
365  * @QAM_4_NR:	4-QAM-NR modulation
366  * @QAM-1024:	1024-QAM modulation
367  * @QAM-4096:	4096-QAM modulation
368  * @APSK_8_L:	8APSK-L modulation
369  * @APSK_16_L:	16APSK-L modulation
370  * @APSK_32_L:	32APSK-L modulation
371  * @APSK_64:	64APSK modulation
372  * @APSK_64_L:	64APSK-L modulation
373  *
374  * Please note that not all modulations are supported by a given standard.
375  *
376  */
377 enum fe_modulation {
378 	QPSK,
379 	QAM_16,
380 	QAM_32,
381 	QAM_64,
382 	QAM_128,
383 	QAM_256,
384 	QAM_AUTO,
385 	VSB_8,
386 	VSB_16,
387 	PSK_8,
388 	APSK_16,
389 	APSK_32,
390 	DQPSK,
391 	QAM_4_NR,
392 	QAM_1024,
393 	QAM_4096,
394 	APSK_8_L,
395 	APSK_16_L,
396 	APSK_32_L,
397 	APSK_64,
398 	APSK_64_L,
399 };
400 
401 /**
402  * enum fe_transmit_mode - Transmission mode
403  *
404  * @TRANSMISSION_MODE_AUTO:
405  *	Autodetect transmission mode. The hardware will try to find the
406  *	correct FFT-size (if capable) to fill in the missing parameters.
407  * @TRANSMISSION_MODE_1K:
408  *	Transmission mode 1K
409  * @TRANSMISSION_MODE_2K:
410  *	Transmission mode 2K
411  * @TRANSMISSION_MODE_8K:
412  *	Transmission mode 8K
413  * @TRANSMISSION_MODE_4K:
414  *	Transmission mode 4K
415  * @TRANSMISSION_MODE_16K:
416  *	Transmission mode 16K
417  * @TRANSMISSION_MODE_32K:
418  *	Transmission mode 32K
419  * @TRANSMISSION_MODE_C1:
420  *	Single Carrier (C=1) transmission mode (DTMB only)
421  * @TRANSMISSION_MODE_C3780:
422  *	Multi Carrier (C=3780) transmission mode (DTMB only)
423  *
424  * Please note that not all transmission modes are supported by a given
425  * standard.
426  */
427 enum fe_transmit_mode {
428 	TRANSMISSION_MODE_2K,
429 	TRANSMISSION_MODE_8K,
430 	TRANSMISSION_MODE_AUTO,
431 	TRANSMISSION_MODE_4K,
432 	TRANSMISSION_MODE_1K,
433 	TRANSMISSION_MODE_16K,
434 	TRANSMISSION_MODE_32K,
435 	TRANSMISSION_MODE_C1,
436 	TRANSMISSION_MODE_C3780,
437 };
438 
439 /**
440  * enum fe_guard_interval - Guard interval
441  *
442  * @GUARD_INTERVAL_AUTO:	Autodetect the guard interval
443  * @GUARD_INTERVAL_1_128:	Guard interval 1/128
444  * @GUARD_INTERVAL_1_32:	Guard interval 1/32
445  * @GUARD_INTERVAL_1_16:	Guard interval 1/16
446  * @GUARD_INTERVAL_1_8:		Guard interval 1/8
447  * @GUARD_INTERVAL_1_4:		Guard interval 1/4
448  * @GUARD_INTERVAL_19_128:	Guard interval 19/128
449  * @GUARD_INTERVAL_19_256:	Guard interval 19/256
450  * @GUARD_INTERVAL_PN420:	PN length 420 (1/4)
451  * @GUARD_INTERVAL_PN595:	PN length 595 (1/6)
452  * @GUARD_INTERVAL_PN945:	PN length 945 (1/9)
453  * @GUARD_INTERVAL_1_64:	Guard interval 1/64
454  *
455  * Please note that not all guard intervals are supported by a given standard.
456  */
457 enum fe_guard_interval {
458 	GUARD_INTERVAL_1_32,
459 	GUARD_INTERVAL_1_16,
460 	GUARD_INTERVAL_1_8,
461 	GUARD_INTERVAL_1_4,
462 	GUARD_INTERVAL_AUTO,
463 	GUARD_INTERVAL_1_128,
464 	GUARD_INTERVAL_19_128,
465 	GUARD_INTERVAL_19_256,
466 	GUARD_INTERVAL_PN420,
467 	GUARD_INTERVAL_PN595,
468 	GUARD_INTERVAL_PN945,
469 	GUARD_INTERVAL_1_64,
470 };
471 
472 /**
473  * enum fe_hierarchy - Hierarchy
474  * @HIERARCHY_NONE:	No hierarchy
475  * @HIERARCHY_AUTO:	Autodetect hierarchy (if supported)
476  * @HIERARCHY_1:	Hierarchy 1
477  * @HIERARCHY_2:	Hierarchy 2
478  * @HIERARCHY_4:	Hierarchy 4
479  *
480  * Please note that not all hierarchy types are supported by a given standard.
481  */
482 enum fe_hierarchy {
483 	HIERARCHY_NONE,
484 	HIERARCHY_1,
485 	HIERARCHY_2,
486 	HIERARCHY_4,
487 	HIERARCHY_AUTO
488 };
489 
490 /**
491  * enum fe_interleaving - Interleaving
492  * @INTERLEAVING_NONE:	No interleaving.
493  * @INTERLEAVING_AUTO:	Auto-detect interleaving.
494  * @INTERLEAVING_240:	Interleaving of 240 symbols.
495  * @INTERLEAVING_720:	Interleaving of 720 symbols.
496  *
497  * Please note that, currently, only DTMB uses it.
498  */
499 enum fe_interleaving {
500 	INTERLEAVING_NONE,
501 	INTERLEAVING_AUTO,
502 	INTERLEAVING_240,
503 	INTERLEAVING_720,
504 };
505 
506 /* DVBv5 property Commands */
507 
508 #define DTV_UNDEFINED		0
509 #define DTV_TUNE		1
510 #define DTV_CLEAR		2
511 #define DTV_FREQUENCY		3
512 #define DTV_MODULATION		4
513 #define DTV_BANDWIDTH_HZ	5
514 #define DTV_INVERSION		6
515 #define DTV_DISEQC_MASTER	7
516 #define DTV_SYMBOL_RATE		8
517 #define DTV_INNER_FEC		9
518 #define DTV_VOLTAGE		10
519 #define DTV_TONE		11
520 #define DTV_PILOT		12
521 #define DTV_ROLLOFF		13
522 #define DTV_DISEQC_SLAVE_REPLY	14
523 
524 /* Basic enumeration set for querying unlimited capabilities */
525 #define DTV_FE_CAPABILITY_COUNT	15
526 #define DTV_FE_CAPABILITY	16
527 #define DTV_DELIVERY_SYSTEM	17
528 
529 /* ISDB-T and ISDB-Tsb */
530 #define DTV_ISDBT_PARTIAL_RECEPTION	18
531 #define DTV_ISDBT_SOUND_BROADCASTING	19
532 
533 #define DTV_ISDBT_SB_SUBCHANNEL_ID	20
534 #define DTV_ISDBT_SB_SEGMENT_IDX	21
535 #define DTV_ISDBT_SB_SEGMENT_COUNT	22
536 
537 #define DTV_ISDBT_LAYERA_FEC			23
538 #define DTV_ISDBT_LAYERA_MODULATION		24
539 #define DTV_ISDBT_LAYERA_SEGMENT_COUNT		25
540 #define DTV_ISDBT_LAYERA_TIME_INTERLEAVING	26
541 
542 #define DTV_ISDBT_LAYERB_FEC			27
543 #define DTV_ISDBT_LAYERB_MODULATION		28
544 #define DTV_ISDBT_LAYERB_SEGMENT_COUNT		29
545 #define DTV_ISDBT_LAYERB_TIME_INTERLEAVING	30
546 
547 #define DTV_ISDBT_LAYERC_FEC			31
548 #define DTV_ISDBT_LAYERC_MODULATION		32
549 #define DTV_ISDBT_LAYERC_SEGMENT_COUNT		33
550 #define DTV_ISDBT_LAYERC_TIME_INTERLEAVING	34
551 
552 #define DTV_API_VERSION		35
553 
554 #define DTV_CODE_RATE_HP	36
555 #define DTV_CODE_RATE_LP	37
556 #define DTV_GUARD_INTERVAL	38
557 #define DTV_TRANSMISSION_MODE	39
558 #define DTV_HIERARCHY		40
559 
560 #define DTV_ISDBT_LAYER_ENABLED	41
561 
562 #define DTV_STREAM_ID		42
563 #define DTV_ISDBS_TS_ID_LEGACY	DTV_STREAM_ID
564 #define DTV_DVBT2_PLP_ID_LEGACY	43
565 
566 #define DTV_ENUM_DELSYS		44
567 
568 /* ATSC-MH */
569 #define DTV_ATSCMH_FIC_VER		45
570 #define DTV_ATSCMH_PARADE_ID		46
571 #define DTV_ATSCMH_NOG			47
572 #define DTV_ATSCMH_TNOG			48
573 #define DTV_ATSCMH_SGN			49
574 #define DTV_ATSCMH_PRC			50
575 #define DTV_ATSCMH_RS_FRAME_MODE	51
576 #define DTV_ATSCMH_RS_FRAME_ENSEMBLE	52
577 #define DTV_ATSCMH_RS_CODE_MODE_PRI	53
578 #define DTV_ATSCMH_RS_CODE_MODE_SEC	54
579 #define DTV_ATSCMH_SCCC_BLOCK_MODE	55
580 #define DTV_ATSCMH_SCCC_CODE_MODE_A	56
581 #define DTV_ATSCMH_SCCC_CODE_MODE_B	57
582 #define DTV_ATSCMH_SCCC_CODE_MODE_C	58
583 #define DTV_ATSCMH_SCCC_CODE_MODE_D	59
584 
585 #define DTV_INTERLEAVING			60
586 #define DTV_LNA					61
587 
588 /* Quality parameters */
589 #define DTV_STAT_SIGNAL_STRENGTH	62
590 #define DTV_STAT_CNR			63
591 #define DTV_STAT_PRE_ERROR_BIT_COUNT	64
592 #define DTV_STAT_PRE_TOTAL_BIT_COUNT	65
593 #define DTV_STAT_POST_ERROR_BIT_COUNT	66
594 #define DTV_STAT_POST_TOTAL_BIT_COUNT	67
595 #define DTV_STAT_ERROR_BLOCK_COUNT	68
596 #define DTV_STAT_TOTAL_BLOCK_COUNT	69
597 
598 /* Physical layer scrambling */
599 #define DTV_SCRAMBLING_SEQUENCE_INDEX	70
600 
601 #define DTV_MAX_COMMAND		DTV_SCRAMBLING_SEQUENCE_INDEX
602 
603 /**
604  * enum fe_pilot - Type of pilot tone
605  *
606  * @PILOT_ON:	Pilot tones enabled
607  * @PILOT_OFF:	Pilot tones disabled
608  * @PILOT_AUTO:	Autodetect pilot tones
609  */
610 enum fe_pilot {
611 	PILOT_ON,
612 	PILOT_OFF,
613 	PILOT_AUTO,
614 };
615 
616 /**
617  * enum fe_rolloff - Rolloff factor
618  * @ROLLOFF_35:		Roloff factor: α=35%
619  * @ROLLOFF_20:		Roloff factor: α=20%
620  * @ROLLOFF_25:		Roloff factor: α=25%
621  * @ROLLOFF_AUTO:	Auto-detect the roloff factor.
622  * @ROLLOFF_15:		Rolloff factor: α=15%
623  * @ROLLOFF_10:		Rolloff factor: α=10%
624  * @ROLLOFF_5:		Rolloff factor: α=5%
625  *
626  * .. note:
627  *
628  *    Roloff factor of 35% is implied on DVB-S. On DVB-S2, it is default.
629  */
630 enum fe_rolloff {
631 	ROLLOFF_35,
632 	ROLLOFF_20,
633 	ROLLOFF_25,
634 	ROLLOFF_AUTO,
635 	ROLLOFF_15,
636 	ROLLOFF_10,
637 	ROLLOFF_5,
638 };
639 
640 /**
641  * enum fe_delivery_system - Type of the delivery system
642  *
643  * @SYS_UNDEFINED:
644  *	Undefined standard. Generally, indicates an error
645  * @SYS_DVBC_ANNEX_A:
646  *	Cable TV: DVB-C following ITU-T J.83 Annex A spec
647  * @SYS_DVBC_ANNEX_B:
648  *	Cable TV: DVB-C following ITU-T J.83 Annex B spec (ClearQAM)
649  * @SYS_DVBC_ANNEX_C:
650  *	Cable TV: DVB-C following ITU-T J.83 Annex C spec
651  * @SYS_DVBC2:
652  *      Cable TV: DVB-C2
653  * @SYS_ISDBC:
654  *	Cable TV: ISDB-C (no drivers yet)
655  * @SYS_DVBT:
656  *	Terrestrial TV: DVB-T
657  * @SYS_DVBT2:
658  *	Terrestrial TV: DVB-T2
659  * @SYS_ISDBT:
660  *	Terrestrial TV: ISDB-T
661  * @SYS_ATSC:
662  *	Terrestrial TV: ATSC
663  * @SYS_ATSCMH:
664  *	Terrestrial TV (mobile): ATSC-M/H
665  * @SYS_DTMB:
666  *	Terrestrial TV: DTMB
667  * @SYS_DVBS:
668  *	Satellite TV: DVB-S
669  * @SYS_DVBS2:
670  *	Satellite TV: DVB-S2 and DVB-S2X
671  * @SYS_TURBO:
672  *	Satellite TV: DVB-S Turbo
673  * @SYS_ISDBS:
674  *	Satellite TV: ISDB-S
675  * @SYS_DAB:
676  *	Digital audio: DAB (not fully supported)
677  * @SYS_DSS:
678  *	Satellite TV: DSS (not fully supported)
679  * @SYS_CMMB:
680  *	Terrestrial TV (mobile): CMMB (not fully supported)
681  * @SYS_DVBH:
682  *	Terrestrial TV (mobile): DVB-H (standard deprecated)
683  */
684 enum fe_delivery_system {
685 	SYS_UNDEFINED,
686 	SYS_DVBC_ANNEX_A,
687 	SYS_DVBC_ANNEX_B,
688 	SYS_DVBT,
689 	SYS_DSS,
690 	SYS_DVBS,
691 	SYS_DVBS2,
692 	SYS_DVBH,
693 	SYS_ISDBT,
694 	SYS_ISDBS,
695 	SYS_ISDBC,
696 	SYS_ATSC,
697 	SYS_ATSCMH,
698 	SYS_DTMB,
699 	SYS_CMMB,
700 	SYS_DAB,
701 	SYS_DVBT2,
702 	SYS_TURBO,
703 	SYS_DVBC_ANNEX_C,
704 	SYS_DVBC2,
705 };
706 
707 /* backward compatibility definitions for delivery systems */
708 #define SYS_DVBC_ANNEX_AC	SYS_DVBC_ANNEX_A
709 #define SYS_DMBTH		SYS_DTMB /* DMB-TH is legacy name, use DTMB */
710 
711 /* ATSC-MH specific parameters */
712 
713 /**
714  * enum atscmh_sccc_block_mode - Type of Series Concatenated Convolutional
715  *				 Code Block Mode.
716  *
717  * @ATSCMH_SCCC_BLK_SEP:
718  *	Separate SCCC: the SCCC outer code mode shall be set independently
719  *	for each Group Region (A, B, C, D)
720  * @ATSCMH_SCCC_BLK_COMB:
721  *	Combined SCCC: all four Regions shall have the same SCCC outer
722  *	code mode.
723  * @ATSCMH_SCCC_BLK_RES:
724  *	Reserved. Shouldn't be used.
725  */
726 enum atscmh_sccc_block_mode {
727 	ATSCMH_SCCC_BLK_SEP      = 0,
728 	ATSCMH_SCCC_BLK_COMB     = 1,
729 	ATSCMH_SCCC_BLK_RES      = 2,
730 };
731 
732 /**
733  * enum atscmh_sccc_code_mode - Type of Series Concatenated Convolutional
734  *				Code Rate.
735  *
736  * @ATSCMH_SCCC_CODE_HLF:
737  *	The outer code rate of a SCCC Block is 1/2 rate.
738  * @ATSCMH_SCCC_CODE_QTR:
739  *	The outer code rate of a SCCC Block is 1/4 rate.
740  * @ATSCMH_SCCC_CODE_RES:
741  *	Reserved. Should not be used.
742  */
743 enum atscmh_sccc_code_mode {
744 	ATSCMH_SCCC_CODE_HLF     = 0,
745 	ATSCMH_SCCC_CODE_QTR     = 1,
746 	ATSCMH_SCCC_CODE_RES     = 2,
747 };
748 
749 /**
750  * enum atscmh_rs_frame_ensemble - Reed Solomon(RS) frame ensemble.
751  *
752  * @ATSCMH_RSFRAME_ENS_PRI:	Primary Ensemble.
753  * @ATSCMH_RSFRAME_ENS_SEC:	Secondary Ensemble.
754  */
755 enum atscmh_rs_frame_ensemble {
756 	ATSCMH_RSFRAME_ENS_PRI   = 0,
757 	ATSCMH_RSFRAME_ENS_SEC   = 1,
758 };
759 
760 /**
761  * enum atscmh_rs_frame_mode - Reed Solomon (RS) frame mode.
762  *
763  * @ATSCMH_RSFRAME_PRI_ONLY:
764  *	Single Frame: There is only a primary RS Frame for all Group
765  *	Regions.
766  * @ATSCMH_RSFRAME_PRI_SEC:
767  *	Dual Frame: There are two separate RS Frames: Primary RS Frame for
768  *	Group Region A and B and Secondary RS Frame for Group Region C and
769  *	D.
770  * @ATSCMH_RSFRAME_RES:
771  *	Reserved. Shouldn't be used.
772  */
773 enum atscmh_rs_frame_mode {
774 	ATSCMH_RSFRAME_PRI_ONLY  = 0,
775 	ATSCMH_RSFRAME_PRI_SEC   = 1,
776 	ATSCMH_RSFRAME_RES       = 2,
777 };
778 
779 /**
780  * enum atscmh_rs_code_mode
781  * @ATSCMH_RSCODE_211_187:	Reed Solomon code (211,187).
782  * @ATSCMH_RSCODE_223_187:	Reed Solomon code (223,187).
783  * @ATSCMH_RSCODE_235_187:	Reed Solomon code (235,187).
784  * @ATSCMH_RSCODE_RES:		Reserved. Shouldn't be used.
785  */
786 enum atscmh_rs_code_mode {
787 	ATSCMH_RSCODE_211_187    = 0,
788 	ATSCMH_RSCODE_223_187    = 1,
789 	ATSCMH_RSCODE_235_187    = 2,
790 	ATSCMH_RSCODE_RES        = 3,
791 };
792 
793 #define NO_STREAM_ID_FILTER	(~0U)
794 #define LNA_AUTO                (~0U)
795 
796 /**
797  * enum fecap_scale_params - scale types for the quality parameters.
798  *
799  * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That
800  *			    could indicate a temporary or a permanent
801  *			    condition.
802  * @FE_SCALE_DECIBEL: The scale is measured in 0.001 dB steps, typically
803  *		      used on signal measures.
804  * @FE_SCALE_RELATIVE: The scale is a relative percentual measure,
805  *		       ranging from 0 (0%) to 0xffff (100%).
806  * @FE_SCALE_COUNTER: The scale counts the occurrence of an event, like
807  *		      bit error, block error, lapsed time.
808  */
809 enum fecap_scale_params {
810 	FE_SCALE_NOT_AVAILABLE = 0,
811 	FE_SCALE_DECIBEL,
812 	FE_SCALE_RELATIVE,
813 	FE_SCALE_COUNTER
814 };
815 
816 /**
817  * struct dtv_stats - Used for reading a DTV status property
818  *
819  * @scale:
820  *	Filled with enum fecap_scale_params - the scale in usage
821  *	for that parameter
822  *
823  * @svalue:
824  *	integer value of the measure, for %FE_SCALE_DECIBEL,
825  *	used for dB measures. The unit is 0.001 dB.
826  *
827  * @uvalue:
828  *	unsigned integer value of the measure, used when @scale is
829  *	either %FE_SCALE_RELATIVE or %FE_SCALE_COUNTER.
830  *
831  * For most delivery systems, this will return a single value for each
832  * parameter.
833  *
834  * It should be noticed, however, that new OFDM delivery systems like
835  * ISDB can use different modulation types for each group of carriers.
836  * On such standards, up to 8 groups of statistics can be provided, one
837  * for each carrier group (called "layer" on ISDB).
838  *
839  * In order to be consistent with other delivery systems, the first
840  * value refers to the entire set of carriers ("global").
841  *
842  * @scale should use the value %FE_SCALE_NOT_AVAILABLE when
843  * the value for the entire group of carriers or from one specific layer
844  * is not provided by the hardware.
845  *
846  * @len should be filled with the latest filled status + 1.
847  *
848  * In other words, for ISDB, those values should be filled like::
849  *
850  *	u.st.stat.svalue[0] = global statistics;
851  *	u.st.stat.scale[0] = FE_SCALE_DECIBEL;
852  *	u.st.stat.value[1] = layer A statistics;
853  *	u.st.stat.scale[1] = FE_SCALE_NOT_AVAILABLE (if not available);
854  *	u.st.stat.svalue[2] = layer B statistics;
855  *	u.st.stat.scale[2] = FE_SCALE_DECIBEL;
856  *	u.st.stat.svalue[3] = layer C statistics;
857  *	u.st.stat.scale[3] = FE_SCALE_DECIBEL;
858  *	u.st.len = 4;
859  */
860 struct dtv_stats {
861 	__u8 scale;	/* enum fecap_scale_params type */
862 	union {
863 		__u64 uvalue;	/* for counters and relative scales */
864 		__s64 svalue;	/* for 0.001 dB measures */
865 	};
866 } __attribute__ ((packed));
867 
868 
869 #define MAX_DTV_STATS   4
870 
871 /**
872  * struct dtv_fe_stats - store Digital TV frontend statistics
873  *
874  * @len:	length of the statistics - if zero, stats is disabled.
875  * @stat:	array with digital TV statistics.
876  *
877  * On most standards, @len can either be 0 or 1. However, for ISDB, each
878  * layer is modulated in separate. So, each layer may have its own set
879  * of statistics. If so, stat[0] carries on a global value for the property.
880  * Indexes 1 to 3 means layer A to B.
881  */
882 struct dtv_fe_stats {
883 	__u8 len;
884 	struct dtv_stats stat[MAX_DTV_STATS];
885 } __attribute__ ((packed));
886 
887 /**
888  * struct dtv_property - store one of frontend command and its value
889  *
890  * @cmd:		Digital TV command.
891  * @reserved:		Not used.
892  * @u:			Union with the values for the command.
893  * @u.data:		A unsigned 32 bits integer with command value.
894  * @u.buffer:		Struct to store bigger properties.
895  *			Currently unused.
896  * @u.buffer.data:	an unsigned 32-bits array.
897  * @u.buffer.len:	number of elements of the buffer.
898  * @u.buffer.reserved1:	Reserved.
899  * @u.buffer.reserved2:	Reserved.
900  * @u.st:		a &struct dtv_fe_stats array of statistics.
901  * @result:		Currently unused.
902  *
903  */
904 struct dtv_property {
905 	__u32 cmd;
906 	__u32 reserved[3];
907 	union {
908 		__u32 data;
909 		struct dtv_fe_stats st;
910 		struct {
911 			__u8 data[32];
912 			__u32 len;
913 			__u32 reserved1[3];
914 			void *reserved2;
915 		} buffer;
916 	} u;
917 	int result;
918 } __attribute__ ((packed));
919 
920 /* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */
921 #define DTV_IOCTL_MAX_MSGS 64
922 
923 /**
924  * struct dtv_properties - a set of command/value pairs.
925  *
926  * @num:	amount of commands stored at the struct.
927  * @props:	a pointer to &struct dtv_property.
928  */
929 struct dtv_properties {
930 	__u32 num;
931 	struct dtv_property *props;
932 };
933 
934 /*
935  * When set, this flag will disable any zigzagging or other "normal" tuning
936  * behavior. Additionally, there will be no automatic monitoring of the lock
937  * status, and hence no frontend events will be generated. If a frontend device
938  * is closed, this flag will be automatically turned off when the device is
939  * reopened read-write.
940  */
941 #define FE_TUNE_MODE_ONESHOT 0x01
942 
943 /* Digital TV Frontend API calls */
944 
945 #define FE_GET_INFO		   _IOR('o', 61, struct dvb_frontend_info)
946 
947 #define FE_DISEQC_RESET_OVERLOAD   _IO('o', 62)
948 #define FE_DISEQC_SEND_MASTER_CMD  _IOW('o', 63, struct dvb_diseqc_master_cmd)
949 #define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply)
950 #define FE_DISEQC_SEND_BURST       _IO('o', 65)  /* fe_sec_mini_cmd_t */
951 
952 #define FE_SET_TONE		   _IO('o', 66)  /* fe_sec_tone_mode_t */
953 #define FE_SET_VOLTAGE		   _IO('o', 67)  /* fe_sec_voltage_t */
954 #define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68)  /* int */
955 
956 #define FE_READ_STATUS		   _IOR('o', 69, fe_status_t)
957 #define FE_READ_BER		   _IOR('o', 70, __u32)
958 #define FE_READ_SIGNAL_STRENGTH    _IOR('o', 71, __u16)
959 #define FE_READ_SNR		   _IOR('o', 72, __u16)
960 #define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32)
961 
962 #define FE_SET_FRONTEND_TUNE_MODE  _IO('o', 81) /* unsigned int */
963 #define FE_GET_EVENT		   _IOR('o', 78, struct dvb_frontend_event)
964 
965 #define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */
966 
967 #define FE_SET_PROPERTY		   _IOW('o', 82, struct dtv_properties)
968 #define FE_GET_PROPERTY		   _IOR('o', 83, struct dtv_properties)
969 
970 #if defined(__DVB_CORE__) || !defined(__KERNEL__)
971 
972 /*
973  * DEPRECATED: Everything below is deprecated in favor of DVBv5 API
974  *
975  * The DVBv3 only ioctls, structs and enums should not be used on
976  * newer programs, as it doesn't support the second generation of
977  * digital TV standards, nor supports newer delivery systems.
978  * They also don't support modern frontends with usually support multiple
979  * delivery systems.
980  *
981  * Drivers shouldn't use them.
982  *
983  * New applications should use DVBv5 delivery system instead
984  */
985 
986 /*
987  */
988 
989 enum fe_bandwidth {
990 	BANDWIDTH_8_MHZ,
991 	BANDWIDTH_7_MHZ,
992 	BANDWIDTH_6_MHZ,
993 	BANDWIDTH_AUTO,
994 	BANDWIDTH_5_MHZ,
995 	BANDWIDTH_10_MHZ,
996 	BANDWIDTH_1_712_MHZ,
997 };
998 
999 /* This is kept for legacy userspace support */
1000 typedef enum fe_sec_voltage fe_sec_voltage_t;
1001 typedef enum fe_caps fe_caps_t;
1002 typedef enum fe_type fe_type_t;
1003 typedef enum fe_sec_tone_mode fe_sec_tone_mode_t;
1004 typedef enum fe_sec_mini_cmd fe_sec_mini_cmd_t;
1005 typedef enum fe_status fe_status_t;
1006 typedef enum fe_spectral_inversion fe_spectral_inversion_t;
1007 typedef enum fe_code_rate fe_code_rate_t;
1008 typedef enum fe_modulation fe_modulation_t;
1009 typedef enum fe_transmit_mode fe_transmit_mode_t;
1010 typedef enum fe_bandwidth fe_bandwidth_t;
1011 typedef enum fe_guard_interval fe_guard_interval_t;
1012 typedef enum fe_hierarchy fe_hierarchy_t;
1013 typedef enum fe_pilot fe_pilot_t;
1014 typedef enum fe_rolloff fe_rolloff_t;
1015 typedef enum fe_delivery_system fe_delivery_system_t;
1016 
1017 /* DVBv3 structs */
1018 
1019 struct dvb_qpsk_parameters {
1020 	__u32		symbol_rate;  /* symbol rate in Symbols per second */
1021 	fe_code_rate_t	fec_inner;    /* forward error correction (see above) */
1022 };
1023 
1024 struct dvb_qam_parameters {
1025 	__u32		symbol_rate; /* symbol rate in Symbols per second */
1026 	fe_code_rate_t	fec_inner;   /* forward error correction (see above) */
1027 	fe_modulation_t	modulation;  /* modulation type (see above) */
1028 };
1029 
1030 struct dvb_vsb_parameters {
1031 	fe_modulation_t	modulation;  /* modulation type (see above) */
1032 };
1033 
1034 struct dvb_ofdm_parameters {
1035 	fe_bandwidth_t      bandwidth;
1036 	fe_code_rate_t      code_rate_HP;  /* high priority stream code rate */
1037 	fe_code_rate_t      code_rate_LP;  /* low priority stream code rate */
1038 	fe_modulation_t     constellation; /* modulation type (see above) */
1039 	fe_transmit_mode_t  transmission_mode;
1040 	fe_guard_interval_t guard_interval;
1041 	fe_hierarchy_t      hierarchy_information;
1042 };
1043 
1044 struct dvb_frontend_parameters {
1045 	__u32 frequency;  /* (absolute) frequency in Hz for DVB-C/DVB-T/ATSC */
1046 			  /* intermediate frequency in kHz for DVB-S */
1047 	fe_spectral_inversion_t inversion;
1048 	union {
1049 		struct dvb_qpsk_parameters qpsk;	/* DVB-S */
1050 		struct dvb_qam_parameters  qam;		/* DVB-C */
1051 		struct dvb_ofdm_parameters ofdm;	/* DVB-T */
1052 		struct dvb_vsb_parameters vsb;		/* ATSC */
1053 	} u;
1054 };
1055 
1056 struct dvb_frontend_event {
1057 	fe_status_t status;
1058 	struct dvb_frontend_parameters parameters;
1059 };
1060 
1061 /* DVBv3 API calls */
1062 
1063 #define FE_SET_FRONTEND		   _IOW('o', 76, struct dvb_frontend_parameters)
1064 #define FE_GET_FRONTEND		   _IOR('o', 77, struct dvb_frontend_parameters)
1065 
1066 #endif
1067 
1068 #endif /*_DVBFRONTEND_H_*/
1069