annotate dhf/efr-dhf-hexout.c @ 32:baf74dff5368

dhf: generate hex forms of EFR DHF
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 13 May 2024 06:26:22 +0000
parents
children 307fe06fabec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This little program takes EFR and MR122 DHFs provided in array-of-params
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * form by libtwamr, turns them into EFR RTP format using libgsmefr function,
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * and emits those two RTP-encoded EFR frames in hex, for inclusion in other
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * C sources.
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 */
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdio.h>
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <stdint.h>
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <stdlib.h>
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <gsm_efr.h>
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include <tw_amr.h>
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 static void
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 emit_one_frame(params, name)
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 const int16_t *params;
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 char *name;
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 {
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 uint8_t efr_rtp[EFR_RTP_FRAME_LEN];
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 unsigned n;
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 EFR_params2frame(params, efr_rtp);
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 printf("%s:\n\n", name);
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 for (n = 0; n < EFR_RTP_FRAME_LEN; n++) {
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 printf("0x%02X,", efr_rtp[n]);
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 if (n == 15 || n == 30)
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 putchar('\n');
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 }
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 putchar('\n');
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 }
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 main(argc, argv)
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 char **argv;
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 {
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 emit_one_frame(amr_dhf_gsmefr, "EFR DHF");
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 emit_one_frame(amr_dhf_mr122, "MR122 DHF");
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 exit(0);
baf74dff5368 dhf: generate hex forms of EFR DHF
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 }