comparison dev/gsm0611-silence-fr.c @ 1:6780b23654bd

libgsmfrp: starting with the silence frame
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 19 Nov 2022 04:04:01 +0000
parents
children 61cb83bd11ec
comparison
equal deleted inserted replaced
0:b45bb0f9bdfc 1:6780b23654bd
1 /*
2 * This program is meant to be run only once by the developer - it uses
3 * libgsm function gsm_implode() to transform the idle frame of GSM 06.11
4 * (3GPP TS 46.011) from the table format given in the spec into
5 * libgsm/RTP format.
6 */
7
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include <strings.h>
12 #include <gsm.h>
13
14 static const gsm_signal lar_params[8] = {42, 39, 21, 10, 9, 4, 3, 2};
15 static const gsm_signal subframe_params[17] =
16 {0, 40, 1, 0, 3, 4, 3, 4, 4, 3, 3, 3, 3, 4, 4, 3, 3};
17
18 main(argc, argv)
19 char **argv;
20 {
21 gsm state;
22 gsm_signal params[76];
23 gsm_byte frame[33];
24 unsigned n;
25
26 /* gsm_implode() requires dummy state */
27 state = gsm_create();
28 if (!state) {
29 fprintf(stderr, "gsm_create() failed!\n");
30 exit(1);
31 }
32 /* gather params */
33 bcopy(lar_params, params, sizeof(gsm_signal) * 8);
34 bcopy(subframe_params, params + 8, sizeof(gsm_signal) * 17);
35 bcopy(subframe_params, params + 25, sizeof(gsm_signal) * 17);
36 bcopy(subframe_params, params + 42, sizeof(gsm_signal) * 17);
37 bcopy(subframe_params, params + 59, sizeof(gsm_signal) * 17);
38 /* generate frame */
39 gsm_implode(state, params, frame);
40 /* print the frame */
41 for (n = 0; n < 33; n++) {
42 printf("0x%02X,", frame[n]);
43 if (n == 4 || n == 11 || n == 18 || n == 25 || n == 32)
44 putchar('\n');
45 else
46 putchar(' ');
47 }
48 exit(0);
49 }