Mercurial > hg > audiostuff
comparison spandsp-0.0.6pre17/src/spandsp/private/v29rx.h @ 4:26cd8f1ef0b1
import spandsp-0.0.6pre17
author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
---|---|
date | Fri, 25 Jun 2010 15:50:58 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
3:c6c5a16ce2f2 | 4:26cd8f1ef0b1 |
---|---|
1 /* | |
2 * SpanDSP - a series of DSP components for telephony | |
3 * | |
4 * private/v29rx.h - ITU V.29 modem receive part | |
5 * | |
6 * Written by Steve Underwood <steveu@coppice.org> | |
7 * | |
8 * Copyright (C) 2003 Steve Underwood | |
9 * | |
10 * All rights reserved. | |
11 * | |
12 * This program is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU Lesser General Public License version 2.1, | |
14 * as published by the Free Software Foundation. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU Lesser General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU Lesser General Public | |
22 * License along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
24 * | |
25 * $Id: v29rx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $ | |
26 */ | |
27 | |
28 #if !defined(_SPANDSP_PRIVATE_V29RX_H_) | |
29 #define _SPANDSP_PRIVATE_V29RX_H_ | |
30 | |
31 /* Target length for the equalizer is about 63 taps, to deal with the worst stuff | |
32 in V.56bis. */ | |
33 /*! Samples before the target position in the equalizer buffer */ | |
34 #define V29_EQUALIZER_PRE_LEN 16 | |
35 /*! Samples after the target position in the equalizer buffer */ | |
36 #define V29_EQUALIZER_POST_LEN 14 | |
37 | |
38 /*! The number of taps in the pulse shaping/bandpass filter */ | |
39 #define V29_RX_FILTER_STEPS 27 | |
40 | |
41 /*! | |
42 V.29 modem receive side descriptor. This defines the working state for a | |
43 single instance of a V.29 modem receiver. | |
44 */ | |
45 struct v29_rx_state_s | |
46 { | |
47 /*! \brief The bit rate of the modem. Valid values are 4800, 7200 and 9600. */ | |
48 int bit_rate; | |
49 /*! \brief The callback function used to put each bit received. */ | |
50 put_bit_func_t put_bit; | |
51 /*! \brief A user specified opaque pointer passed to the put_bit routine. */ | |
52 void *put_bit_user_data; | |
53 | |
54 /*! \brief The callback function used to report modem status changes. */ | |
55 modem_rx_status_func_t status_handler; | |
56 /*! \brief A user specified opaque pointer passed to the status function. */ | |
57 void *status_user_data; | |
58 | |
59 /*! \brief A callback function which may be enabled to report every symbol's | |
60 constellation position. */ | |
61 qam_report_handler_t qam_report; | |
62 /*! \brief A user specified opaque pointer passed to the qam_report callback | |
63 routine. */ | |
64 void *qam_user_data; | |
65 | |
66 /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */ | |
67 #if defined(SPANDSP_USE_FIXED_POINT) | |
68 int16_t rrc_filter[V29_RX_FILTER_STEPS]; | |
69 #else | |
70 float rrc_filter[V29_RX_FILTER_STEPS]; | |
71 #endif | |
72 /*! \brief Current offset into the RRC pulse shaping filter buffer. */ | |
73 int rrc_filter_step; | |
74 | |
75 /*! \brief The register for the data scrambler. */ | |
76 unsigned int scramble_reg; | |
77 /*! \brief The register for the training scrambler. */ | |
78 uint8_t training_scramble_reg; | |
79 /*! \brief The current step in the table of CD constellation positions. */ | |
80 int training_cd; | |
81 /*! \brief TRUE if the previous trained values are to be reused. */ | |
82 int old_train; | |
83 /*! \brief The section of the training data we are currently in. */ | |
84 int training_stage; | |
85 /*! \brief A count of how far through the current training step we are. */ | |
86 int training_count; | |
87 /*! \brief A measure of how much mismatch there is between the real constellation, | |
88 and the decoded symbol positions. */ | |
89 float training_error; | |
90 /*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */ | |
91 int16_t last_sample; | |
92 /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.29 signal. */ | |
93 int signal_present; | |
94 /*! \brief Whether or not a carrier drop was detected and the signal delivery is pending. */ | |
95 int carrier_drop_pending; | |
96 /*! \brief A count of the current consecutive samples below the carrier off threshold. */ | |
97 int low_samples; | |
98 /*! \brief A highest magnitude sample seen. */ | |
99 int16_t high_sample; | |
100 | |
101 /*! \brief The position of the current symbol in the constellation, used for | |
102 differential decoding. */ | |
103 int constellation_state; | |
104 | |
105 /*! \brief The current phase of the carrier (i.e. the DDS parameter). */ | |
106 uint32_t carrier_phase; | |
107 /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */ | |
108 int32_t carrier_phase_rate; | |
109 /*! \brief The carrier update rate saved for reuse when using short training. */ | |
110 int32_t carrier_phase_rate_save; | |
111 #if defined(SPANDSP_USE_FIXED_POINT) | |
112 /*! \brief The proportional part of the carrier tracking filter. */ | |
113 int32_t carrier_track_p; | |
114 /*! \brief The integral part of the carrier tracking filter. */ | |
115 int32_t carrier_track_i; | |
116 #else | |
117 /*! \brief The proportional part of the carrier tracking filter. */ | |
118 float carrier_track_p; | |
119 /*! \brief The integral part of the carrier tracking filter. */ | |
120 float carrier_track_i; | |
121 #endif | |
122 | |
123 /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */ | |
124 power_meter_t power; | |
125 /*! \brief The power meter level at which carrier on is declared. */ | |
126 int32_t carrier_on_power; | |
127 /*! \brief The power meter level at which carrier off is declared. */ | |
128 int32_t carrier_off_power; | |
129 | |
130 /*! \brief Current read offset into the equalizer buffer. */ | |
131 int eq_step; | |
132 /*! \brief Current write offset into the equalizer buffer. */ | |
133 int eq_put_step; | |
134 /*! \brief Symbol counter to the next equalizer update. */ | |
135 int eq_skip; | |
136 | |
137 /*! \brief The current half of the baud. */ | |
138 int baud_half; | |
139 | |
140 #if defined(SPANDSP_USE_FIXED_POINT) | |
141 /*! \brief The scaling factor accessed by the AGC algorithm. */ | |
142 int16_t agc_scaling; | |
143 /*! \brief The previous value of agc_scaling, needed to reuse old training. */ | |
144 int16_t agc_scaling_save; | |
145 | |
146 /*! \brief The current delta factor for updating the equalizer coefficients. */ | |
147 int16_t eq_delta; | |
148 /*! \brief The adaptive equalizer coefficients. */ | |
149 complexi16_t eq_coeff[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN]; | |
150 /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */ | |
151 complexi16_t eq_coeff_save[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN]; | |
152 /*! \brief The equalizer signal buffer. */ | |
153 complexi16_t eq_buf[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN]; | |
154 | |
155 /*! Low band edge filter for symbol sync. */ | |
156 int32_t symbol_sync_low[2]; | |
157 /*! High band edge filter for symbol sync. */ | |
158 int32_t symbol_sync_high[2]; | |
159 /*! DC filter for symbol sync. */ | |
160 int32_t symbol_sync_dc_filter[2]; | |
161 /*! Baud phase for symbol sync. */ | |
162 int32_t baud_phase; | |
163 #else | |
164 /*! \brief The scaling factor accessed by the AGC algorithm. */ | |
165 float agc_scaling; | |
166 /*! \brief The previous value of agc_scaling, needed to reuse old training. */ | |
167 float agc_scaling_save; | |
168 | |
169 /*! \brief The current delta factor for updating the equalizer coefficients. */ | |
170 float eq_delta; | |
171 /*! \brief The adaptive equalizer coefficients. */ | |
172 complexf_t eq_coeff[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN]; | |
173 /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */ | |
174 complexf_t eq_coeff_save[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN]; | |
175 /*! \brief The equalizer signal buffer. */ | |
176 complexf_t eq_buf[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN]; | |
177 | |
178 /*! Low band edge filter for symbol sync. */ | |
179 float symbol_sync_low[2]; | |
180 /*! High band edge filter for symbol sync. */ | |
181 float symbol_sync_high[2]; | |
182 /*! DC filter for symbol sync. */ | |
183 float symbol_sync_dc_filter[2]; | |
184 /*! Baud phase for symbol sync. */ | |
185 float baud_phase; | |
186 #endif | |
187 | |
188 /*! \brief The total symbol timing correction since the carrier came up. | |
189 This is only for performance analysis purposes. */ | |
190 int total_baud_timing_correction; | |
191 | |
192 /*! \brief Starting phase angles for the coarse carrier aquisition step. */ | |
193 int32_t start_angles[2]; | |
194 /*! \brief History list of phase angles for the coarse carrier aquisition step. */ | |
195 int32_t angles[16]; | |
196 /*! \brief Error and flow logging control */ | |
197 logging_state_t logging; | |
198 }; | |
199 | |
200 #endif | |
201 /*- End of file ------------------------------------------------------------*/ |