spandsp 3.0.0
v34.h File Reference

Go to the source code of this file.

Macros

#define V34_CONSTELLATION_SCALING_FACTOR   1.0
 

Typedefs

typedef struct v34_state_s v34_state_t
 

Enumerations

enum  v34_supported_bit_rates_e {
  V34_SUPPORT_2400 = 0x0001 , V34_SUPPORT_4800 = 0x0002 , V34_SUPPORT_7200 = 0x0004 , V34_SUPPORT_9600 = 0x0008 ,
  V34_SUPPORT_12000 = 0x0010 , V34_SUPPORT_14400 = 0x0020 , V34_SUPPORT_16800 = 0x0040 , V34_SUPPORT_19200 = 0x0080 ,
  V34_SUPPORT_21600 = 0x0100 , V34_SUPPORT_24000 = 0x0200 , V34_SUPPORT_26400 = 0x0400 , V34_SUPPORT_28800 = 0x0800 ,
  V34_SUPPORT_31200 = 0x1000 , V34_SUPPORT_33600 = 0x2000
}
 
enum  v34_half_duplex_modes_e {
  V34_HALF_DUPLEX_SOURCE , V34_HALF_DUPLEX_RECIPIENT , V34_HALF_DUPLEX_CONTROL_CHANNEL , V34_HALF_DUPLEX_PRIMARY_CHANNEL ,
  V34_HALF_DUPLEX_SILENCE
}
 

Functions

int v34_rx (v34_state_t *s, const int16_t amp[], int len)
 Process a block of received V.34 modem audio samples.
 
int v34_rx_fillin (v34_state_t *s, int len)
 Fake processing of a missing block of received V.34 modem audio samples.
 
int v34_equalizer_state (v34_state_t *s, complexf_t **coeffs)
 Get a snapshot of the current equalizer coefficients.
 
float v34_rx_carrier_frequency (v34_state_t *s)
 
float v34_rx_symbol_timing_correction (v34_state_t *s)
 
float v34_rx_signal_power (v34_state_t *s)
 
void v34_rx_set_signal_cutoff (v34_state_t *s, float cutoff)
 
void v34_set_qam_report_handler (v34_state_t *s, qam_report_handler_t handler, void *user_data)
 
int v34_tx (v34_state_t *s, int16_t amp[], int 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.
 
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.
 
logging_state_tv34_get_logging_state (v34_state_t *s)
 Get the logging context associated with a V.34 modem context.
 
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.
 
void v34_set_put_bit (v34_state_t *s, span_put_bit_func_t put_bit, void *user_data)
 Change the put_bit function associated with a V.34 modem context.
 
void v34_set_put_aux_bit (v34_state_t *s, span_put_bit_func_t put_bit, void *user_data)
 Change the put_aux_bit function associated with a V.34 modem context.
 

Typedef Documentation

◆ v34_state_t

typedef struct v34_state_s v34_state_t

V.34 modem descriptor. This defines the working state for a single instance of a V.34 modem.

Function Documentation

◆ v34_equalizer_state()

int v34_equalizer_state ( v34_state_t * s,
complexf_t ** coeffs )

Get a snapshot of the current equalizer coefficients.

Get a snapshot of the current equalizer coefficients.

Parameters
coeffsThe vector of complex coefficients.
Returns
The number of coefficients in the vector.

◆ 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_rx()

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

Process a block of received V.34 modem audio samples.

Process a block of received V.34 modem audio samples.

Parameters
sThe modem context.
ampThe audio sample buffer.
lenThe number of samples in the buffer.
Returns
The number of samples unprocessed.

References v34_rx_state_t::sample_time.

◆ v34_rx_carrier_frequency()

float v34_rx_carrier_frequency ( v34_state_t * s)

Get the current received carrier frequency.

Parameters
sThe modem context.
Returns
The frequency, in Hertz.

References dds_frequency(), and v34_rx_state_t::v34_carrier_phase_rate.

◆ v34_rx_fillin()

int v34_rx_fillin ( v34_state_t * s,
int len )

Fake processing of a missing block of received V.34 modem audio samples.

Fake processing of a missing block of received V.34 modem audio samples. (e.g due to packet loss).

Parameters
sThe modem context.
lenThe number of samples to fake.
Returns
The number of samples unprocessed.

References v34_rx_state_t::carrier_phase, dds_advance(), dds_advancef(), v34_state_s::logging, span_log(), and v34_rx_state_t::v34_carrier_phase_rate.

◆ v34_rx_set_signal_cutoff()

void v34_rx_set_signal_cutoff ( v34_state_t * s,
float cutoff )

Set the power level at which the carrier detection will cut in

Parameters
sThe modem context.
cutoffThe signal cutoff power, in dBm0.

References v34_rx_state_t::carrier_off_power, v34_rx_state_t::carrier_on_power, and power_meter_level_dbm0().

Referenced by v34_init().

◆ v34_rx_signal_power()

float v34_rx_signal_power ( v34_state_t * s)

Get a current received signal power.

Parameters
sThe modem context.
Returns
The signal power, in dBm0.

◆ v34_rx_symbol_timing_correction()

float v34_rx_symbol_timing_correction ( v34_state_t * s)

Get the current symbol timing correction since startup.

Parameters
sThe modem context.
Returns
The correction.

◆ 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_set_put_aux_bit()

void v34_set_put_aux_bit ( v34_state_t * s,
span_put_bit_func_t put_bit,
void * user_data )

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

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

Parameters
sThe modem context.
put_bitThe callback routine used to process the aux data received.
user_dataAn opaque pointer.

References v34_rx_state_t::put_aux_bit, and v34_rx_state_t::put_aux_bit_user_data.

◆ v34_set_put_bit()

void v34_set_put_bit ( v34_state_t * s,
span_put_bit_func_t put_bit,
void * user_data )

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

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

Parameters
sThe modem context.
put_bitThe callback routine used to process the data received.
user_dataAn opaque pointer.

References v34_rx_state_t::put_bit, and v34_rx_state_t::put_bit_user_data.

◆ v34_set_qam_report_handler()

void v34_set_qam_report_handler ( v34_state_t * s,
qam_report_handler_t handler,
void * user_data )

Set a handler routine to process QAM status reports

Parameters
sThe modem context.
handlerThe handler routine.
user_dataAn opaque pointer passed to the handler routine.

References v34_rx_state_t::qam_report, and v34_rx_state_t::qam_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().