spandsp  0.0.6
private/v17tx.h
Go to the documentation of this file.
1 /*
2  * SpanDSP - a series of DSP components for telephony
3  *
4  * private/v17tx.h - ITU V.17 modem transmit part
5  *
6  * Written by Steve Underwood <steveu@coppice.org>
7  *
8  * Copyright (C) 2004 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_PRIVATE_V17TX_H_)
29 #define _SPANDSP_PRIVATE_V17TX_H_
30 
31 /*! The number of taps in the pulse shaping/bandpass filter */
32 #define V17_TX_FILTER_STEPS 9
33 
34 /*!
35  V.17 modem transmit side descriptor. This defines the working state for a
36  single instance of a V.17 modem transmitter.
37 */
39 {
40  /*! \brief The bit rate of the modem. Valid values are 4800, 7200 and 9600. */
41  int bit_rate;
42  /*! \brief The callback function used to get the next bit to be transmitted. */
44  /*! \brief A user specified opaque pointer passed to the get_bit function. */
46 
47  /*! \brief The callback function used to report modem status changes. */
49  /*! \brief A user specified opaque pointer passed to the status function. */
51 
52 #if defined(SPANDSP_USE_FIXED_POINT)
53  /*! \brief The gain factor needed to achieve the specified output power. */
54  int32_t gain;
55  /*! \brief A pointer to the constellation currently in use. */
57  /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
59 #else
60  /*! \brief The gain factor needed to achieve the specified output power. */
61  float gain;
62  /*! \brief A pointer to the constellation currently in use. */
64  /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
66 #endif
67 
68  /*! \brief Current offset into the RRC pulse shaping filter buffer. */
70 
71  /*! \brief The current state of the differential encoder. */
72  int diff;
73  /*! \brief The current state of the convolutional encoder. */
75  /*! \brief The code number for the current position in the constellation. */
77 
78  /*! \brief The register for the data scrambler. */
79  uint32_t scramble_reg;
80  /*! \brief Scrambler tap */
81  //int scrambler_tap;
82  /*! \brief TRUE if transmitting the training sequence. FALSE if transmitting user data. */
84  /*! \brief TRUE if the short training sequence is to be used. */
86  /*! \brief A counter used to track progress through sending the training sequence. */
88 
89  /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
90  uint32_t carrier_phase;
91  /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
93  /*! \brief The current fractional phase of the baud timing. */
95 
96  /*! \brief The current number of data bits per symbol. This does not include
97  the redundant bit. */
99  /*! \brief The get_bit function in use at any instant. */
101  /*! \brief Error and flow logging control */
103 };
104 
105 #endif
106 /*- End of file ------------------------------------------------------------*/
v17_rx_state_s::power
power_meter_t power
A power meter, to measure the HPF'ed signal power in the channel.
Definition: private/v17rx.h:192
v17_tx_state_s::current_get_bit
get_bit_func_t current_get_bit
The get_bit function in use at any instant.
Definition: private/v17tx.h:100
v17_tx_state_s::status_user_data
void * status_user_data
A user specified opaque pointer passed to the status function.
Definition: private/v17tx.h:50
v17_tx_state_s::rrc_filter_step
int rrc_filter_step
Current offset into the RRC pulse shaping filter buffer.
Definition: private/v17tx.h:69
v17_tx_state_s::in_training
int in_training
Scrambler tap.
Definition: private/v17tx.h:83
modem_status_func_t
void(* modem_status_func_t)(void *user_data, int status)
Definition: async.h:114
v17_tx_state_s::bits_per_symbol
int bits_per_symbol
The current number of data bits per symbol. This does not include the redundant bit.
Definition: private/v17tx.h:98
complexf_t
Definition: complex.h:42
async.h
v17_tx_state_s::training_step
int training_step
A counter used to track progress through sending the training sequence.
Definition: private/v17tx.h:87
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
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
v17_tx_init
v17_tx_state_t * v17_tx_init(v17_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data)
Initialise a V.17 modem transmit context.
Definition: v17tx.c:431
v17_tx_state_s::baud_phase
int baud_phase
The current fractional phase of the baud timing.
Definition: private/v17tx.h:94
v17_tx_set_get_bit
void v17_tx_set_get_bit(v17_tx_state_t *s, get_bit_func_t get_bit, void *user_data)
Change the get_bit function associated with a V.17 modem transmit context.
Definition: v17tx.c:358
SPAN_DECLARE_NONSTD
SPAN_DECLARE_NONSTD(int) async_tx_get_bit(void *user_data)
Get the next bit of a transmitted serial bit stream.
V17_TX_FILTER_STEPS
#define V17_TX_FILTER_STEPS
Definition: private/v17tx.h:32
complex.h
complexf_t::im
float im
Imaginary part.
Definition: complex.h:47
V17_TRAINING_SEG_1
#define V17_TRAINING_SEG_1
Definition: v17tx.c:81
v17_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/v17tx.h:45
v17_tx_state_s::constellation_state
int constellation_state
The code number for the current position in the constellation.
Definition: private/v17tx.h:76
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
v17_tx_restart
int v17_tx_restart(v17_tx_state_t *s, int bit_rate, int tep, int short_train)
Reinitialise an existing V.17 modem transmit context.
Definition: v17tx.c:380
v17_tx_state_s::scramble_reg
uint32_t scramble_reg
The register for the data scrambler.
Definition: private/v17tx.h:79
v17_tx_power
void v17_tx_power(v17_tx_state_t *s, float power)
Adjust a V.17 modem transmit context's output power.
Definition: v17tx.c:346
v17_tx_state_s::diff
int diff
The current state of the differential encoder.
Definition: private/v17tx.h:72
v17tx.h
V17_TRAINING_SEG_TEP_A
#define V17_TRAINING_SEG_TEP_A
Definition: v17tx.c:77
V17_TRAINING_SEG_TEP_B
#define V17_TRAINING_SEG_TEP_B
Definition: v17tx.c:79
v17_tx_free
int v17_tx_free(v17_tx_state_t *s)
Free a V.17 modem transmit context.
Definition: v17tx.c:469
complexi16_t
Definition: complex.h:88
v17_tx_state_s::status_handler
modem_status_func_t status_handler
The callback function used to report modem status changes.
Definition: private/v17tx.h:48
V17_TRAINING_END
#define V17_TRAINING_END
Definition: v17tx.c:91
CARRIER_NOMINAL_FREQ
#define CARRIER_NOMINAL_FREQ
Definition: v17tx.c:73
v17_tx_state_s::carrier_phase
uint32_t carrier_phase
The current phase of the carrier (i.e. the DDS parameter).
Definition: private/v17tx.h:90
v17_tx_state_s::rrc_filter
complexf_t rrc_filter[2 *9]
The root raised cosine (RRC) pulse shaping filter buffer.
Definition: private/v17tx.h:65
V17_TRAINING_SHORT_SEG_4
#define V17_TRAINING_SHORT_SEG_4
Definition: v17tx.c:89
v17tx.h
V17_TRAINING_SEG_3
#define V17_TRAINING_SEG_3
Definition: v17tx.c:85
V17_BRIDGE_WORD
#define V17_BRIDGE_WORD
Definition: v17tx.c:97
v17_tx_state_s::bit_rate
int bit_rate
The bit rate of the modem. Valid values are 4800, 7200 and 9600.
Definition: private/v17tx.h:41
v17_tx_state_s::gain
float gain
The gain factor needed to achieve the specified output power.
Definition: private/v17tx.h:61
V17_TRAINING_SHUTDOWN_END
#define V17_TRAINING_SHUTDOWN_END
Definition: v17tx.c:94
v17_tx_release
int v17_tx_release(v17_tx_state_t *s)
Release a V.17 modem transmit context.
Definition: v17tx.c:463
logging.h
v17_tx_set_modem_status_handler
void v17_tx_set_modem_status_handler(v17_tx_state_t *s, modem_status_func_t handler, void *user_data)
Change the modem status report function associated with a V.17 modem transmit context.
Definition: v17tx.c:367
v17_rx_state_s::short_train
int short_train
Scrambler tap.
Definition: private/v17rx.h:168
complexf_t::re
float re
Real part.
Definition: complex.h:45
v17_tx_state_s::convolution
int convolution
The current state of the convolutional encoder.
Definition: private/v17tx.h:74
v17_tx_state_s
Definition: private/v17tx.h:38
v17_tx_state_s::short_train
int short_train
TRUE if the short training sequence is to be used.
Definition: private/v17tx.h:85
v17_tx_get_logging_state
logging_state_t * v17_tx_get_logging_state(v17_tx_state_t *s)
Get the logging context associated with a V.17 modem transmit context.
Definition: v17tx.c:374
v17_tx_state_s::constellation
const complexf_t * constellation
A pointer to the constellation currently in use.
Definition: private/v17tx.h:63
v17_tx_state_s::logging
logging_state_t logging
Error and flow logging control.
Definition: private/v17tx.h:102
V17_TRAINING_SEG_4
#define V17_TRAINING_SEG_4
Definition: v17tx.c:87
logging_state_s
Definition: private/logging.h:33
v17_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/v17tx.h:92
v17_rx_state_s::bit_rate
int bit_rate
The bit rate of the modem. Valid values are 7200 9600, 12000 and 14400.
Definition: private/v17rx.h:57
SIG_STATUS_END_OF_DATA
@ SIG_STATUS_END_OF_DATA
The data stream has ended.
Definition: async.h:71
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
V17_TRAINING_SEG_2
#define V17_TRAINING_SEG_2
Definition: v17tx.c:83
dds.h
complexi_t
Definition: complex.h:77
v17_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/v17tx.h:43