2 * Copyright (c) 2005 Marcus Overhagen <marcus@overhagen.de>
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without restriction,
7 * including without limitation the rights to use, copy, modify,
8 * merge, publish, distribute, sublicense, and/or sell copies of
9 * the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
25 /* This is the driver ioctl interface used for DVB on BeOS
26 * it is not final, and will be changed before a public release
27 * is made of the DVB framework (media add-on and example player).
29 * The driver should publish in /dev/dvb/cardname/n (with n=1..).
30 * It must implement the ioctl codes from dvb_ioctl_t.
31 * The driver must have buffers readable by userspace, it
32 * should directly use DMA buffers for that.
33 * The DVB add-on expects DVB_CAPTURE to block until data is
34 * available, or a timeout has expired. If the timeout expired,
35 * it must return B_TIMED_OUT. This ensures that the driver
36 * doesn't block when reception conditions are going bad, and
37 * allows user space programs to recognize this.
38 * If the ioctl succeeds, the driver must record the capture end time
39 * and report the data pointer and size. The data must stay valid
40 * for a few ms, to give the user space thread, running at realtime
41 * priority, a chance to read it. The driver must do at least
42 * double buffering to achieve this.
43 * For DVB-T, two buffers of 61 kByte give about 16 ms validity period
44 * for each buffer, thats enough. A 100 ms timout is used, to ensure
45 * that DVB_CAPTURE doesn't block when no data is available.
47 * A normal ioctl sequence is:
48 * - DVB_GET_INTERFACE_INFO
49 * - DVB_SET_TUNING_PARAMETERS
52 * - DVB_CAPTURE (repeated)
55 * The following ioctls can be called at any time,
56 * including when capture is active:
57 * - DVB_GET_INTERFACE_INFO
58 * - DVB_GET_FREQUENCY_INFO
59 * - DVB_GET_TUNING_PARAMETERS
66 * In future releases, other ioctls that are not yet defined may
67 * be called. It's important that the driver does not crash, but
68 * instead returnes an error code.
70 * Parameter reference for ioctl() functions:
72 * opcode | parameter | description
73 * --------------------------+-------------------------+-----------------------------------------
74 * DVB_GET_INTERFACE_INFO | dvb_interface_info_t | get interface capabilites (memset to 0 first)
75 * DVB_GET_FREQUENCY_INFO | dvb_frequency_info_t | get interface capabilites (memset to 0 first)
76 * DVB_SET_TUNING_PARAMETERS | dvb_tuning_parameters_t | perform tuning information
77 * DVB_GET_TUNING_PARAMETERS | dvb_tuning_parameters_t | get active parameters (after autotuning) (memset to 0 first)
78 * DVB_START_CAPTURE | (none) | start the capture
79 * DVB_STOP_CAPTURE | (none) | stop the capture
80 * DVB_GET_STATUS | dvb_status_t | get current status
81 * DVB_GET_SS | uint32 | signal strength, range 0 to 1000
82 * DVB_GET_BER | uint32 | block error rate, range 0 to 1000
83 * DVB_GET_SNR | uint32 | signal noise ratio, range 0 to 1000
84 * DVB_GET_UPC | uint32 | XXX ???, range 0 to 1000
85 * DVB_CAPTURE | dvb_capture_t | get information about captured data
96 DVB_TYPE_UNKNOWN
= -1,
97 DVB_TYPE_DVB_C
= 0x10,
98 DVB_TYPE_DVB_H
= 0x20,
99 DVB_TYPE_DVB_S
= 0x30,
100 DVB_TYPE_DVB_T
= 0x40,
106 DVB_BANDWIDTH_AUTO
= 0,
107 DVB_BANDWIDTH_5_MHZ
= 5000,
108 DVB_BANDWIDTH_6_MHZ
= 6000,
109 DVB_BANDWIDTH_7_MHZ
= 7000,
110 DVB_BANDWIDTH_8_MHZ
= 8000,
116 DVB_POLARITY_UNKNOWN
= -1,
117 DVB_POLARITY_VERTICAL
= 1,
118 DVB_POLARITY_HORIZONTAL
= 2,
122 // "modulation" or "constellation"
126 DVB_MODULATION_16_QAM
,
127 DVB_MODULATION_32_QAM
,
128 DVB_MODULATION_64_QAM
,
129 DVB_MODULATION_128_QAM
,
130 DVB_MODULATION_256_QAM
,
134 // dvb_cofdm_mode, dvb_transmission_mode
136 DVB_TRANSMISSION_MODE_AUTO
,
137 DVB_TRANSMISSION_MODE_2K
,
138 DVB_TRANSMISSION_MODE_4K
,
139 DVB_TRANSMISSION_MODE_8K
,
140 } dvb_transmission_mode_t
;
143 // code rate, specified by inner FEC (forward error correction) scheme
160 DVB_GUARD_INTERVAL_AUTO
,
161 DVB_GUARD_INTERVAL_1_4
,
162 DVB_GUARD_INTERVAL_1_8
,
163 DVB_GUARD_INTERVAL_1_16
,
164 DVB_GUARD_INTERVAL_1_32
,
165 } dvb_guard_interval_t
;
168 // alpha value for hierarchical transmission
178 // spectral inversion
187 DVB_STATUS_SIGNAL
= 0x0001,
188 DVB_STATUS_CARRIER
= 0x0002,
189 DVB_STATUS_LOCK
= 0x0004,
190 DVB_STATUS_VITERBI
= 0x0008,
191 DVB_STATUS_SYNC
= 0x0010,
196 DVB_GET_INTERFACE_INFO
= (B_DEVICE_OP_CODES_END
+ 0x100),
197 DVB_GET_FREQUENCY_INFO
= (B_DEVICE_OP_CODES_END
+ 0x120),
198 DVB_SET_TUNING_PARAMETERS
,
199 DVB_GET_TUNING_PARAMETERS
,
212 uint32 version
; // set this to 1
213 uint32 flags
; // set this to 0
219 } dvb_interface_info_t
;
224 uint64 frequency_min
;
225 uint64 frequency_max
;
226 uint64 frequency_step
;
228 } dvb_frequency_info_t
;
233 dvb_inversion_t inversion
;
234 dvb_bandwidth_t bandwidth
;
235 dvb_modulation_t modulation
;
236 dvb_hierarchy_t hierarchy
;
237 dvb_code_rate_t code_rate_hp
;
238 dvb_code_rate_t code_rate_lp
;
239 dvb_transmission_mode_t transmission_mode
;
240 dvb_guard_interval_t guard_interval
;
241 } dvb_t_tuning_parameters_t
;
246 dvb_inversion_t inversion
;
247 dvb_modulation_t modulation
;
249 dvb_polarity_t polarity
;
250 } dvb_s_tuning_parameters_t
;
255 dvb_t_tuning_parameters_t dvb_t
;
256 dvb_s_tuning_parameters_t dvb_s
;
259 } dvb_tuning_parameters_t
;