spandsp 0.0.6

private/bell_r2_mf.h
1/*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * bell_r2_mf.h - Bell MF and MFC/R2 tone generation and detection.
5 *
6 * Written by Steve Underwood <steveu@coppice.org>
7 *
8 * Copyright (C) 2001 Steve Underwood
9 *
10 * All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 2.1,
14 * as published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26#if !defined(_SPANDSP_PRIVATE_BELL_R2_MF_H_)
27#define _SPANDSP_PRIVATE_BELL_R2_MF_H_
28
29/*!
30 Bell MF generator state descriptor. This defines the state of a single
31 working instance of a Bell MF generator.
32*/
33 struct bell_mf_tx_state_s
34{
35 /*! The tone generator. */
36 tone_gen_state_t tones;
37 int current_sample;
38 union
39 {
40 queue_state_t queue;
41 uint8_t buf[QUEUE_STATE_T_SIZE(MAX_BELL_MF_DIGITS)];
42 } queue;
43};
44
45/*!
46 Bell MF digit detector descriptor.
47*/
48 struct bell_mf_rx_state_s
49{
50 /*! Optional callback funcion to deliver received digits. */
51 digits_rx_callback_t digits_callback;
52 /*! An opaque pointer passed to the callback function. */
53 void *digits_callback_data;
54 /*! Tone detector working states */
55 goertzel_state_t out[6];
56 /*! Short term history of results from the tone detection, using in persistence checking */
57 uint8_t hits[5];
58 /*! The current sample number within a processing block. */
59 int current_sample;
60
61 /*! The number of digits which have been lost due to buffer overflows. */
62 int lost_digits;
63 /*! The number of digits currently in the digit buffer. */
64 int current_digits;
65 /*! The received digits buffer. This is a NULL terminated string. */
66 char digits[MAX_BELL_MF_DIGITS + 1];
67};
68
69/*!
70 MFC/R2 tone detector descriptor.
71*/
72 struct r2_mf_tx_state_s
73{
74 /*! The tone generator. */
75 tone_gen_state_t tone;
76 /*! TRUE if generating forward tones, otherwise generating reverse tones. */
77 int fwd;
78 /*! The current digit being generated. */
79 int digit;
80};
81
82/*!
83 MFC/R2 tone detector descriptor.
84*/
85 struct r2_mf_rx_state_s
86{
87 /*! Optional callback funcion to deliver received digits. */
88 tone_report_func_t callback;
89 /*! An opaque pointer passed to the callback function. */
90 void *callback_data;
91 /*! TRUE is we are detecting forward tones. FALSE if we are detecting backward tones */
92 int fwd;
93 /*! Tone detector working states */
94 goertzel_state_t out[6];
95 /*! The current sample number within a processing block. */
96 int current_sample;
97 /*! The currently detected digit. */
98 int current_digit;
99};
100
101#endif
102/*- End of file ------------------------------------------------------------*/
MAX_BELL_MF_DIGITS
#define MAX_BELL_MF_DIGITS
Definition bell_r2_mf.h:103
queue_state_t
struct queue_state_s queue_state_t
Definition queue.h:54
bell_mf_rx_state_s
Definition private/bell_r2_mf.h:49
bell_mf_rx_state_s::current_sample
int current_sample
Definition private/bell_r2_mf.h:59
bell_mf_rx_state_s::digits_callback
digits_rx_callback_t digits_callback
Definition private/bell_r2_mf.h:51
bell_mf_rx_state_s::out
goertzel_state_t out[6]
Definition private/bell_r2_mf.h:55
bell_mf_rx_state_s::digits_callback_data
void * digits_callback_data
Definition private/bell_r2_mf.h:53
bell_mf_rx_state_s::hits
uint8_t hits[5]
Definition private/bell_r2_mf.h:57
bell_mf_rx_state_s::current_digits
int current_digits
Definition private/bell_r2_mf.h:64
bell_mf_rx_state_s::digits
char digits[MAX_BELL_MF_DIGITS+1]
Definition private/bell_r2_mf.h:66
bell_mf_rx_state_s::lost_digits
int lost_digits
Definition private/bell_r2_mf.h:62
bell_mf_tx_state_s
Definition private/bell_r2_mf.h:34
bell_mf_tx_state_s::tones
tone_gen_state_t tones
Definition private/bell_r2_mf.h:36
r2_mf_rx_state_s
Definition private/bell_r2_mf.h:86
r2_mf_rx_state_s::callback_data
void * callback_data
Definition private/bell_r2_mf.h:90
r2_mf_rx_state_s::current_digit
int current_digit
Definition private/bell_r2_mf.h:98
r2_mf_rx_state_s::callback
tone_report_func_t callback
Definition private/bell_r2_mf.h:88
r2_mf_rx_state_s::current_sample
int current_sample
Definition private/bell_r2_mf.h:96
r2_mf_rx_state_s::out
goertzel_state_t out[6]
Definition private/bell_r2_mf.h:94
r2_mf_rx_state_s::fwd
int fwd
Definition private/bell_r2_mf.h:92
r2_mf_tx_state_s
Definition private/bell_r2_mf.h:73
r2_mf_tx_state_s::tone
tone_gen_state_t tone
Definition private/bell_r2_mf.h:75
r2_mf_tx_state_s::digit
int digit
Definition private/bell_r2_mf.h:79
r2_mf_tx_state_s::fwd
int fwd
Definition private/bell_r2_mf.h:77
tone_gen_state_t
struct tone_gen_state_s tone_gen_state_t
Definition tone_generate.h:57