4 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
5 * Ralph Metzler <ralph@convergence.de>
6 * Holger Waechtler <holger@convergence.de>
7 * Andre Draszik <ad@convergence.de>
8 * for convergence integrated media GmbH
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation; either version 2.1
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #ifndef _DVBFRONTEND_H_
27 #define _DVBFRONTEND_H_
29 #include <linux/types.h>
38 typedef enum fe_type fe_type_t
;
43 FE_CAN_INVERSION_AUTO
= 0x1,
47 FE_CAN_FEC_4_5
= 0x10,
48 FE_CAN_FEC_5_6
= 0x20,
49 FE_CAN_FEC_6_7
= 0x40,
50 FE_CAN_FEC_7_8
= 0x80,
51 FE_CAN_FEC_8_9
= 0x100,
52 FE_CAN_FEC_AUTO
= 0x200,
54 FE_CAN_QAM_16
= 0x800,
55 FE_CAN_QAM_32
= 0x1000,
56 FE_CAN_QAM_64
= 0x2000,
57 FE_CAN_QAM_128
= 0x4000,
58 FE_CAN_QAM_256
= 0x8000,
59 FE_CAN_QAM_AUTO
= 0x10000,
60 FE_CAN_TRANSMISSION_MODE_AUTO
= 0x20000,
61 FE_CAN_BANDWIDTH_AUTO
= 0x40000,
62 FE_CAN_GUARD_INTERVAL_AUTO
= 0x80000,
63 FE_CAN_HIERARCHY_AUTO
= 0x100000,
64 FE_CAN_8VSB
= 0x200000,
65 FE_CAN_16VSB
= 0x400000,
66 FE_HAS_EXTENDED_CAPS
= 0x800000, /* We need more bitspace for newer APIs, indicate this. */
67 FE_CAN_MULTISTREAM
= 0x4000000, /* frontend supports multistream filtering */
68 FE_CAN_TURBO_FEC
= 0x8000000, /* frontend supports "turbo fec modulation" */
69 FE_CAN_2G_MODULATION
= 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */
70 FE_NEEDS_BENDING
= 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */
71 FE_CAN_RECOVER
= 0x40000000, /* frontend can recover from a cable unplug automatically */
72 FE_CAN_MUTE_TS
= 0x80000000 /* frontend can stop spurious TS data output */
75 typedef enum fe_caps fe_caps_t
;
78 struct dvb_frontend_info
{
80 enum fe_type type
; /* DEPRECATED. Use DTV_ENUM_DELSYS instead */
83 __u32 frequency_stepsize
;
84 __u32 frequency_tolerance
;
85 __u32 symbol_rate_min
;
86 __u32 symbol_rate_max
;
87 __u32 symbol_rate_tolerance
; /* ppm */
88 __u32 notifier_delay
; /* DEPRECATED */
94 * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for
95 * the meaning of this struct...
97 struct dvb_diseqc_master_cmd
{
98 __u8 msg
[6]; /* { framing, address, command, data [3] } */
99 __u8 msg_len
; /* valid values are 3...6 */
103 struct dvb_diseqc_slave_reply
{
104 __u8 msg
[4]; /* { framing, data [3] } */
105 __u8 msg_len
; /* valid values are 0...4, 0 means no msg */
106 int timeout
; /* return from ioctl after timeout ms with */
107 }; /* errorcode when no message was received */
110 enum fe_sec_voltage
{
116 typedef enum fe_sec_voltage fe_sec_voltage_t
;
119 enum fe_sec_tone_mode
{
124 typedef enum fe_sec_tone_mode fe_sec_tone_mode_t
;
127 enum fe_sec_mini_cmd
{
132 typedef enum fe_sec_mini_cmd fe_sec_mini_cmd_t
;
136 * enum fe_status - enumerates the possible frontend status
137 * @FE_HAS_SIGNAL: found something above the noise level
138 * @FE_HAS_CARRIER: found a DVB signal
139 * @FE_HAS_VITERBI: FEC is stable
140 * @FE_HAS_SYNC: found sync bytes
141 * @FE_HAS_LOCK: everything's working
142 * @FE_TIMEDOUT: no lock within the last ~2 seconds
143 * @FE_REINIT: frontend was reinitialized, application is recommended
144 * to reset DiSEqC, tone and parameters
148 FE_HAS_SIGNAL
= 0x01,
149 FE_HAS_CARRIER
= 0x02,
150 FE_HAS_VITERBI
= 0x04,
157 typedef enum fe_status fe_status_t
;
159 enum fe_spectral_inversion
{
165 typedef enum fe_spectral_inversion fe_spectral_inversion_t
;
183 typedef enum fe_code_rate fe_code_rate_t
;
203 typedef enum fe_modulation fe_modulation_t
;
205 enum fe_transmit_mode
{
206 TRANSMISSION_MODE_2K
,
207 TRANSMISSION_MODE_8K
,
208 TRANSMISSION_MODE_AUTO
,
209 TRANSMISSION_MODE_4K
,
210 TRANSMISSION_MODE_1K
,
211 TRANSMISSION_MODE_16K
,
212 TRANSMISSION_MODE_32K
,
213 TRANSMISSION_MODE_C1
,
214 TRANSMISSION_MODE_C3780
,
217 typedef enum fe_transmit_mode fe_transmit_mode_t
;
220 enum fe_guard_interval
{
226 GUARD_INTERVAL_1_128
,
227 GUARD_INTERVAL_19_128
,
228 GUARD_INTERVAL_19_256
,
229 GUARD_INTERVAL_PN420
,
230 GUARD_INTERVAL_PN595
,
231 GUARD_INTERVAL_PN945
,
234 typedef enum fe_guard_interval fe_guard_interval_t
;
244 typedef enum fe_hierarchy fe_hierarchy_t
;
246 enum fe_interleaving
{
254 #define DTV_UNDEFINED 0
257 #define DTV_FREQUENCY 3
258 #define DTV_MODULATION 4
259 #define DTV_BANDWIDTH_HZ 5
260 #define DTV_INVERSION 6
261 #define DTV_DISEQC_MASTER 7
262 #define DTV_SYMBOL_RATE 8
263 #define DTV_INNER_FEC 9
264 #define DTV_VOLTAGE 10
267 #define DTV_ROLLOFF 13
268 #define DTV_DISEQC_SLAVE_REPLY 14
270 /* Basic enumeration set for querying unlimited capabilities */
271 #define DTV_FE_CAPABILITY_COUNT 15
272 #define DTV_FE_CAPABILITY 16
273 #define DTV_DELIVERY_SYSTEM 17
275 /* ISDB-T and ISDB-Tsb */
276 #define DTV_ISDBT_PARTIAL_RECEPTION 18
277 #define DTV_ISDBT_SOUND_BROADCASTING 19
279 #define DTV_ISDBT_SB_SUBCHANNEL_ID 20
280 #define DTV_ISDBT_SB_SEGMENT_IDX 21
281 #define DTV_ISDBT_SB_SEGMENT_COUNT 22
283 #define DTV_ISDBT_LAYERA_FEC 23
284 #define DTV_ISDBT_LAYERA_MODULATION 24
285 #define DTV_ISDBT_LAYERA_SEGMENT_COUNT 25
286 #define DTV_ISDBT_LAYERA_TIME_INTERLEAVING 26
288 #define DTV_ISDBT_LAYERB_FEC 27
289 #define DTV_ISDBT_LAYERB_MODULATION 28
290 #define DTV_ISDBT_LAYERB_SEGMENT_COUNT 29
291 #define DTV_ISDBT_LAYERB_TIME_INTERLEAVING 30
293 #define DTV_ISDBT_LAYERC_FEC 31
294 #define DTV_ISDBT_LAYERC_MODULATION 32
295 #define DTV_ISDBT_LAYERC_SEGMENT_COUNT 33
296 #define DTV_ISDBT_LAYERC_TIME_INTERLEAVING 34
298 #define DTV_API_VERSION 35
300 #define DTV_CODE_RATE_HP 36
301 #define DTV_CODE_RATE_LP 37
302 #define DTV_GUARD_INTERVAL 38
303 #define DTV_TRANSMISSION_MODE 39
304 #define DTV_HIERARCHY 40
306 #define DTV_ISDBT_LAYER_ENABLED 41
308 #define DTV_STREAM_ID 42
309 #define DTV_ISDBS_TS_ID_LEGACY DTV_STREAM_ID
310 #define DTV_DVBT2_PLP_ID_LEGACY 43
312 #define DTV_ENUM_DELSYS 44
315 #define DTV_ATSCMH_FIC_VER 45
316 #define DTV_ATSCMH_PARADE_ID 46
317 #define DTV_ATSCMH_NOG 47
318 #define DTV_ATSCMH_TNOG 48
319 #define DTV_ATSCMH_SGN 49
320 #define DTV_ATSCMH_PRC 50
321 #define DTV_ATSCMH_RS_FRAME_MODE 51
322 #define DTV_ATSCMH_RS_FRAME_ENSEMBLE 52
323 #define DTV_ATSCMH_RS_CODE_MODE_PRI 53
324 #define DTV_ATSCMH_RS_CODE_MODE_SEC 54
325 #define DTV_ATSCMH_SCCC_BLOCK_MODE 55
326 #define DTV_ATSCMH_SCCC_CODE_MODE_A 56
327 #define DTV_ATSCMH_SCCC_CODE_MODE_B 57
328 #define DTV_ATSCMH_SCCC_CODE_MODE_C 58
329 #define DTV_ATSCMH_SCCC_CODE_MODE_D 59
331 #define DTV_INTERLEAVING 60
334 /* Quality parameters */
335 #define DTV_STAT_SIGNAL_STRENGTH 62
336 #define DTV_STAT_CNR 63
337 #define DTV_STAT_PRE_ERROR_BIT_COUNT 64
338 #define DTV_STAT_PRE_TOTAL_BIT_COUNT 65
339 #define DTV_STAT_POST_ERROR_BIT_COUNT 66
340 #define DTV_STAT_POST_TOTAL_BIT_COUNT 67
341 #define DTV_STAT_ERROR_BLOCK_COUNT 68
342 #define DTV_STAT_TOTAL_BLOCK_COUNT 69
344 #define DTV_MAX_COMMAND DTV_STAT_TOTAL_BLOCK_COUNT
352 typedef enum fe_pilot fe_pilot_t
;
355 ROLLOFF_35
, /* Implied value in DVB-S, default for DVB-S2 */
361 typedef enum fe_rolloff fe_rolloff_t
;
363 enum fe_delivery_system
{
385 typedef enum fe_delivery_system fe_delivery_system_t
;
387 /* backward compatibility */
388 #define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A
389 #define SYS_DMBTH SYS_DTMB /* DMB-TH is legacy name, use DTMB instead */
393 enum atscmh_sccc_block_mode
{
394 ATSCMH_SCCC_BLK_SEP
= 0,
395 ATSCMH_SCCC_BLK_COMB
= 1,
396 ATSCMH_SCCC_BLK_RES
= 2,
399 enum atscmh_sccc_code_mode
{
400 ATSCMH_SCCC_CODE_HLF
= 0,
401 ATSCMH_SCCC_CODE_QTR
= 1,
402 ATSCMH_SCCC_CODE_RES
= 2,
405 enum atscmh_rs_frame_ensemble
{
406 ATSCMH_RSFRAME_ENS_PRI
= 0,
407 ATSCMH_RSFRAME_ENS_SEC
= 1,
410 enum atscmh_rs_frame_mode
{
411 ATSCMH_RSFRAME_PRI_ONLY
= 0,
412 ATSCMH_RSFRAME_PRI_SEC
= 1,
413 ATSCMH_RSFRAME_RES
= 2,
416 enum atscmh_rs_code_mode
{
417 ATSCMH_RSCODE_211_187
= 0,
418 ATSCMH_RSCODE_223_187
= 1,
419 ATSCMH_RSCODE_235_187
= 2,
420 ATSCMH_RSCODE_RES
= 3,
423 #define NO_STREAM_ID_FILTER (~0U)
424 #define LNA_AUTO (~0U)
427 char *name
; /* A display name for debugging purposes */
429 __u32 cmd
; /* A unique ID */
432 __u32 set
:1; /* Either a set or get property */
433 __u32 buffer
:1; /* Does this property use the buffer? */
434 __u32 reserved
:30; /* Align */
438 * Scale types for the quality parameters.
439 * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That
440 * could indicate a temporary or a permanent
442 * @FE_SCALE_DECIBEL: The scale is measured in 0.001 dB steps, typically
443 * used on signal measures.
444 * @FE_SCALE_RELATIVE: The scale is a relative percentual measure,
445 * ranging from 0 (0%) to 0xffff (100%).
446 * @FE_SCALE_COUNTER: The scale counts the occurrence of an event, like
447 * bit error, block error, lapsed time.
449 enum fecap_scale_params
{
450 FE_SCALE_NOT_AVAILABLE
= 0,
457 * struct dtv_stats - Used for reading a DTV status property
459 * @value: value of the measure. Should range from 0 to 0xffff;
460 * @scale: Filled with enum fecap_scale_params - the scale
461 * in usage for that parameter
463 * For most delivery systems, this will return a single value for each
465 * It should be noticed, however, that new OFDM delivery systems like
466 * ISDB can use different modulation types for each group of carriers.
467 * On such standards, up to 8 groups of statistics can be provided, one
468 * for each carrier group (called "layer" on ISDB).
469 * In order to be consistent with other delivery systems, the first
470 * value refers to the entire set of carriers ("global").
471 * dtv_status:scale should use the value FE_SCALE_NOT_AVAILABLE when
472 * the value for the entire group of carriers or from one specific layer
473 * is not provided by the hardware.
474 * st.len should be filled with the latest filled status + 1.
476 * In other words, for ISDB, those values should be filled like:
477 * u.st.stat.svalue[0] = global statistics;
478 * u.st.stat.scale[0] = FE_SCALE_DECIBELS;
479 * u.st.stat.value[1] = layer A statistics;
480 * u.st.stat.scale[1] = FE_SCALE_NOT_AVAILABLE (if not available);
481 * u.st.stat.svalue[2] = layer B statistics;
482 * u.st.stat.scale[2] = FE_SCALE_DECIBELS;
483 * u.st.stat.svalue[3] = layer C statistics;
484 * u.st.stat.scale[3] = FE_SCALE_DECIBELS;
488 __u8 scale
; /* enum fecap_scale_params type */
490 __u64 uvalue
; /* for counters and relative scales */
491 __s64 svalue
; /* for 0.001 dB measures */
493 } __attribute__ ((packed
));
496 #define MAX_DTV_STATS 4
498 struct dtv_fe_stats
{
500 struct dtv_stats stat
[MAX_DTV_STATS
];
501 } __attribute__ ((packed
));
503 struct dtv_property
{
508 struct dtv_fe_stats st
;
517 } __attribute__ ((packed
));
519 /* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */
520 #define DTV_IOCTL_MAX_MSGS 64
522 struct dtv_properties
{
524 struct dtv_property
*props
;
527 #if defined(__DVB_CORE__) || !defined (__KERNEL__)
539 typedef enum fe_bandwidth fe_bandwidth_t
;
541 struct dvb_qpsk_parameters
{
542 __u32 symbol_rate
; /* symbol rate in Symbols per second */
543 fe_code_rate_t fec_inner
; /* forward error correction (see above) */
546 struct dvb_qam_parameters
{
547 __u32 symbol_rate
; /* symbol rate in Symbols per second */
548 fe_code_rate_t fec_inner
; /* forward error correction (see above) */
549 fe_modulation_t modulation
; /* modulation type (see above) */
552 struct dvb_vsb_parameters
{
553 fe_modulation_t modulation
; /* modulation type (see above) */
556 struct dvb_ofdm_parameters
{
557 fe_bandwidth_t bandwidth
;
558 fe_code_rate_t code_rate_HP
; /* high priority stream code rate */
559 fe_code_rate_t code_rate_LP
; /* low priority stream code rate */
560 fe_modulation_t constellation
; /* modulation type (see above) */
561 fe_transmit_mode_t transmission_mode
;
562 fe_guard_interval_t guard_interval
;
563 fe_hierarchy_t hierarchy_information
;
567 struct dvb_frontend_parameters
{
568 __u32 frequency
; /* (absolute) frequency in Hz for QAM/OFDM/ATSC */
569 /* intermediate frequency in kHz for QPSK */
570 fe_spectral_inversion_t inversion
;
572 struct dvb_qpsk_parameters qpsk
;
573 struct dvb_qam_parameters qam
;
574 struct dvb_ofdm_parameters ofdm
;
575 struct dvb_vsb_parameters vsb
;
579 struct dvb_frontend_event
{
581 struct dvb_frontend_parameters parameters
;
585 #define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties)
586 #define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties)
590 * When set, this flag will disable any zigzagging or other "normal" tuning
591 * behaviour. Additionally, there will be no automatic monitoring of the lock
592 * status, and hence no frontend events will be generated. If a frontend device
593 * is closed, this flag will be automatically turned off when the device is
594 * reopened read-write.
596 #define FE_TUNE_MODE_ONESHOT 0x01
599 #define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info)
601 #define FE_DISEQC_RESET_OVERLOAD _IO('o', 62)
602 #define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd)
603 #define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply)
604 #define FE_DISEQC_SEND_BURST _IO('o', 65) /* fe_sec_mini_cmd_t */
606 #define FE_SET_TONE _IO('o', 66) /* fe_sec_tone_mode_t */
607 #define FE_SET_VOLTAGE _IO('o', 67) /* fe_sec_voltage_t */
608 #define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */
610 #define FE_READ_STATUS _IOR('o', 69, fe_status_t)
611 #define FE_READ_BER _IOR('o', 70, __u32)
612 #define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16)
613 #define FE_READ_SNR _IOR('o', 72, __u16)
614 #define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32)
616 #define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters)
617 #define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters)
618 #define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */
619 #define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event)
621 #define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */
623 #endif /*_DVBFRONTEND_H_*/