annotate pcm-br/record_ctrl.c @ 37:26c9535df39e

rm abis subdir: moved to e1-fake-trau repository The present code repository is meant to contain code for talking to a TRAU DUT, hence the name ice1-trau-tester. The different and separate function of talking to an E1 BTS (Abis instead of Ater, and in the opposite role) was never in scope for this project, but that code got added here in a haste when the InSite BTS arrived while the TRAU bring-up was still blocked. Now that we have our Nokia TCSM2 system working and are doing TRAU experiments, let's keep the code clean.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 29 Aug 2024 19:02:02 +0000
parents 499d065ee591
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * Here we implement stdin commands that control recording of E1 timeslot
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * read stream.
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdint.h>
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdbool.h>
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdio.h>
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <stdlib.h>
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <osmocom/core/select.h>
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include "globals.h"
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
35
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
15 void cmd_record_a_start(int argc, char **argv)
6
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 {
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 if (argc != 2) {
35
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
18 printf("error: record-a command needs 1 argument\n");
6
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 return;
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 }
35
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
21 if (rec_file_a) {
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
22 printf("error: recording of ts A already in progress\n");
6
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 return;
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 }
35
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
25 rec_file_a = fopen(argv[1], "w");
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
26 if (!rec_file_a)
6
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 perror(argv[1]);
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 }
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
35
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
30 void cmd_record_a_stop(int argc, char **argv)
6
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 {
35
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
32 if (!rec_file_a) {
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
33 printf("error: no recording of ts A in progress\n");
6
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 return;
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 }
35
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
36 fclose(rec_file_a);
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
37 rec_file_a = NULL;
6
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 }
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39
35
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
40 void cmd_record_b_start(int argc, char **argv)
6
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 {
35
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
42 if (argc != 2) {
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
43 printf("error: record-b command needs 1 argument\n");
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
44 return;
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
45 }
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
46 if (rec_file_b) {
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
47 printf("error: recording of ts B already in progress\n");
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
48 return;
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
49 }
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
50 rec_file_b = fopen(argv[1], "w");
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
51 if (!rec_file_b)
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
52 perror(argv[1]);
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
53 }
6
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54
35
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
55 void cmd_record_b_stop(int argc, char **argv)
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
56 {
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
57 if (!rec_file_b) {
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
58 printf("error: no recording of ts B in progress\n");
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
59 return;
6
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 }
35
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
61 fclose(rec_file_b);
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 6
diff changeset
62 rec_file_b = NULL;
6
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 }