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