comparison ffstools/cal2text/smallconv.c @ 142:d41edd329670

fc-cal2text utility written, compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 27 Feb 2017 03:37:11 +0000
parents
children
comparison
equal deleted inserted replaced
141:6b01d4ef85c3 142:d41edd329670
1 /*
2 * /gsm/rf/afcdac and /gsm/rf/stdmap each store a single 16-bit value,
3 * and are not tables in the rftw/rftr sense, hence the code in rftablewr.c
4 * does not handle these two. However, in fc-cal2text we would like to
5 * handle their conversion from binary to ASCII the same way as the bigger
6 * tables, hence the two functions in this module.
7 */
8
9 #include <sys/types.h>
10 #include <stdio.h>
11 #include <stdint.h>
12 #include <endian.h>
13
14 void
15 write_afcdac_ascii(bin, outf)
16 uint16_t *bin;
17 FILE *outf;
18 {
19 int i;
20
21 i = le16toh(*bin);
22 if (i >= 32768)
23 i -= 65536;
24 fprintf(outf, "%d\n", i);
25 }
26
27 void
28 write_stdmap_ascii(bin, outf)
29 uint16_t *bin;
30 FILE *outf;
31 {
32 int i;
33
34 i = le16toh(*bin);
35 fprintf(outf, "0x%04X\n", i);
36 }