spandsp  0.0.6
private/v27ter_tx.h
1 /*
2  * SpanDSP - a series of DSP components for telephony
3  *
4  * private/v27ter_tx.h - ITU V.27ter modem transmit 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 #if !defined(_SPANDSP_PRIVATE_V27TER_TX_H_)
27 #define _SPANDSP_PRIVATE_V27TER_TX_H_
28 
29 /*! The number of taps in the pulse shaping/bandpass filter */
30 #define V27TER_TX_FILTER_STEPS 9
31 
32 /*!
33  V.27ter modem transmit side descriptor. This defines the working state for a
34  single instance of a V.27ter modem transmitter.
35 */
37 {
38  /*! \brief The bit rate of the modem. Valid values are 2400 and 4800. */
39  int bit_rate;
40  /*! \brief The callback function used to get the next bit to be transmitted. */
42  /*! \brief A user specified opaque pointer passed to the get_bit function. */
44 
45  /*! \brief The callback function used to report modem status changes. */
47  /*! \brief A user specified opaque pointer passed to the status function. */
49 
50 #if defined(SPANDSP_USE_FIXED_POINT)
51  /*! \brief The gain factor needed to achieve the specified output power at 2400bps. */
52  int32_t gain_2400;
53  /*! \brief The gain factor needed to achieve the specified output power at 4800bps. */
54  int32_t gain_4800;
55  /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
56  complexi16_t rrc_filter[2*V27TER_TX_FILTER_STEPS];
57 #else
58  /*! \brief The gain factor needed to achieve the specified output power at 2400bps. */
59  float gain_2400;
60  /*! \brief The gain factor needed to achieve the specified output power at 4800bps. */
61  float gain_4800;
62  /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
63  complexf_t rrc_filter[2*V27TER_TX_FILTER_STEPS];
64 #endif
65  /*! \brief Current offset into the RRC pulse shaping filter buffer. */
67 
68  /*! \brief The register for the training and data scrambler. */
69  uint32_t scramble_reg;
70  /*! \brief A counter for the number of consecutive bits of repeating pattern through
71  the scrambler. */
73  /*! \brief TRUE if transmitting the training sequence, or shutting down transmission.
74  FALSE if transmitting user data. */
76  /*! \brief A counter used to track progress through sending the training sequence. */
78 
79  /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
80  uint32_t carrier_phase;
81  /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
83  /*! \brief The current fractional phase of the baud timing. */
85  /*! \brief The code number for the current position in the constellation. */
87  /*! \brief The get_bit function in use at any instant. */
89  /*! \brief Error and flow logging control */
91 };
92 
93 #endif
94 /*- End of file ------------------------------------------------------------*/
v27ter_tx_init
v27ter_tx_state_t * v27ter_tx_init(v27ter_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data)
Initialise a V.27ter modem transmit context.
Definition: v27ter_tx.c:413
v27ter_tx_get_logging_state
logging_state_t * v27ter_tx_get_logging_state(v27ter_tx_state_t *s)
Get the logging context associated with a V.27ter modem transmit context.
Definition: v27ter_tx.c:384
one_way_line_model_state_t
Definition: line_model.h:67
v27ter_tx_free
int v27ter_tx_free(v27ter_tx_state_t *s)
Free a V.27ter modem transmit context.
Definition: v27ter_tx.c:446
v27ter_rx_set_modem_status_handler
void v27ter_rx_set_modem_status_handler(v27ter_rx_state_t *s, modem_status_func_t handler, void *user_data)
Change the modem status report function associated with a V.27ter modem receive context.
Definition: v27ter_rx.c:1023
modem_status_func_t
void(* modem_status_func_t)(void *user_data, int status)
Definition: async.h:114
v27ter_tx_release
int v27ter_tx_release(v27ter_tx_state_t *s)
Release a V.27ter modem transmit context.
Definition: v27ter_tx.c:440
complexf_t
Definition: complex.h:43
v27ter_tx_set_modem_status_handler
void v27ter_tx_set_modem_status_handler(v27ter_tx_state_t *s, modem_status_func_t handler, void *user_data)
Change the modem status report function associated with a V.27ter modem transmit context.
Definition: v27ter_tx.c:377
async.h
v27ter_rx_get_logging_state
logging_state_t * v27ter_rx_get_logging_state(v27ter_rx_state_t *s)
Get the logging context associated with a V.27ter modem receive context.
Definition: v27ter_rx.c:1030
v27ter_tx_init
v27ter_tx_state_t * v27ter_tx_init(v27ter_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data)
Initialise a V.27ter modem transmit context.
Definition: v27ter_tx.c:413
v27ter_rx_symbol_timing_correction
float v27ter_rx_symbol_timing_correction(v27ter_rx_state_t *s)
Definition: v27ter_rx.c:143
dds_phase_ratef
int32_t dds_phase_ratef(float frequency)
Find the phase rate equivalent to a frequency, in Hz.
Definition: dds_float.c:2109
v27ter_tx_state_s::status_user_data
void * status_user_data
A user specified opaque pointer passed to the status function.
Definition: private/v27ter_tx.h:48
V27TER_TRAINING_SEG_2
#define V27TER_TRAINING_SEG_2
Definition: v27ter_tx.c:78
dds_complexf
complexf_t dds_complexf(uint32_t *phase_acc, int32_t phase_rate)
Generate a complex floating point tone sample.
Definition: dds_float.c:2165
v27ter_tx_state_s::carrier_phase_rate
int32_t carrier_phase_rate
The update rate for the phase of the carrier (i.e. the DDS increment).
Definition: private/v27ter_tx.h:82
v27ter_tx_get_logging_state
logging_state_t * v27ter_tx_get_logging_state(v27ter_tx_state_t *s)
Get the logging context associated with a V.27ter modem transmit context.
Definition: v27ter_tx.c:384
v27ter_tx.h
v27ter_rx_carrier_frequency
float v27ter_rx_carrier_frequency(v27ter_rx_state_t *s)
Definition: v27ter_rx.c:137
signal_status_to_str
const char * signal_status_to_str(int status)
Convert a signal status to a short text description.
Definition: async.c:42
SPAN_DECLARE_NONSTD
SPAN_DECLARE_NONSTD(int) async_tx_get_bit(void *user_data)
Get the next bit of a transmitted serial bit stream.
v27ter_tx_state_s::current_get_bit
get_bit_func_t current_get_bit
The get_bit function in use at any instant.
Definition: private/v27ter_tx.h:88
bert_state_s
Definition: private/bert.h:61
v27ter_rx_restart
int v27ter_rx_restart(v27ter_rx_state_t *s, int bit_rate, int old_train)
Reinitialise an existing V.27ter modem receive context.
Definition: v27ter_rx.c:1036
complex.h
complexf_t::im
float im
Imaginary part.
Definition: complex.h:47
CARRIER_NOMINAL_FREQ
#define CARRIER_NOMINAL_FREQ
Definition: v27ter_tx.c:70
V27TER_TRAINING_SEG_3
#define V27TER_TRAINING_SEG_3
Definition: v27ter_tx.c:80
v27ter_tx_state_s::bit_rate
int bit_rate
The bit rate of the modem. Valid values are 2400 and 4800.
Definition: private/v27ter_tx.h:39
v27ter_tx_state_s::scrambler_pattern_count
int scrambler_pattern_count
A counter for the number of consecutive bits of repeating pattern through the scrambler.
Definition: private/v27ter_tx.h:72
SIG_STATUS_SHUTDOWN_COMPLETE
@ SIG_STATUS_SHUTDOWN_COMPLETE
A modem has completed its task, and shut down.
Definition: async.h:77
get_bit_func_t
int(* get_bit_func_t)(void *user_data)
Definition: async.h:108
v27ter_tx_state_s::scramble_reg
uint32_t scramble_reg
The register for the training and data scrambler.
Definition: private/v27ter_tx.h:69
v27ter_tx_restart
int v27ter_tx_restart(v27ter_tx_state_t *s, int bit_rate, int tep)
Reinitialise an existing V.27ter modem transmit context.
Definition: v27ter_tx.c:390
v27ter_rx_set_qam_report_handler
void v27ter_rx_set_qam_report_handler(v27ter_rx_state_t *s, qam_report_handler_t handler, void *user_data)
Definition: v27ter_rx.c:1144
v27ter_tx_state_s
Definition: private/v27ter_tx.h:37
v27ter_tx_state_s::get_bit
get_bit_func_t get_bit
The callback function used to get the next bit to be transmitted.
Definition: private/v27ter_tx.h:41
v27ter_tx_state_s::status_handler
modem_status_func_t status_handler
The callback function used to report modem status changes.
Definition: private/v27ter_tx.h:46
v27ter_tx_state_s::baud_phase
int baud_phase
The current fractional phase of the baud timing.
Definition: private/v27ter_tx.h:84
v27ter_tx_power
void v27ter_tx_power(v27ter_tx_state_t *s, float power)
Adjust a V.27ter modem transmit context's output power.
Definition: v27ter_tx.c:353
V27TER_TRAINING_SEG_5
#define V27TER_TRAINING_SEG_5
Definition: v27ter_tx.c:84
complexi16_t
Definition: complex.h:89
v27ter_rx_state_s
Definition: private/v27ter_rx.h:52
v27ter_tx_state_s::gain_2400
float gain_2400
The gain factor needed to achieve the specified output power at 2400bps.
Definition: private/v27ter_tx.h:59
v27ter_rx_init
v27ter_rx_state_t * v27ter_rx_init(v27ter_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data)
Initialise a V.27ter modem receive context.
Definition: v27ter_rx.c:1104
v27ter_tx_state_s::get_bit_user_data
void * get_bit_user_data
A user specified opaque pointer passed to the get_bit function.
Definition: private/v27ter_tx.h:43
spandsp-sim.h
v27ter_tx_set_get_bit
void v27ter_tx_set_get_bit(v27ter_tx_state_t *s, get_bit_func_t get_bit, void *user_data)
Change the get_bit function associated with a V.27ter modem transmit context.
Definition: v27ter_tx.c:368
V27TER_TRAINING_END
#define V27TER_TRAINING_END
Definition: v27ter_tx.c:86
V27TER_TRAINING_SEG_4
#define V27TER_TRAINING_SEG_4
Definition: v27ter_tx.c:82
v27ter_tx_restart
int v27ter_tx_restart(v27ter_tx_state_t *s, int bit_rate, int tep)
Reinitialise an existing V.27ter modem transmit context.
Definition: v27ter_tx.c:390
v27ter_rx_equalizer_state
int v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexf_t **coeffs)
Get a snapshot of the current equalizer coefficients.
Definition: v27ter_rx.c:178
v27ter_tx_set_modem_status_handler
void v27ter_tx_set_modem_status_handler(v27ter_tx_state_t *s, modem_status_func_t handler, void *user_data)
Change the modem status report function associated with a V.27ter modem transmit context.
Definition: v27ter_tx.c:377
logging.h
V27TER_TRAINING_SHUTDOWN_END
#define V27TER_TRAINING_SHUTDOWN_END
Definition: v27ter_tx.c:88
v27ter_tx_state_s::rrc_filter
complexf_t rrc_filter[2 *9]
The root raised cosine (RRC) pulse shaping filter buffer.
Definition: private/v27ter_tx.h:63
complexf_t::re
float re
Real part.
Definition: complex.h:45
v27ter_tx_state_s::carrier_phase
uint32_t carrier_phase
The current phase of the carrier (i.e. the DDS parameter).
Definition: private/v27ter_tx.h:80
v27ter_tx_power
void v27ter_tx_power(v27ter_tx_state_t *s, float power)
Adjust a V.27ter modem transmit context's output power.
Definition: v27ter_tx.c:353
v27ter_tx_state_s::constellation_state
int constellation_state
The code number for the current position in the constellation.
Definition: private/v27ter_tx.h:86
v27ter_tx_state_s::gain_4800
float gain_4800
The gain factor needed to achieve the specified output power at 4800bps.
Definition: private/v27ter_tx.h:61
v27ter_tx_state_s::in_training
int in_training
TRUE if transmitting the training sequence, or shutting down transmission. FALSE if transmitting user...
Definition: private/v27ter_tx.h:75
v27ter_tx_state_s::training_step
int training_step
A counter used to track progress through sending the training sequence.
Definition: private/v27ter_tx.h:77
SIG_STATUS_TRAINING_SUCCEEDED
@ SIG_STATUS_TRAINING_SUCCEEDED
The modem has trained, and is ready for data exchange.
Definition: async.h:65
v27ter_rx_signal_power
float v27ter_rx_signal_power(v27ter_rx_state_t *s)
Definition: v27ter_rx.c:152
logging_state_s
Definition: private/logging.h:34
v27ter_rx_state_s::qam_report
qam_report_handler_t qam_report
A callback function which may be enabled to report every symbol's constellation position.
Definition: private/v27ter_rx.h:67
v27ter_tx_state_s::rrc_filter_step
int rrc_filter_step
Current offset into the RRC pulse shaping filter buffer.
Definition: private/v27ter_tx.h:66
V27TER_TRAINING_SEG_1
#define V27TER_TRAINING_SEG_1
Definition: v27ter_tx.c:76
SIG_STATUS_END_OF_DATA
@ SIG_STATUS_END_OF_DATA
The data stream has ended.
Definition: async.h:71
bert_results_t
Definition: bert.h:95
dds_complexi
complexi_t dds_complexi(uint32_t *phase_acc, int32_t phase_rate)
Generate a complex integer tone sample.
Definition: dds_int.c:394
v27ter_tx_state_s::logging
logging_state_t logging
Error and flow logging control.
Definition: private/v27ter_tx.h:90
dds.h
complexi_t
Definition: complex.h:78