as102_fe_types.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*
  2. * Abilis Systems Single DVB-T Receiver
  3. * Copyright (C) 2008 Pierrick Hascoet <pierrick.hascoet@abilis.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2, or (at your option)
  8. * any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #ifndef _AS10X_TYPES_H_
  16. #define _AS10X_TYPES_H_
  17. /*********************************/
  18. /* MACRO DEFINITIONS */
  19. /*********************************/
  20. /* bandwidth constant values */
  21. #define BW_5_MHZ 0x00
  22. #define BW_6_MHZ 0x01
  23. #define BW_7_MHZ 0x02
  24. #define BW_8_MHZ 0x03
  25. /* hierarchy priority selection values */
  26. #define HIER_NO_PRIORITY 0x00
  27. #define HIER_LOW_PRIORITY 0x01
  28. #define HIER_HIGH_PRIORITY 0x02
  29. /* constellation available values */
  30. #define CONST_QPSK 0x00
  31. #define CONST_QAM16 0x01
  32. #define CONST_QAM64 0x02
  33. #define CONST_UNKNOWN 0xFF
  34. /* hierarchy available values */
  35. #define HIER_NONE 0x00
  36. #define HIER_ALPHA_1 0x01
  37. #define HIER_ALPHA_2 0x02
  38. #define HIER_ALPHA_4 0x03
  39. #define HIER_UNKNOWN 0xFF
  40. /* interleaving available values */
  41. #define INTLV_NATIVE 0x00
  42. #define INTLV_IN_DEPTH 0x01
  43. #define INTLV_UNKNOWN 0xFF
  44. /* code rate available values */
  45. #define CODE_RATE_1_2 0x00
  46. #define CODE_RATE_2_3 0x01
  47. #define CODE_RATE_3_4 0x02
  48. #define CODE_RATE_5_6 0x03
  49. #define CODE_RATE_7_8 0x04
  50. #define CODE_RATE_UNKNOWN 0xFF
  51. /* guard interval available values */
  52. #define GUARD_INT_1_32 0x00
  53. #define GUARD_INT_1_16 0x01
  54. #define GUARD_INT_1_8 0x02
  55. #define GUARD_INT_1_4 0x03
  56. #define GUARD_UNKNOWN 0xFF
  57. /* transmission mode available values */
  58. #define TRANS_MODE_2K 0x00
  59. #define TRANS_MODE_8K 0x01
  60. #define TRANS_MODE_4K 0x02
  61. #define TRANS_MODE_UNKNOWN 0xFF
  62. /* DVBH signalling available values */
  63. #define TIMESLICING_PRESENT 0x01
  64. #define MPE_FEC_PRESENT 0x02
  65. /* tune state available */
  66. #define TUNE_STATUS_NOT_TUNED 0x00
  67. #define TUNE_STATUS_IDLE 0x01
  68. #define TUNE_STATUS_LOCKING 0x02
  69. #define TUNE_STATUS_SIGNAL_DVB_OK 0x03
  70. #define TUNE_STATUS_STREAM_DETECTED 0x04
  71. #define TUNE_STATUS_STREAM_TUNED 0x05
  72. #define TUNE_STATUS_ERROR 0xFF
  73. /* available TS FID filter types */
  74. #define TS_PID_TYPE_TS 0
  75. #define TS_PID_TYPE_PSI_SI 1
  76. #define TS_PID_TYPE_MPE 2
  77. /* number of echos available */
  78. #define MAX_ECHOS 15
  79. /* Context types */
  80. #define CONTEXT_LNA 1010
  81. #define CONTEXT_ELNA_HYSTERESIS 4003
  82. #define CONTEXT_ELNA_GAIN 4004
  83. #define CONTEXT_MER_THRESHOLD 5005
  84. #define CONTEXT_MER_OFFSET 5006
  85. #define CONTEXT_IR_STATE 7000
  86. #define CONTEXT_TSOUT_MSB_FIRST 7004
  87. #define CONTEXT_TSOUT_FALLING_EDGE 7005
  88. /* Configuration modes */
  89. #define CFG_MODE_ON 0
  90. #define CFG_MODE_OFF 1
  91. #define CFG_MODE_AUTO 2
  92. struct as10x_tps {
  93. uint8_t modulation;
  94. uint8_t hierarchy;
  95. uint8_t interleaving_mode;
  96. uint8_t code_rate_HP;
  97. uint8_t code_rate_LP;
  98. uint8_t guard_interval;
  99. uint8_t transmission_mode;
  100. uint8_t DVBH_mask_HP;
  101. uint8_t DVBH_mask_LP;
  102. uint16_t cell_ID;
  103. } __packed;
  104. struct as10x_tune_args {
  105. /* frequency */
  106. uint32_t freq;
  107. /* bandwidth */
  108. uint8_t bandwidth;
  109. /* hierarchy selection */
  110. uint8_t hier_select;
  111. /* constellation */
  112. uint8_t modulation;
  113. /* hierarchy */
  114. uint8_t hierarchy;
  115. /* interleaving mode */
  116. uint8_t interleaving_mode;
  117. /* code rate */
  118. uint8_t code_rate;
  119. /* guard interval */
  120. uint8_t guard_interval;
  121. /* transmission mode */
  122. uint8_t transmission_mode;
  123. } __packed;
  124. struct as10x_tune_status {
  125. /* tune status */
  126. uint8_t tune_state;
  127. /* signal strength */
  128. int16_t signal_strength;
  129. /* packet error rate 10^-4 */
  130. uint16_t PER;
  131. /* bit error rate 10^-4 */
  132. uint16_t BER;
  133. } __packed;
  134. struct as10x_demod_stats {
  135. /* frame counter */
  136. uint32_t frame_count;
  137. /* Bad frame counter */
  138. uint32_t bad_frame_count;
  139. /* Number of wrong bytes fixed by Reed-Solomon */
  140. uint32_t bytes_fixed_by_rs;
  141. /* Averaged MER */
  142. uint16_t mer;
  143. /* statistics calculation state indicator (started or not) */
  144. uint8_t has_started;
  145. } __packed;
  146. struct as10x_ts_filter {
  147. uint16_t pid; /* valid PID value 0x00 : 0x2000 */
  148. uint8_t type; /* Red TS_PID_TYPE_<N> values */
  149. uint8_t idx; /* index in filtering table */
  150. } __packed;
  151. struct as10x_register_value {
  152. uint8_t mode;
  153. union {
  154. uint8_t value8; /* 8 bit value */
  155. uint16_t value16; /* 16 bit value */
  156. uint32_t value32; /* 32 bit value */
  157. } __packed u;
  158. } __packed;
  159. struct as10x_register_addr {
  160. /* register addr */
  161. uint32_t addr;
  162. /* register mode access */
  163. uint8_t mode;
  164. };
  165. #endif