26 #if !defined(_SPANDSP_PRIVATE_V17RX_H_)
27 #define _SPANDSP_PRIVATE_V17RX_H_
33 #define V17_EQUALIZER_LEN 17
36 #define V17_EQUALIZER_PRE_LEN 8
39 #define V17_RX_FILTER_STEPS 27
46 #define V17_TRELLIS_STORAGE_DEPTH 16
48 #define V17_TRELLIS_LOOKBACK_DEPTH 16
75 #if 1 //defined(RESCALER_TEST)
77 int16_t power_window[40];
80 int64_t window_power_save;
82 #if defined(SPANDSP_USE_FIXED_POINTx)
228 #if defined(SPANDSP_USE_FIXED_POINTx)
power_meter_t power
A power meter, to measure the HPF'ed signal power in the channel.
Definition: private/v17rx.h:192
complexf_t eq_coeff_save[17]
A saved set of adaptive equalizer coefficients for use after restarts.
Definition: private/v17rx.h:130
int32_t angles[16]
History list of phase angles for the coarse carrier aquisition step.
Definition: private/v17rx.h:215
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
complexf_t eq_coeff[17]
The adaptive equalizer coefficients.
Definition: private/v17rx.h:128
complexf_t eq_buf[17]
The equalizer signal buffer.
Definition: private/v17rx.h:132
float carrier_track_p
The proportional part of the carrier tracking filter.
Definition: private/v17rx.h:148
float eq_delta
The current delta factor for updating the equalizer coefficients.
Definition: private/v17rx.h:126
void(* modem_status_func_t)(void *user_data, int status)
Definition: async.h:114
void v17_rx_set_qam_report_handler(v17_rx_state_t *s, qam_report_handler_t handler, void *user_data)
Definition: v17rx.c:1563
@ 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 symbol_sync_high[2]
Definition: private/v17rx.h:137
@ 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
int32_t start_angles[2]
Starting phase angles for the coarse carrier aquisition step.
Definition: private/v17rx.h:213
float v17_rx_signal_power(v17_rx_state_t *s)
Definition: v17rx.c:182
int eq_skip
Symbol count to the next equalizer update.
Definition: private/v17rx.h:203
float training_error
A measure of how much mismatch there is between the real constellation, and the decoded symbol positi...
Definition: private/v17rx.h:145
int rrc_filter_step
Current offset into the RRC pulse shaping filter buffer.
Definition: private/v17rx.h:158
void(* put_bit_func_t)(void *user_data, int bit)
Definition: async.h:105
int32_t power_meter_update(power_meter_t *s, int16_t amp)
Update a power meter.
Definition: power_meter.c:84
int im
Imaginary part.
Definition: complex.h:82
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
float carrier_track_i
The integral part of the carrier tracking filter.
Definition: private/v17rx.h:150
int v17_rx_restart(v17_rx_state_t *s, int bit_rate, int short_train)
Reinitialise an existing V.17 modem receive context.
Definition: v17rx.c:1380
SPAN_DECLARE_NONSTD(int) async_tx_get_bit(void *user_data)
Get the next bit of a transmitted serial bit stream.
int baud_half
The current half of the baud.
Definition: private/v17rx.h:206
float symbol_sync_dc_filter[2]
Definition: private/v17rx.h:139
Definition: power_meter.h:49
float im
Imaginary part.
Definition: complex.h:47
#define EQUALIZER_SLOW_ADAPTION_DELTA
Definition: v17rx.c:95
void * status_user_data
A user specified opaque pointer passed to the status function.
Definition: private/v17rx.h:66
int16_t last_sample
The value of the last signal sample, using the a simple HPF for signal power estimation.
Definition: private/v17rx.h:174
int low_samples
A count of the current consecutive samples below the carrier off threshold.
Definition: private/v17rx.h:180
logging_state_t logging
Error and flow logging control.
Definition: private/v17rx.h:238
float v17_rx_carrier_frequency(v17_rx_state_t *s)
Definition: v17rx.c:170
int16_t high_sample
A highest magnitude sample seen.
Definition: private/v17rx.h:182
#define V17_TRAINING_SHORT_SEG_2_LEN
Definition: v17rx.c:103
qam_report_handler_t qam_report
A callback function which may be enabled to report every symbol's constellation position.
Definition: private/v17rx.h:70
int training_count
A count of how far through the current training step we are.
Definition: private/v17rx.h:172
#define V17_TRAINING_SEG_3_LEN
Definition: v17rx.c:105
int32_t carrier_phase_rate
The update rate for the phase of the carrier (i.e. the DDS increment).
Definition: private/v17rx.h:187
uint32_t carrier_phase
The current phase of the carrier (i.e. the DDS parameter).
Definition: private/v17rx.h:185
@ SIG_STATUS_TRAINING_FAILED
The modem has failed to train.
Definition: async.h:67
int total_baud_timing_correction
The total symbol timing correction since the carrier came up. This is only for performance analysis p...
Definition: private/v17rx.h:210
float symbol_sync_low[2]
Definition: private/v17rx.h:135
float rrc_filter[27]
The root raised cosine (RRC) pulse shaping filter buffer.
Definition: private/v17rx.h:152
int eq_put_step
Current write offset into the equalizer buffer.
Definition: private/v17rx.h:201
Definition: complex.h:100
const complexf_t * constellation
A pointer to the current constellation.
Definition: private/v17rx.h:155
int eq_step
Current read offset into the equalizer buffer.
Definition: private/v17rx.h:199
#define V17_TRAINING_SEG_1_LEN
Definition: v17rx.c:99
@ SIG_STATUS_CARRIER_DOWN
The carrier signal has dropped.
Definition: async.h:54
int v17_rx_equalizer_state(v17_rx_state_t *s, complexf_t **coeffs)
Get a snapshot of the current equalizer coefficients.
Definition: v17rx.c:208
complexf_t dds_lookup_complexf(uint32_t phase)
Lookup the complex value of a specified phase.
Definition: dds_float.c:2176
int32_t carrier_off_power
The power meter level at which carrier off is declared.
Definition: private/v17rx.h:196
int32_t im
Imaginary part.
Definition: complex.h:104
logging_state_t * v17_rx_get_logging_state(v17_rx_state_t *s)
Get the logging context associated with a V.17 modem receive context.
Definition: v17rx.c:1374
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
int full_path_to_past_state_locations[16][8]
The trellis.
Definition: private/v17rx.h:225
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
float agc_scaling_save
The previous value of agc_scaling, needed to reuse old training.
Definition: private/v17rx.h:123
#define EQUALIZER_FAST_ADAPTION_DELTA
Definition: v17rx.c:91
int32_t carrier_on_power
The power meter level at which carrier on is declared.
Definition: private/v17rx.h:194
uint32_t scramble_reg
The register for the data scrambler.
Definition: private/v17rx.h:163
int carrier_drop_pending
Whether or not a carrier drop was detected and the signal delivery is pending.
Definition: private/v17rx.h:178
int span_log(logging_state_t *s, int level, const char *format,...)
Generate a log entry.
Definition: logging.c:84
void * qam_user_data
A user specified opaque pointer passed to the qam_report callback routine.
Definition: private/v17rx.h:73
#define V17_TRAINING_SEG_4A_LEN
Definition: v17rx.c:107
int bits_per_symbol
The number of bits in each symbol at the current bit rate.
Definition: private/v17rx.h:220
#define EQUALIZER_MEDIUM_ADAPTION_DELTA
Definition: v17rx.c:93
#define CARRIER_NOMINAL_FREQ
Definition: v17rx.c:87
float dds_frequencyf(int32_t phase_rate)
Find the frequency, in Hz, equivalent to a phase rate.
Definition: dds_float.c:2115
int16_t im
Imaginary part.
Definition: complex.h:93
void v17_rx_set_modem_status_handler(v17_rx_state_t *s, modem_status_func_t handler, void *user_data)
Change the modem status report function associated with a V.17 modem receive context.
Definition: v17rx.c:1367
void * put_bit_user_data
A user specified opaque pointer passed to the put_but routine.
Definition: private/v17rx.h:61
int training_stage
The section of the training data we are currently in.
Definition: private/v17rx.h:170
#define V17_BRIDGE_WORD
Definition: v17rx.c:112
float distances[8]
Euclidean distances (actually the squares of the distances) from the last states of the trellis.
Definition: private/v17rx.h:235
int signal_present
>0 if a signal above the minimum is present. It may or may not be a V.17 signal.
Definition: private/v17rx.h:176
int32_t power_meter_level_dbm0(float level)
Get the current power meter reading, in dBm0.
Definition: power_meter.c:91
int short_train
Scrambler tap.
Definition: private/v17rx.h:168
int diff
The current state of the differential decoder.
Definition: private/v17rx.h:161
float re
Real part.
Definition: complex.h:45
modem_status_func_t status_handler
The callback function used to report modem status changes.
Definition: private/v17rx.h:64
v17_rx_state_t * v17_rx_init(v17_rx_state_t *s, int bit_rate, put_bit_func_t put_bit, void *user_data)
Initialise a V.17 modem receive context.
Definition: v17rx.c:1517
int16_t re
Real part.
Definition: complex.h:91
int v17_rx_release(v17_rx_state_t *s)
Release a V.17 modem receive context.
Definition: v17rx.c:1550
power_meter_t * power_meter_init(power_meter_t *s, int shift)
Initialise a power meter context.
Definition: power_meter.c:50
#define V17_TRAINING_SEG_2_LEN
Definition: v17rx.c:101
@ SIG_STATUS_TRAINING_SUCCEEDED
The modem has trained, and is ready for data exchange.
Definition: async.h:65
int trellis_ptr
Current pointer to the trellis buffers.
Definition: private/v17rx.h:223
int past_state_locations[16][8]
The trellis.
Definition: private/v17rx.h:227
Definition: private/logging.h:34
void v17_rx_set_put_bit(v17_rx_state_t *s, put_bit_func_t put_bit, void *user_data)
Change the put_bit function associated with a V.17 modem receive context.
Definition: v17rx.c:1360
int space_map
A pointer to the current space map. There is a space map for each trellis state.
Definition: private/v17rx.h:218
void v17_rx_signal_cutoff(v17_rx_state_t *s, float cutoff)
Definition: v17rx.c:188
put_bit_func_t put_bit
The callback function used to put each bit received.
Definition: private/v17rx.h:59
int re
Real part.
Definition: complex.h:80
int32_t carrier_phase_rate_save
The carrier update rate saved for reuse when using short training.
Definition: private/v17rx.h:189
Definition: private/v17rx.h:55
float baud_phase
Definition: private/v17rx.h:141
#define V17_TRAINING_SEG_4_LEN
Definition: v17rx.c:109
float v17_rx_symbol_timing_correction(v17_rx_state_t *s)
Definition: v17rx.c:176
int bit_rate
The bit rate of the modem. Valid values are 7200 9600, 12000 and 14400.
Definition: private/v17rx.h:57
float agc_scaling
The scaling factor accessed by the AGC algorithm.
Definition: private/v17rx.h:121
int v17_rx_free(v17_rx_state_t *s)
Free a V.17 modem receive context.
Definition: v17rx.c:1556