• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
2 /*
3  * frontend.h
4  *
5  * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
6  *		    Ralph  Metzler <ralph@convergence.de>
7  *		    Holger Waechtler <holger@convergence.de>
8  *		    Andre Draszik <ad@convergence.de>
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  *
300  * Please note that not all FEC types are supported by a given standard.
301  */
302 enum fe_code_rate {
303 	FEC_NONE = 0,
304 	FEC_1_2,
305 	FEC_2_3,
306 	FEC_3_4,
307 	FEC_4_5,
308 	FEC_5_6,
309 	FEC_6_7,
310 	FEC_7_8,
311 	FEC_8_9,
312 	FEC_AUTO,
313 	FEC_3_5,
314 	FEC_9_10,
315 	FEC_2_5,
316 };
317 
318 /**
319  * enum fe_modulation - Type of modulation/constellation
320  * @QPSK:	QPSK modulation
321  * @QAM_16:	16-QAM modulation
322  * @QAM_32:	32-QAM modulation
323  * @QAM_64:	64-QAM modulation
324  * @QAM_128:	128-QAM modulation
325  * @QAM_256:	256-QAM modulation
326  * @QAM_AUTO:	Autodetect QAM modulation
327  * @VSB_8:	8-VSB modulation
328  * @VSB_16:	16-VSB modulation
329  * @PSK_8:	8-PSK modulation
330  * @APSK_16:	16-APSK modulation
331  * @APSK_32:	32-APSK modulation
332  * @DQPSK:	DQPSK modulation
333  * @QAM_4_NR:	4-QAM-NR modulation
334  *
335  * Please note that not all modulations are supported by a given standard.
336  *
337  */
338 enum fe_modulation {
339 	QPSK,
340 	QAM_16,
341 	QAM_32,
342 	QAM_64,
343 	QAM_128,
344 	QAM_256,
345 	QAM_AUTO,
346 	VSB_8,
347 	VSB_16,
348 	PSK_8,
349 	APSK_16,
350 	APSK_32,
351 	DQPSK,
352 	QAM_4_NR,
353 };
354 
355 /**
356  * enum fe_transmit_mode - Transmission mode
357  *
358  * @TRANSMISSION_MODE_AUTO:
359  *	Autodetect transmission mode. The hardware will try to find the
360  *	correct FFT-size (if capable) to fill in the missing parameters.
361  * @TRANSMISSION_MODE_1K:
362  *	Transmission mode 1K
363  * @TRANSMISSION_MODE_2K:
364  *	Transmission mode 2K
365  * @TRANSMISSION_MODE_8K:
366  *	Transmission mode 8K
367  * @TRANSMISSION_MODE_4K:
368  *	Transmission mode 4K
369  * @TRANSMISSION_MODE_16K:
370  *	Transmission mode 16K
371  * @TRANSMISSION_MODE_32K:
372  *	Transmission mode 32K
373  * @TRANSMISSION_MODE_C1:
374  *	Single Carrier (C=1) transmission mode (DTMB only)
375  * @TRANSMISSION_MODE_C3780:
376  *	Multi Carrier (C=3780) transmission mode (DTMB only)
377  *
378  * Please note that not all transmission modes are supported by a given
379  * standard.
380  */
381 enum fe_transmit_mode {
382 	TRANSMISSION_MODE_2K,
383 	TRANSMISSION_MODE_8K,
384 	TRANSMISSION_MODE_AUTO,
385 	TRANSMISSION_MODE_4K,
386 	TRANSMISSION_MODE_1K,
387 	TRANSMISSION_MODE_16K,
388 	TRANSMISSION_MODE_32K,
389 	TRANSMISSION_MODE_C1,
390 	TRANSMISSION_MODE_C3780,
391 };
392 
393 /**
394  * enum fe_guard_interval - Guard interval
395  *
396  * @GUARD_INTERVAL_AUTO:	Autodetect the guard interval
397  * @GUARD_INTERVAL_1_128:	Guard interval 1/128
398  * @GUARD_INTERVAL_1_32:	Guard interval 1/32
399  * @GUARD_INTERVAL_1_16:	Guard interval 1/16
400  * @GUARD_INTERVAL_1_8:		Guard interval 1/8
401  * @GUARD_INTERVAL_1_4:		Guard interval 1/4
402  * @GUARD_INTERVAL_19_128:	Guard interval 19/128
403  * @GUARD_INTERVAL_19_256:	Guard interval 19/256
404  * @GUARD_INTERVAL_PN420:	PN length 420 (1/4)
405  * @GUARD_INTERVAL_PN595:	PN length 595 (1/6)
406  * @GUARD_INTERVAL_PN945:	PN length 945 (1/9)
407  *
408  * Please note that not all guard intervals are supported by a given standard.
409  */
410 enum fe_guard_interval {
411 	GUARD_INTERVAL_1_32,
412 	GUARD_INTERVAL_1_16,
413 	GUARD_INTERVAL_1_8,
414 	GUARD_INTERVAL_1_4,
415 	GUARD_INTERVAL_AUTO,
416 	GUARD_INTERVAL_1_128,
417 	GUARD_INTERVAL_19_128,
418 	GUARD_INTERVAL_19_256,
419 	GUARD_INTERVAL_PN420,
420 	GUARD_INTERVAL_PN595,
421 	GUARD_INTERVAL_PN945,
422 };
423 
424 /**
425  * enum fe_hierarchy - Hierarchy
426  * @HIERARCHY_NONE:	No hierarchy
427  * @HIERARCHY_AUTO:	Autodetect hierarchy (if supported)
428  * @HIERARCHY_1:	Hierarchy 1
429  * @HIERARCHY_2:	Hierarchy 2
430  * @HIERARCHY_4:	Hierarchy 4
431  *
432  * Please note that not all hierarchy types are supported by a given standard.
433  */
434 enum fe_hierarchy {
435 	HIERARCHY_NONE,
436 	HIERARCHY_1,
437 	HIERARCHY_2,
438 	HIERARCHY_4,
439 	HIERARCHY_AUTO
440 };
441 
442 /**
443  * enum fe_interleaving - Interleaving
444  * @INTERLEAVING_NONE:	No interleaving.
445  * @INTERLEAVING_AUTO:	Auto-detect interleaving.
446  * @INTERLEAVING_240:	Interleaving of 240 symbols.
447  * @INTERLEAVING_720:	Interleaving of 720 symbols.
448  *
449  * Please note that, currently, only DTMB uses it.
450  */
451 enum fe_interleaving {
452 	INTERLEAVING_NONE,
453 	INTERLEAVING_AUTO,
454 	INTERLEAVING_240,
455 	INTERLEAVING_720,
456 };
457 
458 /* DVBv5 property Commands */
459 
460 #define DTV_UNDEFINED		0
461 #define DTV_TUNE		1
462 #define DTV_CLEAR		2
463 #define DTV_FREQUENCY		3
464 #define DTV_MODULATION		4
465 #define DTV_BANDWIDTH_HZ	5
466 #define DTV_INVERSION		6
467 #define DTV_DISEQC_MASTER	7
468 #define DTV_SYMBOL_RATE		8
469 #define DTV_INNER_FEC		9
470 #define DTV_VOLTAGE		10
471 #define DTV_TONE		11
472 #define DTV_PILOT		12
473 #define DTV_ROLLOFF		13
474 #define DTV_DISEQC_SLAVE_REPLY	14
475 
476 /* Basic enumeration set for querying unlimited capabilities */
477 #define DTV_FE_CAPABILITY_COUNT	15
478 #define DTV_FE_CAPABILITY	16
479 #define DTV_DELIVERY_SYSTEM	17
480 
481 /* ISDB-T and ISDB-Tsb */
482 #define DTV_ISDBT_PARTIAL_RECEPTION	18
483 #define DTV_ISDBT_SOUND_BROADCASTING	19
484 
485 #define DTV_ISDBT_SB_SUBCHANNEL_ID	20
486 #define DTV_ISDBT_SB_SEGMENT_IDX	21
487 #define DTV_ISDBT_SB_SEGMENT_COUNT	22
488 
489 #define DTV_ISDBT_LAYERA_FEC			23
490 #define DTV_ISDBT_LAYERA_MODULATION		24
491 #define DTV_ISDBT_LAYERA_SEGMENT_COUNT		25
492 #define DTV_ISDBT_LAYERA_TIME_INTERLEAVING	26
493 
494 #define DTV_ISDBT_LAYERB_FEC			27
495 #define DTV_ISDBT_LAYERB_MODULATION		28
496 #define DTV_ISDBT_LAYERB_SEGMENT_COUNT		29
497 #define DTV_ISDBT_LAYERB_TIME_INTERLEAVING	30
498 
499 #define DTV_ISDBT_LAYERC_FEC			31
500 #define DTV_ISDBT_LAYERC_MODULATION		32
501 #define DTV_ISDBT_LAYERC_SEGMENT_COUNT		33
502 #define DTV_ISDBT_LAYERC_TIME_INTERLEAVING	34
503 
504 #define DTV_API_VERSION		35
505 
506 #define DTV_CODE_RATE_HP	36
507 #define DTV_CODE_RATE_LP	37
508 #define DTV_GUARD_INTERVAL	38
509 #define DTV_TRANSMISSION_MODE	39
510 #define DTV_HIERARCHY		40
511 
512 #define DTV_ISDBT_LAYER_ENABLED	41
513 
514 #define DTV_STREAM_ID		42
515 #define DTV_ISDBS_TS_ID_LEGACY	DTV_STREAM_ID
516 #define DTV_DVBT2_PLP_ID_LEGACY	43
517 
518 #define DTV_ENUM_DELSYS		44
519 
520 /* ATSC-MH */
521 #define DTV_ATSCMH_FIC_VER		45
522 #define DTV_ATSCMH_PARADE_ID		46
523 #define DTV_ATSCMH_NOG			47
524 #define DTV_ATSCMH_TNOG			48
525 #define DTV_ATSCMH_SGN			49
526 #define DTV_ATSCMH_PRC			50
527 #define DTV_ATSCMH_RS_FRAME_MODE	51
528 #define DTV_ATSCMH_RS_FRAME_ENSEMBLE	52
529 #define DTV_ATSCMH_RS_CODE_MODE_PRI	53
530 #define DTV_ATSCMH_RS_CODE_MODE_SEC	54
531 #define DTV_ATSCMH_SCCC_BLOCK_MODE	55
532 #define DTV_ATSCMH_SCCC_CODE_MODE_A	56
533 #define DTV_ATSCMH_SCCC_CODE_MODE_B	57
534 #define DTV_ATSCMH_SCCC_CODE_MODE_C	58
535 #define DTV_ATSCMH_SCCC_CODE_MODE_D	59
536 
537 #define DTV_INTERLEAVING			60
538 #define DTV_LNA					61
539 
540 /* Quality parameters */
541 #define DTV_STAT_SIGNAL_STRENGTH	62
542 #define DTV_STAT_CNR			63
543 #define DTV_STAT_PRE_ERROR_BIT_COUNT	64
544 #define DTV_STAT_PRE_TOTAL_BIT_COUNT	65
545 #define DTV_STAT_POST_ERROR_BIT_COUNT	66
546 #define DTV_STAT_POST_TOTAL_BIT_COUNT	67
547 #define DTV_STAT_ERROR_BLOCK_COUNT	68
548 #define DTV_STAT_TOTAL_BLOCK_COUNT	69
549 
550 #define DTV_MAX_COMMAND		DTV_STAT_TOTAL_BLOCK_COUNT
551 
552 /**
553  * enum fe_pilot - Type of pilot tone
554  *
555  * @PILOT_ON:	Pilot tones enabled
556  * @PILOT_OFF:	Pilot tones disabled
557  * @PILOT_AUTO:	Autodetect pilot tones
558  */
559 enum fe_pilot {
560 	PILOT_ON,
561 	PILOT_OFF,
562 	PILOT_AUTO,
563 };
564 
565 /**
566  * enum fe_rolloff - Rolloff factor
567  * @ROLLOFF_35:		Roloff factor: α=35%
568  * @ROLLOFF_20:		Roloff factor: α=20%
569  * @ROLLOFF_25:		Roloff factor: α=25%
570  * @ROLLOFF_AUTO:	Auto-detect the roloff factor.
571  *
572  * .. note:
573  *
574  *    Roloff factor of 35% is implied on DVB-S. On DVB-S2, it is default.
575  */
576 enum fe_rolloff {
577 	ROLLOFF_35,
578 	ROLLOFF_20,
579 	ROLLOFF_25,
580 	ROLLOFF_AUTO,
581 };
582 
583 /**
584  * enum fe_delivery_system - Type of the delivery system
585  *
586  * @SYS_UNDEFINED:
587  *	Undefined standard. Generally, indicates an error
588  * @SYS_DVBC_ANNEX_A:
589  *	Cable TV: DVB-C following ITU-T J.83 Annex A spec
590  * @SYS_DVBC_ANNEX_B:
591  *	Cable TV: DVB-C following ITU-T J.83 Annex B spec (ClearQAM)
592  * @SYS_DVBC_ANNEX_C:
593  *	Cable TV: DVB-C following ITU-T J.83 Annex C spec
594  * @SYS_ISDBC:
595  *	Cable TV: ISDB-C (no drivers yet)
596  * @SYS_DVBT:
597  *	Terrestrial TV: DVB-T
598  * @SYS_DVBT2:
599  *	Terrestrial TV: DVB-T2
600  * @SYS_ISDBT:
601  *	Terrestrial TV: ISDB-T
602  * @SYS_ATSC:
603  *	Terrestrial TV: ATSC
604  * @SYS_ATSCMH:
605  *	Terrestrial TV (mobile): ATSC-M/H
606  * @SYS_DTMB:
607  *	Terrestrial TV: DTMB
608  * @SYS_DVBS:
609  *	Satellite TV: DVB-S
610  * @SYS_DVBS2:
611  *	Satellite TV: DVB-S2
612  * @SYS_TURBO:
613  *	Satellite TV: DVB-S Turbo
614  * @SYS_ISDBS:
615  *	Satellite TV: ISDB-S
616  * @SYS_DAB:
617  *	Digital audio: DAB (not fully supported)
618  * @SYS_DSS:
619  *	Satellite TV: DSS (not fully supported)
620  * @SYS_CMMB:
621  *	Terrestrial TV (mobile): CMMB (not fully supported)
622  * @SYS_DVBH:
623  *	Terrestrial TV (mobile): DVB-H (standard deprecated)
624  */
625 enum fe_delivery_system {
626 	SYS_UNDEFINED,
627 	SYS_DVBC_ANNEX_A,
628 	SYS_DVBC_ANNEX_B,
629 	SYS_DVBT,
630 	SYS_DSS,
631 	SYS_DVBS,
632 	SYS_DVBS2,
633 	SYS_DVBH,
634 	SYS_ISDBT,
635 	SYS_ISDBS,
636 	SYS_ISDBC,
637 	SYS_ATSC,
638 	SYS_ATSCMH,
639 	SYS_DTMB,
640 	SYS_CMMB,
641 	SYS_DAB,
642 	SYS_DVBT2,
643 	SYS_TURBO,
644 	SYS_DVBC_ANNEX_C,
645 };
646 
647 /* backward compatibility definitions for delivery systems */
648 #define SYS_DVBC_ANNEX_AC	SYS_DVBC_ANNEX_A
649 #define SYS_DMBTH		SYS_DTMB /* DMB-TH is legacy name, use DTMB */
650 
651 /* ATSC-MH specific parameters */
652 
653 /**
654  * enum atscmh_sccc_block_mode - Type of Series Concatenated Convolutional
655  *				 Code Block Mode.
656  *
657  * @ATSCMH_SCCC_BLK_SEP:
658  *	Separate SCCC: the SCCC outer code mode shall be set independently
659  *	for each Group Region (A, B, C, D)
660  * @ATSCMH_SCCC_BLK_COMB:
661  *	Combined SCCC: all four Regions shall have the same SCCC outer
662  *	code mode.
663  * @ATSCMH_SCCC_BLK_RES:
664  *	Reserved. Shouldn't be used.
665  */
666 enum atscmh_sccc_block_mode {
667 	ATSCMH_SCCC_BLK_SEP      = 0,
668 	ATSCMH_SCCC_BLK_COMB     = 1,
669 	ATSCMH_SCCC_BLK_RES      = 2,
670 };
671 
672 /**
673  * enum atscmh_sccc_code_mode - Type of Series Concatenated Convolutional
674  *				Code Rate.
675  *
676  * @ATSCMH_SCCC_CODE_HLF:
677  *	The outer code rate of a SCCC Block is 1/2 rate.
678  * @ATSCMH_SCCC_CODE_QTR:
679  *	The outer code rate of a SCCC Block is 1/4 rate.
680  * @ATSCMH_SCCC_CODE_RES:
681  *	Reserved. Should not be used.
682  */
683 enum atscmh_sccc_code_mode {
684 	ATSCMH_SCCC_CODE_HLF     = 0,
685 	ATSCMH_SCCC_CODE_QTR     = 1,
686 	ATSCMH_SCCC_CODE_RES     = 2,
687 };
688 
689 /**
690  * enum atscmh_rs_frame_ensemble - Reed Solomon(RS) frame ensemble.
691  *
692  * @ATSCMH_RSFRAME_ENS_PRI:	Primary Ensemble.
693  * @ATSCMH_RSFRAME_ENS_SEC:	Secondary Ensemble.
694  */
695 enum atscmh_rs_frame_ensemble {
696 	ATSCMH_RSFRAME_ENS_PRI   = 0,
697 	ATSCMH_RSFRAME_ENS_SEC   = 1,
698 };
699 
700 /**
701  * enum atscmh_rs_frame_mode - Reed Solomon (RS) frame mode.
702  *
703  * @ATSCMH_RSFRAME_PRI_ONLY:
704  *	Single Frame: There is only a primary RS Frame for all Group
705  *	Regions.
706  * @ATSCMH_RSFRAME_PRI_SEC:
707  *	Dual Frame: There are two separate RS Frames: Primary RS Frame for
708  *	Group Region A and B and Secondary RS Frame for Group Region C and
709  *	D.
710  * @ATSCMH_RSFRAME_RES:
711  *	Reserved. Shouldn't be used.
712  */
713 enum atscmh_rs_frame_mode {
714 	ATSCMH_RSFRAME_PRI_ONLY  = 0,
715 	ATSCMH_RSFRAME_PRI_SEC   = 1,
716 	ATSCMH_RSFRAME_RES       = 2,
717 };
718 
719 /**
720  * enum atscmh_rs_code_mode
721  * @ATSCMH_RSCODE_211_187:	Reed Solomon code (211,187).
722  * @ATSCMH_RSCODE_223_187:	Reed Solomon code (223,187).
723  * @ATSCMH_RSCODE_235_187:	Reed Solomon code (235,187).
724  * @ATSCMH_RSCODE_RES:		Reserved. Shouldn't be used.
725  */
726 enum atscmh_rs_code_mode {
727 	ATSCMH_RSCODE_211_187    = 0,
728 	ATSCMH_RSCODE_223_187    = 1,
729 	ATSCMH_RSCODE_235_187    = 2,
730 	ATSCMH_RSCODE_RES        = 3,
731 };
732 
733 #define NO_STREAM_ID_FILTER	(~0U)
734 #define LNA_AUTO                (~0U)
735 
736 /**
737  * enum fecap_scale_params - scale types for the quality parameters.
738  *
739  * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That
740  *			    could indicate a temporary or a permanent
741  *			    condition.
742  * @FE_SCALE_DECIBEL: The scale is measured in 0.001 dB steps, typically
743  *		      used on signal measures.
744  * @FE_SCALE_RELATIVE: The scale is a relative percentual measure,
745  *		       ranging from 0 (0%) to 0xffff (100%).
746  * @FE_SCALE_COUNTER: The scale counts the occurrence of an event, like
747  *		      bit error, block error, lapsed time.
748  */
749 enum fecap_scale_params {
750 	FE_SCALE_NOT_AVAILABLE = 0,
751 	FE_SCALE_DECIBEL,
752 	FE_SCALE_RELATIVE,
753 	FE_SCALE_COUNTER
754 };
755 
756 /**
757  * struct dtv_stats - Used for reading a DTV status property
758  *
759  * @scale:	Filled with enum fecap_scale_params - the scale
760  *		in usage for that parameter
761  *
762  * The ``{unnamed_union}`` may have either one of the values below:
763  *
764  * %svalue
765  *	integer value of the measure, for %FE_SCALE_DECIBEL,
766  *	used for dB measures. The unit is 0.001 dB.
767  *
768  * %uvalue
769  *	unsigned integer value of the measure, used when @scale is
770  *	either %FE_SCALE_RELATIVE or %FE_SCALE_COUNTER.
771  *
772  * For most delivery systems, this will return a single value for each
773  * parameter.
774  *
775  * It should be noticed, however, that new OFDM delivery systems like
776  * ISDB can use different modulation types for each group of carriers.
777  * On such standards, up to 8 groups of statistics can be provided, one
778  * for each carrier group (called "layer" on ISDB).
779  *
780  * In order to be consistent with other delivery systems, the first
781  * value refers to the entire set of carriers ("global").
782  *
783  * @scale should use the value %FE_SCALE_NOT_AVAILABLE when
784  * the value for the entire group of carriers or from one specific layer
785  * is not provided by the hardware.
786  *
787  * @len should be filled with the latest filled status + 1.
788  *
789  * In other words, for ISDB, those values should be filled like::
790  *
791  *	u.st.stat.svalue[0] = global statistics;
792  *	u.st.stat.scale[0] = FE_SCALE_DECIBEL;
793  *	u.st.stat.value[1] = layer A statistics;
794  *	u.st.stat.scale[1] = FE_SCALE_NOT_AVAILABLE (if not available);
795  *	u.st.stat.svalue[2] = layer B statistics;
796  *	u.st.stat.scale[2] = FE_SCALE_DECIBEL;
797  *	u.st.stat.svalue[3] = layer C statistics;
798  *	u.st.stat.scale[3] = FE_SCALE_DECIBEL;
799  *	u.st.len = 4;
800  */
801 struct dtv_stats {
802 	__u8 scale;	/* enum fecap_scale_params type */
803 	union {
804 		__u64 uvalue;	/* for counters and relative scales */
805 		__s64 svalue;	/* for 0.001 dB measures */
806 	};
807 } __attribute__ ((packed));
808 
809 
810 #define MAX_DTV_STATS   4
811 
812 /**
813  * struct dtv_fe_stats - store Digital TV frontend statistics
814  *
815  * @len:	length of the statistics - if zero, stats is disabled.
816  * @stat:	array with digital TV statistics.
817  *
818  * On most standards, @len can either be 0 or 1. However, for ISDB, each
819  * layer is modulated in separate. So, each layer may have its own set
820  * of statistics. If so, stat[0] carries on a global value for the property.
821  * Indexes 1 to 3 means layer A to B.
822  */
823 struct dtv_fe_stats {
824 	__u8 len;
825 	struct dtv_stats stat[MAX_DTV_STATS];
826 } __attribute__ ((packed));
827 
828 /**
829  * struct dtv_property - store one of frontend command and its value
830  *
831  * @cmd:	Digital TV command.
832  * @reserved:	Not used.
833  * @u:		Union with the values for the command.
834  * @result:	Unused
835  *
836  * The @u union may have either one of the values below:
837  *
838  * %data
839  *	an unsigned 32-bits number.
840  * %st
841  *	a &struct dtv_fe_stats array of statistics.
842  * %buffer
843  *	a buffer of up to 32 characters (currently unused).
844  */
845 struct dtv_property {
846 	__u32 cmd;
847 	__u32 reserved[3];
848 	union {
849 		__u32 data;
850 		struct dtv_fe_stats st;
851 		struct {
852 			__u8 data[32];
853 			__u32 len;
854 			__u32 reserved1[3];
855 			void *reserved2;
856 		} buffer;
857 	} u;
858 	int result;
859 } __attribute__ ((packed));
860 
861 /* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */
862 #define DTV_IOCTL_MAX_MSGS 64
863 
864 /**
865  * struct dtv_properties - a set of command/value pairs.
866  *
867  * @num:	amount of commands stored at the struct.
868  * @props:	a pointer to &struct dtv_property.
869  */
870 struct dtv_properties {
871 	__u32 num;
872 	struct dtv_property *props;
873 };
874 
875 /*
876  * When set, this flag will disable any zigzagging or other "normal" tuning
877  * behavior. Additionally, there will be no automatic monitoring of the lock
878  * status, and hence no frontend events will be generated. If a frontend device
879  * is closed, this flag will be automatically turned off when the device is
880  * reopened read-write.
881  */
882 #define FE_TUNE_MODE_ONESHOT 0x01
883 
884 /* Digital TV Frontend API calls */
885 
886 #define FE_GET_INFO		   _IOR('o', 61, struct dvb_frontend_info)
887 
888 #define FE_DISEQC_RESET_OVERLOAD   _IO('o', 62)
889 #define FE_DISEQC_SEND_MASTER_CMD  _IOW('o', 63, struct dvb_diseqc_master_cmd)
890 #define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply)
891 #define FE_DISEQC_SEND_BURST       _IO('o', 65)  /* fe_sec_mini_cmd_t */
892 
893 #define FE_SET_TONE		   _IO('o', 66)  /* fe_sec_tone_mode_t */
894 #define FE_SET_VOLTAGE		   _IO('o', 67)  /* fe_sec_voltage_t */
895 #define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68)  /* int */
896 
897 #define FE_READ_STATUS		   _IOR('o', 69, fe_status_t)
898 #define FE_READ_BER		   _IOR('o', 70, __u32)
899 #define FE_READ_SIGNAL_STRENGTH    _IOR('o', 71, __u16)
900 #define FE_READ_SNR		   _IOR('o', 72, __u16)
901 #define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32)
902 
903 #define FE_SET_FRONTEND_TUNE_MODE  _IO('o', 81) /* unsigned int */
904 #define FE_GET_EVENT		   _IOR('o', 78, struct dvb_frontend_event)
905 
906 #define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */
907 
908 #define FE_SET_PROPERTY		   _IOW('o', 82, struct dtv_properties)
909 #define FE_GET_PROPERTY		   _IOR('o', 83, struct dtv_properties)
910 
911 #if defined(__DVB_CORE__) || !defined(__KERNEL__)
912 
913 /*
914  * DEPRECATED: Everything below is deprecated in favor of DVBv5 API
915  *
916  * The DVBv3 only ioctls, structs and enums should not be used on
917  * newer programs, as it doesn't support the second generation of
918  * digital TV standards, nor supports newer delivery systems.
919  * They also don't support modern frontends with usually support multiple
920  * delivery systems.
921  *
922  * Drivers shouldn't use them.
923  *
924  * New applications should use DVBv5 delivery system instead
925  */
926 
927 /*
928  */
929 
930 enum fe_bandwidth {
931 	BANDWIDTH_8_MHZ,
932 	BANDWIDTH_7_MHZ,
933 	BANDWIDTH_6_MHZ,
934 	BANDWIDTH_AUTO,
935 	BANDWIDTH_5_MHZ,
936 	BANDWIDTH_10_MHZ,
937 	BANDWIDTH_1_712_MHZ,
938 };
939 
940 /* This is kept for legacy userspace support */
941 typedef enum fe_sec_voltage fe_sec_voltage_t;
942 typedef enum fe_caps fe_caps_t;
943 typedef enum fe_type fe_type_t;
944 typedef enum fe_sec_tone_mode fe_sec_tone_mode_t;
945 typedef enum fe_sec_mini_cmd fe_sec_mini_cmd_t;
946 typedef enum fe_status fe_status_t;
947 typedef enum fe_spectral_inversion fe_spectral_inversion_t;
948 typedef enum fe_code_rate fe_code_rate_t;
949 typedef enum fe_modulation fe_modulation_t;
950 typedef enum fe_transmit_mode fe_transmit_mode_t;
951 typedef enum fe_bandwidth fe_bandwidth_t;
952 typedef enum fe_guard_interval fe_guard_interval_t;
953 typedef enum fe_hierarchy fe_hierarchy_t;
954 typedef enum fe_pilot fe_pilot_t;
955 typedef enum fe_rolloff fe_rolloff_t;
956 typedef enum fe_delivery_system fe_delivery_system_t;
957 
958 /* DVBv3 structs */
959 
960 struct dvb_qpsk_parameters {
961 	__u32		symbol_rate;  /* symbol rate in Symbols per second */
962 	fe_code_rate_t	fec_inner;    /* forward error correction (see above) */
963 };
964 
965 struct dvb_qam_parameters {
966 	__u32		symbol_rate; /* symbol rate in Symbols per second */
967 	fe_code_rate_t	fec_inner;   /* forward error correction (see above) */
968 	fe_modulation_t	modulation;  /* modulation type (see above) */
969 };
970 
971 struct dvb_vsb_parameters {
972 	fe_modulation_t	modulation;  /* modulation type (see above) */
973 };
974 
975 struct dvb_ofdm_parameters {
976 	fe_bandwidth_t      bandwidth;
977 	fe_code_rate_t      code_rate_HP;  /* high priority stream code rate */
978 	fe_code_rate_t      code_rate_LP;  /* low priority stream code rate */
979 	fe_modulation_t     constellation; /* modulation type (see above) */
980 	fe_transmit_mode_t  transmission_mode;
981 	fe_guard_interval_t guard_interval;
982 	fe_hierarchy_t      hierarchy_information;
983 };
984 
985 struct dvb_frontend_parameters {
986 	__u32 frequency;  /* (absolute) frequency in Hz for DVB-C/DVB-T/ATSC */
987 			  /* intermediate frequency in kHz for DVB-S */
988 	fe_spectral_inversion_t inversion;
989 	union {
990 		struct dvb_qpsk_parameters qpsk;	/* DVB-S */
991 		struct dvb_qam_parameters  qam;		/* DVB-C */
992 		struct dvb_ofdm_parameters ofdm;	/* DVB-T */
993 		struct dvb_vsb_parameters vsb;		/* ATSC */
994 	} u;
995 };
996 
997 struct dvb_frontend_event {
998 	fe_status_t status;
999 	struct dvb_frontend_parameters parameters;
1000 };
1001 
1002 /* DVBv3 API calls */
1003 
1004 #define FE_SET_FRONTEND		   _IOW('o', 76, struct dvb_frontend_parameters)
1005 #define FE_GET_FRONTEND		   _IOR('o', 77, struct dvb_frontend_parameters)
1006 
1007 #endif
1008 
1009 #endif /*_DVBFRONTEND_H_*/
1010