• 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 /* Physical layer scrambling */
551 #define DTV_SCRAMBLING_SEQUENCE_INDEX	70
552 
553 #define DTV_MAX_COMMAND		DTV_SCRAMBLING_SEQUENCE_INDEX
554 
555 /**
556  * enum fe_pilot - Type of pilot tone
557  *
558  * @PILOT_ON:	Pilot tones enabled
559  * @PILOT_OFF:	Pilot tones disabled
560  * @PILOT_AUTO:	Autodetect pilot tones
561  */
562 enum fe_pilot {
563 	PILOT_ON,
564 	PILOT_OFF,
565 	PILOT_AUTO,
566 };
567 
568 /**
569  * enum fe_rolloff - Rolloff factor
570  * @ROLLOFF_35:		Roloff factor: α=35%
571  * @ROLLOFF_20:		Roloff factor: α=20%
572  * @ROLLOFF_25:		Roloff factor: α=25%
573  * @ROLLOFF_AUTO:	Auto-detect the roloff factor.
574  *
575  * .. note:
576  *
577  *    Roloff factor of 35% is implied on DVB-S. On DVB-S2, it is default.
578  */
579 enum fe_rolloff {
580 	ROLLOFF_35,
581 	ROLLOFF_20,
582 	ROLLOFF_25,
583 	ROLLOFF_AUTO,
584 };
585 
586 /**
587  * enum fe_delivery_system - Type of the delivery system
588  *
589  * @SYS_UNDEFINED:
590  *	Undefined standard. Generally, indicates an error
591  * @SYS_DVBC_ANNEX_A:
592  *	Cable TV: DVB-C following ITU-T J.83 Annex A spec
593  * @SYS_DVBC_ANNEX_B:
594  *	Cable TV: DVB-C following ITU-T J.83 Annex B spec (ClearQAM)
595  * @SYS_DVBC_ANNEX_C:
596  *	Cable TV: DVB-C following ITU-T J.83 Annex C spec
597  * @SYS_ISDBC:
598  *	Cable TV: ISDB-C (no drivers yet)
599  * @SYS_DVBT:
600  *	Terrestrial TV: DVB-T
601  * @SYS_DVBT2:
602  *	Terrestrial TV: DVB-T2
603  * @SYS_ISDBT:
604  *	Terrestrial TV: ISDB-T
605  * @SYS_ATSC:
606  *	Terrestrial TV: ATSC
607  * @SYS_ATSCMH:
608  *	Terrestrial TV (mobile): ATSC-M/H
609  * @SYS_DTMB:
610  *	Terrestrial TV: DTMB
611  * @SYS_DVBS:
612  *	Satellite TV: DVB-S
613  * @SYS_DVBS2:
614  *	Satellite TV: DVB-S2
615  * @SYS_TURBO:
616  *	Satellite TV: DVB-S Turbo
617  * @SYS_ISDBS:
618  *	Satellite TV: ISDB-S
619  * @SYS_DAB:
620  *	Digital audio: DAB (not fully supported)
621  * @SYS_DSS:
622  *	Satellite TV: DSS (not fully supported)
623  * @SYS_CMMB:
624  *	Terrestrial TV (mobile): CMMB (not fully supported)
625  * @SYS_DVBH:
626  *	Terrestrial TV (mobile): DVB-H (standard deprecated)
627  */
628 enum fe_delivery_system {
629 	SYS_UNDEFINED,
630 	SYS_DVBC_ANNEX_A,
631 	SYS_DVBC_ANNEX_B,
632 	SYS_DVBT,
633 	SYS_DSS,
634 	SYS_DVBS,
635 	SYS_DVBS2,
636 	SYS_DVBH,
637 	SYS_ISDBT,
638 	SYS_ISDBS,
639 	SYS_ISDBC,
640 	SYS_ATSC,
641 	SYS_ATSCMH,
642 	SYS_DTMB,
643 	SYS_CMMB,
644 	SYS_DAB,
645 	SYS_DVBT2,
646 	SYS_TURBO,
647 	SYS_DVBC_ANNEX_C,
648 };
649 
650 /* backward compatibility definitions for delivery systems */
651 #define SYS_DVBC_ANNEX_AC	SYS_DVBC_ANNEX_A
652 #define SYS_DMBTH		SYS_DTMB /* DMB-TH is legacy name, use DTMB */
653 
654 /* ATSC-MH specific parameters */
655 
656 /**
657  * enum atscmh_sccc_block_mode - Type of Series Concatenated Convolutional
658  *				 Code Block Mode.
659  *
660  * @ATSCMH_SCCC_BLK_SEP:
661  *	Separate SCCC: the SCCC outer code mode shall be set independently
662  *	for each Group Region (A, B, C, D)
663  * @ATSCMH_SCCC_BLK_COMB:
664  *	Combined SCCC: all four Regions shall have the same SCCC outer
665  *	code mode.
666  * @ATSCMH_SCCC_BLK_RES:
667  *	Reserved. Shouldn't be used.
668  */
669 enum atscmh_sccc_block_mode {
670 	ATSCMH_SCCC_BLK_SEP      = 0,
671 	ATSCMH_SCCC_BLK_COMB     = 1,
672 	ATSCMH_SCCC_BLK_RES      = 2,
673 };
674 
675 /**
676  * enum atscmh_sccc_code_mode - Type of Series Concatenated Convolutional
677  *				Code Rate.
678  *
679  * @ATSCMH_SCCC_CODE_HLF:
680  *	The outer code rate of a SCCC Block is 1/2 rate.
681  * @ATSCMH_SCCC_CODE_QTR:
682  *	The outer code rate of a SCCC Block is 1/4 rate.
683  * @ATSCMH_SCCC_CODE_RES:
684  *	Reserved. Should not be used.
685  */
686 enum atscmh_sccc_code_mode {
687 	ATSCMH_SCCC_CODE_HLF     = 0,
688 	ATSCMH_SCCC_CODE_QTR     = 1,
689 	ATSCMH_SCCC_CODE_RES     = 2,
690 };
691 
692 /**
693  * enum atscmh_rs_frame_ensemble - Reed Solomon(RS) frame ensemble.
694  *
695  * @ATSCMH_RSFRAME_ENS_PRI:	Primary Ensemble.
696  * @ATSCMH_RSFRAME_ENS_SEC:	Secondary Ensemble.
697  */
698 enum atscmh_rs_frame_ensemble {
699 	ATSCMH_RSFRAME_ENS_PRI   = 0,
700 	ATSCMH_RSFRAME_ENS_SEC   = 1,
701 };
702 
703 /**
704  * enum atscmh_rs_frame_mode - Reed Solomon (RS) frame mode.
705  *
706  * @ATSCMH_RSFRAME_PRI_ONLY:
707  *	Single Frame: There is only a primary RS Frame for all Group
708  *	Regions.
709  * @ATSCMH_RSFRAME_PRI_SEC:
710  *	Dual Frame: There are two separate RS Frames: Primary RS Frame for
711  *	Group Region A and B and Secondary RS Frame for Group Region C and
712  *	D.
713  * @ATSCMH_RSFRAME_RES:
714  *	Reserved. Shouldn't be used.
715  */
716 enum atscmh_rs_frame_mode {
717 	ATSCMH_RSFRAME_PRI_ONLY  = 0,
718 	ATSCMH_RSFRAME_PRI_SEC   = 1,
719 	ATSCMH_RSFRAME_RES       = 2,
720 };
721 
722 /**
723  * enum atscmh_rs_code_mode
724  * @ATSCMH_RSCODE_211_187:	Reed Solomon code (211,187).
725  * @ATSCMH_RSCODE_223_187:	Reed Solomon code (223,187).
726  * @ATSCMH_RSCODE_235_187:	Reed Solomon code (235,187).
727  * @ATSCMH_RSCODE_RES:		Reserved. Shouldn't be used.
728  */
729 enum atscmh_rs_code_mode {
730 	ATSCMH_RSCODE_211_187    = 0,
731 	ATSCMH_RSCODE_223_187    = 1,
732 	ATSCMH_RSCODE_235_187    = 2,
733 	ATSCMH_RSCODE_RES        = 3,
734 };
735 
736 #define NO_STREAM_ID_FILTER	(~0U)
737 #define LNA_AUTO                (~0U)
738 
739 /**
740  * enum fecap_scale_params - scale types for the quality parameters.
741  *
742  * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That
743  *			    could indicate a temporary or a permanent
744  *			    condition.
745  * @FE_SCALE_DECIBEL: The scale is measured in 0.001 dB steps, typically
746  *		      used on signal measures.
747  * @FE_SCALE_RELATIVE: The scale is a relative percentual measure,
748  *		       ranging from 0 (0%) to 0xffff (100%).
749  * @FE_SCALE_COUNTER: The scale counts the occurrence of an event, like
750  *		      bit error, block error, lapsed time.
751  */
752 enum fecap_scale_params {
753 	FE_SCALE_NOT_AVAILABLE = 0,
754 	FE_SCALE_DECIBEL,
755 	FE_SCALE_RELATIVE,
756 	FE_SCALE_COUNTER
757 };
758 
759 /**
760  * struct dtv_stats - Used for reading a DTV status property
761  *
762  * @scale:
763  *	Filled with enum fecap_scale_params - the scale in usage
764  *	for that parameter
765  *
766  * @svalue:
767  *	integer value of the measure, for %FE_SCALE_DECIBEL,
768  *	used for dB measures. The unit is 0.001 dB.
769  *
770  * @uvalue:
771  *	unsigned integer value of the measure, used when @scale is
772  *	either %FE_SCALE_RELATIVE or %FE_SCALE_COUNTER.
773  *
774  * For most delivery systems, this will return a single value for each
775  * parameter.
776  *
777  * It should be noticed, however, that new OFDM delivery systems like
778  * ISDB can use different modulation types for each group of carriers.
779  * On such standards, up to 8 groups of statistics can be provided, one
780  * for each carrier group (called "layer" on ISDB).
781  *
782  * In order to be consistent with other delivery systems, the first
783  * value refers to the entire set of carriers ("global").
784  *
785  * @scale should use the value %FE_SCALE_NOT_AVAILABLE when
786  * the value for the entire group of carriers or from one specific layer
787  * is not provided by the hardware.
788  *
789  * @len should be filled with the latest filled status + 1.
790  *
791  * In other words, for ISDB, those values should be filled like::
792  *
793  *	u.st.stat.svalue[0] = global statistics;
794  *	u.st.stat.scale[0] = FE_SCALE_DECIBEL;
795  *	u.st.stat.value[1] = layer A statistics;
796  *	u.st.stat.scale[1] = FE_SCALE_NOT_AVAILABLE (if not available);
797  *	u.st.stat.svalue[2] = layer B statistics;
798  *	u.st.stat.scale[2] = FE_SCALE_DECIBEL;
799  *	u.st.stat.svalue[3] = layer C statistics;
800  *	u.st.stat.scale[3] = FE_SCALE_DECIBEL;
801  *	u.st.len = 4;
802  */
803 struct dtv_stats {
804 	__u8 scale;	/* enum fecap_scale_params type */
805 	union {
806 		__u64 uvalue;	/* for counters and relative scales */
807 		__s64 svalue;	/* for 0.001 dB measures */
808 	};
809 } __attribute__ ((packed));
810 
811 
812 #define MAX_DTV_STATS   4
813 
814 /**
815  * struct dtv_fe_stats - store Digital TV frontend statistics
816  *
817  * @len:	length of the statistics - if zero, stats is disabled.
818  * @stat:	array with digital TV statistics.
819  *
820  * On most standards, @len can either be 0 or 1. However, for ISDB, each
821  * layer is modulated in separate. So, each layer may have its own set
822  * of statistics. If so, stat[0] carries on a global value for the property.
823  * Indexes 1 to 3 means layer A to B.
824  */
825 struct dtv_fe_stats {
826 	__u8 len;
827 	struct dtv_stats stat[MAX_DTV_STATS];
828 } __attribute__ ((packed));
829 
830 /**
831  * struct dtv_property - store one of frontend command and its value
832  *
833  * @cmd:		Digital TV command.
834  * @reserved:		Not used.
835  * @u:			Union with the values for the command.
836  * @u.data:		A unsigned 32 bits integer with command value.
837  * @u.buffer:		Struct to store bigger properties.
838  *			Currently unused.
839  * @u.buffer.data:	an unsigned 32-bits array.
840  * @u.buffer.len:	number of elements of the buffer.
841  * @u.buffer.reserved1:	Reserved.
842  * @u.buffer.reserved2:	Reserved.
843  * @u.st:		a &struct dtv_fe_stats array of statistics.
844  * @result:		Currently unused.
845  *
846  */
847 struct dtv_property {
848 	__u32 cmd;
849 	__u32 reserved[3];
850 	union {
851 		__u32 data;
852 		struct dtv_fe_stats st;
853 		struct {
854 			__u8 data[32];
855 			__u32 len;
856 			__u32 reserved1[3];
857 			void *reserved2;
858 		} buffer;
859 	} u;
860 	int result;
861 } __attribute__ ((packed));
862 
863 /* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */
864 #define DTV_IOCTL_MAX_MSGS 64
865 
866 /**
867  * struct dtv_properties - a set of command/value pairs.
868  *
869  * @num:	amount of commands stored at the struct.
870  * @props:	a pointer to &struct dtv_property.
871  */
872 struct dtv_properties {
873 	__u32 num;
874 	struct dtv_property *props;
875 };
876 
877 /*
878  * When set, this flag will disable any zigzagging or other "normal" tuning
879  * behavior. Additionally, there will be no automatic monitoring of the lock
880  * status, and hence no frontend events will be generated. If a frontend device
881  * is closed, this flag will be automatically turned off when the device is
882  * reopened read-write.
883  */
884 #define FE_TUNE_MODE_ONESHOT 0x01
885 
886 /* Digital TV Frontend API calls */
887 
888 #define FE_GET_INFO		   _IOR('o', 61, struct dvb_frontend_info)
889 
890 #define FE_DISEQC_RESET_OVERLOAD   _IO('o', 62)
891 #define FE_DISEQC_SEND_MASTER_CMD  _IOW('o', 63, struct dvb_diseqc_master_cmd)
892 #define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply)
893 #define FE_DISEQC_SEND_BURST       _IO('o', 65)  /* fe_sec_mini_cmd_t */
894 
895 #define FE_SET_TONE		   _IO('o', 66)  /* fe_sec_tone_mode_t */
896 #define FE_SET_VOLTAGE		   _IO('o', 67)  /* fe_sec_voltage_t */
897 #define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68)  /* int */
898 
899 #define FE_READ_STATUS		   _IOR('o', 69, fe_status_t)
900 #define FE_READ_BER		   _IOR('o', 70, __u32)
901 #define FE_READ_SIGNAL_STRENGTH    _IOR('o', 71, __u16)
902 #define FE_READ_SNR		   _IOR('o', 72, __u16)
903 #define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32)
904 
905 #define FE_SET_FRONTEND_TUNE_MODE  _IO('o', 81) /* unsigned int */
906 #define FE_GET_EVENT		   _IOR('o', 78, struct dvb_frontend_event)
907 
908 #define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */
909 
910 #define FE_SET_PROPERTY		   _IOW('o', 82, struct dtv_properties)
911 #define FE_GET_PROPERTY		   _IOR('o', 83, struct dtv_properties)
912 
913 #if defined(__DVB_CORE__) || !defined(__KERNEL__)
914 
915 /*
916  * DEPRECATED: Everything below is deprecated in favor of DVBv5 API
917  *
918  * The DVBv3 only ioctls, structs and enums should not be used on
919  * newer programs, as it doesn't support the second generation of
920  * digital TV standards, nor supports newer delivery systems.
921  * They also don't support modern frontends with usually support multiple
922  * delivery systems.
923  *
924  * Drivers shouldn't use them.
925  *
926  * New applications should use DVBv5 delivery system instead
927  */
928 
929 /*
930  */
931 
932 enum fe_bandwidth {
933 	BANDWIDTH_8_MHZ,
934 	BANDWIDTH_7_MHZ,
935 	BANDWIDTH_6_MHZ,
936 	BANDWIDTH_AUTO,
937 	BANDWIDTH_5_MHZ,
938 	BANDWIDTH_10_MHZ,
939 	BANDWIDTH_1_712_MHZ,
940 };
941 
942 /* This is kept for legacy userspace support */
943 typedef enum fe_sec_voltage fe_sec_voltage_t;
944 typedef enum fe_caps fe_caps_t;
945 typedef enum fe_type fe_type_t;
946 typedef enum fe_sec_tone_mode fe_sec_tone_mode_t;
947 typedef enum fe_sec_mini_cmd fe_sec_mini_cmd_t;
948 typedef enum fe_status fe_status_t;
949 typedef enum fe_spectral_inversion fe_spectral_inversion_t;
950 typedef enum fe_code_rate fe_code_rate_t;
951 typedef enum fe_modulation fe_modulation_t;
952 typedef enum fe_transmit_mode fe_transmit_mode_t;
953 typedef enum fe_bandwidth fe_bandwidth_t;
954 typedef enum fe_guard_interval fe_guard_interval_t;
955 typedef enum fe_hierarchy fe_hierarchy_t;
956 typedef enum fe_pilot fe_pilot_t;
957 typedef enum fe_rolloff fe_rolloff_t;
958 typedef enum fe_delivery_system fe_delivery_system_t;
959 
960 /* DVBv3 structs */
961 
962 struct dvb_qpsk_parameters {
963 	__u32		symbol_rate;  /* symbol rate in Symbols per second */
964 	fe_code_rate_t	fec_inner;    /* forward error correction (see above) */
965 };
966 
967 struct dvb_qam_parameters {
968 	__u32		symbol_rate; /* symbol rate in Symbols per second */
969 	fe_code_rate_t	fec_inner;   /* forward error correction (see above) */
970 	fe_modulation_t	modulation;  /* modulation type (see above) */
971 };
972 
973 struct dvb_vsb_parameters {
974 	fe_modulation_t	modulation;  /* modulation type (see above) */
975 };
976 
977 struct dvb_ofdm_parameters {
978 	fe_bandwidth_t      bandwidth;
979 	fe_code_rate_t      code_rate_HP;  /* high priority stream code rate */
980 	fe_code_rate_t      code_rate_LP;  /* low priority stream code rate */
981 	fe_modulation_t     constellation; /* modulation type (see above) */
982 	fe_transmit_mode_t  transmission_mode;
983 	fe_guard_interval_t guard_interval;
984 	fe_hierarchy_t      hierarchy_information;
985 };
986 
987 struct dvb_frontend_parameters {
988 	__u32 frequency;  /* (absolute) frequency in Hz for DVB-C/DVB-T/ATSC */
989 			  /* intermediate frequency in kHz for DVB-S */
990 	fe_spectral_inversion_t inversion;
991 	union {
992 		struct dvb_qpsk_parameters qpsk;	/* DVB-S */
993 		struct dvb_qam_parameters  qam;		/* DVB-C */
994 		struct dvb_ofdm_parameters ofdm;	/* DVB-T */
995 		struct dvb_vsb_parameters vsb;		/* ATSC */
996 	} u;
997 };
998 
999 struct dvb_frontend_event {
1000 	fe_status_t status;
1001 	struct dvb_frontend_parameters parameters;
1002 };
1003 
1004 /* DVBv3 API calls */
1005 
1006 #define FE_SET_FRONTEND		   _IOW('o', 76, struct dvb_frontend_parameters)
1007 #define FE_GET_FRONTEND		   _IOR('o', 77, struct dvb_frontend_parameters)
1008 
1009 #endif
1010 
1011 #endif /*_DVBFRONTEND_H_*/
1012