view 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
line wrap: on
line source

/*
 * In this module we implement the TFO transform for HRv1.  Our implementation
 * of this transform is a wrapper around our RxFE block that was specifically
 * designed to be usable both for the full decoder and for TFO.
 */

#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include "tw_gsmhr.h"
#include "namespace.h"
#include "rxfe.h"

void gsmhr_tfo_xfrm(struct gsmhr_rxfe_state *st, int dtxd, const int16_t *ul,
		    int16_t *dl)
{
	rxfe_main(st, ul, dl, dtxd, NULL, NULL, dl + 19);
	if (dtxd) {
		dl[18] = 0;	/* VAD=0 dummy setting */
		if (!dl[19])	/* turn CN into re-emission of SID */
			gsmhr_set_sid_cw_params(dl);
	} else {
		/* sans-DTX: VAD=1 SP=1 always */
		dl[18] = 1;
		dl[19] = 1;
	}
	/* homing logic */
	if (!ul[18] &&
	    !memcmp(ul, gsmhr_dhf_params, sizeof(int16_t) * GSMHR_NUM_PARAMS))
		gsmhr_rxfe_reset(st);
}