FreeCalypso > hg > gsm-codec-lib
changeset 165:ef3ea52a190f
rename gsmfr-cvt-dlcap to gsmfr-dlcap-gsmx
for consistency with EFR version
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Dec 2022 04:09:03 +0000 |
parents | 5f23cb3f0f8d |
children | 500f3e93964f |
files | .hgignore frtest/Makefile frtest/cvt-dlcap.c frtest/dlcap-gsmx.c |
diffstat | 4 files changed, 84 insertions(+), 86 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Fri Dec 16 03:05:21 2022 +0000 +++ b/.hgignore Fri Dec 16 04:09:03 2022 +0000 @@ -24,9 +24,9 @@ ^efrtest/gsmefr-etsi-enc$ ^efrtest/gsmefr-rec2etsi$ -^frtest/gsmfr-cvt-dlcap$ ^frtest/gsmfr-decode$ ^frtest/gsmfr-decode-r$ +^frtest/gsmfr-dlcap-gsmx$ ^frtest/gsmfr-encode$ ^frtest/gsmfr-encode-r$ ^frtest/gsmfr-hand-test$
--- a/frtest/Makefile Fri Dec 16 03:05:21 2022 +0000 +++ b/frtest/Makefile Fri Dec 16 04:09:03 2022 +0000 @@ -1,25 +1,23 @@ CC= gcc CFLAGS= -O2 -PROGS= gsmfr-cvt-dlcap gsmfr-decode gsmfr-decode-r gsmfr-encode gsmfr-encode-r\ - gsmfr-hand-test gsmfr-max-out gsmfr-preproc +PROGS= gsmfr-decode gsmfr-decode-r gsmfr-dlcap-gsmx gsmfr-encode \ + gsmfr-encode-r gsmfr-hand-test gsmfr-max-out gsmfr-preproc LIBPP= ../libgsmfrp/libgsmfrp.a LIBTEST=../libtest/libtest.a LIBDEC= ${LIBTEST} ${LIBPP} INSTBIN=/opt/freecalypso/bin -CVT_OBJS=cvt-dlcap.o tidsp.o - all: ${PROGS} -gsmfr-cvt-dlcap: ${CVT_OBJS} ${LIBTEST} - ${CC} ${CFLAGS} -o $@ ${CVT_OBJS} ${LIBTEST} - gsmfr-decode: decode.o ${LIBDEC} ${CC} ${CFLAGS} -o $@ decode.o ${LIBDEC} -lgsm gsmfr-decode-r: decode-r.o ${LIBDEC} ${CC} ${CFLAGS} -o $@ decode-r.o ${LIBDEC} -lgsm +gsmfr-dlcap-gsmx: dlcap-gsmx.o tidsp.o ${LIBTEST} + ${CC} ${CFLAGS} -o $@ dlcap-gsmx.o tidsp.o ${LIBTEST} + gsmfr-encode: encode.o ${LIBTEST} ${CC} ${CFLAGS} -o $@ encode.o ${LIBTEST} -lgsm
--- a/frtest/cvt-dlcap.c Fri Dec 16 03:05:21 2022 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* - * This program reads a TCH/FS downlink capture produced with FreeCalypso tools - * (fw version with TCH downlink sniffing feature and fc-shell tch record) - * and converts it into our extended-libgsm binary format, to be further - * fed to gsmfr-decode. - */ - -#include <ctype.h> -#include <stdio.h> -#include <stdint.h> -#include <stdlib.h> -#include <string.h> -#include <strings.h> - -main(argc, argv) - char **argv; -{ - FILE *inf, *outf; - char linebuf[128]; - int lineno, rc; - uint16_t status_words[3]; - uint8_t tidsp_bytes[33], libgsm_bytes[33], bfi[2]; - unsigned fn_mod_104; - - if (argc != 3) { - fprintf(stderr, "usage: %s infile outfile\n", argv[0]); - exit(1); - } - inf = fopen(argv[1], "r"); - if (!inf) { - perror(argv[1]); - exit(1); - } - outf = fopen(argv[2], "w"); - if (!outf) { - perror(argv[2]); - exit(1); - } - for (lineno = 1; fgets(linebuf, sizeof linebuf, inf); lineno++) { - /* support both old and new formats */ - if (isxdigit(linebuf[0]) && isxdigit(linebuf[1]) && - isxdigit(linebuf[2]) && isxdigit(linebuf[3])) { - rc = parse_dlcap_common(linebuf, status_words, - tidsp_bytes); - if (rc < 0) { -invalid: fprintf(stderr, - "error: %s is not in the expected format\n", - argv[1]); - exit(1); - } - fn_mod_104 = 0; /* won't have TAF */ - } else if (!strncmp(linebuf, "FR ", 3)) { - rc = parse_dlcap_common(linebuf + 3, status_words, - tidsp_bytes); - if (rc < 0) - goto invalid; - if (linebuf[84] != ' ') - goto invalid; - if (!isdigit(linebuf[85])) - goto invalid; - fn_mod_104 = strtoul(linebuf + 85, 0, 10); - } else - goto invalid; - /* - * Bit 15 of status word 0 is buffer validity flag, - * bit 2 is BFI. - */ - if (!(status_words[0] & 0x8000) || (status_words[0] & 0x0004)) { - bfi[0] = 0xBF; - bfi[1] = fn_mod_104 == 60; - fwrite(bfi, 1, 2, outf); - } else { - gsm0610_tidsp_to_libgsm(tidsp_bytes, libgsm_bytes); - fwrite(libgsm_bytes, 1, 33, outf); - } - } - exit(0); -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/frtest/dlcap-gsmx.c Fri Dec 16 04:09:03 2022 +0000 @@ -0,0 +1,78 @@ +/* + * This program reads a TCH/FS downlink capture produced with FreeCalypso tools + * (fw version with TCH downlink sniffing feature and fc-shell tch record) + * and converts it into our extended-libgsm binary format, to be further + * fed to gsmfr-decode. + */ + +#include <ctype.h> +#include <stdio.h> +#include <stdint.h> +#include <stdlib.h> +#include <string.h> +#include <strings.h> + +main(argc, argv) + char **argv; +{ + FILE *inf, *outf; + char linebuf[128]; + int lineno, rc; + uint16_t status_words[3]; + uint8_t tidsp_bytes[33], libgsm_bytes[33], bfi[2]; + unsigned fn_mod_104; + + if (argc != 3) { + fprintf(stderr, "usage: %s infile outfile\n", argv[0]); + exit(1); + } + inf = fopen(argv[1], "r"); + if (!inf) { + perror(argv[1]); + exit(1); + } + outf = fopen(argv[2], "w"); + if (!outf) { + perror(argv[2]); + exit(1); + } + for (lineno = 1; fgets(linebuf, sizeof linebuf, inf); lineno++) { + /* support both old and new formats */ + if (isxdigit(linebuf[0]) && isxdigit(linebuf[1]) && + isxdigit(linebuf[2]) && isxdigit(linebuf[3])) { + rc = parse_dlcap_common(linebuf, status_words, + tidsp_bytes); + if (rc < 0) { +invalid: fprintf(stderr, + "error: %s is not in the expected format\n", + argv[1]); + exit(1); + } + fn_mod_104 = 0; /* won't have TAF */ + } else if (!strncmp(linebuf, "FR ", 3)) { + rc = parse_dlcap_common(linebuf + 3, status_words, + tidsp_bytes); + if (rc < 0) + goto invalid; + if (linebuf[84] != ' ') + goto invalid; + if (!isdigit(linebuf[85])) + goto invalid; + fn_mod_104 = strtoul(linebuf + 85, 0, 10); + } else + goto invalid; + /* + * Bit 15 of status word 0 is buffer validity flag, + * bit 2 is BFI. + */ + if (!(status_words[0] & 0x8000) || (status_words[0] & 0x0004)) { + bfi[0] = 0xBF; + bfi[1] = fn_mod_104 == 60; + fwrite(bfi, 1, 2, outf); + } else { + gsm0610_tidsp_to_libgsm(tidsp_bytes, libgsm_bytes); + fwrite(libgsm_bytes, 1, 33, outf); + } + } + exit(0); +}