annotate pcm-br/user_cmd.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
5
7233c10af3ad pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
7233c10af3ad pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * In this module we handle user-issued stdin commands during
35
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
3 * itt-pcm-br running session.
5
7233c10af3ad pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
7233c10af3ad pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
7233c10af3ad pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdint.h>
7233c10af3ad pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdbool.h>
7233c10af3ad pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdio.h>
7233c10af3ad pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <stdlib.h>
7233c10af3ad pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <string.h>
7233c10af3ad pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
7233c10af3ad pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include <osmocom/core/select.h>
7233c10af3ad pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
7233c10af3ad pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 #include "globals.h"
7233c10af3ad pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
6
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
16 static struct cmdtab {
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
17 char *cmd;
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
18 void (*func)(int argc, char **argv);
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
19 } cmdtab[] = {
35
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
20 {"record-a", cmd_record_a_start},
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
21 {"record-a-stop", cmd_record_a_stop},
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
22 {"record-b", cmd_record_b_start},
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
23 {"record-b-stop", cmd_record_b_stop},
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
24 {"show-a", cmd_show_a},
499d065ee591 new program itt-pcm-br (PCM bridge)
Mychaela Falconia <falcon@freecalypso.org>
parents: 12
diff changeset
25 {"show-b", cmd_show_b},
6
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
26 /* table search terminator */
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
27 {NULL, NULL}
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
28 };
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
29
5
7233c10af3ad pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 void handle_user_cmd(int argc, char **argv)
7233c10af3ad pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 {
6
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
32 struct cmdtab *tp;
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
33
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
34 for (tp = cmdtab; tp->cmd; tp++)
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
35 if (!strcmp(tp->cmd, argv[0]))
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
36 break;
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
37 if (!tp->func) {
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
38 printf("error: unknown or unimplemented command\n");
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
39 return;
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
40 }
631f2db08538 pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents: 5
diff changeset
41 tp->func(argc, argv);
5
7233c10af3ad pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 }