/usr/include/spandsp/bell_r2_mf.h is in libspandsp-dev 0.0.6-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | /*
* SpanDSP - a series of DSP components for telephony
*
* bell_r2_mf.h - Bell MF and MFC/R2 tone generation and detection.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2001 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*! \file */
#if !defined(_SPANDSP_BELL_R2_MF_H_)
#define _SPANDSP_BELL_R2_MF_H_
/*! \page mfc_r2_tone_generation_page MFC/R2 tone generation
\section mfc_r2_tone_generation_page_sec_1 What does it do?
The MFC/R2 tone generation module provides for the generation of the
repertoire of 15 dual tones needs for the digital MFC/R2 signalling protocol.
\section mfc_r2_tone_generation_page_sec_2 How does it work?
*/
/*! \page bell_mf_tone_generation_page Bell MF tone generation
\section bell_mf_tone_generation_page_sec_1 What does it do?
The Bell MF tone generation module provides for the generation of the
repertoire of 15 dual tones needs for various Bell MF signalling protocols.
\section bell_mf_tone_generation_page_sec_2 How does it work?
Basic Bell MF tone generation specs:
- Tone on time = KP: 100+-7ms. All other signals: 68+-7ms
- Tone off time (between digits) = 68+-7ms
- Frequency tolerance +- 1.5%
- Signal level -7+-1dBm per frequency
*/
/*! \page mfc_r2_tone_rx_page MFC/R2 tone receiver
\section mfc_r2_tone_rx_page_sec_1 What does it do?
The MFC/R2 tone receiver module provides for the detection of the
repertoire of 15 dual tones needs for the digital MFC/R2 signalling protocol.
It is compliant with ITU-T Q.441D.
\section mfc_r2_tone_rx_page_sec_2 How does it work?
Basic MFC/R2 tone detection specs:
- Receiver response range: -5dBm to -35dBm
- Difference in level for a pair of frequencies
- Adjacent tones: <5dB
- Non-adjacent tones: <7dB
- Receiver not to detect a signal of 2 frequencies of level -5dB and
duration <7ms.
- Receiver not to recognise a signal of 2 frequencies having a difference
in level >=20dB.
- Max received signal frequency error: +-10Hz
- The sum of the operate and release times of a 2 frequency signal not to
exceed 80ms (there are no individual specs for the operate and release
times).
- Receiver not to release for signal interruptions <=7ms.
- System malfunction due to signal interruptions >7ms (typically 20ms) is
prevented by further logic elements.
*/
/*! \page bell_mf_tone_rx_page Bell MF tone receiver
\section bell_mf_tone_rx_page_sec_1 What does it do?
The Bell MF tone receiver module provides for the detection of the
repertoire of 15 dual tones needs for various Bell MF signalling protocols.
It is compliant with ITU-T Q.320, ITU-T Q.322, ITU-T Q.323B.
\section bell_mf_tone_rx_page_sec_2 How does it work?
Basic Bell MF tone detection specs:
- Frequency tolerance +- 1.5% +-10Hz
- Signal level -14dBm to 0dBm
- Perform a "two and only two tones present" test.
- Twist <= 6dB accepted
- Receiver sensitive to signals above -22dBm per frequency
- Test for a minimum of 55ms if KP, or 30ms of other signals.
- Signals to be recognised if the two tones arrive within 8ms of each other.
- Invalid signals result in the return of the re-order tone.
Note: Above -3dBm the signal starts to clip. We can detect with a little clipping,
but not up to 0dBm, which the above spec seems to require. There isn't a lot
we can do about that. Is the spec. incorrectly worded about the dBm0 reference
point, or have I misunderstood it?
*/
/*! The maximum number of Bell MF digits we can buffer. */
#define MAX_BELL_MF_DIGITS 128
/*!
Bell MF generator state descriptor. This defines the state of a single
working instance of a Bell MF generator.
*/
typedef struct bell_mf_tx_state_s bell_mf_tx_state_t;
/*!
Bell MF digit detector descriptor.
*/
typedef struct bell_mf_rx_state_s bell_mf_rx_state_t;
/*!
MFC/R2 tone detector descriptor.
*/
typedef struct r2_mf_tx_state_s r2_mf_tx_state_t;
/*!
MFC/R2 tone detector descriptor.
*/
typedef struct r2_mf_rx_state_s r2_mf_rx_state_t;
#if defined(__cplusplus)
extern "C"
{
#endif
/*! \brief Generate a buffer of Bell MF tones.
\param s The Bell MF generator context.
\param amp The buffer for the generated signal.
\param max_samples The required number of generated samples.
\return The number of samples actually generated. This may be less than
max_samples if the input buffer empties. */
SPAN_DECLARE(int) bell_mf_tx(bell_mf_tx_state_t *s, int16_t amp[], int max_samples);
/*! \brief Put a string of digits in a Bell MF generator's input buffer.
\param s The Bell MF generator context.
\param digits The string of digits to be added.
\param len The length of the string of digits. If negative, the string is
assumed to be a NULL terminated string.
\return The number of digits actually added. This may be less than the
length of the digit string, if the buffer fills up. */
SPAN_DECLARE(int) bell_mf_tx_put(bell_mf_tx_state_t *s, const char *digits, int len);
/*! \brief Initialise a Bell MF generator context.
\param s The Bell MF generator context.
\return A pointer to the Bell MF generator context.*/
SPAN_DECLARE(bell_mf_tx_state_t *) bell_mf_tx_init(bell_mf_tx_state_t *s);
/*! \brief Release a Bell MF generator context.
\param s The Bell MF generator context.
\return 0 for OK, else -1. */
SPAN_DECLARE(int) bell_mf_tx_release(bell_mf_tx_state_t *s);
/*! \brief Free a Bell MF generator context.
\param s The Bell MF generator context.
\return 0 for OK, else -1. */
SPAN_DECLARE(int) bell_mf_tx_free(bell_mf_tx_state_t *s);
/*! \brief Generate a block of R2 MF tones.
\param s The R2 MF generator context.
\param amp The buffer for the generated signal.
\param samples The required number of generated samples.
\return The number of samples actually generated. */
SPAN_DECLARE(int) r2_mf_tx(r2_mf_tx_state_t *s, int16_t amp[], int samples);
/*! \brief Generate a block of R2 MF tones.
\param s The R2 MF generator context.
\param digit The digit to be generated.
\return 0 for OK, or -1 for a bad request. */
SPAN_DECLARE(int) r2_mf_tx_put(r2_mf_tx_state_t *s, char digit);
/*! \brief Initialise an R2 MF tone generator context.
\param s The R2 MF generator context.
\param fwd TRUE if the context is for forward signals. FALSE if the
context is for backward signals.
\return A pointer to the MFC/R2 generator context.*/
SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, int fwd);
/*! \brief Release an R2 MF tone generator context.
\param s The R2 MF tone generator context.
\return 0 for OK, else -1. */
SPAN_DECLARE(int) r2_mf_tx_release(r2_mf_tx_state_t *s);
/*! \brief Free an R2 MF tone generator context.
\param s The R2 MF tone generator context.
\return 0 for OK, else -1. */
SPAN_DECLARE(int) r2_mf_tx_free(r2_mf_tx_state_t *s);
/*! Process a block of received Bell MF audio samples.
\brief Process a block of received Bell MF audio samples.
\param s The Bell MF receiver context.
\param amp The audio sample buffer.
\param samples The number of samples in the buffer.
\return The number of samples unprocessed. */
SPAN_DECLARE(int) bell_mf_rx(bell_mf_rx_state_t *s, const int16_t amp[], int samples);
/*! \brief Get a string of digits from a Bell MF receiver's output buffer.
\param s The Bell MF receiver context.
\param buf The buffer for the received digits.
\param max The maximum number of digits to be returned,
\return The number of digits actually returned. */
SPAN_DECLARE(size_t) bell_mf_rx_get(bell_mf_rx_state_t *s, char *buf, int max);
/*! \brief Initialise a Bell MF receiver context.
\param s The Bell MF receiver context.
\param callback An optional callback routine, used to report received digits. If
no callback routine is set, digits may be collected, using the bell_mf_rx_get()
function.
\param user_data An opaque pointer which is associated with the context,
and supplied in callbacks.
\return A pointer to the Bell MF receiver context.*/
SPAN_DECLARE(bell_mf_rx_state_t *) bell_mf_rx_init(bell_mf_rx_state_t *s,
digits_rx_callback_t callback,
void *user_data);
/*! \brief Release a Bell MF receiver context.
\param s The Bell MF receiver context.
\return 0 for OK, else -1. */
SPAN_DECLARE(int) bell_mf_rx_release(bell_mf_rx_state_t *s);
/*! \brief Free a Bell MF receiver context.
\param s The Bell MF receiver context.
\return 0 for OK, else -1. */
SPAN_DECLARE(int) bell_mf_rx_free(bell_mf_rx_state_t *s);
/*! Process a block of received R2 MF audio samples.
\brief Process a block of received R2 MF audio samples.
\param s The R2 MF receiver context.
\param amp The audio sample buffer.
\param samples The number of samples in the buffer.
\return The number of samples unprocessed. */
SPAN_DECLARE(int) r2_mf_rx(r2_mf_rx_state_t *s, const int16_t amp[], int samples);
/*! \brief Get the current digit from an R2 MF receiver.
\param s The R2 MF receiver context.
\return The number digits being received. */
SPAN_DECLARE(int) r2_mf_rx_get(r2_mf_rx_state_t *s);
/*! \brief Initialise an R2 MF receiver context.
\param s The R2 MF receiver context.
\param fwd TRUE if the context is for forward signals. FALSE if the
context is for backward signals.
\param callback An optional callback routine, used to report received digits. If
no callback routine is set, digits may be collected, using the r2_mf_rx_get()
function.
\param user_data An opaque pointer which is associated with the context,
and supplied in callbacks.
\return A pointer to the R2 MF receiver context. */
SPAN_DECLARE(r2_mf_rx_state_t *) r2_mf_rx_init(r2_mf_rx_state_t *s,
int fwd,
tone_report_func_t callback,
void *user_data);
/*! \brief Release an R2 MF receiver context.
\param s The R2 MF receiver context.
\return 0 for OK, else -1. */
SPAN_DECLARE(int) r2_mf_rx_release(r2_mf_rx_state_t *s);
/*! \brief Free an R2 MF receiver context.
\param s The R2 MF receiver context.
\return 0 for OK, else -1. */
SPAN_DECLARE(int) r2_mf_rx_free(r2_mf_rx_state_t *s);
#if defined(__cplusplus)
}
#endif
#endif
/*- End of file ------------------------------------------------------------*/
|