changeset 46:edd2e20e7090

gsmrec-dump: decode EFR frames
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 25 Nov 2022 03:06:03 +0000
parents 4ae1dd43e332
children 89945a3b576e
files Makefile miscutil/Makefile miscutil/gsmrec-dump.c
diffstat 3 files changed, 21 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Nov 25 02:40:21 2022 +0000
+++ b/Makefile	Fri Nov 25 03:06:03 2022 +0000
@@ -10,7 +10,7 @@
 all:	${SUBDIR}
 
 frtest:		libgsmfrp libtest
-miscutil:	libtest
+miscutil:	libgsmefr libtest
 
 ${SUBDIR}: FRC
 	cd $@; ${MAKE} ${MFLAGS} CC=${CC} CFLAGS="${CFLAGS}"
--- a/miscutil/Makefile	Fri Nov 25 02:40:21 2022 +0000
+++ b/miscutil/Makefile	Fri Nov 25 03:06:03 2022 +0000
@@ -1,13 +1,14 @@
 CC=	gcc
 CFLAGS=	-O2
 PROGS=	gsmrec-dump
+LIBEFR=	../libgsmefr/libgsmefr.a
 LIBTEST=../libtest/libtest.a
 INSTBIN=/opt/freecalypso/bin
 
 all:	${PROGS}
 
-gsmrec-dump:	gsmrec-dump.o ${LIBTEST}
-	${CC} ${CFLAGS} -o $@ gsmrec-dump.o ${LIBTEST} -lgsm
+gsmrec-dump:	gsmrec-dump.o ${LIBTEST} ${LIBEFR}
+	${CC} ${CFLAGS} -o $@ gsmrec-dump.o ${LIBTEST} ${LIBEFR} -lgsm
 
 install:
 	mkdir -p ${INSTBIN}
--- a/miscutil/gsmrec-dump.c	Fri Nov 25 02:40:21 2022 +0000
+++ b/miscutil/gsmrec-dump.c	Fri Nov 25 03:06:03 2022 +0000
@@ -7,6 +7,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <gsm.h>
+#include "../libgsmefr/gsm_efr.h"
 #include "../libtest/binreader.h"
 
 main(argc, argv)
@@ -16,7 +17,7 @@
 	gsm dummy_state;
 	unsigned frame_index;
 	uint8_t frame[BINFILE_MAX_FRAME];
-	gsm_signal fr_params[76];
+	gsm_signal params[76];
 	int rc, i, j, n;
 
 	if (argc != 2) {
@@ -47,19 +48,30 @@
 			printf("BFI TAF=%u\n", frame[1] & 1);
 			break;
 		case 0xC0:
-			puts("EFR (decoding not implemented)");
+			printf("EFR SID=%d LPC", EFR_sid_classify(frame));
+			EFR_frame2params(frame, params);
+			n = 0;
+			for (i = 0; i < 5; i++)
+				printf(" %u", params[n++]);
+			putchar('\n');
+			for (i = 0; i < 4; i++) {
+				putchar(' ');
+				for (j = 0; j < 13; j++)
+					printf(" %u", params[n++]);
+				putchar('\n');
+			}
 			break;
 		case 0xD0:
 			fputs("FR", stdout);
-			gsm_explode(dummy_state, frame, fr_params);
+			gsm_explode(dummy_state, frame, params);
 			n = 0;
 			for (i = 0; i < 8; i++)
-				printf(" %u", fr_params[n++]);
+				printf(" %u", params[n++]);
 			putchar('\n');
 			for (i = 0; i < 4; i++) {
 				putchar(' ');
 				for (j = 0; j < 17; j++)
-					printf(" %u", fr_params[n++]);
+					printf(" %u", params[n++]);
 				putchar('\n');
 			}
 			break;