FreeCalypso > hg > ice1-trau-tester
comparison ater/d144.c @ 50:6ba4de500532
ater: implement edata switch for D144
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 24 Sep 2024 06:15:40 +0000 |
parents | ater/dbits.c@40f781efdbe1 |
children |
comparison
equal
deleted
inserted
replaced
49:40f781efdbe1 | 50:6ba4de500532 |
---|---|
1 /* | |
2 * Here we implement commands for exercising D144 mode. | |
3 */ | |
4 | |
5 #include <stdint.h> | |
6 #include <stdbool.h> | |
7 #include <stdio.h> | |
8 #include <stdlib.h> | |
9 #include <string.h> | |
10 | |
11 #include <osmocom/core/select.h> | |
12 | |
13 #include "globals.h" | |
14 #include "submux.h" | |
15 | |
16 void cmd_set_edata(int argc, char **argv) | |
17 { | |
18 int nr; | |
19 struct ater_subslot *at; | |
20 | |
21 if (argc != 3) { | |
22 usage: fprintf(stderr, "usage: %s 0|1|2|3 0|1\n", argv[0]); | |
23 return; | |
24 } | |
25 if (argv[1][0] < '0' || argv[1][0] > '3' || argv[1][1]) | |
26 goto usage; | |
27 nr = argv[1][0] - '0'; | |
28 at = &subslots[nr]; | |
29 if (!at->is_active) { | |
30 fprintf(stderr, "error: subslot %d is not active\n", nr); | |
31 return; | |
32 } | |
33 if (!at->is_data_144) { | |
34 fprintf(stderr, "error: subslot %d is not in D144 mode\n", nr); | |
35 return; | |
36 } | |
37 if (!strcmp(argv[2], "0")) | |
38 at->d144_edata = 0; | |
39 else if (!strcmp(argv[2], "1")) | |
40 at->d144_edata = 1; | |
41 else | |
42 goto usage; | |
43 } |