spandsp
0.0.6
Main Page
Related Pages
Classes
Files
File List
File Members
v27ter_rx.h
Go to the documentation of this file.
1
/*
2
* SpanDSP - a series of DSP components for telephony
3
*
4
* v27ter_rx.h - ITU V.27ter modem receive part
5
*
6
* Written by Steve Underwood <steveu@coppice.org>
7
*
8
* Copyright (C) 2003 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
/*! \file */
27
28
#if !defined(_SPANDSP_V27TER_RX_H_)
29
#define _SPANDSP_V27TER_RX_H_
30
31
/*! \page v27ter_rx_page The V.27ter receiver
32
33
\section v27ter_rx_page_sec_1 What does it do?
34
The V.27ter receiver implements the receive side of a V.27ter modem. This can operate
35
at data rates of 4800 and 2400 bits/s. The audio input is a stream of 16 bit samples,
36
at 8000 samples/second. The transmit and receive side of V.27ter modems operate
37
independantly. V.27ter is mostly used for FAX transmission, where it provides the
38
standard 4800 bits/s rate (the 2400 bits/s mode is not used for FAX).
39
40
\section v27ter_rx_page_sec_2 How does it work?
41
V.27ter defines two modes of operation. One uses 8-PSK at 1600 baud, giving 4800bps.
42
The other uses 4-PSK at 1200 baud, giving 2400bps. A training sequence is specified
43
at the start of transmission, which makes the design of a V.27ter receiver relatively
44
straightforward.
45
*/
46
47
/*!
48
V.27ter modem receive side descriptor. This defines the working state for a
49
single instance of a V.27ter modem receiver.
50
*/
51
typedef
struct
v27ter_rx_state_s
v27ter_rx_state_t
;
52
53
#if defined(__cplusplus)
54
extern
"C"
55
{
56
#endif
57
58
/*! Initialise a V.27ter modem receive context.
59
\brief Initialise a V.27ter modem receive context.
60
\param s The modem context.
61
\param bit_rate The bit rate of the modem. Valid values are 2400 and 4800.
62
\param put_bit The callback routine used to put the received data.
63
\param user_data An opaque pointer passed to the put_bit routine.
64
\return A pointer to the modem context, or NULL if there was a problem. */
65
SPAN_DECLARE(
v27ter_rx_state_t
*)
v27ter_rx_init
(
v27ter_rx_state_t
*s,
int
bit_rate
,
put_bit_func_t
put_bit
,
void
*user_data);
66
67
/*! Reinitialise an existing V.27ter modem receive context.
68
\brief Reinitialise an existing V.27ter modem receive context.
69
\param s The modem context.
70
\param bit_rate The bit rate of the modem. Valid values are 2400 and 4800.
71
\param old_train TRUE if a previous trained values are to be reused.
72
\return 0 for OK, -1 for bad parameter */
73
SPAN_DECLARE(
int
)
v27ter_rx_restart
(
v27ter_rx_state_t
*s,
int
bit_rate,
int
old_train
);
74
75
/*! Release a V.27ter modem receive context.
76
\brief Release a V.27ter modem receive context.
77
\param s The modem context.
78
\return 0 for OK */
79
SPAN_DECLARE(
int
)
v27ter_rx_release
(
v27ter_rx_state_t
*s);
80
81
/*! Free a V.27ter modem receive context.
82
\brief Free a V.27ter modem receive context.
83
\param s The modem context.
84
\return 0 for OK */
85
SPAN_DECLARE(
int
)
v27ter_rx_free
(
v27ter_rx_state_t
*s);
86
87
/*! Get the logging context associated with a V.27ter modem receive context.
88
\brief Get the logging context associated with a V.27ter modem receive context.
89
\param s The modem context.
90
\return A pointer to the logging context */
91
SPAN_DECLARE(
logging_state_t
*)
v27ter_rx_get_logging_state
(
v27ter_rx_state_t
*s);
92
93
/*! Change the put_bit function associated with a V.27ter modem receive context.
94
\brief Change the put_bit function associated with a V.27ter modem receive context.
95
\param s The modem context.
96
\param put_bit The callback routine used to handle received bits.
97
\param user_data An opaque pointer. */
98
SPAN_DECLARE(
void
)
v27ter_rx_set_put_bit
(
v27ter_rx_state_t
*s,
put_bit_func_t
put_bit,
void
*user_data);
99
100
/*! Change the modem status report function associated with a V.27ter modem receive context.
101
\brief Change the modem status report function associated with a V.27ter modem receive context.
102
\param s The modem context.
103
\param handler The callback routine used to report modem status changes.
104
\param user_data An opaque pointer. */
105
SPAN_DECLARE(
void
)
v27ter_rx_set_modem_status_handler
(
v27ter_rx_state_t
*s,
modem_rx_status_func_t
handler,
void
*user_data);
106
107
/*! Process a block of received V.27ter modem audio samples.
108
\brief Process a block of received V.27ter modem audio samples.
109
\param s The modem context.
110
\param amp The audio sample buffer.
111
\param len The number of samples in the buffer.
112
\return The number of samples unprocessed.
113
*/
114
SPAN_DECLARE_NONSTD
(
int
) v27ter_rx(
v27ter_rx_state_t
*s, const int16_t amp[],
int
len);
115
116
/*! Fake processing of a missing block of received V.27ter modem audio samples.
117
(e.g due to packet loss).
118
\brief Fake processing of a missing block of received V.27ter modem audio samples.
119
\param s The modem context.
120
\param len The number of samples to fake.
121
\return The number of samples unprocessed.
122
*/
123
SPAN_DECLARE_NONSTD
(
int
) v27ter_rx_fillin(
v27ter_rx_state_t
*s,
int
len);
124
125
/*! Get a snapshot of the current equalizer coefficients.
126
\brief Get a snapshot of the current equalizer coefficients.
127
\param coeffs The vector of complex coefficients.
128
\return The number of coefficients in the vector. */
129
SPAN_DECLARE(
int
)
v27ter_rx_equalizer_state
(
v27ter_rx_state_t
*s,
complexf_t
**coeffs);
130
131
/*! Get the current received carrier frequency.
132
\param s The modem context.
133
\return The frequency, in Hertz. */
134
SPAN_DECLARE(
float
)
v27ter_rx_carrier_frequency
(
v27ter_rx_state_t
*s);
135
136
/*! Get the current symbol timing correction since startup.
137
\param s The modem context.
138
\return The correction. */
139
SPAN_DECLARE(
float
)
v27ter_rx_symbol_timing_correction
(
v27ter_rx_state_t
*s);
140
141
/*! Get a current received signal power.
142
\param s The modem context.
143
\return The signal power, in dBm0. */
144
SPAN_DECLARE(
float
)
v27ter_rx_signal_power
(
v27ter_rx_state_t
*s);
145
146
/*! Set the power level at which the carrier detection will cut in
147
\param s The modem context.
148
\param cutoff The signal cutoff power, in dBm0. */
149
SPAN_DECLARE(
void
)
v27ter_rx_signal_cutoff
(
v27ter_rx_state_t
*s,
float
cutoff);
150
151
/*! Set a handler routine to process QAM status reports
152
\param s The modem context.
153
\param handler The handler routine.
154
\param user_data An opaque pointer passed to the handler routine. */
155
SPAN_DECLARE(
void
)
v27ter_rx_set_qam_report_handler
(
v27ter_rx_state_t
*s, qam_report_handler_t handler,
void
*user_data);
156
157
#if defined(__cplusplus)
158
}
159
#endif
160
161
#endif
162
/*- End of file ------------------------------------------------------------*/
src
spandsp
v27ter_rx.h
Generated by
1.8.4