view librftab/smallconv.c @ 834:c458e33060bf

ffstools/tiaud: prep for adding support for new AEC
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 30 Jul 2021 00:10:13 +0000
parents b73c21a2148f
children
line wrap: on
line source

/*
 * /gsm/rf/afcdac and /gsm/rf/stdmap each store a single 16-bit value,
 * and are not tables in the rftw/rftr sense, hence the code in rftablewr.c
 * does not handle these two.  However, in fc-cal2text we would like to
 * handle their conversion from binary to ASCII the same way as the bigger
 * tables, hence the two functions in this module.
 */

#include <sys/types.h>
#include <stdio.h>
#include <stdint.h>
#include <endian.h>

void
write_afcdac_ascii(bin, outf)
	uint16_t *bin;
	FILE *outf;
{
	int i;

	i = le16toh(*bin);
	if (i >= 32768)
		i -= 65536;
	fprintf(outf, "%d\n", i);
}

void
write_stdmap_ascii(bin, outf)
	uint16_t *bin;
	FILE *outf;
{
	int i;

	i = le16toh(*bin);
	fprintf(outf, "0x%04X\n", i);
}