spandsp
0.0.6
Main Page
Related Pages
Classes
Files
File List
File Members
private/v27ter_rx.h
1
/*
2
* SpanDSP - a series of DSP components for telephony
3
*
4
* private/v27ter_rx.h - ITU V.27ter 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
26
#if !defined(_SPANDSP_PRIVATE_V27TER_RX_H_)
27
#define _SPANDSP_PRIVATE_V27TER_RX_H_
28
29
/* Target length for the equalizer is about 43 taps for 4800bps and 32 taps for 2400bps
30
to deal with the worst stuff in V.56bis. */
31
/*! The length of the equalizer buffer. Must be a power of 2 */
32
#define V27TER_EQUALIZER_LEN 32
33
/*! Samples before the target central position in the equalizer buffer */
34
#define V27TER_EQUALIZER_PRE_LEN 16
35
36
/*! The number of taps in the 4800bps pulse shaping/bandpass filter */
37
#define V27TER_RX_4800_FILTER_STEPS 27
38
/*! The number of taps in the 2400bps pulse shaping/bandpass filter */
39
#define V27TER_RX_2400_FILTER_STEPS 27
40
41
#if V27TER_RX_4800_FILTER_STEPS > V27TER_RX_2400_FILTER_STEPS
42
#define V27TER_RX_FILTER_STEPS V27TER_RX_4800_FILTER_STEPS
43
#else
44
#define V27TER_RX_FILTER_STEPS V27TER_RX_2400_FILTER_STEPS
45
#endif
46
47
/*!
48
V.27ter modem receive side descriptor. This defines the working state for a
49
single instance of a V.27ter modem receiver.
50
*/
51
struct
v27ter_rx_state_s
52
{
53
/*! \brief The bit rate of the modem. Valid values are 2400 and 4800. */
54
int
bit_rate
;
55
/*! \brief The callback function used to put each bit received. */
56
put_bit_func_t
put_bit
;
57
/*! \brief A user specified opaque pointer passed to the put_bit routine. */
58
void
*
put_bit_user_data
;
59
60
/*! \brief The callback function used to report modem status changes. */
61
modem_rx_status_func_t
status_handler
;
62
/*! \brief A user specified opaque pointer passed to the status function. */
63
void
*
status_user_data
;
64
65
/*! \brief A callback function which may be enabled to report every symbol's
66
constellation position. */
67
qam_report_handler_t
qam_report
;
68
/*! \brief A user specified opaque pointer passed to the qam_report callback
69
routine. */
70
void
*
qam_user_data
;
71
72
/*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
73
#if defined(SPANDSP_USE_FIXED_POINT)
74
int16_t
rrc_filter
[V27TER_RX_FILTER_STEPS];
75
#else
76
float
rrc_filter
[V27TER_RX_FILTER_STEPS];
77
#endif
78
/*! \brief Current offset into the RRC pulse shaping filter buffer. */
79
int
rrc_filter_step
;
80
81
/*! \brief The register for the training and data scrambler. */
82
unsigned
int
scramble_reg
;
83
/*! \brief A counter for the number of consecutive bits of repeating pattern through
84
the scrambler. */
85
int
scrambler_pattern_count
;
86
/*! \brief The current step in the table of BC constellation positions. */
87
int
training_bc
;
88
/*! \brief TRUE if the previous trained values are to be reused. */
89
int
old_train
;
90
/*! \brief The section of the training data we are currently in. */
91
int
training_stage
;
92
/*! \brief A count of how far through the current training step we are. */
93
int
training_count
;
94
/*! \brief A measure of how much mismatch there is between the real constellation,
95
and the decoded symbol positions. */
96
float
training_error
;
97
/*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */
98
int16_t
last_sample
;
99
/*! \brief >0 if a signal above the minimum is present. It may or may not be a V.27ter signal. */
100
int
signal_present
;
101
/*! \brief Whether or not a carrier drop was detected and the signal delivery is pending. */
102
int
carrier_drop_pending
;
103
/*! \brief A count of the current consecutive samples below the carrier off threshold. */
104
int
low_samples
;
105
/*! \brief A highest magnitude sample seen. */
106
int16_t
high_sample
;
107
108
/*! \brief The position of the current symbol in the constellation, used for
109
differential decoding. */
110
int
constellation_state
;
111
112
/*! \brief The current phase of the carrier (i.e. the DDS parameter). */
113
uint32_t
carrier_phase
;
114
/*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
115
int32_t
carrier_phase_rate
;
116
/*! \brief The carrier update rate saved for reuse when using short training. */
117
int32_t
carrier_phase_rate_save
;
118
#if defined(SPANDSP_USE_FIXED_POINTx)
119
/*! \brief The proportional part of the carrier tracking filter. */
120
float
carrier_track_p
;
121
/*! \brief The integral part of the carrier tracking filter. */
122
float
carrier_track_i
;
123
#else
124
/*! \brief The proportional part of the carrier tracking filter. */
125
float
carrier_track_p
;
126
/*! \brief The integral part of the carrier tracking filter. */
127
float
carrier_track_i
;
128
#endif
129
130
/*! \brief A power meter, to measure the HPF'ed signal power in the channel. */
131
power_meter_t
power
;
132
/*! \brief The power meter level at which carrier on is declared. */
133
int32_t
carrier_on_power
;
134
/*! \brief The power meter level at which carrier off is declared. */
135
int32_t
carrier_off_power
;
136
137
/*! \brief Current read offset into the equalizer buffer. */
138
int
eq_step
;
139
/*! \brief Current write offset into the equalizer buffer. */
140
int
eq_put_step
;
141
/*! \brief Symbol counter to the next equalizer update. */
142
int
eq_skip
;
143
144
/*! \brief The current half of the baud. */
145
int
baud_half
;
146
147
#if defined(SPANDSP_USE_FIXED_POINT)
148
/*! \brief The scaling factor accessed by the AGC algorithm. */
149
int16_t
agc_scaling
;
150
/*! \brief The previous value of agc_scaling, needed to reuse old training. */
151
int16_t
agc_scaling_save
;
152
153
/*! \brief The current delta factor for updating the equalizer coefficients. */
154
float
eq_delta
;
155
/*! \brief The adaptive equalizer coefficients. */
156
/*complexi16_t*/
complexf_t
eq_coeff
[V27TER_EQUALIZER_LEN];
157
/*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */
158
/*complexi16_t*/
complexf_t
eq_coeff_save
[V27TER_EQUALIZER_LEN];
159
/*! \brief The equalizer signal buffer. */
160
/*complexi16_t*/
complexf_t
eq_buf
[V27TER_EQUALIZER_LEN];
161
#else
162
/*! \brief The scaling factor accessed by the AGC algorithm. */
163
float
agc_scaling
;
164
/*! \brief The previous value of agc_scaling, needed to reuse old training. */
165
float
agc_scaling_save
;
166
167
/*! \brief The current delta factor for updating the equalizer coefficients. */
168
float
eq_delta
;
169
/*! \brief The adaptive equalizer coefficients. */
170
complexf_t
eq_coeff
[V27TER_EQUALIZER_LEN];
171
/*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */
172
complexf_t
eq_coeff_save
[V27TER_EQUALIZER_LEN];
173
/*! \brief The equalizer signal buffer. */
174
complexf_t
eq_buf
[V27TER_EQUALIZER_LEN];
175
#endif
176
177
/*! \brief Integration variable for damping the Gardner algorithm tests. */
178
int
gardner_integrate
;
179
/*! \brief Current step size of Gardner algorithm integration. */
180
int
gardner_step
;
181
/*! \brief The total symbol timing correction since the carrier came up.
182
This is only for performance analysis purposes. */
183
int
total_baud_timing_correction
;
184
185
/*! \brief Starting phase angles for the coarse carrier aquisition step. */
186
int32_t
start_angles
[2];
187
/*! \brief History list of phase angles for the coarse carrier aquisition step. */
188
int32_t
angles
[16];
189
/*! \brief Error and flow logging control */
190
logging_state_t
logging
;
191
};
192
193
#endif
194
/*- End of file ------------------------------------------------------------*/
src
spandsp
private
v27ter_rx.h
Generated by
1.8.1.2