private/v29rx.h

00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * private/v29rx.h - ITU V.29 modem receive part
00005  *
00006  * Written by Steve Underwood <steveu@coppice.org>
00007  *
00008  * Copyright (C) 2003 Steve Underwood
00009  *
00010  * All rights reserved.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU Lesser General Public License version 2.1,
00014  * as published by the Free Software Foundation.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Lesser General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00024  *
00025  * $Id: v29rx.h,v 1.1 2008/10/13 13:14:01 steveu Exp $
00026  */
00027 
00028 #if !defined(_SPANDSP_PRIVATE_V29RX_H_)
00029 #define _SPANDSP_PRIVATE_V29RX_H_
00030 
00031 /*!
00032     V.29 modem receive side descriptor. This defines the working state for a
00033     single instance of a V.29 modem receiver.
00034 */
00035 struct v29_rx_state_s
00036 {
00037     /*! \brief The bit rate of the modem. Valid values are 4800, 7200 and 9600. */
00038     int bit_rate;
00039     /*! \brief The callback function used to put each bit received. */
00040     put_bit_func_t put_bit;
00041     /*! \brief A user specified opaque pointer passed to the put_bit routine. */
00042     void *put_bit_user_data;
00043 
00044     /*! \brief The callback function used to report modem status changes. */
00045     modem_rx_status_func_t status_handler;
00046     /*! \brief A user specified opaque pointer passed to the status function. */
00047     void *status_user_data;
00048 
00049     /*! \brief A callback function which may be enabled to report every symbol's
00050                constellation position. */
00051     qam_report_handler_t qam_report;
00052     /*! \brief A user specified opaque pointer passed to the qam_report callback
00053                routine. */
00054     void *qam_user_data;
00055 
00056     /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
00057 #if defined(SPANDSP_USE_FIXED_POINT)
00058     int16_t rrc_filter[V29_RX_FILTER_STEPS];
00059 #else
00060     float rrc_filter[V29_RX_FILTER_STEPS];
00061 #endif
00062     /*! \brief Current offset into the RRC pulse shaping filter buffer. */
00063     int rrc_filter_step;
00064 
00065     /*! \brief The register for the data scrambler. */
00066     unsigned int scramble_reg;
00067     /*! \brief The register for the training scrambler. */
00068     uint8_t training_scramble_reg;
00069     /*! \brief The current step in the table of CD constellation positions. */
00070     int training_cd;
00071     /*! \brief TRUE if the previous trained values are to be reused. */
00072     int old_train;
00073     /*! \brief The section of the training data we are currently in. */
00074     int training_stage;
00075     /*! \brief A count of how far through the current training step we are. */
00076     int training_count;
00077     /*! \brief A measure of how much mismatch there is between the real constellation,
00078         and the decoded symbol positions. */
00079     float training_error;
00080     /*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */
00081     int16_t last_sample;
00082     /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.29 signal. */
00083     int signal_present;
00084     /*! \brief Whether or not a carrier drop was detected and the signal delivery is pending. */
00085     int carrier_drop_pending;
00086     /*! \brief A count of the current consecutive samples below the carrier off threshold. */
00087     int low_samples;
00088     /*! \brief A highest magnitude sample seen. */
00089     int16_t high_sample;
00090 
00091     /*! \brief The position of the current symbol in the constellation, used for
00092                differential decoding. */
00093     int constellation_state;
00094 
00095     /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
00096     uint32_t carrier_phase;
00097     /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
00098     int32_t carrier_phase_rate;
00099     /*! \brief The carrier update rate saved for reuse when using short training. */
00100     int32_t carrier_phase_rate_save;
00101 #if defined(SPANDSP_USE_FIXED_POINT)
00102     /*! \brief The proportional part of the carrier tracking filter. */
00103     int32_t carrier_track_p;
00104     /*! \brief The integral part of the carrier tracking filter. */
00105     int32_t carrier_track_i;
00106 #else
00107     /*! \brief The proportional part of the carrier tracking filter. */
00108     float carrier_track_p;
00109     /*! \brief The integral part of the carrier tracking filter. */
00110     float carrier_track_i;
00111 #endif
00112 
00113     /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */    
00114     power_meter_t power;
00115     /*! \brief The power meter level at which carrier on is declared. */
00116     int32_t carrier_on_power;
00117     /*! \brief The power meter level at which carrier off is declared. */
00118     int32_t carrier_off_power;
00119 
00120     /*! \brief Current read offset into the equalizer buffer. */
00121     int eq_step;
00122     /*! \brief Current write offset into the equalizer buffer. */
00123     int eq_put_step;
00124     /*! \brief Symbol counter to the next equalizer update. */
00125     int eq_skip;
00126 
00127     /*! \brief The current half of the baud. */
00128     int baud_half;
00129 
00130 #if defined(SPANDSP_USE_FIXED_POINT)
00131     /*! \brief The scaling factor accessed by the AGC algorithm. */
00132     int16_t agc_scaling;
00133     /*! \brief The previous value of agc_scaling, needed to reuse old training. */
00134     int16_t agc_scaling_save;
00135 
00136     /*! \brief The current delta factor for updating the equalizer coefficients. */
00137     int16_t eq_delta;
00138     /*! \brief The adaptive equalizer coefficients. */
00139     complexi16_t eq_coeff[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN];
00140     /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */
00141     complexi16_t eq_coeff_save[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN];
00142     /*! \brief The equalizer signal buffer. */
00143     complexi16_t eq_buf[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN];
00144 
00145     /*! Low band edge filter for symbol sync. */
00146     int32_t symbol_sync_low[2];
00147     /*! High band edge filter for symbol sync. */
00148     int32_t symbol_sync_high[2];
00149     /*! DC filter for symbol sync. */
00150     int32_t symbol_sync_dc_filter[2];
00151     /*! Baud phase for symbol sync. */
00152     int32_t baud_phase;
00153 #else
00154     /*! \brief The scaling factor accessed by the AGC algorithm. */
00155     float agc_scaling;
00156     /*! \brief The previous value of agc_scaling, needed to reuse old training. */
00157     float agc_scaling_save;
00158 
00159     /*! \brief The current delta factor for updating the equalizer coefficients. */
00160     float eq_delta;
00161     /*! \brief The adaptive equalizer coefficients. */
00162     complexf_t eq_coeff[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN];
00163     /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */
00164     complexf_t eq_coeff_save[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN];
00165     /*! \brief The equalizer signal buffer. */
00166     complexf_t eq_buf[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN];
00167 
00168     /*! Low band edge filter for symbol sync. */
00169     float symbol_sync_low[2];
00170     /*! High band edge filter for symbol sync. */
00171     float symbol_sync_high[2];
00172     /*! DC filter for symbol sync. */
00173     float symbol_sync_dc_filter[2];
00174     /*! Baud phase for symbol sync. */
00175     float baud_phase;
00176 #endif
00177 
00178     /*! \brief The total symbol timing correction since the carrier came up.
00179                This is only for performance analysis purposes. */
00180     int total_baud_timing_correction;
00181 
00182     /*! \brief Starting phase angles for the coarse carrier aquisition step. */
00183     int32_t start_angles[2];
00184     /*! \brief History list of phase angles for the coarse carrier aquisition step. */
00185     int32_t angles[16];
00186     /*! \brief Error and flow logging control */
00187     logging_state_t logging;
00188 };
00189 
00190 #endif
00191 /*- End of file ------------------------------------------------------------*/

Generated by  doxygen 1.6.2