spandsp  0.0.6
private/v29tx.h
1 /*
2  * SpanDSP - a series of DSP components for telephony
3  *
4  * private/v29tx.h - ITU V.29 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_V29TX_H_)
27 #define _SPANDSP_PRIVATE_V29TX_H_
28 
29 /*! The number of taps in the pulse shaping/bandpass filter */
30 #define V29_TX_FILTER_STEPS 9
31 
32 /*!
33  V.29 modem transmit side descriptor. This defines the working state for a
34  single instance of a V.29 modem transmitter.
35 */
37 {
38  /*! \brief The bit rate of the modem. Valid values are 4800, 7200 and 9600. */
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 Gain required to achieve the specified output power, not allowing
52  for the size of the current constellation. */
53  float base_gain;
54  /*! \brief Gain required to achieve the specified output power, allowing
55  for the size of the current constellation. */
56  int32_t gain;
57  /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
58  complexi16_t rrc_filter[2*V29_TX_FILTER_STEPS];
59 #else
60  /*! \brief Gain required to achieve the specified output power, not allowing
61  for the size of the current constellation. */
62  float base_gain;
63  /*! \brief Gain required to achieve the specified output power, allowing
64  for the size of the current constellation. */
65  float gain;
66  /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
67  complexf_t rrc_filter[2*V29_TX_FILTER_STEPS];
68 #endif
69  /*! \brief Current offset into the RRC pulse shaping filter buffer. */
71 
72  /*! \brief The register for the data scrambler. */
73  uint32_t scramble_reg;
74  /*! \brief The register for the training scrambler. */
76  /*! \brief TRUE if transmitting the training sequence, or shutting down transmission.
77  FALSE if transmitting user data. */
79  /*! \brief A counter used to track progress through sending the training sequence. */
81  /*! \brief An offset value into the table of training parameters, used to match the
82  training pattern to the bit rate. */
84 
85  /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
86  uint32_t carrier_phase;
87  /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
89  /*! \brief The current fractional phase of the baud timing. */
91  /*! \brief The code number for the current position in the constellation. */
93  /*! \brief The get_bit function in use at any instant. */
95  /*! \brief Error and flow logging control */
97 };
98 
99 #endif
100 /*- End of file ------------------------------------------------------------*/
v29_tx_state_s::current_get_bit
get_bit_func_t current_get_bit
The get_bit function in use at any instant.
Definition: private/v29tx.h:94
v29_tx_state_s::status_handler
modem_status_func_t status_handler
The callback function used to report modem status changes.
Definition: private/v29tx.h:46
v29_tx_init
v29_tx_state_t * v29_tx_init(v29_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data)
Initialise a V.29 modem transmit context.
Definition: v29tx.c:369
v29_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/v29tx.h:43
v29_tx_state_s::baud_phase
int baud_phase
The current fractional phase of the baud timing.
Definition: private/v29tx.h:90
v29_tx_state_s::rrc_filter
complexf_t rrc_filter[2 *9]
The root raised cosine (RRC) pulse shaping filter buffer.
Definition: private/v29tx.h:67
modem_status_func_t
void(* modem_status_func_t)(void *user_data, int status)
Definition: async.h:114
V29_TRAINING_SEG_4
#define V29_TRAINING_SEG_4
Definition: v29tx.c:81
v29_rx_state_s::bit_rate
int bit_rate
The bit rate of the modem. Valid values are 4800, 7200 and 9600.
Definition: private/v29rx.h:46
complexf_t
Definition: complex.h:43
v29_tx_state_s::status_user_data
void * status_user_data
A user specified opaque pointer passed to the status function.
Definition: private/v29tx.h:48
async.h
v29_tx_free
int v29_tx_free(v29_tx_state_t *s)
Free a V.29 modem transmit context.
Definition: v29tx.c:403
v29_tx_state_s::base_gain
float base_gain
Gain required to achieve the specified output power, not allowing for the size of the current constel...
Definition: private/v29tx.h:62
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
SPAN_DECLARE_NONSTD
SPAN_DECLARE_NONSTD(int) async_tx_get_bit(void *user_data)
Get the next bit of a transmitted serial bit stream.
v29_rx_state_s::power
power_meter_t power
A power meter, to measure the HPF'ed signal power in the channel.
Definition: private/v29rx.h:167
complex.h
complexf_t::im
float im
Imaginary part.
Definition: complex.h:47
v29_tx_restart
int v29_tx_restart(v29_tx_state_t *s, int bit_rate, int tep)
Reinitialise an existing V.29 modem transmit context.
Definition: v29tx.c:332
v29_tx_state_s::in_training
int in_training
TRUE if transmitting the training sequence, or shutting down transmission. FALSE if transmitting user...
Definition: private/v29tx.h:78
v29_tx_state_s::training_scramble_reg
uint8_t training_scramble_reg
The register for the training scrambler.
Definition: private/v29tx.h:75
V29_TRAINING_END
#define V29_TRAINING_END
Definition: v29tx.c:83
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
v29_tx_state_s::rrc_filter_step
int rrc_filter_step
Current offset into the RRC pulse shaping filter buffer.
Definition: private/v29tx.h:70
v29_tx_state_s::gain
float gain
Gain required to achieve the specified output power, allowing for the size of the current constellati...
Definition: private/v29tx.h:65
V29_TRAINING_SEG_3
#define V29_TRAINING_SEG_3
Definition: v29tx.c:79
v29_tx_power
void v29_tx_power(v29_tx_state_t *s, float power)
Adjust a V.29 modem transmit context's output power.
Definition: v29tx.c:300
V29_TRAINING_SEG_1
#define V29_TRAINING_SEG_1
Definition: v29tx.c:75
CARRIER_NOMINAL_FREQ
#define CARRIER_NOMINAL_FREQ
Definition: v29tx.c:69
V29_TRAINING_SEG_2
#define V29_TRAINING_SEG_2
Definition: v29tx.c:77
complexi16_t
Definition: complex.h:89
span_log
int span_log(logging_state_t *s, int level, const char *format,...)
Generate a log entry.
Definition: logging.c:84
v29_tx_state_s::bit_rate
int bit_rate
The bit rate of the modem. Valid values are 4800, 7200 and 9600.
Definition: private/v29tx.h:39
v29_tx_get_logging_state
logging_state_t * v29_tx_get_logging_state(v29_tx_state_t *s)
Get the logging context associated with a V.29 modem transmit context.
Definition: v29tx.c:326
V29_TRAINING_SHUTDOWN_END
#define V29_TRAINING_SHUTDOWN_END
Definition: v29tx.c:85
v29_tx_state_s::logging
logging_state_t logging
Error and flow logging control.
Definition: private/v29tx.h:96
v29_tx_state_s
Definition: private/v29tx.h:37
logging.h
v29_tx_set_get_bit
void v29_tx_set_get_bit(v29_tx_state_t *s, get_bit_func_t get_bit, void *user_data)
Change the get_bit function associated with a V.29 modem transmit context.
Definition: v29tx.c:310
complexf_t::re
float re
Real part.
Definition: complex.h:45
v29_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/v29tx.h:88
v29_tx_state_s::scramble_reg
uint32_t scramble_reg
The register for the data scrambler.
Definition: private/v29tx.h:73
v29tx.h
v29_tx_state_s::training_offset
int training_offset
An offset value into the table of training parameters, used to match the training pattern to the bit ...
Definition: private/v29tx.h:83
v29_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/v29tx.h:41
logging_state_s
Definition: private/logging.h:34
v29_tx_release
int v29_tx_release(v29_tx_state_t *s)
Release a V.29 modem transmit context.
Definition: v29tx.c:397
v29_tx_state_s::training_step
int training_step
A counter used to track progress through sending the training sequence.
Definition: private/v29tx.h:80
v29_tx_set_modem_status_handler
void v29_tx_set_modem_status_handler(v29_tx_state_t *s, modem_status_func_t handler, void *user_data)
Change the modem status report function associated with a V.29 modem transmit context.
Definition: v29tx.c:319
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
V29_TRAINING_SEG_TEP
#define V29_TRAINING_SEG_TEP
Definition: v29tx.c:73
dds.h
complexi_t
Definition: complex.h:78
v29_tx_state_s::carrier_phase
uint32_t carrier_phase
The current phase of the carrier (i.e. the DDS parameter).
Definition: private/v29tx.h:86
v29_tx_state_s::constellation_state
int constellation_state
The code number for the current position in the constellation.
Definition: private/v29tx.h:92