spandsp 0.0.6
|
00001 /* 00002 * SpanDSP - a series of DSP components for telephony 00003 * 00004 * bell_r2_mf.h - Bell MF and MFC/R2 tone generation and detection. 00005 * 00006 * Written by Steve Underwood <steveu@coppice.org> 00007 * 00008 * Copyright (C) 2001 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_BELL_R2_MF_H_) 00027 #define _SPANDSP_PRIVATE_BELL_R2_MF_H_ 00028 00029 /*! 00030 Bell MF generator state descriptor. This defines the state of a single 00031 working instance of a Bell MF generator. 00032 */ 00033 struct bell_mf_tx_state_s 00034 { 00035 /*! The tone generator. */ 00036 tone_gen_state_t tones; 00037 int current_sample; 00038 union 00039 { 00040 queue_state_t queue; 00041 uint8_t buf[QUEUE_STATE_T_SIZE(MAX_BELL_MF_DIGITS)]; 00042 } queue; 00043 }; 00044 00045 /*! 00046 Bell MF digit detector descriptor. 00047 */ 00048 struct bell_mf_rx_state_s 00049 { 00050 /*! Optional callback funcion to deliver received digits. */ 00051 digits_rx_callback_t digits_callback; 00052 /*! An opaque pointer passed to the callback function. */ 00053 void *digits_callback_data; 00054 /*! Tone detector working states */ 00055 goertzel_state_t out[6]; 00056 /*! Short term history of results from the tone detection, using in persistence checking */ 00057 uint8_t hits[5]; 00058 /*! The current sample number within a processing block. */ 00059 int current_sample; 00060 00061 /*! The number of digits which have been lost due to buffer overflows. */ 00062 int lost_digits; 00063 /*! The number of digits currently in the digit buffer. */ 00064 int current_digits; 00065 /*! The received digits buffer. This is a NULL terminated string. */ 00066 char digits[MAX_BELL_MF_DIGITS + 1]; 00067 }; 00068 00069 /*! 00070 MFC/R2 tone detector descriptor. 00071 */ 00072 struct r2_mf_tx_state_s 00073 { 00074 /*! The tone generator. */ 00075 tone_gen_state_t tone; 00076 /*! TRUE if generating forward tones, otherwise generating reverse tones. */ 00077 int fwd; 00078 /*! The current digit being generated. */ 00079 int digit; 00080 }; 00081 00082 /*! 00083 MFC/R2 tone detector descriptor. 00084 */ 00085 struct r2_mf_rx_state_s 00086 { 00087 /*! Optional callback funcion to deliver received digits. */ 00088 tone_report_func_t callback; 00089 /*! An opaque pointer passed to the callback function. */ 00090 void *callback_data; 00091 /*! TRUE is we are detecting forward tones. FALSE if we are detecting backward tones */ 00092 int fwd; 00093 /*! Tone detector working states */ 00094 goertzel_state_t out[6]; 00095 /*! The current sample number within a processing block. */ 00096 int current_sample; 00097 /*! The currently detected digit. */ 00098 int current_digit; 00099 }; 00100 00101 #endif 00102 /*- End of file ------------------------------------------------------------*/