FreeCalypso > hg > freecalypso-tools
changeset 759:d2fccd82a83e
ti2arfcn utility added to miscutil
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 27 Nov 2020 04:39:38 +0000 |
parents | b8cb116a7dc7 |
children | e1c8c5bcb233 |
files | .hgignore miscutil/Makefile miscutil/ti2arfcn.c |
diffstat | 3 files changed, 78 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Fri Nov 27 03:53:11 2020 +0000 +++ b/.hgignore Fri Nov 27 04:39:38 2020 +0000 @@ -43,6 +43,7 @@ ^miscutil/make-imeisv$ ^miscutil/mokosrec2bin$ ^miscutil/srec-regions$ +^miscutil/ti2arfcn$ ^ringtools/fc-e1decode$ ^ringtools/fc-e1gen$
--- a/miscutil/Makefile Fri Nov 27 03:53:11 2020 +0000 +++ b/miscutil/Makefile Fri Nov 27 04:39:38 2020 +0000 @@ -2,7 +2,7 @@ CFLAGS= -O2 PROGS= arfcn2ti fc-fr2tch fc-gsm2vm fc-pulse-dtr fc-pulse-rts fc-rgbconv \ fc-serterm fc-tch2fr fc-vm2hex imei-luhn make-imeisv mokosrec2bin \ - srec-regions + srec-regions ti2arfcn SCRIPTS=c139explore pirexplore INSTALL_PREFIX= /opt/freecalypso @@ -58,6 +58,9 @@ srec-regions: srec-regions.c ${CC} ${CFLAGS} -o $@ $@.c +ti2arfcn: ti2arfcn.c + ${CC} ${CFLAGS} -o $@ $@.c + install: mkdir -p ${INSTBIN} install -c ${PROGS} ${SCRIPTS} ${INSTBIN}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/miscutil/ti2arfcn.c Fri Nov 27 04:39:38 2020 +0000 @@ -0,0 +1,73 @@ +/* + * TI's TCS211 L1 does not use standard ARFCNs internally, instead it uses + * its own non-standard radio_freq numbers in their place. Other firmware + * components and all external interfaces do use standard ARFCNs, thus + * conversion functions are invoked at appropriate points in the firmware. + * However, L1-internal radio_freq numbers are emitted in L1 debug traces, + * thus anyone looking at these traces needs to be able to convert between + * standard ARFCNs and L1-internal radio_freq. + * + * The present utility converts TI's radio_freq numbers as seen in L1 traces + * into standard ARFCNs. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <strings.h> + +main(argc, argv) + char **argv; +{ + int ti_num; + + if (argc != 3) { +usage: fprintf(stderr, "usage: %s {eu|us} L1_radio_freq\n", argv[0]); + exit(1); + } + ti_num = atoi(argv[2]); + if (!strcmp(argv[1], "eu")) + ti2arfcn_eu(ti_num); + else if (!strcmp(argv[1], "us")) + ti2arfcn_us(ti_num); + else + goto usage; + exit(0); +} + +ti2arfcn_eu(radio_freq) +{ + int arfcn; + + if (radio_freq < 1 || radio_freq > 548) { + fprintf(stderr, + "error: specified radio_freq is out of range for dual-EU\n"); + exit(1); + } + if (radio_freq < 175) { + if (radio_freq <= 124) + arfcn = radio_freq; + else if (radio_freq < 174) + arfcn = radio_freq - 125 + 975; + else + arfcn = 0; + } else + arfcn = radio_freq - 175 + 512; + printf("%d\n", arfcn); +} + +ti2arfcn_us(radio_freq) +{ + int arfcn; + + if (radio_freq < 1 || radio_freq > 423) { + fprintf(stderr, + "error: specified radio_freq is out of range for dual-US\n"); + exit(1); + } + if (radio_freq < 125) + arfcn = radio_freq - 1 + 128; + else + arfcn = radio_freq - 125 + 512; + printf("%d\n", arfcn); +}