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 const uint8_t conv_encode_table_t[64][16];
58typedef const 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 bool use_high_carrier;
203 int additional_power_reduction;
212 int additional_power_reduction;
215 bool use_high_carrier;
216 int preemphasis_filter;
218 int baud_rate_a_to_c;
219 int baud_rate_c_to_a;
226 bool use_high_carrier;
227 int preemphasis_filter;
237 int aux_channel_supported;
239 bool use_non_linear_encoder;
240 bool expanded_shaping;
241 bool mp_acknowledged;
242 int signalling_rate_mask;
243 bool asymmetric_rates_allowed;
252 int control_channel_2400;
254 bool use_non_linear_encoder;
255 bool expanded_shaping;
256 int signalling_rate_mask;
257 bool asymmetric_rates_allowed;
321 bool use_non_linear_encoder;
323#if defined(SPANDSP_USE_FIXED_POINT)
360#if defined(SPANDSP_USE_FIXED_POINT)
366#if defined(SPANDSP_USE_FIXED_POINT)
369 int16_t rrc_filter_im[V34_INFO_TX_FILTER_STEPS];
374 float rrc_filter_im[V34_INFO_TX_FILTER_STEPS];
399 int current_modulator;
402 int line_probe_cycles;
404 float line_probe_scaling;
417 const conv_encode_table_t *conv_encode_table;
419 bool info0_acknowledgement;
447#if defined(SPANDSP_USE_FIXED_POINT)
495 uint16_t branch_error_x[8];
505 int16_t curr_min_state;
513 const conv_decode_table_t *conv_decode_table;
611#if defined(SPANDSP_USE_FIXED_POINT)
624#if defined(SPANDSP_USE_FIXED_POINT)
638#if defined(SPANDSP_USE_FIXED_POINT)
650 const v34_rx_shaper_t *shaper_re;
651 const v34_rx_shaper_t *shaper_im;
666 uint32_t last_angles[2];
691 bool info0_acknowledgement;
711#if defined(SPANDSP_USE_FIXED_POINT)
712 int16_t dft_buffer[160];
713 int32_t l1_l2_gains[25];
714 int32_t l1_l2_phases[25];
719 float l1_l2_gains[25];
720 float l1_l2_phases[25];
726 int current_demodulator;
732 span_sample_timer_t tone_ab_hop_time;
int(* span_get_bit_func_t)(void *user_data)
Definition async.h:127
void(* span_put_bit_func_t)(void *user_data, int bit)
Definition async.h:123
struct bitstream_state_s bitstream_state_t
Definition bitstream.h:38
struct logging_state_s logging_state_t
Definition logging.h:72
struct modem_echo_can_state_s modem_echo_can_state_t
Definition modem_echo.h:85
Definition private/v34.h:210
Definition private/v34.h:194
Definition private/v34.h:201
Definition private/v34.h:223
Definition private/v34.h:233
complexi16_t precoder_coeffs[3]
Only in an MP1 message.
Definition private/v34.h:245
Definition private/v34.h:249
complexi16_t precoder_coeffs[3]
Only in an MPH1 message.
Definition private/v34.h:259
Definition private/v34.h:446
float baud_phase
Baud phase for symbol sync.
Definition private/v34.h:471
float low_band_edge_coeff[3]
Low band edge filter coefficients for symbol sync.
Definition private/v34.h:474
float symbol_sync_high[2]
High band edge filter for symbol sync.
Definition private/v34.h:467
float mixed_edges_coeff_3
A coefficient common to the low and high band edges.
Definition private/v34.h:478
float symbol_sync_dc_filter[2]
DC filter for symbol sync.
Definition private/v34.h:469
float high_band_edge_coeff[3]
High band edge filter coefficients for symbol sync.
Definition private/v34.h:476
float symbol_sync_low[2]
Low band edge filter for symbol sync.
Definition private/v34.h:465
Definition private/v34.h:182
Definition private/v34.h:264
int k
The number of shell mapped bits.
Definition private/v34.h:273
int samples_per_symbol_numerator
Definition private/v34.h:284
int b
Bits per high mapping frame. A low mapping frame is one bit less.
Definition private/v34.h:270
int bit_rate
Parameters for the current bit rate and baud rate.
Definition private/v34.h:268
int samples_per_symbol_denominator
Definition private/v34.h:286
int r
Mapping frame switching parameter.
Definition private/v34.h:281
int q
The number of uncoded Q bits per 2D symbol.
Definition private/v34.h:278
int max_bit_rate_code
The code (0-16) for the maximum bit rate.
Definition private/v34.h:266
Definition private/v34.h:517
uint32_t r0
Mapping frame output.
Definition private/v34.h:572
uint8_t info_buf[25]
Buffer for receiving info frames.
Definition private/v34.h:669
uint32_t carrier_phase
The current phase of the carrier (i.e. the DDS parameter).
Definition private/v34.h:601
bool high_carrier
True if using the higher of the two carrier frequency options.
Definition private/v34.h:548
int baud_half
The current half of the baud.
Definition private/v34.h:658
int mjk[8]
(x0,y0) (x1,y1)...
Definition private/v34.h:577
int baud_rate
The current baud rate selection, as a value from 0 to 5.
Definition private/v34.h:546
v34_parameters_t parms
Parameters for the current bit rate and baud rate.
Definition private/v34.h:582
float agc_scaling
The scaling factor assessed by the AGC algorithm.
Definition private/v34.h:631
float carrier_track_i
The integral part of the carrier tracking filter.
Definition private/v34.h:647
int carrier_drop_pending
Whether or not a carrier drop was detected and the signal delivery is pending.
Definition private/v34.h:685
qam_report_handler_t qam_report
A callback function which may be enabled to report every symbol's constellation position.
Definition private/v34.h:540
int eq_put_step
Current write offset into the equalizer buffer.
Definition private/v34.h:621
span_put_bit_func_t put_bit
The callback function used to put each bit received.
Definition private/v34.h:529
int32_t carrier_off_power
The power meter level at which carrier off is declared.
Definition private/v34.h:565
int round_trip_delay_estimate
The measured round trip delay estimate, in sample times.
Definition private/v34.h:660
uint32_t scramble_reg
The register for the data scrambler.
Definition private/v34.h:554
void * put_bit_user_data
A user specified opaque pointer passed to the put_bit routine.
Definition private/v34.h:531
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:655
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:608
bool calling_party
True if this is the calling side modem.
Definition private/v34.h:519
int eq_step
Current read offset into the equalizer buffer.
Definition private/v34.h:619
bool half_duplex_source
Definition private/v34.h:523
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:586
int rrc_filter_step
Current offset into the RRC pulse shaping filter buffer.
Definition private/v34.h:617
float carrier_track_p
The proportional part of the carrier tracking filter.
Definition private/v34.h:645
int16_t high_sample
A highest magnitude sample seen.
Definition private/v34.h:689
int scrambler_tap
The scrambler tap which selects between the caller and answerer scramblers.
Definition private/v34.h:556
bool half_duplex_state
Definition private/v34.h:525
int16_t ww[3]
ww contains old z, current z and current w
Definition private/v34.h:598
float rrc_filter[27]
The root raised cosine (RRC) pulse shaping filter buffer.
Definition private/v34.h:614
power_meter_t power
A power meter, to measure the HPF'ed signal power in the channel.
Definition private/v34.h:561
int32_t carrier_on_power
The power meter level at which carrier on is declared.
Definition private/v34.h:563
void * qam_user_data
A user specified opaque pointer passed to the qam_report callback routine.
Definition private/v34.h:543
int low_samples
A count of the current consecutive samples below the carrier off threshold.
Definition private/v34.h:687
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:606
void * put_aux_bit_user_data
A user specified opaque pointer passed to the put_aux_bit routine.
Definition private/v34.h:536
complexi16_t xy[2][4]
These are quantized points in the respective 2D coset (0,1,2,3)
Definition private/v34.h:593
float agc_scaling_save
The previous value of agc_scaling, needed to reuse old training.
Definition private/v34.h:633
span_put_bit_func_t put_aux_bit
The callback function used to put each aux bit received.
Definition private/v34.h:534
bool duplex
True if this is a full duplex modem.
Definition private/v34.h:521
int32_t carrier_phase_rate_save
The carrier update rate saved for reuse when using short training.
Definition private/v34.h:603
span_sample_timer_t sample_time
Used to align the transmit and receive positions, to ensure things like round trip delay are properly...
Definition private/v34.h:730
Definition private/v34.h:742
bool calling_party
True if this is the calling side modem.
Definition private/v34.h:744
bool duplex
True if this is a full duplex modem.
Definition private/v34.h:746
logging_state_t logging
Error and flow logging control.
Definition private/v34.h:759
int bit_rate
The bit rate of the modem.
Definition private/v34.h:752
bool half_duplex_source
Definition private/v34.h:748
bool half_duplex_state
Definition private/v34.h:750
Definition private/v34.h:290
span_get_bit_func_t current_get_bit
The get_bit function in use at any instant.
Definition private/v34.h:436
void * get_aux_bit_user_data
A user specified opaque pointer passed to the get_aux_bit function.
Definition private/v34.h:309
int scrambler_tap
The scrambler tap which selects between the caller and answerer scramblers.
Definition private/v34.h:319
bool calling_party
True if this is the calling side modem.
Definition private/v34.h:292
bool high_carrier
True if using the higher of the two carrier frequency options.
Definition private/v34.h:314
float rrc_filter_re[9]
The root raised cosine (RRC) pulse shaping filter buffer.
Definition private/v34.h:373
int baud_rate
The current baud rate selection, as a value from 0 to 5.
Definition private/v34.h:312
uint32_t guard_phase
The current phase of the guard tone (i.e. the DDS parameter).
Definition private/v34.h:388
uint32_t scramble_reg
The register for the data scrambler.
Definition private/v34.h:317
v34_parameters_t parms
Parameters for the current bit rate and baud rate.
Definition private/v34.h:345
span_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:307
void * get_bit_user_data
A user specified opaque pointer passed to the get_bit function.
Definition private/v34.h:304
complexi16_t x[8+3]
We need to remember some old x values in the C code: x[0] x[1] x[2] x[3] x[4] x[5] x[6] x[7] x[8] x[9...
Definition private/v34.h:350
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:383
int mjk[8]
(x0,y0) (x1,y1)...
Definition private/v34.h:335
bool duplex
True if this is a full duplex modem.
Definition private/v34.h:294
int32_t guard_phase_rate
The update rate for the phase of the guard tone (i.e. the DDS increment).
Definition private/v34.h:390
uint32_t r0
Mapping frame parsed input.
Definition private/v34.h:330
complexi16_t precoder_coeffs[3]
Precoder coefficients.
Definition private/v34.h:352
span_sample_timer_t sample_time
Used to align the transmit and receive positions, to ensure things like round trip delay are properly...
Definition private/v34.h:440
int rrc_filter_step
Current offset into the RRC pulse shaping filter buffer.
Definition private/v34.h:378
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:385
bool half_duplex_source
Definition private/v34.h:296
int baud_phase
The current fractional phase of the baud timing.
Definition private/v34.h:394
bool half_duplex_state
Definition private/v34.h:298
span_get_bit_func_t get_bit
The callback function used to get the next bit to be transmitted.
Definition private/v34.h:302
uint32_t carrier_phase
The current phase of the carrier (i.e. the DDS parameter).
Definition private/v34.h:381
float guard_level
Guard tone signal level.
Definition private/v34.h:392
Definition private/v34.h:483
uint16_t branch_error[8]
Eight 4D squared branch errors for each of 8 4D subsets. Indexed array for indexing from viterbi look...
Definition private/v34.h:511
int windup
Countdown to the first data being available from the viterbi pipeline.
Definition private/v34.h:504
complexi16_t bb[2][8]
Branches of the x and y coords of the points in the eight 4D subsets to which a sequence of 2D points...
Definition private/v34.h:499
uint32_t cumulative_path_metric[16]
Cumulative path metric.
Definition private/v34.h:491
int ptr
Latest viterbi table slot.
Definition private/v34.h:502
uint16_t previous_path_ptr[16]
Previous path pointer.
Definition private/v34.h:493
struct v34_state_s v34_state_t
Definition v34.h:79