spandsp 3.0.0
v22bis_rx.c File Reference
#include <inttypes.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "spandsp/stdbool.h"
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/logging.h"
#include "spandsp/fast_convert.h"
#include "spandsp/math_fixed.h"
#include "spandsp/saturated.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/async.h"
#include "spandsp/power_meter.h"
#include "spandsp/arctan2.h"
#include "spandsp/dds.h"
#include "spandsp/complex_filters.h"
#include "spandsp/v29rx.h"
#include "spandsp/v22bis.h"
#include "spandsp/private/logging.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/v22bis.h"
#include "v22bis_rx_1200_rrc.h"
#include "v22bis_rx_2400_rrc.h"

Macros

#define FP_SCALE(x)
#define ms_to_symbols(t)
#define LOW_CARRIER_FREQUENCY   1200.0f
#define HIGH_CARRIER_FREQUENCY   2400.0f
#define EQUALIZER_DELTA   0.25f
#define PULSESHAPER_COEFF_SETS   12

Functions

float v22bis_rx_carrier_frequency (v22bis_state_t *s)
float v22bis_rx_symbol_timing_correction (v22bis_state_t *s)
float v22bis_rx_signal_power (v22bis_state_t *s)
void v22bis_rx_set_signal_cutoff (v22bis_state_t *s, float cutoff)
void v22bis_report_status_change (v22bis_state_t *s, int status)
int v22bis_rx_equalizer_state (v22bis_state_t *s, complexf_t **coeffs)
 Get a snapshot of the current equalizer coefficients.
void v22bis_equalizer_coefficient_reset (v22bis_state_t *s)
int v22bis_rx (v22bis_state_t *s, const int16_t amp[], int len)
 Process a block of received V.22bis modem audio samples.
int v22bis_rx_fillin (v22bis_state_t *s, int len)
 Fake processing of a missing block of received V.22bis modem audio samples.
int v22bis_rx_restart (v22bis_state_t *s)
 Reinitialise an existing V.22bis modem receive context.
void v22bis_rx_set_qam_report_handler (v22bis_state_t *s, qam_report_handler_t handler, void *user_data)

Macro Definition Documentation

◆ EQUALIZER_DELTA

#define EQUALIZER_DELTA   0.25f

The adaption rate coefficient for the equalizer

◆ FP_SCALE

#define FP_SCALE ( x)
Value:
(x)

◆ ms_to_symbols

#define ms_to_symbols ( t)
Value:
(((t)*600)/1000)

◆ PULSESHAPER_COEFF_SETS

#define PULSESHAPER_COEFF_SETS   12

The number of phase shifted coefficient set for the pulse shaping/bandpass filter

Referenced by v22bis_rx(), and v22bis_rx_symbol_timing_correction().

Function Documentation

◆ v22bis_rx()

int v22bis_rx ( v22bis_state_t * s,
const int16_t amp[],
int len )

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

Process a block of received V.22bis 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 v22bis_state_s::bit_rate, v22bis_state_s::calling_party, dds_advance(), dds_advancef(), dds_lookup_complexf(), dds_lookup_complexi16(), complexi16_t::im, power_meter_update(), PULSESHAPER_COEFF_SETS, complexi16_t::re, SIG_STATUS_CARRIER_DOWN, SIG_STATUS_CARRIER_UP, v22bis_restart(), and v22bis_rx().

Referenced by v22bis_rx().

◆ v22bis_rx_carrier_frequency()

float v22bis_rx_carrier_frequency ( v22bis_state_t * s)

Get the current received carrier frequency.

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

References dds_frequencyf(), and v22bis_rx_carrier_frequency().

Referenced by v22bis_rx_carrier_frequency().

◆ v22bis_rx_equalizer_state()

int v22bis_rx_equalizer_state ( v22bis_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 v22bis_rx_equalizer_state().

Referenced by v22bis_rx_equalizer_state().

◆ v22bis_rx_fillin()

int v22bis_rx_fillin ( v22bis_state_t * s,
int len )

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

Fake processing of a missing block of received V.22bis 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 dds_advance(), dds_advancef(), v22bis_state_s::logging, span_log(), and v22bis_rx_fillin().

Referenced by v22bis_rx_fillin().

◆ v22bis_rx_restart()

int v22bis_rx_restart ( v22bis_state_t * s)

Reinitialise an existing V.22bis modem receive context.

Reinitialise an existing V.22bis modem receive context.

Parameters
sThe modem context.
Returns
0 for OK, -1 for bad parameter

References v22bis_state_s::calling_party, power_meter_init(), and v22bis_rx_set_signal_cutoff().

◆ v22bis_rx_set_qam_report_handler()

void v22bis_rx_set_qam_report_handler ( v22bis_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 v22bis_rx_set_qam_report_handler().

Referenced by v22bis_rx_set_qam_report_handler().

◆ v22bis_rx_set_signal_cutoff()

void v22bis_rx_set_signal_cutoff ( v22bis_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 power_meter_level_dbm0(), and v22bis_rx_set_signal_cutoff().

Referenced by v22bis_rx_restart(), and v22bis_rx_set_signal_cutoff().

◆ v22bis_rx_signal_power()

float v22bis_rx_signal_power ( v22bis_state_t * s)

Get a current received signal power.

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

References power_meter_current_dbm0(), and v22bis_rx_signal_power().

Referenced by v22bis_rx_signal_power().

◆ v22bis_rx_symbol_timing_correction()

float v22bis_rx_symbol_timing_correction ( v22bis_state_t * s)

Get the current symbol timing correction since startup.

Parameters
sThe modem context.
Returns
The correction.

References PULSESHAPER_COEFF_SETS, and v22bis_rx_symbol_timing_correction().

Referenced by v22bis_rx_symbol_timing_correction().