stv0367_priv.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /*
  2. * stv0367_priv.h
  3. *
  4. * Driver for ST STV0367 DVB-T & DVB-C demodulator IC.
  5. *
  6. * Copyright (C) ST Microelectronics.
  7. * Copyright (C) 2010,2011 NetUP Inc.
  8. * Copyright (C) 2010,2011 Igor M. Liplianin <liplianin@netup.ru>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (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. *
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24. */
  25. /* Common driver error constants */
  26. #ifndef STV0367_PRIV_H
  27. #define STV0367_PRIV_H
  28. #ifndef TRUE
  29. #define TRUE (1 == 1)
  30. #endif
  31. #ifndef FALSE
  32. #define FALSE (!TRUE)
  33. #endif
  34. #ifndef NULL
  35. #define NULL 0
  36. #endif
  37. /* MACRO definitions */
  38. #define ABS(X) ((X) < 0 ? (-1 * (X)) : (X))
  39. #define MAX(X, Y) ((X) >= (Y) ? (X) : (Y))
  40. #define MIN(X, Y) ((X) <= (Y) ? (X) : (Y))
  41. #define INRANGE(X, Y, Z) \
  42. ((((X) <= (Y)) && ((Y) <= (Z))) || \
  43. (((Z) <= (Y)) && ((Y) <= (X))) ? 1 : 0)
  44. #ifndef MAKEWORD
  45. #define MAKEWORD(X, Y) (((X) << 8) + (Y))
  46. #endif
  47. #define LSB(X) (((X) & 0xff))
  48. #define MSB(Y) (((Y) >> 8) & 0xff)
  49. #define MMSB(Y)(((Y) >> 16) & 0xff)
  50. enum stv0367_ter_signal_type {
  51. FE_TER_NOAGC = 0,
  52. FE_TER_AGCOK = 5,
  53. FE_TER_NOTPS = 6,
  54. FE_TER_TPSOK = 7,
  55. FE_TER_NOSYMBOL = 8,
  56. FE_TER_BAD_CPQ = 9,
  57. FE_TER_PRFOUNDOK = 10,
  58. FE_TER_NOPRFOUND = 11,
  59. FE_TER_LOCKOK = 12,
  60. FE_TER_NOLOCK = 13,
  61. FE_TER_SYMBOLOK = 15,
  62. FE_TER_CPAMPOK = 16,
  63. FE_TER_NOCPAMP = 17,
  64. FE_TER_SWNOK = 18
  65. };
  66. enum stv0367_ts_mode {
  67. STV0367_OUTPUTMODE_DEFAULT,
  68. STV0367_SERIAL_PUNCT_CLOCK,
  69. STV0367_SERIAL_CONT_CLOCK,
  70. STV0367_PARALLEL_PUNCT_CLOCK,
  71. STV0367_DVBCI_CLOCK
  72. };
  73. enum stv0367_clk_pol {
  74. STV0367_CLOCKPOLARITY_DEFAULT,
  75. STV0367_RISINGEDGE_CLOCK,
  76. STV0367_FALLINGEDGE_CLOCK
  77. };
  78. enum stv0367_ter_bw {
  79. FE_TER_CHAN_BW_6M = 6,
  80. FE_TER_CHAN_BW_7M = 7,
  81. FE_TER_CHAN_BW_8M = 8
  82. };
  83. #if 0
  84. enum FE_TER_Rate_TPS {
  85. FE_TER_TPS_1_2 = 0,
  86. FE_TER_TPS_2_3 = 1,
  87. FE_TER_TPS_3_4 = 2,
  88. FE_TER_TPS_5_6 = 3,
  89. FE_TER_TPS_7_8 = 4
  90. };
  91. #endif
  92. enum stv0367_ter_mode {
  93. FE_TER_MODE_2K,
  94. FE_TER_MODE_8K,
  95. FE_TER_MODE_4K
  96. };
  97. #if 0
  98. enum FE_TER_Hierarchy_Alpha {
  99. FE_TER_HIER_ALPHA_NONE, /* Regular modulation */
  100. FE_TER_HIER_ALPHA_1, /* Hierarchical modulation a = 1*/
  101. FE_TER_HIER_ALPHA_2, /* Hierarchical modulation a = 2*/
  102. FE_TER_HIER_ALPHA_4 /* Hierarchical modulation a = 4*/
  103. };
  104. #endif
  105. enum stv0367_ter_hierarchy {
  106. FE_TER_HIER_NONE, /*Hierarchy None*/
  107. FE_TER_HIER_LOW_PRIO, /*Hierarchy : Low Priority*/
  108. FE_TER_HIER_HIGH_PRIO, /*Hierarchy : High Priority*/
  109. FE_TER_HIER_PRIO_ANY /*Hierarchy :Any*/
  110. };
  111. #if 0
  112. enum fe_stv0367_ter_spec {
  113. FE_TER_INVERSION_NONE = 0,
  114. FE_TER_INVERSION = 1,
  115. FE_TER_INVERSION_AUTO = 2,
  116. FE_TER_INVERSION_UNK = 4
  117. };
  118. #endif
  119. enum stv0367_ter_if_iq_mode {
  120. FE_TER_NORMAL_IF_TUNER = 0,
  121. FE_TER_LONGPATH_IF_TUNER = 1,
  122. FE_TER_IQ_TUNER = 2
  123. };
  124. #if 0
  125. enum FE_TER_FECRate {
  126. FE_TER_FEC_NONE = 0x00, /* no FEC rate specified */
  127. FE_TER_FEC_ALL = 0xFF, /* Logical OR of all FECs */
  128. FE_TER_FEC_1_2 = 1,
  129. FE_TER_FEC_2_3 = (1 << 1),
  130. FE_TER_FEC_3_4 = (1 << 2),
  131. FE_TER_FEC_4_5 = (1 << 3),
  132. FE_TER_FEC_5_6 = (1 << 4),
  133. FE_TER_FEC_6_7 = (1 << 5),
  134. FE_TER_FEC_7_8 = (1 << 6),
  135. FE_TER_FEC_8_9 = (1 << 7)
  136. };
  137. enum FE_TER_Rate {
  138. FE_TER_FE_1_2 = 0,
  139. FE_TER_FE_2_3 = 1,
  140. FE_TER_FE_3_4 = 2,
  141. FE_TER_FE_5_6 = 3,
  142. FE_TER_FE_6_7 = 4,
  143. FE_TER_FE_7_8 = 5
  144. };
  145. #endif
  146. enum stv0367_ter_force {
  147. FE_TER_FORCENONE = 0,
  148. FE_TER_FORCE_M_G = 1
  149. };
  150. enum stv0367cab_mod {
  151. FE_CAB_MOD_QAM4,
  152. FE_CAB_MOD_QAM16,
  153. FE_CAB_MOD_QAM32,
  154. FE_CAB_MOD_QAM64,
  155. FE_CAB_MOD_QAM128,
  156. FE_CAB_MOD_QAM256,
  157. FE_CAB_MOD_QAM512,
  158. FE_CAB_MOD_QAM1024
  159. };
  160. #if 0
  161. enum {
  162. FE_CAB_FEC_A = 1, /* J83 Annex A */
  163. FE_CAB_FEC_B = (1 << 1),/* J83 Annex B */
  164. FE_CAB_FEC_C = (1 << 2) /* J83 Annex C */
  165. } FE_CAB_FECType_t;
  166. #endif
  167. struct stv0367_cab_signal_info {
  168. int locked;
  169. u32 frequency; /* kHz */
  170. u32 symbol_rate; /* Mbds */
  171. enum stv0367cab_mod modulation;
  172. enum fe_spectral_inversion spect_inv;
  173. s32 Power_dBmx10; /* Power of the RF signal (dBm x 10) */
  174. u32 CN_dBx10; /* Carrier to noise ratio (dB x 10) */
  175. u32 BER; /* Bit error rate (x 10000000) */
  176. };
  177. enum stv0367_cab_signal_type {
  178. FE_CAB_NOTUNER,
  179. FE_CAB_NOAGC,
  180. FE_CAB_NOSIGNAL,
  181. FE_CAB_NOTIMING,
  182. FE_CAB_TIMINGOK,
  183. FE_CAB_NOCARRIER,
  184. FE_CAB_CARRIEROK,
  185. FE_CAB_NOBLIND,
  186. FE_CAB_BLINDOK,
  187. FE_CAB_NODEMOD,
  188. FE_CAB_DEMODOK,
  189. FE_CAB_DATAOK
  190. };
  191. #endif