annotate libgsmhr1/tfo.c @ 587:7bce90c844c2 default tip

tw5b-dump: support verbose invalid SID per TW-TS-002 v1.2.0
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 12 Mar 2025 20:38:23 +0000
parents 7d0e565aa1ae
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
582
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * In this module we implement the TFO transform for HRv1. Our implementation
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * of this transform is a wrapper around our RxFE block that was specifically
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * designed to be usable both for the full decoder and for TFO.
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 */
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stddef.h>
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdint.h>
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <string.h>
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include "tw_gsmhr.h"
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include "namespace.h"
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include "rxfe.h"
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 void gsmhr_tfo_xfrm(struct gsmhr_rxfe_state *st, int dtxd, const int16_t *ul,
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 int16_t *dl)
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 {
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 rxfe_main(st, ul, dl, dtxd, NULL, NULL, dl + 19);
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 if (dtxd) {
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 dl[18] = 0; /* VAD=0 dummy setting */
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 if (!dl[19]) /* turn CN into re-emission of SID */
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 gsmhr_set_sid_cw_params(dl);
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 } else {
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 /* sans-DTX: VAD=1 SP=1 always */
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 dl[18] = 1;
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 dl[19] = 1;
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 }
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 /* homing logic */
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 if (!ul[18] &&
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 !memcmp(ul, gsmhr_dhf_params, sizeof(int16_t) * GSMHR_NUM_PARAMS))
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 gsmhr_rxfe_reset(st);
7d0e565aa1ae libgsmhr1: implement TFO wrapper around RxFE
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 }