spandsp 0.0.6
private/v29tx.h
00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * private/v29tx.h - ITU V.29 modem transmit 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: v29tx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $
00026  */
00027 
00028 #if !defined(_SPANDSP_PRIVATE_V29TX_H_)
00029 #define _SPANDSP_PRIVATE_V29TX_H_
00030 
00031 /*! The number of taps in the pulse shaping/bandpass filter */
00032 #define V29_TX_FILTER_STEPS     9
00033 
00034 /*!
00035     V.29 modem transmit side descriptor. This defines the working state for a
00036     single instance of a V.29 modem transmitter.
00037 */
00038 struct v29_tx_state_s
00039 {
00040     /*! \brief The bit rate of the modem. Valid values are 4800, 7200 and 9600. */
00041     int bit_rate;
00042     /*! \brief The callback function used to get the next bit to be transmitted. */
00043     get_bit_func_t get_bit;
00044     /*! \brief A user specified opaque pointer passed to the get_bit function. */
00045     void *get_bit_user_data;
00046 
00047     /*! \brief The callback function used to report modem status changes. */
00048     modem_tx_status_func_t status_handler;
00049     /*! \brief A user specified opaque pointer passed to the status function. */
00050     void *status_user_data;
00051 
00052     /*! \brief Gain required to achieve the specified output power, not allowing
00053                for the size of the current constellation. */
00054     float base_gain;
00055     /*! \brief Gain required to achieve the specified output power, allowing
00056                for the size of the current constellation. */
00057 #if defined(SPANDSP_USE_FIXED_POINT)
00058     int32_t gain;
00059 #else
00060     float gain;
00061 #endif
00062 
00063     /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
00064 #if defined(SPANDSP_USE_FIXED_POINT)
00065     complexi16_t rrc_filter[2*V29_TX_FILTER_STEPS];
00066 #else
00067     complexf_t rrc_filter[2*V29_TX_FILTER_STEPS];
00068 #endif
00069     /*! \brief Current offset into the RRC pulse shaping filter buffer. */
00070     int rrc_filter_step;
00071 
00072     /*! \brief The register for the data scrambler. */
00073     unsigned int scramble_reg;
00074     /*! \brief The register for the training scrambler. */
00075     uint8_t training_scramble_reg;
00076     /*! \brief TRUE if transmitting the training sequence, or shutting down transmission.
00077                FALSE if transmitting user data. */
00078     int in_training;
00079     /*! \brief A counter used to track progress through sending the training sequence. */
00080     int training_step;
00081     /*! \brief An offset value into the table of training parameters, used to match the
00082                training pattern to the bit rate. */
00083     int training_offset;
00084 
00085     /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
00086     uint32_t carrier_phase;
00087     /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
00088     int32_t carrier_phase_rate;
00089     /*! \brief The current fractional phase of the baud timing. */
00090     int baud_phase;
00091     /*! \brief The code number for the current position in the constellation. */
00092     int constellation_state;
00093     /*! \brief The get_bit function in use at any instant. */
00094     get_bit_func_t current_get_bit;
00095     /*! \brief Error and flow logging control */
00096     logging_state_t logging;
00097 };
00098 
00099 #endif
00100 /*- End of file ------------------------------------------------------------*/