FreeCalypso > hg > ice1-trau-tester
annotate 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 |
rev | line source |
---|---|
45
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
50
6ba4de500532
ater: implement edata switch for D144
Mychaela Falconia <falcon@freecalypso.org>
parents:
49
diff
changeset
|
2 * Here we implement commands for exercising D144 mode. |
45
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <stdint.h> |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdbool.h> |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdio.h> |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdlib.h> |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <string.h> |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <osmocom/core/select.h> |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include "globals.h" |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include "submux.h" |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 |
50
6ba4de500532
ater: implement edata switch for D144
Mychaela Falconia <falcon@freecalypso.org>
parents:
49
diff
changeset
|
16 void cmd_set_edata(int argc, char **argv) |
45
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 { |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 int nr; |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 struct ater_subslot *at; |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
50
6ba4de500532
ater: implement edata switch for D144
Mychaela Falconia <falcon@freecalypso.org>
parents:
49
diff
changeset
|
21 if (argc != 3) { |
6ba4de500532
ater: implement edata switch for D144
Mychaela Falconia <falcon@freecalypso.org>
parents:
49
diff
changeset
|
22 usage: fprintf(stderr, "usage: %s 0|1|2|3 0|1\n", argv[0]); |
45
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 return; |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 } |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 if (argv[1][0] < '0' || argv[1][0] > '3' || argv[1][1]) |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 goto usage; |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 nr = argv[1][0] - '0'; |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 at = &subslots[nr]; |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 if (!at->is_active) { |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 fprintf(stderr, "error: subslot %d is not active\n", nr); |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 return; |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 } |
50
6ba4de500532
ater: implement edata switch for D144
Mychaela Falconia <falcon@freecalypso.org>
parents:
49
diff
changeset
|
33 if (!at->is_data_144) { |
6ba4de500532
ater: implement edata switch for D144
Mychaela Falconia <falcon@freecalypso.org>
parents:
49
diff
changeset
|
34 fprintf(stderr, "error: subslot %d is not in D144 mode\n", nr); |
45
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 return; |
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 } |
50
6ba4de500532
ater: implement edata switch for D144
Mychaela Falconia <falcon@freecalypso.org>
parents:
49
diff
changeset
|
37 if (!strcmp(argv[2], "0")) |
6ba4de500532
ater: implement edata switch for D144
Mychaela Falconia <falcon@freecalypso.org>
parents:
49
diff
changeset
|
38 at->d144_edata = 0; |
6ba4de500532
ater: implement edata switch for D144
Mychaela Falconia <falcon@freecalypso.org>
parents:
49
diff
changeset
|
39 else if (!strcmp(argv[2], "1")) |
6ba4de500532
ater: implement edata switch for D144
Mychaela Falconia <falcon@freecalypso.org>
parents:
49
diff
changeset
|
40 at->d144_edata = 1; |
6ba4de500532
ater: implement edata switch for D144
Mychaela Falconia <falcon@freecalypso.org>
parents:
49
diff
changeset
|
41 else |
6ba4de500532
ater: implement edata switch for D144
Mychaela Falconia <falcon@freecalypso.org>
parents:
49
diff
changeset
|
42 goto usage; |
45
349fb785a414
ater: add dset command for setting Dn bits
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 } |