spandsp  3.0.0
private/v34.h
1 /*
2  * SpanDSP - a series of DSP components for telephony
3  *
4  * private/v34.h - ITU V.34 modem
5  *
6  * Written by Steve Underwood <steveu@coppice.org>
7  *
8  * Copyright (C) 2009 Steve Underwood
9  *
10  * All rights reserved.
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 2.1,
14  * as published by the Free Software Foundation.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this program; if not, write to the Free Software
23  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  */
25 
26 #if !defined(_SPANDSP_PRIVATE_V34_H_)
27 #define _SPANDSP_PRIVATE_V34_H_
28 
29 /*! The number of taps in the info data transmit pulse shaping filter */
30 #define V34_INFO_TX_FILTER_STEPS 9
31 #define V34_TX_FILTER_STEPS 9
32 
33 #define V34_RX_FILTER_STEPS 27
34 #define V34_RX_PULSESHAPER_COEFF_SETS 192
35 #define V34_RX_CC_PULSESHAPER_COEFF_SETS 12
36 
37 #define V34_EQUALIZER_PRE_LEN 63
38 #define V34_EQUALIZER_POST_LEN 63
39 #define V34_EQUALIZER_MASK 127
40 
41 /*! The offset between x index values, and what they mean in terms of the V.34
42  spec numbering */
43 #define V34_XOFF 3
44 
45 #define V34_RX_PULSESHAPER_GAIN 1.000000f
46 
47 extern const complexf_t v34_constellation[16];
48 
49 #if defined(SPANDSP_USE_FIXED_POINT)
50 typedef int16_t v34_rx_shaper_t[V34_RX_PULSESHAPER_COEFF_SETS][V34_RX_FILTER_STEPS];
51 typedef int16_t cc_rx_shaper_t[V34_RX_CC_PULSESHAPER_COEFF_SETS][V34_RX_FILTER_STEPS];
52 #else
53 typedef float v34_rx_shaper_t[V34_RX_PULSESHAPER_COEFF_SETS][V34_RX_FILTER_STEPS];
54 typedef float cc_rx_shaper_t[V34_RX_CC_PULSESHAPER_COEFF_SETS][V34_RX_FILTER_STEPS];
55 #endif
56 
57 typedef const uint8_t conv_encode_table_t[64][16];
58 typedef const uint8_t conv_decode_table_t[16][16];
59 
60 enum
61 {
62  V34_MODULATION_V34 = 0,
63  V34_MODULATION_CC,
64  V34_MODULATION_TONES,
65  V34_MODULATION_L1_L2,
66  V34_MODULATION_SILENCE
67 };
68 
69 enum v34_rx_stages_e
70 {
71  V34_RX_STAGE_INFO0 = 1,
72  V34_RX_STAGE_INFOH,
73  V34_RX_STAGE_INFO1C,
74  V34_RX_STAGE_INFO1A,
75  V34_RX_STAGE_TONE_A,
76  V34_RX_STAGE_TONE_B,
77  V34_RX_STAGE_L1_L2,
78  V34_RX_STAGE_CC,
79  V34_RX_STAGE_PRIMARY_CHANNEL
80 };
81 
82 enum v34_tx_stages_e
83 {
84  /*! \brief An initial bit of extra preamble ahead of the first INFO0, to ensure
85  bit synchronisation is OK by the first bit of INFO0 */
86  V34_TX_STAGE_INITIAL_PREAMBLE = 1,
87  /*! \brief INFO0 is being transmitted the first time */
88  V34_TX_STAGE_INFO0,
89  /*! \brief Transmitting A while waiting for 50ms timeout */
90  V34_TX_STAGE_INITIAL_A,
91  /*! \brief Transmitting A while waiting for received INFO0c */
92  V34_TX_STAGE_FIRST_A,
93  V34_TX_STAGE_FIRST_NOT_A,
94  V34_TX_STAGE_FIRST_NOT_A_REVERSAL_SEEN,
95  V34_TX_STAGE_SECOND_A,
96  /*! \brief L1 is being transmitted */
97  V34_TX_STAGE_L1,
98  /*! \brief L2 is being transmitted */
99  V34_TX_STAGE_L2,
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,
104  /*! \brief INFO1 is being trasnmitted */
105  V34_TX_STAGE_INFO1,
106 
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,
116  /*! \brief INFO0 is being resent on a bad startup */
117  V34_TX_STAGE_INFO0_RETRY,
118 
119  V34_TX_STAGE_FIRST_S,
120  V34_TX_STAGE_FIRST_NOT_S,
121  /*! \brief The optional MD is being transmitted */
122  V34_TX_STAGE_MD,
123  V34_TX_STAGE_SECOND_S,
124  V34_TX_STAGE_SECOND_NOT_S,
125  /*! \brief TRN is being transmitted */
126  V34_TX_STAGE_TRN,
127  /*! \brief J is being transmitted */
128  V34_TX_STAGE_J,
129  /*! \brief J' is being transmitted */
130  V34_TX_STAGE_J_DASHED,
131  /*! \brief MP is being transmitted */
132  V34_TX_STAGE_MP,
133 
134  /*! \brief Half-duplex initial stages */
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,
141 
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,
148 
149  /*! \brief Half-duplex control channel stages */
150  /*! \brief Sh and !Sh are being transmitted */
151  V34_TX_STAGE_HDX_SH,
152  /*! \brief The first ALT is being transmitted */
153  V34_TX_STAGE_HDX_FIRST_ALT,
154  /*! \brief The PPh is being transmitted */
155  V34_TX_STAGE_HDX_PPH,
156  /*! \brief The second ALT is being transmitted */
157  V34_TX_STAGE_HDX_SECOND_ALT,
158  /*! \brief MPh is being transmitted */
159  V34_TX_STAGE_HDX_MPH,
160  /*! \brief E is being transmitted */
161  V34_TX_STAGE_HDX_E
162 };
163 
164 enum v34_events_e
165 {
166  V34_EVENT_NONE = 0,
167  V34_EVENT_TONE_SEEN,
168  V34_EVENT_REVERSAL_1,
169  V34_EVENT_REVERSAL_2,
170  V34_EVENT_REVERSAL_3,
171  V34_EVENT_INFO0_OK,
172  V34_EVENT_INFO0_BAD,
173  V34_EVENT_INFO1_OK,
174  V34_EVENT_INFO1_BAD,
175  V34_EVENT_INFOH_OK,
176  V34_EVENT_INFOH_BAD,
177  V34_EVENT_L2_SEEN,
178  V34_EVENT_S
179 };
180 
181 typedef struct
182 {
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;
189  bool from_cme_modem;
190  bool rate_3429_allowed;
192 
193 typedef struct
194 {
195  bool use_high_carrier;
196  int pre_emphasis;
197  int max_bit_rate;
199 
200 typedef struct
201 {
202  int power_reduction;
203  int additional_power_reduction;
204  int md;
205  int freq_offset;
206  info1c_baud_rate_parms_t rate_data[6];
207 } info1c_t;
208 
209 typedef struct
210 {
211  int power_reduction;
212  int additional_power_reduction;
213  int md;
214  int freq_offset;
215  bool use_high_carrier;
216  int preemphasis_filter;
217  int max_data_rate;
218  int baud_rate_a_to_c;
219  int baud_rate_c_to_a;
220 } info1a_t;
221 
222 typedef struct
223 {
224  int power_reduction;
225  int length_of_trn;
226  bool use_high_carrier;
227  int preemphasis_filter;
228  int baud_rate;
229  bool trn16;
230 } infoh_t;
231 
232 typedef struct
233 {
234  int type;
235  int bit_rate_a_to_c;
236  int bit_rate_c_to_a;
237  int aux_channel_supported;
238  int trellis_size;
239  bool use_non_linear_encoder;
240  bool expanded_shaping;
241  bool mp_acknowledged;
242  int signalling_rate_mask;
243  bool asymmetric_rates_allowed;
244  /*! \brief Only in an MP1 message */
245  complexi16_t precoder_coeffs[3];
246 } mp_t;
247 
248 typedef struct
249 {
250  int type;
251  int max_data_rate;
252  int control_channel_2400;
253  int trellis_size;
254  bool use_non_linear_encoder;
255  bool expanded_shaping;
256  int signalling_rate_mask;
257  bool asymmetric_rates_allowed;
258  /*! \brief Only in an MPH1 message */
259  complexi16_t precoder_coeffs[3];
260 } mph_t;
261 
262 /*! The set of working parameters, which defines operation at the current settings */
263 typedef struct
264 {
265  /*! \brief The code (0-16) for the maximum bit rate */
267  /*! \brief Parameters for the current bit rate and baud rate */
268  int bit_rate;
269  /*! \brief Bits per high mapping frame. A low mapping frame is one bit less. */
270  int b;
271  int j;
272  /*! \brief The number of shell mapped bits */
273  int k;
274  int l;
275  int m;
276  int p;
277  /*! \brief The number of uncoded Q bits per 2D symbol */
278  int q;
279  int q_mask;
280  /*! \brief Mapping frame switching parameter */
281  int r;
282  int w;
283  /*! The numerator of the number of samples per symbol ratio. */
285  /*! The denominator of the number of samples per symbol ratio. */
288 
289 typedef struct
290 {
291  /*! \brief True if this is the calling side modem. */
293  /*! \brief True if this is a full duplex modem. */
294  bool duplex;
295  /*! The current source end when in half-duplex mode */
297  /*! The current operating state when in half-duplex mode */
299  /*! \brief */
300  int bit_rate;
301  /*! \brief The callback function used to get the next bit to be transmitted. */
303  /*! \brief A user specified opaque pointer passed to the get_bit function. */
305 
306  /*! \brief The callback function used to get the next aux channel bit to be transmitted. */
308  /*! \brief A user specified opaque pointer passed to the get_aux_bit function. */
310 
311  /*! \brief The current baud rate selection, as a value from 0 to 5. */
313  /*! \brief True if using the higher of the two carrier frequency options. */
315 
316  /*! \brief The register for the data scrambler. */
317  uint32_t scramble_reg;
318  /*! \brief The scrambler tap which selects between the caller and answerer scramblers */
320 
321  bool use_non_linear_encoder;
322 
323 #if defined(SPANDSP_USE_FIXED_POINT)
324  complexi16_t (*current_getbaud)(v34_state_t *s);
325 #else
326  complexf_t (*current_getbaud)(v34_state_t *s);
327 #endif
328 
329  /*! \brief Mapping frame parsed input */
330  uint32_t r0;
331  uint16_t qbits[8];
332  uint16_t ibits[4];
333 
334  /*! \brief (x0,y0) (x1,y1)... */
335  int mjk[8];
336 
337  int step_2d;
338 
340  uint32_t bitstream;
341 
342  int i;
343 
344  /*! \brief Parameters for the current bit rate and baud rate */
346 
347  /*! \brief We need to remember some old x values
348  in the C code: x[0] x[1] x[2] x[3] x[4] x[5] x[6] x[7] x[8] x[9] x[10]
349  in V.34: x[-3] x[-2] x[-1] x[0] x[1] x[2] x[3] x[4] x[5] x[6] x[7] */
350  complexi16_t x[8 + V34_XOFF];
351  /*! \brief Precoder coefficients */
352  complexi16_t precoder_coeffs[3];
353 
354  complexi16_t c;
355  complexi16_t p;
356  int z;
357  int y0;
358  int state;
359 
360 #if defined(SPANDSP_USE_FIXED_POINT)
361  int16_t gain;
362 #else
363  float gain;
364 #endif
365 
366 #if defined(SPANDSP_USE_FIXED_POINT)
367  /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
368  int16_t rrc_filter_re[V34_INFO_TX_FILTER_STEPS];
369  int16_t rrc_filter_im[V34_INFO_TX_FILTER_STEPS];
370  complexi16_t lastbit;
371 #else
372  /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
373  float rrc_filter_re[V34_INFO_TX_FILTER_STEPS];
374  float rrc_filter_im[V34_INFO_TX_FILTER_STEPS];
375  complexf_t lastbit;
376 #endif
377  /*! \brief Current offset into the RRC pulse shaping filter buffer. */
379 
380  /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
381  uint32_t carrier_phase;
382  /*! \brief The update rate for the phase of the control channel carrier (i.e. the DDS increment). */
384  /*! \brief The update rate for the phase of the V.34 carrier (i.e. the DDS increment). */
386 
387  /*! \brief The current phase of the guard tone (i.e. the DDS parameter). */
388  uint32_t guard_phase;
389  /*! \brief The update rate for the phase of the guard tone (i.e. the DDS increment). */
391  /*! \brief Guard tone signal level. */
392  float guard_level;
393  /*! \brief The current fractional phase of the baud timing. */
395 
396  int stage;
397  int convolution;
398  int training_stage;
399  int current_modulator;
400  int diff;
401 
402  int line_probe_cycles;
403  int line_probe_step;
404  float line_probe_scaling;
405  int tone_duration;
406 
407  int super_frame;
408  int data_frame;
409  int s_bit_cnt;
410  int aux_bit_cnt;
411 
412  uint16_t v0_pattern;
413 
414  uint8_t txbuf[50];
415  int txbits;
416  int txptr;
417  const conv_encode_table_t *conv_encode_table;
418 
419  bool info0_acknowledgement;
420 
421  union
422  {
423  info1a_t info1a;
424  info1c_t info1c;
425  infoh_t infoh;
426  };
427  union
428  {
429  mp_t mp;
430  mph_t mph;
431  };
432 
433  int persistence2;
434 
435  /*! \brief The get_bit function in use at any instant. */
437 
438  /*! \brief Used to align the transmit and receive positions, to ensure things like
439  round trip delay are properly handled. */
440  span_sample_timer_t sample_time;
441 
442  logging_state_t *logging;
444 
445 typedef struct
446 {
447 #if defined(SPANDSP_USE_FIXED_POINT)
448  /*! \brief Low band edge filter for symbol sync. */
449  int32_t symbol_sync_low[2];
450  /*! \brief High band edge filter for symbol sync. */
451  int32_t symbol_sync_high[2];
452  /*! \brief DC filter for symbol sync. */
453  int32_t symbol_sync_dc_filter[2];
454  /*! \brief Baud phase for symbol sync. */
455  int32_t baud_phase;
456 
457  /*! \brief Low band edge filter coefficients for symbol sync. */
458  int32_t low_band_edge_coeff[3];
459  /*! \brief High band edge filter coefficients for symbol sync. */
460  int32_t high_band_edge_coeff[3];
461  /*! \brief A coefficient common to the low and high band edges */
462  int32_t mixed_edges_coeff_3;
463 #else
464  /*! \brief Low band edge filter for symbol sync. */
465  float symbol_sync_low[2];
466  /*! \brief High band edge filter for symbol sync. */
467  float symbol_sync_high[2];
468  /*! \brief DC filter for symbol sync. */
469  float symbol_sync_dc_filter[2];
470  /*! \brief Baud phase for symbol sync. */
471  float baud_phase;
472 
473  /*! \brief Low band edge filter coefficients for symbol sync. */
474  float low_band_edge_coeff[3];
475  /*! \brief High band edge filter coefficients for symbol sync. */
476  float high_band_edge_coeff[3];
477  /*! \brief A coefficient common to the low and high band edges */
479 #endif
480 } ted_t;
481 
482 typedef struct
483 {
484  /*! \brief Viterbi trellis state table
485  16 4D symbols deep, with 16 states each
486  Each state has 4 entries: cumulative path metric, and prev. path pointer, x, y
487  circularly addressed */
488  struct
489  {
490  /*! \brief Cumulative path metric */
491  uint32_t cumulative_path_metric[16];
492  /*! \brief Previous path pointer */
493  uint16_t previous_path_ptr[16];
494  uint16_t pts[16];
495  uint16_t branch_error_x[8];
496  /*! \brief Branches of the x and y coords of the points in the eight 4D subsets
497  to which a sequence of 2D points has been sliced.
498  indexed from 0 to 15 --> 8 points for 16 past 4D symbols */
499  complexi16_t bb[2][8];
500  } vit[16];
501  /*! \brief Latest viterbi table slot. */
502  int ptr;
503  /*! \brief Countdown to the first data being available from the viterbi pipeline */
504  int windup;
505  int16_t curr_min_state;
506 
507  int16_t error[2][4];
508 
509  /*! \brief Eight 4D squared branch errors for each of 8 4D subsets.
510  Indexed array for indexing from viterbi lookup table */
511  uint16_t branch_error[8];
512 
513  const conv_decode_table_t *conv_decode_table;
514 } viterbi_t;
515 
516 typedef struct
517 {
518  /*! \brief True if this is the calling side modem. */
520  /*! \brief True if this is a full duplex modem. */
521  bool duplex;
522  /*! The current source end when in half-duplex mode */
524  /*! The current operating state when in half-duplex mode */
526  /*! \brief */
527  int bit_rate;
528  /*! \brief The callback function used to put each bit received. */
530  /*! \brief A user specified opaque pointer passed to the put_bit routine. */
532 
533  /*! \brief The callback function used to put each aux bit received. */
535  /*! \brief A user specified opaque pointer passed to the put_aux_bit routine. */
537 
538  /*! \brief A callback function which may be enabled to report every symbol's
539  constellation position. */
540  qam_report_handler_t qam_report;
541  /*! \brief A user specified opaque pointer passed to the qam_report callback
542  routine. */
544 
545  /*! \brief The current baud rate selection, as a value from 0 to 5. */
547  /*! \brief True if using the higher of the two carrier frequency options. */
549 
550  int stage;
551  int received_event;
552 
553  /*! \brief The register for the data scrambler. */
554  uint32_t scramble_reg;
555  /*! \brief The scrambler tap which selects between the caller and answerer scramblers */
557 
558  uint16_t v0_pattern;
559 
560  /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */
562  /*! \brief The power meter level at which carrier on is declared. */
564  /*! \brief The power meter level at which carrier off is declared. */
566  bool signal_present;
567 
569  uint32_t bitstream;
570 
571  /*! \brief Mapping frame output */
572  uint32_t r0;
573  uint16_t qbits[8];
574  uint16_t ibits[4];
575 
576  /*! \brief (x0,y0) (x1,y1)... */
577  int mjk[8];
578 
579  int step_2d;
580 
581  /*! \brief Parameters for the current bit rate and baud rate */
583 
584  /*! \brief yt's are the noise corrupted points fed to the viterbi decoder.
585  Assumed to have format 9:7 (7 fractional bits) */
587  complexi16_t xt[4];
588 
589  complexi16_t x[3];
590  complexi16_t h[3];
591 
592  /*! \brief These are quantized points in the respective 2D coset (0,1,2,3) */
593  complexi16_t xy[2][4];
594 
595  viterbi_t viterbi;
596 
597  /*! \brief ww contains old z, current z and current w */
598  int16_t ww[3];
599 
600  /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
601  uint32_t carrier_phase;
602  /*! \brief The carrier update rate saved for reuse when using short training. */
604 
605  /*! \brief The update rate for the phase of the control channel carrier (i.e. the DDS increment). */
607  /*! \brief The update rate for the phase of the V.34 carrier (i.e. the DDS increment). */
609 
610  /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
611 #if defined(SPANDSP_USE_FIXED_POINT)
612  int16_t rrc_filter[V34_RX_FILTER_STEPS];
613 #else
614  float rrc_filter[V34_RX_FILTER_STEPS];
615 #endif
616  /*! \brief Current offset into the RRC pulse shaping filter buffer. */
618  /*! \brief Current read offset into the equalizer buffer. */
619  int eq_step;
620  /*! \brief Current write offset into the equalizer buffer. */
622  int shaper_sets;
623 
624 #if defined(SPANDSP_USE_FIXED_POINT)
625  /*! \brief The scaling factor assessed by the AGC algorithm. */
626  int16_t agc_scaling;
627  /*! \brief The previous value of agc_scaling, needed to reuse old training. */
628  int16_t agc_scaling_save;
629 #else
630  /*! \brief The scaling factor assessed by the AGC algorithm. */
631  float agc_scaling;
632  /*! \brief The previous value of agc_scaling, needed to reuse old training. */
634 #endif
635  ted_t pri_ted;
636  ted_t cc_ted;
637 
638 #if defined(SPANDSP_USE_FIXED_POINT)
639  /*! \brief The proportional part of the carrier tracking filter. */
640  float carrier_track_p;
641  /*! \brief The integral part of the carrier tracking filter. */
642  float carrier_track_i;
643 #else
644  /*! \brief The proportional part of the carrier tracking filter. */
646  /*! \brief The integral part of the carrier tracking filter. */
648 #endif
649 
650  const v34_rx_shaper_t *shaper_re;
651  const v34_rx_shaper_t *shaper_im;
652 
653  /*! \brief The total symbol timing correction since the carrier came up.
654  This is only for performance analysis purposes. */
656 
657  /*! \brief The current half of the baud. */
659  /*! \brief The measured round trip delay estimate, in sample times */
661 
662  int duration;
663  int bit_count;
664  int target_bits;
665  uint16_t crc;
666  uint32_t last_angles[2];
667 
668  /*! \brief Buffer for receiving info frames. */
669  uint8_t info_buf[25];
670 
671  int super_frame;
672  int data_frame;
673  int s_bit_cnt;
674  int aux_bit_cnt;
675 
676  uint8_t rxbuf[50];
677  int rxbits;
678  int rxptr;
679 
680  int blip_duration;
681 
682  v34_capabilities_t far_capabilities;
683 
684  /*! \brief Whether or not a carrier drop was detected and the signal delivery is pending. */
686  /*! \brief A count of the current consecutive samples below the carrier off threshold. */
688  /*! \brief A highest magnitude sample seen. */
689  int16_t high_sample;
690 
691  bool info0_acknowledgement;
692 
693  union
694  {
695  info1a_t info1a;
696  info1c_t info1c;
697  infoh_t infoh;
698  };
699 
700  int step;
701  int persistence1;
702  int persistence2;
703 
704  /* MP or MPh receive tracking data */
705  int mp_count;
706  int mp_len;
707  int mp_and_fill_len;
708  int mp_seen;
709 
710  int dft_ptr;
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];
715  int32_t base_phase;
716  complexf_t last_sample;
717  #else
718  complexf_t dft_buffer[160];
719  float l1_l2_gains[25];
720  float l1_l2_phases[25];
721  float base_phase;
722  complexf_t last_sample;
723 #endif
724  int l1_l2_duration;
725 
726  int current_demodulator;
727 
728  /*! \brief Used to align the transmit and receive positions, to ensure things like
729  round trip delay are properly handled. */
730  span_sample_timer_t sample_time;
731 
732  span_sample_timer_t tone_ab_hop_time;
733 
734  logging_state_t *logging;
736 
737 /*!
738  V.34 modem descriptor. This defines the working state for a single instance
739  of a V.34 modem.
740 */
742 {
743  /*! \brief True if this is the calling side modem. */
745  /*! \brief True if this is a full duplex modem. */
746  bool duplex;
747  /*! The current source end when in half-duplex mode */
749  /*! The current operating state when in half-duplex mode */
751  /*! \brief The bit rate of the modem. */
752  int bit_rate;
753 
754  v34_tx_state_t tx;
755  v34_rx_state_t rx;
757 
758  /*! \brief Error and flow logging control */
760 };
761 
762 #endif
763 /*- End of file ------------------------------------------------------------*/
bool half_duplex_state
Definition: private/v34.h:525
int16_t high_sample
A highest magnitude sample seen.
Definition: private/v34.h:689
Definition: private/v34.h:289
float agc_scaling
The scaling factor assessed by the AGC algorithm.
Definition: private/v34.h:631
float guard_level
Guard tone signal level.
Definition: private/v34.h:392
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
Definition: private/v34.h:248
Definition: private/power_meter.h:33
int samples_per_symbol_numerator
Definition: private/v34.h:284
Definition: private/v34.h:209
Definition: complex.h:88
int samples_per_symbol_denominator
Definition: private/v34.h:286
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
void * get_bit_user_data
A user specified opaque pointer passed to the get_bit function.
Definition: private/v34.h:304
int bit_rate
Parameters for the current bit rate and baud rate.
Definition: private/v34.h:268
logging_state_t logging
Error and flow logging control.
Definition: private/v34.h:759
int rrc_filter_step
Current offset into the RRC pulse shaping filter buffer.
Definition: private/v34.h:378
power_meter_t power
A power meter, to measure the HPF&#39;ed signal power in the channel.
Definition: private/v34.h:561
int r
Mapping frame switching parameter.
Definition: private/v34.h:281
uint32_t r0
Mapping frame output.
Definition: private/v34.h:572
void * get_aux_bit_user_data
A user specified opaque pointer passed to the get_aux_bit function.
Definition: private/v34.h:309
void * put_bit_user_data
A user specified opaque pointer passed to the put_bit routine.
Definition: private/v34.h:531
int windup
Countdown to the first data being available from the viterbi pipeline.
Definition: private/v34.h:504
Definition: private/v34.h:200
int(* span_get_bit_func_t)(void *user_data)
Definition: async.h:127
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
bool duplex
True if this is a full duplex modem.
Definition: private/v34.h:521
bool high_carrier
True if using the higher of the two carrier frequency options.
Definition: private/v34.h:314
v34_parameters_t parms
Parameters for the current bit rate and baud rate.
Definition: private/v34.h:345
int k
The number of shell mapped bits.
Definition: private/v34.h:273
bool high_carrier
True if using the higher of the two carrier frequency options.
Definition: private/v34.h:548
void * qam_user_data
A user specified opaque pointer passed to the qam_report callback routine.
Definition: private/v34.h:543
int scrambler_tap
The scrambler tap which selects between the caller and answerer scramblers.
Definition: private/v34.h:556
int q
The number of uncoded Q bits per 2D symbol.
Definition: private/v34.h:278
bool calling_party
True if this is the calling side modem.
Definition: private/v34.h:519
bool duplex
True if this is a full duplex modem.
Definition: private/v34.h:746
Definition: private/v34.h:193
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 carrier_on_power
The power meter level at which carrier on is declared.
Definition: private/v34.h:563
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
void(* span_put_bit_func_t)(void *user_data, int bit)
Definition: async.h:123
bool half_duplex_source
Definition: private/v34.h:523
int rrc_filter_step
Current offset into the RRC pulse shaping filter buffer.
Definition: private/v34.h:617
Definition: private/v34.h:445
int scrambler_tap
The scrambler tap which selects between the caller and answerer scramblers.
Definition: private/v34.h:319
Definition: private/bitstream.h:30
span_get_bit_func_t get_bit
The callback function used to get the next bit to be transmitted.
Definition: private/v34.h:302
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
int eq_step
Current read offset into the equalizer buffer.
Definition: private/v34.h:619
int b
Bits per high mapping frame. A low mapping frame is one bit less.
Definition: private/v34.h:270
Definition: private/v34.h:741
float carrier_track_i
The integral part of the carrier tracking filter.
Definition: private/v34.h:647
int low_samples
A count of the current consecutive samples below the carrier off threshold.
Definition: private/v34.h:687
int carrier_drop_pending
Whether or not a carrier drop was detected and the signal delivery is pending.
Definition: private/v34.h:685
span_put_bit_func_t put_bit
The callback function used to put each bit received.
Definition: private/v34.h:529
int baud_rate
The current baud rate selection, as a value from 0 to 5.
Definition: private/v34.h:312
float baud_phase
Baud phase for symbol sync.
Definition: private/v34.h:471
float carrier_track_p
The proportional part of the carrier tracking filter.
Definition: private/v34.h:645
bool calling_party
True if this is the calling side modem.
Definition: private/v34.h:292
span_get_bit_func_t current_get_bit
The get_bit function in use at any instant.
Definition: private/v34.h:436
bool half_duplex_state
Definition: private/v34.h:298
int baud_rate
The current baud rate selection, as a value from 0 to 5.
Definition: private/v34.h:546
uint32_t scramble_reg
The register for the data scrambler.
Definition: private/v34.h:554
bool half_duplex_state
Definition: private/v34.h:750
uint32_t guard_phase
The current phase of the guard tone (i.e. the DDS parameter).
Definition: private/v34.h:388
bool half_duplex_source
Definition: private/v34.h:296
Definition: complex.h:42
int baud_half
The current half of the baud.
Definition: private/v34.h:658
Definition: private/v34.h:263
Definition: private/v34.h:222
v34_parameters_t parms
Parameters for the current bit rate and baud rate.
Definition: private/v34.h:582
int baud_phase
The current fractional phase of the baud timing.
Definition: private/v34.h:394
span_put_bit_func_t put_aux_bit
The callback function used to put each aux bit received.
Definition: private/v34.h:534
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
uint32_t r0
Mapping frame parsed input.
Definition: private/v34.h:330
Definition: private/logging.h:33
int bit_rate
The bit rate of the modem.
Definition: private/v34.h:752
uint32_t carrier_phase
The current phase of the carrier (i.e. the DDS parameter).
Definition: private/v34.h:601
int32_t carrier_off_power
The power meter level at which carrier off is declared.
Definition: private/v34.h:565
bool calling_party
True if this is the calling side modem.
Definition: private/v34.h:744
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
int32_t carrier_phase_rate_save
The carrier update rate saved for reuse when using short training.
Definition: private/v34.h:603
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
bool half_duplex_source
Definition: private/v34.h:748
float mixed_edges_coeff_3
A coefficient common to the low and high band edges.
Definition: private/v34.h:478
int max_bit_rate_code
The code (0-16) for the maximum bit rate.
Definition: private/v34.h:266
Definition: private/modem_echo.h:62
int eq_put_step
Current write offset into the equalizer buffer.
Definition: private/v34.h:621
int round_trip_delay_estimate
The measured round trip delay estimate, in sample times.
Definition: private/v34.h:660
int ptr
Latest viterbi table slot.
Definition: private/v34.h:502
complexi16_t yt
yt&#39;s are the noise corrupted points fed to the viterbi decoder. Assumed to have format 9:7 (7 fractio...
Definition: private/v34.h:586
bool duplex
True if this is a full duplex modem.
Definition: private/v34.h:294
uint32_t carrier_phase
The current phase of the carrier (i.e. the DDS parameter).
Definition: private/v34.h:381
Definition: private/v34.h:232
void * put_aux_bit_user_data
A user specified opaque pointer passed to the put_aux_bit routine.
Definition: private/v34.h:536
Definition: private/v34.h:482
Definition: private/v34.h:516
float agc_scaling_save
The previous value of agc_scaling, needed to reuse old training.
Definition: private/v34.h:633
Definition: private/v34.h:181
uint32_t scramble_reg
The register for the data scrambler.
Definition: private/v34.h:317