Main Page | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

private/v22bis.h

00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * private/v22bis.h - ITU V.22bis modem
00005  *
00006  * Written by Steve Underwood <steveu@coppice.org>
00007  *
00008  * Copyright (C) 2004 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: v22bis.h,v 1.1 2008/11/30 03:39:58 steveu Exp $
00026  */
00027 
00028 #if !defined(_SPANDSP_PRIVATE_V22BIS_H_)
00029 #define _SPANDSP_PRIVATE_V22BIS_H_
00030 
00031 /*!
00032     V.22bis modem descriptor. This defines the working state for a single instance
00033     of a V.22bis modem.
00034 */
00035 struct v22bis_state_s
00036 {
00037     /*! \brief The bit rate of the modem. Valid values are 1200 and 2400. */
00038     int bit_rate;
00039     /*! \brief TRUE is this is the calling side modem. */
00040     int caller;
00041     /*! \brief The callback function used to put each bit received. */
00042     put_bit_func_t put_bit;
00043     /*! \brief The callback function used to get the next bit to be transmitted. */
00044     get_bit_func_t get_bit;
00045     /*! \brief A user specified opaque pointer passed to the callback routines. */
00046     void *user_data;
00047 
00048     /* RECEIVE SECTION */
00049     struct
00050     {
00051         /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
00052         float rrc_filter[2*V22BIS_RX_FILTER_STEPS];
00053         /*! \brief Current offset into the RRC pulse shaping filter buffer. */
00054         int rrc_filter_step;
00055 
00056         /*! \brief The register for the data scrambler. */
00057         unsigned int scramble_reg;
00058         /*! \brief A counter for the number of consecutive bits of repeating pattern through
00059                    the scrambler. */
00060         int scrambler_pattern_count;
00061 
00062         /*! \brief 0 if receiving user data. A training stage value during training */
00063         int training;
00064         /*! \brief A count of how far through the current training step we are. */
00065         int training_count;
00066 
00067         /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.22bis signal. */
00068         int signal_present;
00069 
00070         /*! \brief A measure of how much mismatch there is between the real constellation,
00071             and the decoded symbol positions. */
00072         float training_error;
00073 
00074         /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
00075         uint32_t carrier_phase;
00076         /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
00077         int32_t carrier_phase_rate;
00078         /*! \brief The proportional part of the carrier tracking filter. */
00079         float carrier_track_p;
00080         /*! \brief The integral part of the carrier tracking filter. */
00081         float carrier_track_i;
00082 
00083         /*! \brief A callback function which may be enabled to report every symbol's
00084                    constellation position. */
00085         qam_report_handler_t qam_report;
00086         /*! \brief A user specified opaque pointer passed to the qam_report callback
00087                    routine. */
00088         void *qam_user_data;
00089 
00090         /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */    
00091         power_meter_t rx_power;
00092         /*! \brief The power meter level at which carrier on is declared. */
00093         int32_t carrier_on_power;
00094         /*! \brief The power meter level at which carrier off is declared. */
00095         int32_t carrier_off_power;
00096         /*! \brief The scaling factor accessed by the AGC algorithm. */
00097         float agc_scaling;
00098     
00099         int constellation_state;
00100 
00101         /*! \brief The current delta factor for updating the equalizer coefficients. */
00102         float eq_delta;
00103 #if defined(SPANDSP_USE_FIXED_POINTx)
00104         /*! \brief The adaptive equalizer coefficients. */
00105         complexi_t eq_coeff[2*V22BIS_EQUALIZER_LEN + 1];
00106         /*! \brief The equalizer signal buffer. */
00107         complexi_t eq_buf[V22BIS_EQUALIZER_MASK + 1];
00108 #else
00109         complexf_t eq_coeff[2*V22BIS_EQUALIZER_LEN + 1];
00110         complexf_t eq_buf[V22BIS_EQUALIZER_MASK + 1];
00111 #endif
00112         /*! \brief Current offset into the equalizer buffer. */
00113         int eq_step;
00114         /*! \brief Current write offset into the equalizer buffer. */
00115         int eq_put_step;
00116 
00117         /*! \brief Integration variable for damping the Gardner algorithm tests. */
00118         int gardner_integrate;
00119         /*! \brief Current step size of Gardner algorithm integration. */
00120         int gardner_step;
00121         /*! \brief The total symbol timing correction since the carrier came up.
00122                    This is only for performance analysis purposes. */
00123         int total_baud_timing_correction;
00124         /*! \brief The current fractional phase of the baud timing. */
00125         int baud_phase;
00126     
00127         int sixteen_way_decisions;
00128     } rx;
00129 
00130     /* TRANSMIT SECTION */
00131     struct
00132     {
00133         /*! \brief The gain factor needed to achieve the specified output power. */
00134         float gain;
00135 
00136         /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
00137         complexf_t rrc_filter[2*V22BIS_TX_FILTER_STEPS];
00138         /*! \brief Current offset into the RRC pulse shaping filter buffer. */
00139         int rrc_filter_step;
00140 
00141         /*! \brief The register for the data scrambler. */
00142         unsigned int scramble_reg;
00143         /*! \brief A counter for the number of consecutive bits of repeating pattern through
00144                    the scrambler. */
00145         int scrambler_pattern_count;
00146 
00147         /*! \brief 0 if transmitting user data. A training stage value during training */
00148         int training;
00149         /*! \brief A counter used to track progress through sending the training sequence. */
00150         int training_count;
00151         /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
00152         uint32_t carrier_phase;
00153         /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
00154         int32_t carrier_phase_rate;
00155         /*! \brief The current phase of the guard tone (i.e. the DDS parameter). */
00156         uint32_t guard_phase;
00157         /*! \brief The update rate for the phase of the guard tone (i.e. the DDS increment). */
00158         int32_t guard_phase_rate;
00159         float guard_level;
00160         /*! \brief The current fractional phase of the baud timing. */
00161         int baud_phase;
00162         /*! \brief The code number for the current position in the constellation. */
00163         int constellation_state;
00164         /*! \brief An indicator to mark that we are tidying up to stop transmission. */
00165         int shutdown;
00166         /*! \brief The get_bit function in use at any instant. */
00167         get_bit_func_t current_get_bit;
00168     } tx;
00169 
00170     int detected_unscrambled_ones;
00171     int detected_unscrambled_zeros;
00172 
00173     int detected_unscrambled_ones_or_zeros;
00174     int detected_unscrambled_0011_ending;
00175     int detected_scrambled_ones_or_zeros_at_1200bps;
00176     int detected_scrambled_ones_at_2400bps;
00177 
00178     /*! \brief Error and flow logging control */
00179     logging_state_t logging;
00180 };
00181 
00182 #endif
00183 /*- End of file ------------------------------------------------------------*/

Generated on Fri Aug 28 20:12:27 2009 for spandsp by  doxygen 1.3.9.1