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