26#if !defined(_SPANDSP_PRIVATE_V34_H_)
27#define _SPANDSP_PRIVATE_V34_H_
30#define V34_INFO_TX_FILTER_STEPS 9
31#define V34_TX_FILTER_STEPS 9
33#define V34_RX_FILTER_STEPS 27
34#define V34_RX_PULSESHAPER_COEFF_SETS 192
35#define V34_RX_CC_PULSESHAPER_COEFF_SETS 12
37#define V34_EQUALIZER_PRE_LEN 63
38#define V34_EQUALIZER_POST_LEN 63
39#define V34_EQUALIZER_MASK 127
45#define V34_RX_PULSESHAPER_GAIN 1.000000f
49#if defined(SPANDSP_USE_FIXED_POINT)
50typedef int16_t v34_rx_shaper_t[V34_RX_PULSESHAPER_COEFF_SETS][V34_RX_FILTER_STEPS];
51typedef int16_t cc_rx_shaper_t[V34_RX_CC_PULSESHAPER_COEFF_SETS][V34_RX_FILTER_STEPS];
53typedef float v34_rx_shaper_t[V34_RX_PULSESHAPER_COEFF_SETS][V34_RX_FILTER_STEPS];
54typedef float cc_rx_shaper_t[V34_RX_CC_PULSESHAPER_COEFF_SETS][V34_RX_FILTER_STEPS];
57typedef uint8_t conv_encode_table_t[64][16];
58typedef uint8_t conv_decode_table_t[16][16];
62 V34_MODULATION_V34 = 0,
66 V34_MODULATION_SILENCE
71 V34_RX_STAGE_INFO0 = 1,
79 V34_RX_STAGE_PRIMARY_CHANNEL
86 V34_TX_STAGE_INITIAL_PREAMBLE = 1,
90 V34_TX_STAGE_INITIAL_A,
93 V34_TX_STAGE_FIRST_NOT_A,
94 V34_TX_STAGE_FIRST_NOT_A_REVERSAL_SEEN,
95 V34_TX_STAGE_SECOND_A,
100 V34_TX_STAGE_POST_L2_A,
101 V34_TX_STAGE_POST_L2_NOT_A,
102 V34_TX_STAGE_A_SILENCE,
103 V34_TX_STAGE_PRE_INFO1_A,
107 V34_TX_STAGE_FIRST_B,
108 V34_TX_STAGE_FIRST_B_INFO_SEEN,
109 V34_TX_STAGE_FIRST_NOT_B_WAIT,
110 V34_TX_STAGE_FIRST_NOT_B,
111 V34_TX_STAGE_FIRST_B_SILENCE,
112 V34_TX_STAGE_FIRST_B_POST_REVERSAL_SILENCE,
113 V34_TX_STAGE_SECOND_B,
114 V34_TX_STAGE_SECOND_B_WAIT,
115 V34_TX_STAGE_SECOND_NOT_B,
117 V34_TX_STAGE_INFO0_RETRY,
119 V34_TX_STAGE_FIRST_S,
120 V34_TX_STAGE_FIRST_NOT_S,
123 V34_TX_STAGE_SECOND_S,
124 V34_TX_STAGE_SECOND_NOT_S,
130 V34_TX_STAGE_J_DASHED,
135 V34_TX_STAGE_HDX_INITIAL_A,
136 V34_TX_STAGE_HDX_FIRST_A,
137 V34_TX_STAGE_HDX_FIRST_NOT_A,
138 V34_TX_STAGE_HDX_FIRST_A_SILENCE,
139 V34_TX_STAGE_HDX_SECOND_A,
140 V34_TX_STAGE_HDX_SECOND_A_WAIT,
142 V34_TX_STAGE_HDX_FIRST_B,
143 V34_TX_STAGE_HDX_FIRST_B_INFO_SEEN,
144 V34_TX_STAGE_HDX_FIRST_NOT_B_WAIT,
145 V34_TX_STAGE_HDX_FIRST_NOT_B,
146 V34_TX_STAGE_HDX_POST_L2_B,
147 V34_TX_STAGE_HDX_POST_L2_SILENCE,
153 V34_TX_STAGE_HDX_FIRST_ALT,
155 V34_TX_STAGE_HDX_PPH,
157 V34_TX_STAGE_HDX_SECOND_ALT,
159 V34_TX_STAGE_HDX_MPH,
168 V34_EVENT_REVERSAL_1,
169 V34_EVENT_REVERSAL_2,
170 V34_EVENT_REVERSAL_3,
183 bool support_baud_rate_low_carrier[6];
184 bool support_baud_rate_high_carrier[6];
185 bool support_power_reduction;
186 uint8_t max_baud_rate_difference;
187 bool support_1664_point_constellation;
188 uint8_t tx_clock_source;
190 bool rate_3429_allowed;
195 int use_high_carrier;
203 int additional_power_reduction;
212 int additional_power_reduction;
215 int use_high_carrier;
216 int preemphasis_filter;
218 int baud_rate_a_to_c;
219 int baud_rate_c_to_a;
226 int use_high_carrier;
227 int preemphasis_filter;
235 int baud_rate_a_to_c;
236 int baud_rate_c_to_a;
237 int aux_channel_supported;
239 int use_non_linear_encoder;
240 int expanded_shaping;
242 int signalling_rate_mask;
243 int asymmetric_rates_allowed;
252 int control_channel_2400;
254 int use_non_linear_encoder;
255 int expanded_shaping;
256 int signalling_rate_mask;
257 int asymmetric_rates_allowed;
320#if defined(SPANDSP_USE_FIXED_POINT)
357#if defined(SPANDSP_USE_FIXED_POINT)
363#if defined(SPANDSP_USE_FIXED_POINT)
365 int16_t rrc_filter_re[V34_INFO_TX_FILTER_STEPS];
366 int16_t rrc_filter_im[V34_INFO_TX_FILTER_STEPS];
370 float rrc_filter_re[V34_INFO_TX_FILTER_STEPS];
371 float rrc_filter_im[V34_INFO_TX_FILTER_STEPS];
396 int current_modulator;
399 int line_probe_cycles;
401 float line_probe_scaling;
412 const conv_encode_table_t *conv_encode_table;
414 bool info0_acknowledgement;
438#if defined(SPANDSP_USE_FIXED_POINT)
440 int32_t symbol_sync_low[2];
442 int32_t symbol_sync_high[2];
444 int32_t symbol_sync_dc_filter[2];
449 int32_t low_band_edge_coeff[3];
451 int32_t high_band_edge_coeff[3];
453 int32_t mixed_edges_coeff_3;
456 float symbol_sync_low[2];
458 float symbol_sync_high[2];
460 float symbol_sync_dc_filter[2];
465 float low_band_edge_coeff[3];
467 float high_band_edge_coeff[3];
480 uint32_t cumulative_path_metric[16][16];
482 uint16_t previous_path_ptr[16][16];
483 uint16_t pts[16][16];
488 int16_t curr_min_state;
494 uint16_t branch_error[8];
495 uint16_t branch_error_x[16][8];
502 const conv_decode_table_t *conv_decode_table;
598#if defined(SPANDSP_USE_FIXED_POINT)
599 int16_t rrc_filter[V34_RX_FILTER_STEPS];
601 float rrc_filter[V34_RX_FILTER_STEPS];
611#if defined(SPANDSP_USE_FIXED_POINT)
615 int16_t agc_scaling_save;
625#if defined(SPANDSP_USE_FIXED_POINT)
627 float carrier_track_p;
629 float carrier_track_i;
637 const v34_rx_shaper_t *shaper_re;
638 const v34_rx_shaper_t *shaper_im;
653 uint32_t last_angles[2];
656 uint8_t info_buf[25];
678 bool info0_acknowledgement;
698#if defined(SPANDSP_USE_FIXED_POINT)
699 int16_t dft_buffer[160];
700 int32_t l1_l2_gains[25];
701 int32_t l1_l2_phases[25];
706 float l1_l2_gains[25];
707 float l1_l2_phases[25];
713 int current_demodulator;
Definition private/bitstream.h:31
Definition private/v34.h:210
Definition private/v34.h:194
Definition private/v34.h:201
Definition private/v34.h:223
Definition private/logging.h:34
Definition private/v34.h:233
Definition private/v34.h:249
Definition private/power_meter.h:34
Definition private/v34.h:437
float baud_phase
Baud phase for symbol sync.
Definition private/v34.h:462
float mixed_edges_coeff_3
A coefficient common to the low and high band edges.
Definition private/v34.h:469
Definition private/v34.h:182
Definition private/v34.h:264
int k
The number of shell mapped bits.
Definition private/v34.h:272
int samples_per_symbol_numerator
Definition private/v34.h:283
int b
Bits per high mapping frame. A low mapping frame is one bit less.
Definition private/v34.h:269
int bit_rate
Parameters for the current bit rate and baud rate.
Definition private/v34.h:267
int samples_per_symbol_denominator
Definition private/v34.h:285
int r
Mapping frame switching parameter.
Definition private/v34.h:280
int q
The number of uncoded Q bits per 2D symbol.
Definition private/v34.h:277
Definition private/v34.h:506
uint32_t r0
Mapping frame output.
Definition private/v34.h:559
put_bit_func_t put_aux_bit
The callback function used to put each aux bit received.
Definition private/v34.h:523
uint32_t carrier_phase
The current phase of the carrier (i.e. the DDS parameter).
Definition private/v34.h:588
bool high_carrier
True if using the higher of the two carrier frequency options.
Definition private/v34.h:537
int baud_half
The current half of the baud.
Definition private/v34.h:645
int baud_rate
The current baud rate selection, as a value from 0 to 5.
Definition private/v34.h:535
v34_parameters_t parms
Parameters for the current bit rate and baud rate.
Definition private/v34.h:569
float agc_scaling
The scaling factor assessed by the AGC algorithm.
Definition private/v34.h:618
float carrier_track_i
The integral part of the carrier tracking filter.
Definition private/v34.h:634
int carrier_drop_pending
Whether or not a carrier drop was detected and the signal delivery is pending.
Definition private/v34.h:672
qam_report_handler_t qam_report
A callback function which may be enabled to report every symbol's constellation position.
Definition private/v34.h:529
int eq_put_step
Current write offset into the equalizer buffer.
Definition private/v34.h:608
int32_t carrier_off_power
The power meter level at which carrier off is declared.
Definition private/v34.h:552
int round_trip_delay_estimate
The measured round trip delay estimate, in sample times.
Definition private/v34.h:647
uint32_t scramble_reg
The register for the data scrambler.
Definition private/v34.h:543
void * put_bit_user_data
A user specified opaque pointer passed to the put_bit routine.
Definition private/v34.h:520
int total_baud_timing_correction
The total symbol timing correction since the carrier came up. This is only for performance analysis p...
Definition private/v34.h:642
int32_t v34_carrier_phase_rate
The update rate for the phase of the V.34 carrier (i.e. the DDS increment).
Definition private/v34.h:595
bool calling_party
True if this is the calling side modem.
Definition private/v34.h:508
int eq_step
Current read offset into the equalizer buffer.
Definition private/v34.h:606
bool half_duplex_source
Definition private/v34.h:512
complexi16_t yt
yt's are the noise corrupted points fed to the viterbi decoder. Assumed to have format 9:7 (7 fractio...
Definition private/v34.h:573
int rrc_filter_step
Current offset into the RRC pulse shaping filter buffer.
Definition private/v34.h:604
float carrier_track_p
The proportional part of the carrier tracking filter.
Definition private/v34.h:632
int16_t high_sample
A highest magnitude sample seen.
Definition private/v34.h:676
int scrambler_tap
The scrambler tap which selects between the caller and answerer scramblers.
Definition private/v34.h:545
bool half_duplex_state
Definition private/v34.h:514
power_meter_t power
A power meter, to measure the HPF'ed signal power in the channel.
Definition private/v34.h:548
int32_t carrier_on_power
The power meter level at which carrier on is declared.
Definition private/v34.h:550
void * qam_user_data
A user specified opaque pointer passed to the qam_report callback routine.
Definition private/v34.h:532
int low_samples
A count of the current consecutive samples below the carrier off threshold.
Definition private/v34.h:674
int32_t cc_carrier_phase_rate
The update rate for the phase of the control channel carrier (i.e. the DDS increment).
Definition private/v34.h:593
void * put_aux_bit_user_data
A user specified opaque pointer passed to the put_aux_bit routine.
Definition private/v34.h:525
float agc_scaling_save
The previous value of agc_scaling, needed to reuse old training.
Definition private/v34.h:620
bool duplex
True if this is a full duplex modem.
Definition private/v34.h:510
int32_t carrier_phase_rate_save
The carrier update rate saved for reuse when using short training.
Definition private/v34.h:590
put_bit_func_t put_bit
The callback function used to put each bit received.
Definition private/v34.h:518
Definition private/v34.h:723
bool calling_party
True if this is the calling side modem.
Definition private/v34.h:725
bool duplex
True if this is a full duplex modem.
Definition private/v34.h:727
logging_state_t logging
Error and flow logging control.
Definition private/v34.h:739
int bit_rate
The bit rate of the modem. Valid values are 1200 and 2400.
Definition private/v34.h:733
bool half_duplex_source
Definition private/v34.h:729
bool half_duplex_state
Definition private/v34.h:731
Definition private/v34.h:289
get_bit_func_t current_get_bit
The get_bit function in use at any instant.
Definition private/v34.h:432
void * get_aux_bit_user_data
A user specified opaque pointer passed to the get_aux_bit function.
Definition private/v34.h:308
int scrambler_tap
The scrambler tap which selects between the caller and answerer scramblers.
Definition private/v34.h:318
bool calling_party
True if this is the calling side modem.
Definition private/v34.h:291
bool high_carrier
True if using the higher of the two carrier frequency options.
Definition private/v34.h:313
int baud_rate
The current baud rate selection, as a value from 0 to 5.
Definition private/v34.h:311
uint32_t guard_phase
The current phase of the guard tone (i.e. the DDS parameter).
Definition private/v34.h:385
uint32_t scramble_reg
The register for the data scrambler.
Definition private/v34.h:316
v34_parameters_t parms
Parameters for the current bit rate and baud rate.
Definition private/v34.h:342
void * get_bit_user_data
A user specified opaque pointer passed to the get_bit function.
Definition private/v34.h:303
get_bit_func_t get_bit
The callback function used to get the next bit to be transmitted.
Definition private/v34.h:301
int32_t cc_carrier_phase_rate
The update rate for the phase of the control channel carrier (i.e. the DDS increment).
Definition private/v34.h:380
get_bit_func_t get_aux_bit
The callback function used to get the next aux channel bit to be transmitted.
Definition private/v34.h:306
bool duplex
True if this is a full duplex modem.
Definition private/v34.h:293
int32_t guard_phase_rate
The update rate for the phase of the guard tone (i.e. the DDS increment).
Definition private/v34.h:387
uint32_t r0
Mapping frame parsed input.
Definition private/v34.h:327
int rrc_filter_step
Current offset into the RRC pulse shaping filter buffer.
Definition private/v34.h:375
int32_t v34_carrier_phase_rate
The update rate for the phase of the V.34 carrier (i.e. the DDS increment).
Definition private/v34.h:382
bool half_duplex_source
Definition private/v34.h:295
int baud_phase
The current fractional phase of the baud timing.
Definition private/v34.h:391
bool half_duplex_state
Definition private/v34.h:297
uint32_t carrier_phase
The current phase of the carrier (i.e. the DDS parameter).
Definition private/v34.h:378
float guard_level
Guard tone signal level.
Definition private/v34.h:389
Definition private/v34.h:474
int windup
Countdown to the first data being available from the viterbi pipeline.
Definition private/v34.h:487
int ptr
Latest viterbi table slot.
Definition private/v34.h:485