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 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 */ 19 #ifndef _AS10X_TYPES_H_ 20 #define _AS10X_TYPES_H_ 21 22 #include "as10x_handle.h" 23 24 /*********************************/ 25 /* MACRO DEFINITIONS */ 26 /*********************************/ 27 28 /* bandwidth constant values */ 29 #define BW_5_MHZ 0x00 30 #define BW_6_MHZ 0x01 31 #define BW_7_MHZ 0x02 32 #define BW_8_MHZ 0x03 33 34 /* hierarchy priority selection values */ 35 #define HIER_NO_PRIORITY 0x00 36 #define HIER_LOW_PRIORITY 0x01 37 #define HIER_HIGH_PRIORITY 0x02 38 39 /* constellation available values */ 40 #define CONST_QPSK 0x00 41 #define CONST_QAM16 0x01 42 #define CONST_QAM64 0x02 43 #define CONST_UNKNOWN 0xFF 44 45 /* hierarchy available values */ 46 #define HIER_NONE 0x00 47 #define HIER_ALPHA_1 0x01 48 #define HIER_ALPHA_2 0x02 49 #define HIER_ALPHA_4 0x03 50 #define HIER_UNKNOWN 0xFF 51 52 /* interleaving available values */ 53 #define INTLV_NATIVE 0x00 54 #define INTLV_IN_DEPTH 0x01 55 #define INTLV_UNKNOWN 0xFF 56 57 /* code rate available values */ 58 #define CODE_RATE_1_2 0x00 59 #define CODE_RATE_2_3 0x01 60 #define CODE_RATE_3_4 0x02 61 #define CODE_RATE_5_6 0x03 62 #define CODE_RATE_7_8 0x04 63 #define CODE_RATE_UNKNOWN 0xFF 64 65 /* guard interval available values */ 66 #define GUARD_INT_1_32 0x00 67 #define GUARD_INT_1_16 0x01 68 #define GUARD_INT_1_8 0x02 69 #define GUARD_INT_1_4 0x03 70 #define GUARD_UNKNOWN 0xFF 71 72 /* transmission mode available values */ 73 #define TRANS_MODE_2K 0x00 74 #define TRANS_MODE_8K 0x01 75 #define TRANS_MODE_4K 0x02 76 #define TRANS_MODE_UNKNOWN 0xFF 77 78 /* DVBH signalling available values */ 79 #define TIMESLICING_PRESENT 0x01 80 #define MPE_FEC_PRESENT 0x02 81 82 /* tune state available */ 83 #define TUNE_STATUS_NOT_TUNED 0x00 84 #define TUNE_STATUS_IDLE 0x01 85 #define TUNE_STATUS_LOCKING 0x02 86 #define TUNE_STATUS_SIGNAL_DVB_OK 0x03 87 #define TUNE_STATUS_STREAM_DETECTED 0x04 88 #define TUNE_STATUS_STREAM_TUNED 0x05 89 #define TUNE_STATUS_ERROR 0xFF 90 91 /* available TS FID filter types */ 92 #define TS_PID_TYPE_TS 0 93 #define TS_PID_TYPE_PSI_SI 1 94 #define TS_PID_TYPE_MPE 2 95 96 /* number of echos available */ 97 #define MAX_ECHOS 15 98 99 /* Context types */ 100 #define CONTEXT_LNA 1010 101 #define CONTEXT_ELNA_HYSTERESIS 4003 102 #define CONTEXT_ELNA_GAIN 4004 103 #define CONTEXT_MER_THRESHOLD 5005 104 #define CONTEXT_MER_OFFSET 5006 105 #define CONTEXT_IR_STATE 7000 106 #define CONTEXT_TSOUT_MSB_FIRST 7004 107 #define CONTEXT_TSOUT_FALLING_EDGE 7005 108 109 /* Configuration modes */ 110 #define CFG_MODE_ON 0 111 #define CFG_MODE_OFF 1 112 #define CFG_MODE_AUTO 2 113 114 struct as10x_tps { 115 uint8_t modulation; 116 uint8_t hierarchy; 117 uint8_t interleaving_mode; 118 uint8_t code_rate_HP; 119 uint8_t code_rate_LP; 120 uint8_t guard_interval; 121 uint8_t transmission_mode; 122 uint8_t DVBH_mask_HP; 123 uint8_t DVBH_mask_LP; 124 uint16_t cell_ID; 125 } __packed; 126 127 struct as10x_tune_args { 128 /* frequency */ 129 uint32_t freq; 130 /* bandwidth */ 131 uint8_t bandwidth; 132 /* hierarchy selection */ 133 uint8_t hier_select; 134 /* constellation */ 135 uint8_t modulation; 136 /* hierarchy */ 137 uint8_t hierarchy; 138 /* interleaving mode */ 139 uint8_t interleaving_mode; 140 /* code rate */ 141 uint8_t code_rate; 142 /* guard interval */ 143 uint8_t guard_interval; 144 /* transmission mode */ 145 uint8_t transmission_mode; 146 } __packed; 147 148 struct as10x_tune_status { 149 /* tune status */ 150 uint8_t tune_state; 151 /* signal strength */ 152 int16_t signal_strength; 153 /* packet error rate 10^-4 */ 154 uint16_t PER; 155 /* bit error rate 10^-4 */ 156 uint16_t BER; 157 } __packed; 158 159 struct as10x_demod_stats { 160 /* frame counter */ 161 uint32_t frame_count; 162 /* Bad frame counter */ 163 uint32_t bad_frame_count; 164 /* Number of wrong bytes fixed by Reed-Solomon */ 165 uint32_t bytes_fixed_by_rs; 166 /* Averaged MER */ 167 uint16_t mer; 168 /* statistics calculation state indicator (started or not) */ 169 uint8_t has_started; 170 } __packed; 171 172 struct as10x_ts_filter { 173 uint16_t pid; /* valid PID value 0x00 : 0x2000 */ 174 uint8_t type; /* Red TS_PID_TYPE_<N> values */ 175 uint8_t idx; /* index in filtering table */ 176 } __packed; 177 178 struct as10x_register_value { 179 uint8_t mode; 180 union { 181 uint8_t value8; /* 8 bit value */ 182 uint16_t value16; /* 16 bit value */ 183 uint32_t value32; /* 32 bit value */ 184 } __packed u; 185 } __packed; 186 187 struct as10x_register_addr { 188 /* register addr */ 189 uint32_t addr; 190 /* register mode access */ 191 uint8_t mode; 192 }; 193 194 #endif 195