spandsp  0.0.6
private/fsk.h
00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * private/fsk.h - FSK modem transmit and receive parts
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 
00026 #if !defined(_SPANDSP_PRIVATE_FSK_H_)
00027 #define _SPANDSP_PRIVATE_FSK_H_
00028 
00029 /*!
00030     FSK modem transmit descriptor. This defines the state of a single working
00031     instance of an FSK modem transmitter.
00032 */
00033 struct fsk_tx_state_s
00034 {
00035     int baud_rate;
00036     /*! \brief The callback function used to get the next bit to be transmitted. */
00037     get_bit_func_t get_bit;
00038     /*! \brief A user specified opaque pointer passed to the get_bit function. */
00039     void *get_bit_user_data;
00040 
00041     /*! \brief The callback function used to report modem status changes. */
00042     modem_tx_status_func_t status_handler;
00043     /*! \brief A user specified opaque pointer passed to the status function. */
00044     void *status_user_data;
00045 
00046     int32_t phase_rates[2];
00047     int16_t scaling;
00048     int32_t current_phase_rate;
00049     uint32_t phase_acc;
00050     int baud_frac;
00051     int shutdown;
00052 };
00053 
00054 /*!
00055     FSK modem receive descriptor. This defines the state of a single working
00056     instance of an FSK modem receiver.
00057 */
00058 struct fsk_rx_state_s
00059 {
00060     int baud_rate;
00061     /*! \brief Synchronous/asynchronous framing control */
00062     int framing_mode;
00063     /*! \brief The callback function used to put each bit received. */
00064     put_bit_func_t put_bit;
00065     /*! \brief A user specified opaque pointer passed to the put_bit routine. */
00066     void *put_bit_user_data;
00067 
00068     /*! \brief The callback function used to report modem status changes. */
00069     modem_tx_status_func_t status_handler;
00070     /*! \brief A user specified opaque pointer passed to the status function. */
00071     void *status_user_data;
00072 
00073     int32_t carrier_on_power;
00074     int32_t carrier_off_power;
00075     power_meter_t power;
00076     /*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */
00077     int16_t last_sample;
00078     /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.29 signal. */
00079     int signal_present;
00080 
00081     int32_t phase_rate[2];
00082     uint32_t phase_acc[2];
00083 
00084     int correlation_span;
00085 
00086     complexi32_t window[2][FSK_MAX_WINDOW_LEN];
00087     complexi32_t dot[2];
00088     int buf_ptr;
00089 
00090     int frame_state;
00091     int frame_bits;
00092     int baud_phase;
00093     int last_bit;
00094     int scaling_shift;
00095 };
00096 
00097 #endif
00098 /*- End of file ------------------------------------------------------------*/