FreeCalypso > hg > ice1-trau-tester
annotate ater/user_cmd.c @ 52:626180a15857 default tip
ater play-d144: emit E-data frames manually,
osmo_trau_frame_encode() is currently broken for this frame type
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 25 Sep 2024 06:40:43 +0000 |
parents | db39e8855f3d |
children |
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 |
15
98ae717734d6
ater: starting skeleton
Mychaela Falconia <falcon@freecalypso.org>
parents:
12
diff
changeset
|
3 * itt-ater-16 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[] = { |
24
f49e57b0d1a2
ater: implement activ command
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
20 {"activ", cmd_activate}, |
44
16715bd149e0
ater: add support for data mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
29
diff
changeset
|
21 {"activ-d", cmd_activate_csd}, |
25
45411b72b6b3
ater: implement deact command
Mychaela Falconia <falcon@freecalypso.org>
parents:
24
diff
changeset
|
22 {"deact", cmd_deact}, |
45
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
23 {"dset", cmd_set_dbits}, |
50
6ba4de500532
ater: implement edata switch for D144
Mychaela Falconia <falcon@freecalypso.org>
parents:
45
diff
changeset
|
24 {"edata", cmd_set_edata}, |
27
2742dbea95f1
ater: implement play command
Mychaela Falconia <falcon@freecalypso.org>
parents:
25
diff
changeset
|
25 {"play", cmd_play_file}, |
51
db39e8855f3d
ater: implement play-d144
Mychaela Falconia <falcon@freecalypso.org>
parents:
50
diff
changeset
|
26 {"play-d144", cmd_play_d144}, |
29
1dda11905e85
ater: implement play-stop command
Mychaela Falconia <falcon@freecalypso.org>
parents:
27
diff
changeset
|
27 {"play-stop", cmd_play_stop}, |
6
631f2db08538
pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
28 {"print-rx", cmd_print_rx}, |
631f2db08538
pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
29 {"record", cmd_record_start}, |
631f2db08538
pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
30 {"record-stop", cmd_record_stop}, |
631f2db08538
pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
31 /* table search terminator */ |
631f2db08538
pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
32 {NULL, NULL} |
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 |
5
7233c10af3ad
pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 void handle_user_cmd(int argc, char **argv) |
7233c10af3ad
pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 { |
6
631f2db08538
pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
37 struct cmdtab *tp; |
631f2db08538
pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
38 |
631f2db08538
pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
39 for (tp = cmdtab; tp->cmd; tp++) |
631f2db08538
pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
40 if (!strcmp(tp->cmd, argv[0])) |
631f2db08538
pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
41 break; |
631f2db08538
pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
42 if (!tp->func) { |
631f2db08538
pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
43 printf("error: unknown or unimplemented command\n"); |
631f2db08538
pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
44 return; |
631f2db08538
pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
45 } |
631f2db08538
pcm: implement print-rx and record commands
Mychaela Falconia <falcon@freecalypso.org>
parents:
5
diff
changeset
|
46 tp->func(argc, argv); |
5
7233c10af3ad
pcm: hook in stdin select mechanism
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 } |