26 #if !defined(_SPANDSP_PRIVATE_V29RX_H_)
27 #define _SPANDSP_PRIVATE_V29RX_H_
32 #define V29_EQUALIZER_LEN 33
34 #define V29_EQUALIZER_PRE_LEN 16
37 #define V29_RX_FILTER_STEPS 27
64 #if defined(SPANDSP_USE_FIXED_POINT)
int32_t angles[16]
History list of phase angles for the coarse carrier aquisition step.
Definition: private/v29rx.h:190
void v29_rx_set_modem_status_handler(v29_rx_state_t *s, modem_status_func_t handler, void *user_data)
Change the modem status report function associated with a V.29 modem receive context.
Definition: v29rx.c:1059
uint32_t scramble_reg
The register for the data scrambler.
Definition: private/v29rx.h:137
float v29_rx_signal_power(v29_rx_state_t *s)
Definition: v29rx.c:165
void dds_advance(uint32_t *phase_acc, int32_t phase_rate)
Advance the phase, without returning any new signal sample.
Definition: dds_int.c:362
int eq_skip
Symbol counter to the next equalizer update.
Definition: private/v29rx.h:178
int v29_rx_equalizer_state(v29_rx_state_t *s, complexf_t **coeffs)
Get a snapshot of the current equalizer coefficients.
Definition: v29rx.c:191
v29_rx_state_t * v29_rx_init(v29_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data)
Initialise a V.29 modem receive context.
Definition: v29rx.c:1171
Definition: line_model.h:66
int signal_present
>0 if a signal above the minimum is present. It may or may not be a V.29 signal.
Definition: private/v29rx.h:151
void v29_rx_set_qam_report_handler(v29_rx_state_t *s, qam_report_handler_t handler, void *user_data)
Definition: v29rx.c:1217
logging_state_t logging
Error and flow logging control.
Definition: private/v29rx.h:197
float agc_scaling
The scaling factor accessed by the AGC algorithm.
Definition: private/v29rx.h:100
int constellation_state
The position of the current symbol in the constellation, used for differential decoding.
Definition: private/v29rx.h:194
complexi32_t cvec_circular_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n, int pos)
Find the dot product of two complex int16_t vectors, where the first is a circular buffer with an off...
Definition: complex_vector_int.c:83
void(* modem_status_func_t)(void *user_data, int status)
Definition: async.h:114
int bit_rate
The bit rate of the modem. Valid values are 4800, 7200 and 9600.
Definition: private/v29rx.h:46
complexf_t eq_coeff[33]
The adaptive equalizer coefficients.
Definition: private/v29rx.h:107
@ SIG_STATUS_CARRIER_UP
The carrier signal is up. This merely indicates that carrier energy has been seen....
Definition: async.h:58
void dds_advancef(uint32_t *phase_acc, int32_t phase_rate)
Advance the phase, without returning any new signal sample.
Definition: dds_float.c:2133
float power_meter_current_dbm0(power_meter_t *s)
Get the current power meter reading, in dBm0.
Definition: power_meter.c:120
float v29_rx_symbol_timing_correction(v29_rx_state_t *s)
Definition: v29rx.c:159
@ SIG_STATUS_TRAINING_IN_PROGRESS
The modem is training. This is an early indication that the signal seems to be of the right type....
Definition: async.h:63
#define V29_TRAINING_SEG_2_LEN
Definition: v29rx.c:84
void v29_rx_signal_cutoff(v29_rx_state_t *s, float cutoff)
Definition: v29rx.c:171
float eq_delta
The current delta factor for updating the equalizer coefficients.
Definition: private/v29rx.h:105
int32_t dds_phase_ratef(float frequency)
Find the phase rate equivalent to a frequency, in Hz.
Definition: dds_float.c:2109
int16_t high_sample
A highest magnitude sample seen.
Definition: private/v29rx.h:157
void(* put_bit_func_t)(void *user_data, int bit)
Definition: async.h:105
int16_t last_sample
The value of the last signal sample, using the a simple HPF for signal power estimation.
Definition: private/v29rx.h:149
int32_t power_meter_update(power_meter_t *s, int16_t amp)
Update a power meter.
Definition: power_meter.c:84
void * put_bit_user_data
A user specified opaque pointer passed to the put_bit routine.
Definition: private/v29rx.h:50
float vec_circular_dot_prodf(const float x[], const float y[], int n, int pos)
Find the dot product of two float vectors, where the first is a circular buffer with an offset for th...
Definition: vector_float.c:852
int v29_rx_restart(v29_rx_state_t *s, int bit_rate, int old_train)
Reinitialise an existing V.29 modem receive context.
Definition: v29rx.c:1072
put_bit_func_t put_bit
The callback function used to put each bit received.
Definition: private/v29rx.h:48
#define EQUALIZER_DELTA
Definition: v29rx.c:75
float symbol_sync_dc_filter[2]
Definition: private/v29rx.h:118
const char * signal_status_to_str(int status)
Convert a signal status to a short text description.
Definition: async.c:42
void v29_rx_set_qam_report_handler(v29_rx_state_t *s, qam_report_handler_t handler, void *user_data)
Definition: v29rx.c:1217
SPAN_DECLARE_NONSTD(int) async_tx_get_bit(void *user_data)
Get the next bit of a transmitted serial bit stream.
Definition: private/bert.h:60
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
float training_error
A measure of how much mismatch there is between the real constellation, and the decoded symbol positi...
Definition: private/v29rx.h:124
void * status_user_data
A user specified opaque pointer passed to the status function.
Definition: private/v29rx.h:55
Definition: power_meter.h:48
power_meter_t power
A power meter, to measure the HPF'ed signal power in the channel.
Definition: private/v29rx.h:167
float im
Imaginary part.
Definition: complex.h:47
logging_state_t * v29_rx_get_logging_state(v29_rx_state_t *s)
Get the logging context associated with a V.29 modem receive context.
Definition: v29rx.c:1066
int old_train
TRUE if the previous trained values are to be reused.
Definition: private/v29rx.h:143
int32_t carrier_phase_rate
The update rate for the phase of the carrier (i.e. the DDS increment).
Definition: private/v29rx.h:162
void v29_rx_set_modem_status_handler(v29_rx_state_t *s, modem_status_func_t handler, void *user_data)
Change the modem status report function associated with a V.29 modem receive context.
Definition: v29rx.c:1059
uint32_t carrier_phase
The current phase of the carrier (i.e. the DDS parameter).
Definition: private/v29rx.h:160
complexi16_t dds_lookup_complexi16(uint32_t phase)
Generate a complex 16 bit integer tone sample.
Definition: dds_int.c:415
void v29_rx_signal_cutoff(v29_rx_state_t *s, float cutoff)
Definition: v29rx.c:171
@ SIG_STATUS_TRAINING_FAILED
The modem has failed to train.
Definition: async.h:67
float carrier_track_i
The integral part of the carrier tracking filter.
Definition: private/v29rx.h:129
@ SIG_STATUS_CARRIER_DOWN
The carrier signal has dropped.
Definition: async.h:54
int v29_rx_release(v29_rx_state_t *s)
Release a V.29 modem receive context.
Definition: v29rx.c:1204
complexf_t dds_lookup_complexf(uint32_t phase)
Lookup the complex value of a specified phase.
Definition: dds_float.c:2176
int rrc_filter_step
Current offset into the RRC pulse shaping filter buffer.
Definition: private/v29rx.h:134
int32_t im
Imaginary part.
Definition: complex.h:104
int32_t re
Real part.
Definition: complex.h:102
int32_t vec_circular_dot_prodi16(const int16_t x[], const int16_t y[], int n, int pos)
Find the dot product of two int16_t vectors, where the first is a circular buffer with an offset for ...
Definition: vector_int.c:261
complexf_t cvec_circular_dot_prodf(const complexf_t x[], const complexf_t y[], int n, int pos)
Find the dot product of two complex float vectors, where the first is a circular buffer with an offse...
Definition: complex_vector_float.c:173
int32_t start_angles[2]
Starting phase angles for the coarse carrier aquisition step.
Definition: private/v29rx.h:188
modem_status_func_t status_handler
The callback function used to report modem status changes.
Definition: private/v29rx.h:53
float carrier_track_p
The proportional part of the carrier tracking filter.
Definition: private/v29rx.h:127
void v29_rx_set_put_bit(v29_rx_state_t *s, put_bit_func_t put_bit, void *user_data)
Change the put_bit function associated with a V.29 modem receive context.
Definition: v29rx.c:1052
#define CARRIER_NOMINAL_FREQ
Definition: v29rx.c:71
uint8_t training_scramble_reg
The register for the training scrambler.
Definition: private/v29rx.h:139
int32_t carrier_phase_rate_save
The carrier update rate saved for reuse when using short training.
Definition: private/v29rx.h:164
int baud_half
The current half of the baud.
Definition: private/v29rx.h:181
int span_log(logging_state_t *s, int level, const char *format,...)
Generate a log entry.
Definition: logging.c:84
complexf_t eq_buf[33]
The equalizer signal buffer.
Definition: private/v29rx.h:111
float v29_rx_signal_power(v29_rx_state_t *s)
Definition: v29rx.c:165
int32_t carrier_on_power
The power meter level at which carrier on is declared.
Definition: private/v29rx.h:169
float dds_frequencyf(int32_t phase_rate)
Find the frequency, in Hz, equivalent to a phase rate.
Definition: dds_float.c:2115
float agc_scaling_save
The previous value of agc_scaling, needed to reuse old training.
Definition: private/v29rx.h:102
int16_t im
Imaginary part.
Definition: complex.h:93
complexf_t eq_coeff_save[33]
A saved set of adaptive equalizer coefficients for use after restarts.
Definition: private/v29rx.h:109
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
void * qam_user_data
A user specified opaque pointer passed to the qam_report callback routine.
Definition: private/v29rx.h:62
int v29_rx_restart(v29_rx_state_t *s, int bit_rate, int old_train)
Reinitialise an existing V.29 modem receive context.
Definition: v29rx.c:1072
float rrc_filter[27]
The root raised cosine (RRC) pulse shaping filter buffer.
Definition: private/v29rx.h:131
Definition: private/v29tx.h:36
float v29_rx_carrier_frequency(v29_rx_state_t *s)
Definition: v29rx.c:153
int32_t power_meter_level_dbm0(float level)
Get the current power meter reading, in dBm0.
Definition: power_meter.c:91
float symbol_sync_high[2]
Definition: private/v29rx.h:116
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
float v29_rx_symbol_timing_correction(v29_rx_state_t *s)
Definition: v29rx.c:159
logging_state_t * v29_rx_get_logging_state(v29_rx_state_t *s)
Get the logging context associated with a V.29 modem receive context.
Definition: v29rx.c:1066
int training_cd
The current step in the table of CD constellation positions.
Definition: private/v29rx.h:141
float re
Real part.
Definition: complex.h:45
#define V29_TRAINING_SEG_3_LEN
Definition: v29rx.c:86
Definition: private/v29rx.h:43
int low_samples
A count of the current consecutive samples below the carrier off threshold.
Definition: private/v29rx.h:155
int eq_put_step
Current write offset into the equalizer buffer.
Definition: private/v29rx.h:176
int total_baud_timing_correction
The total symbol timing correction since the carrier came up. This is only for performance analysis p...
Definition: private/v29rx.h:185
int eq_step
Current read offset into the equalizer buffer.
Definition: private/v29rx.h:174
int v29_rx_equalizer_state(v29_rx_state_t *s, complexf_t **coeffs)
Get a snapshot of the current equalizer coefficients.
Definition: v29rx.c:191
v29_rx_state_t * v29_rx_init(v29_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data)
Initialise a V.29 modem receive context.
Definition: v29rx.c:1171
int16_t re
Real part.
Definition: complex.h:91
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
int v29_rx_free(v29_rx_state_t *s)
Free a V.29 modem receive context.
Definition: v29rx.c:1210
qam_report_handler_t qam_report
A callback function which may be enabled to report every symbol's constellation position.
Definition: private/v29rx.h:59
float symbol_sync_low[2]
Definition: private/v29rx.h:114
power_meter_t * power_meter_init(power_meter_t *s, int shift)
Initialise a power meter context.
Definition: power_meter.c:50
@ SIG_STATUS_TRAINING_SUCCEEDED
The modem has trained, and is ready for data exchange.
Definition: async.h:65
Definition: private/logging.h:33
#define V29_TRAINING_SEG_4_LEN
Definition: v29rx.c:88
int training_count
A count of how far through the current training step we are.
Definition: private/v29rx.h:147
int training_stage
The section of the training data we are currently in.
Definition: private/v29rx.h:145
float v29_rx_carrier_frequency(v29_rx_state_t *s)
Definition: v29rx.c:153
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
int32_t carrier_off_power
The power meter level at which carrier off is declared.
Definition: private/v29rx.h:171
int carrier_drop_pending
Whether or not a carrier drop was detected and the signal delivery is pending.
Definition: private/v29rx.h:153
float baud_phase
Definition: private/v29rx.h:120