spandsp 3.0.0
v32bis.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/logging.h"
#include "spandsp/complex.h"
#include "spandsp/vector_float.h"
#include "spandsp/complex_vector_float.h"
#include "spandsp/async.h"
#include "spandsp/power_meter.h"
#include "spandsp/arctan2.h"
#include "spandsp/dds.h"
#include "spandsp/complex_filters.h"
#include "spandsp/modem_echo.h"
#include "spandsp/v29rx.h"
#include "spandsp/v17tx.h"
#include "spandsp/v17rx.h"
#include "spandsp/v32bis.h"
#include "spandsp/private/logging.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/v17tx.h"
#include "spandsp/private/v17rx.h"
#include "spandsp/private/v32bis.h"
#include "v17_v32bis_tx_constellation_maps.h"
#include "v17_v32bis_rx_constellation_maps.h"
#include "v17_v32bis_tx_rrc.h"
#include "v17_v32bis_rx_rrc.h"

Macros

#define FP_SCALE(x)
 
#define FP_CONSTELLATION_SCALE(x)
 

Functions

int v32bis_equalizer_state (v32bis_state_t *s, complexf_t **coeffs)
 Get a snapshot of the current equalizer coefficients.
 
float v32bis_rx_carrier_frequency (v32bis_state_t *s)
 
float v32bis_rx_symbol_timing_correction (v32bis_state_t *s)
 
float v32bis_rx_signal_power (v32bis_state_t *s)
 
int v32bis_tx (v32bis_state_t *s, int16_t amp[], int len)
 Generate a block of V.32bis modem audio samples.
 
int v32bis_rx (v32bis_state_t *s, const int16_t amp[], int len)
 Process a block of received V.32bis modem audio samples.
 
int v32bis_rx_fillin (v32bis_state_t *s, int len)
 Fake processing of a missing block of received V.32bis modem audio samples.
 
void v32bis_tx_power (v32bis_state_t *s, float power)
 Adjust a V.32bis modem transmit context's output power.
 
void v32bis_set_get_bit (v32bis_state_t *s, span_get_bit_func_t get_bit, void *user_data)
 Change the get_bit function associated with a V.32bis modem context.
 
void v32bis_set_put_bit (v32bis_state_t *s, span_put_bit_func_t put_bit, void *user_data)
 Change the put_bit function associated with a V.32bis modem context.
 
int v32bis_set_supported_bit_rates (v32bis_state_t *s, int rates)
 Set the supported bit rates for a V.32bis modem context.
 
int v32bis_current_bit_rate (v32bis_state_t *s)
 Report the current operating bit rate of a V.22bis modem context.
 
logging_state_tv32bis_get_logging_state (v32bis_state_t *s)
 Get the logging context associated with a V.32bis modem context.
 
int v32bis_restart (v32bis_state_t *s, int bit_rate)
 Reinitialise an existing V.32bis modem context.
 
v32bis_state_tv32bis_init (v32bis_state_t *s, int bit_rate, bool calling_party, 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.32bis modem context.
 
int v32bis_release (v32bis_state_t *s)
 Release a V.32bis modem receive context.
 
int v32bis_free (v32bis_state_t *s)
 Free a V.32bis modem receive context.
 
void v32bis_set_qam_report_handler (v32bis_state_t *s, qam_report_handler_t handler, void *user_data)
 

Macro Definition Documentation

◆ FP_CONSTELLATION_SCALE

#define FP_CONSTELLATION_SCALE ( x)
Value:
FP_SCALE(x)

◆ FP_SCALE

#define FP_SCALE ( x)
Value:
(x)

Function Documentation

◆ v32bis_current_bit_rate()

int v32bis_current_bit_rate ( v32bis_state_t * s)

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

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

Parameters
sThe modem context.

◆ v32bis_equalizer_state()

int v32bis_equalizer_state ( v32bis_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.

References v17_rx_equalizer_state().

◆ v32bis_free()

int v32bis_free ( v32bis_state_t * s)

Free a V.32bis modem receive context.

Free a V.32bis modem receive context.

Parameters
sThe modem context.
Returns
0 for OK

◆ v32bis_get_logging_state()

logging_state_t * v32bis_get_logging_state ( v32bis_state_t * s)

Get the logging context associated with a V.32bis modem context.

Get the logging context associated with a V.32bis modem context.

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

References v32bis_state_s::logging.

◆ v32bis_init()

v32bis_state_t * v32bis_init ( v32bis_state_t * s,
int bit_rate,
bool calling_party,
get_bit_func_t get_bit,
void * get_bit_user_data,
put_bit_func_t put_bit,
void * put_bit_user_data )

Initialise a V.32bis modem context.

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

Parameters
sThe modem context.
bit_rateThe bit rate of the modem. Valid values are 4800, 7200, 9600, 12000 and 14400.
calling_partyTrue if this is the calling modem.
get_bitThe callback routine used to get the data to be transmitted.
get_bit_user_dataAn opaque pointer, passed in calls to the get 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.
Parameters
get_bit_user_dataAn opaque pointer, passed in calls to the put routine.

References v32bis_state_s::bit_rate, v32bis_state_s::calling_party, v32bis_state_s::logging, v17_rx_state_s::scrambler_tap, v17_tx_state_s::scrambler_tap, v17_rx_init(), v17_tx_init(), v32bis_restart(), and v32bis_set_supported_bit_rates().

◆ v32bis_release()

int v32bis_release ( v32bis_state_t * s)

Release a V.32bis modem receive context.

Release a V.32bis modem receive context.

Parameters
sThe modem context.
Returns
0 for OK

◆ v32bis_restart()

int v32bis_restart ( v32bis_state_t * s,
int bit_rate )

Reinitialise an existing V.32bis modem context.

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

Parameters
sThe modem context.
bit_rateThe bit rate of the modem. Valid values are 4800, 7200, 9600, 12000 and 14400.
Returns
0 for OK, -1 for bad parameter.

References v17_rx_state_s::logging, span_log(), v17_rx_restart(), and v17_tx_restart().

Referenced by v32bis_init().

◆ v32bis_rx()

int v32bis_rx ( v32bis_state_t * s,
const int16_t amp[],
int len )

Process a block of received V.32bis modem audio samples.

Process a block of received V.32bis 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 v17_rx().

◆ v32bis_rx_carrier_frequency()

float v32bis_rx_carrier_frequency ( v32bis_state_t * s)

Get the current received carrier frequency.

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

References v17_rx_carrier_frequency().

◆ v32bis_rx_fillin()

int v32bis_rx_fillin ( v32bis_state_t * s,
int len )

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

Fake processing of a missing block of received V.32bis 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 v17_rx_fillin().

◆ v32bis_rx_signal_power()

float v32bis_rx_signal_power ( v32bis_state_t * s)

Get a current received signal power.

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

References v17_rx_signal_power().

◆ v32bis_rx_symbol_timing_correction()

float v32bis_rx_symbol_timing_correction ( v32bis_state_t * s)

Get the current symbol timing correction since startup.

Parameters
sThe modem context.
Returns
The correction.

References v17_rx_symbol_timing_correction().

◆ v32bis_set_get_bit()

void v32bis_set_get_bit ( v32bis_state_t * s,
get_bit_func_t get_bit,
void * user_data )

Change the get_bit function associated with a V.32bis modem context.

Change the get_bit function associated with a V.32bis modem context.

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

References v17_tx_set_get_bit().

◆ v32bis_set_put_bit()

void v32bis_set_put_bit ( v32bis_state_t * s,
put_bit_func_t put_bit,
void * user_data )

Change the put_bit function associated with a V.32bis modem context.

Change the get_bit function associated with a V.32bis modem context.

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

References v17_rx_set_put_bit().

◆ v32bis_set_qam_report_handler()

void v32bis_set_qam_report_handler ( v32bis_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 v17_rx_state_s::qam_report, and v17_rx_state_s::qam_user_data.

◆ v32bis_set_supported_bit_rates()

int v32bis_set_supported_bit_rates ( v32bis_state_t * s,
int rates )

Set the supported bit rates for a V.32bis modem context.

Set the supported bit rates for a V.32bis modem context.

Parameters
sThe modem context.
ratesThe bit rate mask
Returns
0 for OK, -1 for bad parameter.

Referenced by v32bis_init().

◆ v32bis_tx()

int v32bis_tx ( v32bis_state_t * s,
int16_t amp[],
int len )

Generate a block of V.32bis modem audio samples.

Generate a block of V.32bis 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 v17_tx().

◆ v32bis_tx_power()

void v32bis_tx_power ( v32bis_state_t * s,
float power )

Adjust a V.32bis modem transmit context's output power.

Adjust a V.32bis modem transmit context's power output.

Parameters
sThe modem context.
powerThe power level, in dBm0

References v17_tx_power().