spandsp 3.0.0
v34tx.c File Reference
#include <stdlib.h>
#include <inttypes.h>
#include <string.h>
#include <stdio.h>
#include "spandsp/stdbool.h"
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/bit_operations.h"
#include "spandsp/bitstream.h"
#include "spandsp/complex.h"
#include "spandsp/vector_float.h"
#include "spandsp/complex_vector_float.h"
#include "spandsp/vector_int.h"
#include "spandsp/complex_vector_int.h"
#include "spandsp/modem_echo.h"
#include "spandsp/async.h"
#include "spandsp/power_meter.h"
#include "spandsp/arctan2.h"
#include "spandsp/dds.h"
#include "spandsp/crc.h"
#include "spandsp/complex_filters.h"
#include "spandsp/v29rx.h"
#include "spandsp/v34.h"
#include "spandsp/private/bitstream.h"
#include "spandsp/private/logging.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/modem_echo.h"
#include "spandsp/private/v34.h"
#include "v22bis_tx_rrc.h"
#include "v34_tx_2400_rrc.h"
#include "v34_tx_2743_rrc.h"
#include "v34_tx_2800_rrc.h"
#include "v34_tx_3000_rrc.h"
#include "v34_tx_3200_rrc.h"
#include "v34_tx_3429_rrc.h"
#include "v34_local.h"
#include "v34_tables.h"
#include "v34_superconstellation_map.h"
#include "v34_convolutional_coders.h"
#include "v34_probe_signals.h"
#include "v34_shell_map.h"
#include "v34_tx_pre_emphasis_filters.h"

Macros

#define complex_sig_set(re, im)
 
#define complex_sig_t   complexf_t
 
#define FP_Q9_7_TO_F(x)
 
#define EQUALIZER_DELTA   0.21f
 
#define EQUALIZER_SLOW_ADAPT_RATIO   0.1f
 
#define V34_TRAINING_SEG_1   0
 
#define V34_TRAINING_SEG_4   0
 
#define V34_TRAINING_END   0
 
#define V34_TRAINING_SHUTDOWN_END   0
 
#define INFO_FILL_AND_SYNC_BITS   0x4EF
 
#define TRAINING_SCALE(x)
 
#define TRAINING_AMP   10.0f
 
#define SH_PLUS_NO_SH_SYMBOLS   32
 

Typedefs

typedef float tx_shaper_t[9]
 

Enumerations

enum  { TRAINING_TX_STAGE_NORMAL_OPERATION_V34 = 0 , TRAINING_TX_STAGE_NORMAL_OPERATION_CC = 1 , TRAINING_TX_STAGE_PARKED }
 

Functions

int v34_get_mapping_frame (v34_tx_state_t *s, int16_t bits[16])
 
int v34_tx (v34_state_t *s, int16_t amp[], int max_len)
 Generate a block of V.34 modem audio samples.
 
void v34_tx_power (v34_state_t *s, float power)
 Adjust a V.34 modem transmit context's output power.
 
void v34_set_get_bit (v34_state_t *s, span_get_bit_func_t get_bit, void *user_data)
 Change the get_bit function associated with a V.34 modem context.
 
void v34_set_get_aux_bit (v34_state_t *s, span_get_bit_func_t get_bit, void *user_data)
 Change the get_aux_bit function associated with a V.34 modem context.
 
logging_state_tv34_get_logging_state (v34_state_t *s)
 Get the logging context associated with a V.34 modem context.
 
void v34_set_working_parameters (v34_parameters_t *s, int baud_rate, int bit_rate, int expanded)
 
int v34_get_current_bit_rate (v34_state_t *s)
 Report the current operating bit rate of a V.34 modem context.
 
int v34_half_duplex_change_mode (v34_state_t *s, int mode)
 Change the operating mode of a V.34 half-duplex modem.
 
int v34_restart (v34_state_t *s, int baud_rate, int bit_rate, bool duplex)
 Reinitialise an existing V.34 modem context.
 
v34_state_tv34_init (v34_state_t *s, int baud_rate, int bit_rate, bool calling_party, bool duplex, span_get_bit_func_t get_bit, void *get_bit_user_data, span_put_bit_func_t put_bit, void *put_bit_user_data)
 Initialise a V.34 modem context.
 
int v34_release (v34_state_t *s)
 Release a V.34 modem receive context.
 
int v34_free (v34_state_t *s)
 Free a V.34 modem receive context.
 

Macro Definition Documentation

◆ complex_sig_set

#define complex_sig_set ( re,
im )
Value:
complex_setf(re,im)

◆ FP_Q9_7_TO_F

#define FP_Q9_7_TO_F ( x)
Value:
((float) x/128.0f)

◆ TRAINING_SCALE

#define TRAINING_SCALE ( x)
Value:
(x)

Function Documentation

◆ v34_free()

int v34_free ( v34_state_t * s)

Free a V.34 modem receive context.

Free a V.34 modem receive context.

Parameters
sThe modem context.
Returns
0 for OK

◆ v34_get_current_bit_rate()

int v34_get_current_bit_rate ( v34_state_t * s)

Report the current operating bit rate of a V.34 modem context.

Report the current operating bit rate of a V.34 modem context.

Parameters
sThe modem context.
Returns
???

References v34_state_s::bit_rate.

◆ v34_get_logging_state()

logging_state_t * v34_get_logging_state ( v34_state_t * s)

Get the logging context associated with a V.34 modem context.

Get the logging context associated with a V.34 modem context.

Parameters
sThe modem context.
Returns
A pointer to the logging context

References v34_state_s::logging.

◆ v34_half_duplex_change_mode()

int v34_half_duplex_change_mode ( v34_state_t * s,
int mode )

Change the operating mode of a V.34 half-duplex modem.

Change the operating mode of a V.34 half-duplex modem.

Parameters
sThe modem context.
modeThe new mode to be selected.
Returns
???

References v34_rx_state_t::half_duplex_source, v34_state_s::half_duplex_source, v34_tx_state_t::half_duplex_source, v34_rx_state_t::half_duplex_state, v34_state_s::half_duplex_state, and v34_tx_state_t::half_duplex_state.

◆ v34_init()

v34_state_t * v34_init ( v34_state_t * s,
int baud_rate,
int bit_rate,
bool calling_party,
bool duplex,
span_get_bit_func_t get_bit,
void * get_bit_user_data,
span_put_bit_func_t put_bit,
void * put_bit_user_data )

Initialise a V.34 modem context.

Initialise a V.34 modem context. This must be called before the first use of the context, to initialise its contents.

Parameters
sThe modem context.
baud_rateThe baud rate of the modem. Valid values are 2400, 2743, 2800, 3000, 3200 and 3429
bit_rateThe bit rate of the modem. Valid values are 4800, 7200, 9600, 12000 and 14400.
calling_partyTrue if this is the calling modem.
duplexTrue if this is a full duplex mode modem. Otherwise this is a half-duplex modem.
get_bitThe callback routine used to get the data to be transmitted.
get_bit_user_dataAn opaque pointer, passed in calls to the gett routine.
put_bitThe callback routine used to get the data to be transmitted.
put_bit_user_dataAn opaque pointer, passed in calls to the put routine.
Returns
A pointer to the modem context, or NULL if there was a problem.

References v34_rx_state_t::agc_scaling, v34_rx_state_t::agc_scaling_save, v34_state_s::bit_rate, v34_rx_state_t::calling_party, v34_state_s::calling_party, v34_tx_state_t::calling_party, v34_rx_state_t::carrier_phase_rate_save, v34_tx_state_t::get_bit, v34_tx_state_t::get_bit_user_data, v34_state_s::logging, v34_rx_state_t::put_bit, v34_rx_state_t::put_bit_user_data, v34_rx_state_t::scrambler_tap, v34_tx_state_t::scrambler_tap, v34_restart(), v34_rx_set_signal_cutoff(), and v34_tx_power().

◆ v34_release()

int v34_release ( v34_state_t * s)

Release a V.34 modem receive context.

Release a V.34 modem receive context.

Parameters
sThe modem context.
Returns
0 for OK

◆ v34_restart()

int v34_restart ( v34_state_t * s,
int baud_rate,
int bit_rate,
bool duplex )

Reinitialise an existing V.34 modem context.

Reinitialise an existing V.34 modem context, so it may be reused.

Parameters
sThe modem context.
baud_rateThe baud rate of the modem. Valid values are 2400, 2743, 2800, 3000, 3200 and 3429
bit_rateThe bit rate of the modem. Valid values are 4800, 7200, 9600, 12000 and 14400.
duplexTrue if this is a full duplex mode modem. Otherwise this is a half-duplex modem.
Returns
0 for OK, -1 for bad parameter

References v34_state_s::calling_party, v34_rx_state_t::duplex, v34_state_s::duplex, v34_tx_state_t::duplex, v34_rx_state_t::half_duplex_source, v34_state_s::half_duplex_source, v34_tx_state_t::half_duplex_source, v34_state_s::logging, and span_log().

Referenced by v34_init().

◆ v34_set_get_aux_bit()

void v34_set_get_aux_bit ( v34_state_t * s,
span_get_bit_func_t get_bit,
void * user_data )

Change the get_aux_bit function associated with a V.34 modem context.

Change the get_aux_bit function associated with a V.34 modem context.

Parameters
sThe modem context.
get_bitThe callback routine used to get the aux. data to be transmitted.
user_dataAn opaque pointer.

References v34_tx_state_t::get_aux_bit, and v34_tx_state_t::get_aux_bit_user_data.

◆ v34_set_get_bit()

void v34_set_get_bit ( v34_state_t * s,
span_get_bit_func_t get_bit,
void * user_data )

Change the get_bit function associated with a V.34 modem context.

Change the get_bit function associated with a V.34 modem context.

Parameters
sThe modem context.
get_bitThe callback routine used to get the data to be transmitted.
user_dataAn opaque pointer.

References v34_tx_state_t::current_get_bit, v34_tx_state_t::get_bit, and v34_tx_state_t::get_bit_user_data.

◆ v34_tx()

int v34_tx ( v34_state_t * s,
int16_t amp[],
int len )

Generate a block of V.34 modem audio samples.

Generate a block of V.34 modem audio samples.

Parameters
sThe modem context.
ampThe audio sample buffer.
lenThe number of samples to be generated.
Returns
The number of samples actually generated.

References v34_tx_state_t::sample_time.

◆ v34_tx_power()

void v34_tx_power ( v34_state_t * s,
float power )

Adjust a V.34 modem transmit context's output power.

Adjust a V.34 modem transmit context's power output.

Parameters
sThe modem context.
powerThe power level, in dBm0

Referenced by v34_init().