frontend.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. /*
  2. * frontend.h
  3. *
  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
  9. *
  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.
  14. *
  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.
  19. *
  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.
  23. *
  24. */
  25. #ifndef _DVBFRONTEND_H_
  26. #define _DVBFRONTEND_H_
  27. #include <linux/types.h>
  28. typedef enum fe_type {
  29. FE_QPSK,
  30. FE_QAM,
  31. FE_OFDM,
  32. FE_ATSC
  33. } fe_type_t;
  34. typedef enum fe_caps {
  35. FE_IS_STUPID = 0,
  36. FE_CAN_INVERSION_AUTO = 0x1,
  37. FE_CAN_FEC_1_2 = 0x2,
  38. FE_CAN_FEC_2_3 = 0x4,
  39. FE_CAN_FEC_3_4 = 0x8,
  40. FE_CAN_FEC_4_5 = 0x10,
  41. FE_CAN_FEC_5_6 = 0x20,
  42. FE_CAN_FEC_6_7 = 0x40,
  43. FE_CAN_FEC_7_8 = 0x80,
  44. FE_CAN_FEC_8_9 = 0x100,
  45. FE_CAN_FEC_AUTO = 0x200,
  46. FE_CAN_QPSK = 0x400,
  47. FE_CAN_QAM_16 = 0x800,
  48. FE_CAN_QAM_32 = 0x1000,
  49. FE_CAN_QAM_64 = 0x2000,
  50. FE_CAN_QAM_128 = 0x4000,
  51. FE_CAN_QAM_256 = 0x8000,
  52. FE_CAN_QAM_AUTO = 0x10000,
  53. FE_CAN_TRANSMISSION_MODE_AUTO = 0x20000,
  54. FE_CAN_BANDWIDTH_AUTO = 0x40000,
  55. FE_CAN_GUARD_INTERVAL_AUTO = 0x80000,
  56. FE_CAN_HIERARCHY_AUTO = 0x100000,
  57. FE_CAN_8VSB = 0x200000,
  58. FE_CAN_16VSB = 0x400000,
  59. FE_HAS_EXTENDED_CAPS = 0x800000, /* We need more bitspace for newer APIs, indicate this. */
  60. #ifndef __GENKSYMS__
  61. FE_CAN_TURBO_FEC = 0x8000000, /* frontend supports "turbo fec modulation" */
  62. #endif
  63. FE_CAN_2G_MODULATION = 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */
  64. FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */
  65. FE_CAN_RECOVER = 0x40000000, /* frontend can recover from a cable unplug automatically */
  66. FE_CAN_MUTE_TS = 0x80000000 /* frontend can stop spurious TS data output */
  67. } fe_caps_t;
  68. struct dvb_frontend_info {
  69. char name[128];
  70. fe_type_t type;
  71. __u32 frequency_min;
  72. __u32 frequency_max;
  73. __u32 frequency_stepsize;
  74. __u32 frequency_tolerance;
  75. __u32 symbol_rate_min;
  76. __u32 symbol_rate_max;
  77. __u32 symbol_rate_tolerance; /* ppm */
  78. __u32 notifier_delay; /* DEPRECATED */
  79. fe_caps_t caps;
  80. };
  81. /**
  82. * Check out the DiSEqC bus spec available on http://www.eutelsat.org/ for
  83. * the meaning of this struct...
  84. */
  85. struct dvb_diseqc_master_cmd {
  86. __u8 msg [6]; /* { framing, address, command, data [3] } */
  87. __u8 msg_len; /* valid values are 3...6 */
  88. };
  89. struct dvb_diseqc_slave_reply {
  90. __u8 msg [4]; /* { framing, data [3] } */
  91. __u8 msg_len; /* valid values are 0...4, 0 means no msg */
  92. int timeout; /* return from ioctl after timeout ms with */
  93. }; /* errorcode when no message was received */
  94. typedef enum fe_sec_voltage {
  95. SEC_VOLTAGE_13,
  96. SEC_VOLTAGE_18,
  97. SEC_VOLTAGE_OFF
  98. } fe_sec_voltage_t;
  99. typedef enum fe_sec_tone_mode {
  100. SEC_TONE_ON,
  101. SEC_TONE_OFF
  102. } fe_sec_tone_mode_t;
  103. typedef enum fe_sec_mini_cmd {
  104. SEC_MINI_A,
  105. SEC_MINI_B
  106. } fe_sec_mini_cmd_t;
  107. typedef enum fe_status {
  108. FE_HAS_SIGNAL = 0x01, /* found something above the noise level */
  109. FE_HAS_CARRIER = 0x02, /* found a DVB signal */
  110. FE_HAS_VITERBI = 0x04, /* FEC is stable */
  111. FE_HAS_SYNC = 0x08, /* found sync bytes */
  112. FE_HAS_LOCK = 0x10, /* everything's working... */
  113. FE_TIMEDOUT = 0x20, /* no lock within the last ~2 seconds */
  114. FE_REINIT = 0x40 /* frontend was reinitialized, */
  115. } fe_status_t; /* application is recommended to reset */
  116. /* DiSEqC, tone and parameters */
  117. typedef enum fe_spectral_inversion {
  118. INVERSION_OFF,
  119. INVERSION_ON,
  120. INVERSION_AUTO
  121. } fe_spectral_inversion_t;
  122. typedef enum fe_code_rate {
  123. FEC_NONE = 0,
  124. FEC_1_2,
  125. FEC_2_3,
  126. FEC_3_4,
  127. FEC_4_5,
  128. FEC_5_6,
  129. FEC_6_7,
  130. FEC_7_8,
  131. FEC_8_9,
  132. FEC_AUTO,
  133. FEC_3_5,
  134. FEC_9_10,
  135. } fe_code_rate_t;
  136. typedef enum fe_modulation {
  137. QPSK,
  138. QAM_16,
  139. QAM_32,
  140. QAM_64,
  141. QAM_128,
  142. QAM_256,
  143. QAM_AUTO,
  144. VSB_8,
  145. VSB_16,
  146. PSK_8,
  147. APSK_16,
  148. APSK_32,
  149. DQPSK,
  150. } fe_modulation_t;
  151. typedef enum fe_transmit_mode {
  152. TRANSMISSION_MODE_2K,
  153. TRANSMISSION_MODE_8K,
  154. TRANSMISSION_MODE_AUTO,
  155. TRANSMISSION_MODE_4K
  156. } fe_transmit_mode_t;
  157. typedef enum fe_bandwidth {
  158. BANDWIDTH_8_MHZ,
  159. BANDWIDTH_7_MHZ,
  160. BANDWIDTH_6_MHZ,
  161. BANDWIDTH_AUTO
  162. } fe_bandwidth_t;
  163. typedef enum fe_guard_interval {
  164. GUARD_INTERVAL_1_32,
  165. GUARD_INTERVAL_1_16,
  166. GUARD_INTERVAL_1_8,
  167. GUARD_INTERVAL_1_4,
  168. GUARD_INTERVAL_AUTO
  169. } fe_guard_interval_t;
  170. typedef enum fe_hierarchy {
  171. HIERARCHY_NONE,
  172. HIERARCHY_1,
  173. HIERARCHY_2,
  174. HIERARCHY_4,
  175. HIERARCHY_AUTO
  176. } fe_hierarchy_t;
  177. struct dvb_qpsk_parameters {
  178. __u32 symbol_rate; /* symbol rate in Symbols per second */
  179. fe_code_rate_t fec_inner; /* forward error correction (see above) */
  180. };
  181. struct dvb_qam_parameters {
  182. __u32 symbol_rate; /* symbol rate in Symbols per second */
  183. fe_code_rate_t fec_inner; /* forward error correction (see above) */
  184. fe_modulation_t modulation; /* modulation type (see above) */
  185. };
  186. struct dvb_vsb_parameters {
  187. fe_modulation_t modulation; /* modulation type (see above) */
  188. };
  189. struct dvb_ofdm_parameters {
  190. fe_bandwidth_t bandwidth;
  191. fe_code_rate_t code_rate_HP; /* high priority stream code rate */
  192. fe_code_rate_t code_rate_LP; /* low priority stream code rate */
  193. fe_modulation_t constellation; /* modulation type (see above) */
  194. fe_transmit_mode_t transmission_mode;
  195. fe_guard_interval_t guard_interval;
  196. fe_hierarchy_t hierarchy_information;
  197. };
  198. struct dvb_frontend_parameters {
  199. __u32 frequency; /* (absolute) frequency in Hz for QAM/OFDM/ATSC */
  200. /* intermediate frequency in kHz for QPSK */
  201. fe_spectral_inversion_t inversion;
  202. union {
  203. struct dvb_qpsk_parameters qpsk;
  204. struct dvb_qam_parameters qam;
  205. struct dvb_ofdm_parameters ofdm;
  206. struct dvb_vsb_parameters vsb;
  207. } u;
  208. };
  209. struct dvb_frontend_event {
  210. fe_status_t status;
  211. struct dvb_frontend_parameters parameters;
  212. };
  213. /* S2API Commands */
  214. #define DTV_UNDEFINED 0
  215. #define DTV_TUNE 1
  216. #define DTV_CLEAR 2
  217. #define DTV_FREQUENCY 3
  218. #define DTV_MODULATION 4
  219. #define DTV_BANDWIDTH_HZ 5
  220. #define DTV_INVERSION 6
  221. #define DTV_DISEQC_MASTER 7
  222. #define DTV_SYMBOL_RATE 8
  223. #define DTV_INNER_FEC 9
  224. #define DTV_VOLTAGE 10
  225. #define DTV_TONE 11
  226. #define DTV_PILOT 12
  227. #define DTV_ROLLOFF 13
  228. #define DTV_DISEQC_SLAVE_REPLY 14
  229. /* Basic enumeration set for querying unlimited capabilities */
  230. #define DTV_FE_CAPABILITY_COUNT 15
  231. #define DTV_FE_CAPABILITY 16
  232. #define DTV_DELIVERY_SYSTEM 17
  233. /* ISDB-T and ISDB-Tsb */
  234. #define DTV_ISDBT_PARTIAL_RECEPTION 18
  235. #define DTV_ISDBT_SOUND_BROADCASTING 19
  236. #define DTV_ISDBT_SB_SUBCHANNEL_ID 20
  237. #define DTV_ISDBT_SB_SEGMENT_IDX 21
  238. #define DTV_ISDBT_SB_SEGMENT_COUNT 22
  239. #define DTV_ISDBT_LAYERA_FEC 23
  240. #define DTV_ISDBT_LAYERA_MODULATION 24
  241. #define DTV_ISDBT_LAYERA_SEGMENT_COUNT 25
  242. #define DTV_ISDBT_LAYERA_TIME_INTERLEAVING 26
  243. #define DTV_ISDBT_LAYERB_FEC 27
  244. #define DTV_ISDBT_LAYERB_MODULATION 28
  245. #define DTV_ISDBT_LAYERB_SEGMENT_COUNT 29
  246. #define DTV_ISDBT_LAYERB_TIME_INTERLEAVING 30
  247. #define DTV_ISDBT_LAYERC_FEC 31
  248. #define DTV_ISDBT_LAYERC_MODULATION 32
  249. #define DTV_ISDBT_LAYERC_SEGMENT_COUNT 33
  250. #define DTV_ISDBT_LAYERC_TIME_INTERLEAVING 34
  251. #define DTV_API_VERSION 35
  252. #define DTV_CODE_RATE_HP 36
  253. #define DTV_CODE_RATE_LP 37
  254. #define DTV_GUARD_INTERVAL 38
  255. #define DTV_TRANSMISSION_MODE 39
  256. #define DTV_HIERARCHY 40
  257. #define DTV_ISDBT_LAYER_ENABLED 41
  258. #define DTV_ISDBS_TS_ID 42
  259. #define DTV_MAX_COMMAND DTV_ISDBS_TS_ID
  260. typedef enum fe_pilot {
  261. PILOT_ON,
  262. PILOT_OFF,
  263. PILOT_AUTO,
  264. } fe_pilot_t;
  265. typedef enum fe_rolloff {
  266. ROLLOFF_35, /* Implied value in DVB-S, default for DVB-S2 */
  267. ROLLOFF_20,
  268. ROLLOFF_25,
  269. ROLLOFF_AUTO,
  270. } fe_rolloff_t;
  271. typedef enum fe_delivery_system {
  272. SYS_UNDEFINED,
  273. SYS_DVBC_ANNEX_AC,
  274. SYS_DVBC_ANNEX_B,
  275. SYS_DVBT,
  276. SYS_DSS,
  277. SYS_DVBS,
  278. SYS_DVBS2,
  279. SYS_DVBH,
  280. SYS_ISDBT,
  281. SYS_ISDBS,
  282. SYS_ISDBC,
  283. SYS_ATSC,
  284. SYS_ATSCMH,
  285. SYS_DMBTH,
  286. SYS_CMMB,
  287. SYS_DAB,
  288. } fe_delivery_system_t;
  289. struct dtv_cmds_h {
  290. char *name; /* A display name for debugging purposes */
  291. __u32 cmd; /* A unique ID */
  292. /* Flags */
  293. __u32 set:1; /* Either a set or get property */
  294. __u32 buffer:1; /* Does this property use the buffer? */
  295. __u32 reserved:30; /* Align */
  296. };
  297. struct dtv_property {
  298. __u32 cmd;
  299. __u32 reserved[3];
  300. union {
  301. __u32 data;
  302. struct {
  303. __u8 data[32];
  304. __u32 len;
  305. __u32 reserved1[3];
  306. void *reserved2;
  307. } buffer;
  308. } u;
  309. int result;
  310. } __attribute__ ((packed));
  311. /* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */
  312. #define DTV_IOCTL_MAX_MSGS 64
  313. struct dtv_properties {
  314. __u32 num;
  315. struct dtv_property *props;
  316. };
  317. #define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties)
  318. #define FE_GET_PROPERTY _IOR('o', 83, struct dtv_properties)
  319. /**
  320. * When set, this flag will disable any zigzagging or other "normal" tuning
  321. * behaviour. Additionally, there will be no automatic monitoring of the lock
  322. * status, and hence no frontend events will be generated. If a frontend device
  323. * is closed, this flag will be automatically turned off when the device is
  324. * reopened read-write.
  325. */
  326. #define FE_TUNE_MODE_ONESHOT 0x01
  327. #define FE_GET_INFO _IOR('o', 61, struct dvb_frontend_info)
  328. #define FE_DISEQC_RESET_OVERLOAD _IO('o', 62)
  329. #define FE_DISEQC_SEND_MASTER_CMD _IOW('o', 63, struct dvb_diseqc_master_cmd)
  330. #define FE_DISEQC_RECV_SLAVE_REPLY _IOR('o', 64, struct dvb_diseqc_slave_reply)
  331. #define FE_DISEQC_SEND_BURST _IO('o', 65) /* fe_sec_mini_cmd_t */
  332. #define FE_SET_TONE _IO('o', 66) /* fe_sec_tone_mode_t */
  333. #define FE_SET_VOLTAGE _IO('o', 67) /* fe_sec_voltage_t */
  334. #define FE_ENABLE_HIGH_LNB_VOLTAGE _IO('o', 68) /* int */
  335. #define FE_READ_STATUS _IOR('o', 69, fe_status_t)
  336. #define FE_READ_BER _IOR('o', 70, __u32)
  337. #define FE_READ_SIGNAL_STRENGTH _IOR('o', 71, __u16)
  338. #define FE_READ_SNR _IOR('o', 72, __u16)
  339. #define FE_READ_UNCORRECTED_BLOCKS _IOR('o', 73, __u32)
  340. #define FE_SET_FRONTEND _IOW('o', 76, struct dvb_frontend_parameters)
  341. #define FE_GET_FRONTEND _IOR('o', 77, struct dvb_frontend_parameters)
  342. #define FE_SET_FRONTEND_TUNE_MODE _IO('o', 81) /* unsigned int */
  343. #define FE_GET_EVENT _IOR('o', 78, struct dvb_frontend_event)
  344. #define FE_DISHNETWORK_SEND_LEGACY_CMD _IO('o', 80) /* unsigned int */
  345. #endif /*_DVBFRONTEND_H_*/