changeset 35:6bb1651f8c11

dhf: generate binary form of EFR DHF
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 14 May 2024 03:46:12 +0000
parents 307fe06fabec
children e4c6fc4e30f4
files .hgignore dhf/Makefile dhf/emit-dhfbin-efr.c
diffstat 3 files changed, 41 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Tue May 14 03:36:31 2024 +0000
+++ b/.hgignore	Tue May 14 03:46:12 2024 +0000
@@ -6,8 +6,10 @@
 ^amrdiff/readone-amr$
 ^amrdiff/readone-efr$
 
+^dhf/efr-dhf\.gsmx$
 ^dhf/efr-dhf-bytes\.c$
 ^dhf/efr-dhf-hexout$
+^dhf/emit-dhfbin-efr$
 ^dhf/mr122-dhf-bytes\.c$
 
 ^dmw/gen-dmw-bin$
--- a/dhf/Makefile	Tue May 14 03:36:31 2024 +0000
+++ b/dhf/Makefile	Tue May 14 03:46:12 2024 +0000
@@ -1,15 +1,22 @@
 CC=	gcc
 CFLAGS=	-O2
-PROG=	efr-dhf-hexout
+PROGS=	efr-dhf-hexout emit-dhfbin-efr
 COUT=	efr-dhf-bytes.c mr122-dhf-bytes.c
+OUTF=	${COUT} efr-dhf.gsmx
 
-all:	${PROG} ${COUT}
+all:	${PROGS} ${OUTF}
 
-${PROG}:	${PROG}.c
+efr-dhf-hexout:	efr-dhf-hexout.c
 	${CC} ${CFLAGS} -o $@ $@.c -lgsmefr -ltwamr
 
 ${COUT}:	efr-dhf-hexout
 	./efr-dhf-hexout efr-dhf-bytes.c mr122-dhf-bytes.c
 
+emit-dhfbin-efr:	emit-dhfbin-efr.o efr-dhf-bytes.o
+	${CC} ${CFLAGS} -o $@ $^
+
+efr-dhf.gsmx:	emit-dhfbin-efr
+	./emit-dhfbin-efr $@
+
 clean:
-	rm -f *.o ${PROG} ${COUT}
+	rm -f *.o ${PROGS} ${COUT} *.gsmx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dhf/emit-dhfbin-efr.c	Tue May 14 03:46:12 2024 +0000
@@ -0,0 +1,28 @@
+/*
+ * This program emits a binary file containing one EFR DHF.
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+extern const uint8_t efr_dhf_bytes[31];
+
+main(argc, argv)
+	char **argv;
+{
+	FILE *outf;
+
+	if (argc != 2) {
+		fprintf(stderr, "usage: %s out-bin-file\n", argv[0]);
+		exit(1);
+	}
+	outf = fopen(argv[1], "w");
+	if (!outf) {
+		perror(argv[1]);
+		exit(1);
+	}
+	fwrite(efr_dhf_bytes, 1, 31, outf);
+	fclose(outf);
+	exit(0);
+}