FreeCalypso > hg > freecalypso-tools
annotate rvinterf/etmsync/l1tmcmd.c @ 856:ab20ff8156ea
rvinterf/Makefile: add l1filter
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 09 Nov 2021 23:15:29 +0000 |
parents | aec320fe2653 |
children |
rev | line source |
---|---|
273
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module contains the user command wrappers around the functions |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * in the l1tmops.c module. |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <sys/types.h> |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <ctype.h> |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdio.h> |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <string.h> |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <strings.h> |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <stdlib.h> |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include "pktmux.h" |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include "limits.h" |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include "localtypes.h" |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #include "tm3.h" |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #include "l1tm.h" |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #include "exitcodes.h" |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 extern void write_afcparams_table(); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 extern void write_agcwords_table(); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 extern void write_agcglobals_table(); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 extern void write_il2agc_table(); |
290
94234e9c843b
fc-tmsync: rftr save to file implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
275
diff
changeset
|
23 extern void write_tx_ramps_table(); |
273
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 extern void write_tx_levels_table(); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 extern void write_tx_calchan_table(); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 extern void write_tx_caltemp_table(); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 extern void write_rx_calchan_table(); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 extern void write_rx_caltemp_table(); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 extern void write_rx_agcparams_table(); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 cmd_tms(argc, argv) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 char **argv; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 u16 arg; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 arg = strtoul(argv[1], 0, 0); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 return do_tms(arg); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 } |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 static |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 is_num_string(argstr) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 char *argstr; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 char *cp = argstr; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 if (!isdigit(*cp++)) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 return(0); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 while (*cp) { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 if (!isdigit(*cp++)) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 return(0); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 } |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 return(1); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 } |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 struct kwtab { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 char *kw; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 int val; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 }; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 static |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 keyword_or_num(argstr, kwtab, valp) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 char *argstr; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 struct kwtab *kwtab; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 u16 *valp; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 struct kwtab *tp; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 if (is_num_string(argstr)) { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 *valp = atoi(argstr); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 return(0); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 } |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 for (tp = kwtab; tp->kw; tp++) { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 if (!strcmp(tp->kw, argstr)) { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 *valp = tp->val; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 return(0); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 } |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 } |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 printf("error: non-numeric argument not understood\n"); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 return(ERROR_USAGE); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 } |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 static struct kwtab rf_param_arg[] = { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 {"bcch-arfcn", BCCH_ARFCN}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 {"tch-arfcn", TCH_ARFCN}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 {"mon-arfcn", MON_ARFCN}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 {"pdtch-arfcn", PDTCH_ARFCN}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 {"std-band", STD_BAND_FLAG}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 {"afc-enable", AFC_ENA_FLAG}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 {"afc-dac-val", AFC_DAC_VALUE}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 {"init-afc-dac", INITIAL_AFC_DAC}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 {"multislot-class", MULTISLOT_CLASS}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 {0, 0} |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 }; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 cmd_rfpw2(argc, argv) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 char **argv; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 u16 index, value; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 if (keyword_or_num(argv[1], rf_param_arg, &index)) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 return(ERROR_USAGE); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 value = strtol(argv[2], 0, 0); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 return do_rfpw(index, value); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 } |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 cmd_rfpw3(argc, argv) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 char **argv; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 u16 index; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 u8 val1, val2; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 if (keyword_or_num(argv[1], rf_param_arg, &index)) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 return(ERROR_USAGE); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 val1 = strtoul(argv[2], 0, 0); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 val2 = strtoul(argv[3], 0, 0); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 return do_rfpw(index, (val2 << 8) | val1); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 } |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 cmd_rfpw(argc, argv) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 char **argv; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 switch (argc) { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 case 3: |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 return cmd_rfpw2(argc, argv); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 case 4: |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 return cmd_rfpw3(argc, argv); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 default: |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 fprintf(stderr, "BUG: wrong argc in cmd_rfpw()\n"); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 return(ERROR_BUG); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 } |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 } |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 cmd_rfpr(argc, argv) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 char **argv; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 u16 index, val; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 int rc; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 if (keyword_or_num(argv[1], rf_param_arg, &index)) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 return(ERROR_USAGE); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 rc = do_rfpr(index, &val); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 if (rc) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 return(rc); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 if (val >= 0x8000) |
275
81da9717babe
fc-tmsync: missed newline at the end of rfpr output
Mychaela Falconia <falcon@freecalypso.org>
parents:
273
diff
changeset
|
145 printf("read value: 0x%04X (%u or %d)\n", val, val, |
273
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 (int)val - 65536); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 else |
275
81da9717babe
fc-tmsync: missed newline at the end of rfpr output
Mychaela Falconia <falcon@freecalypso.org>
parents:
273
diff
changeset
|
148 printf("read value: 0x%04X (%u)\n", val, val); |
273
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 return(0); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 } |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 static struct kwtab rf_table_arg[] = { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 {"rx-agc-table", RX_AGC_TABLE}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 {"afcparams", AFC_PARAMS}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 {"rx-agc-global-params", RX_AGC_GLOBAL_PARAMS}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 {"rx-il2agc-max", RX_IL_2_AGC_MAX}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 {"rx-il2agc-pwr", RX_IL_2_AGC_PWR}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 {"rx-il2agc-av", RX_IL_2_AGC_AV}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 {"tx-levels", TX_LEVELS}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 {"tx-calchan", TX_CAL_CHAN}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 {"tx-caltemp", TX_CAL_TEMP}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 {"rx-calchan", RX_CAL_CHAN}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 {"rx-caltemp", RX_CAL_TEMP}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 {"rx-agcparams", RX_AGC_PARAMS}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 {0, 0} |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 }; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 static struct table_map { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 int index; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 int size; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 void (*func)(); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 } table_map[] = { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 {RX_AGC_TABLE, 40, write_agcwords_table}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 {AFC_PARAMS, 24, write_afcparams_table}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 {RX_AGC_GLOBAL_PARAMS, 8, write_agcglobals_table}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 {RX_IL_2_AGC_MAX, 121, write_il2agc_table}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 {RX_IL_2_AGC_PWR, 121, write_il2agc_table}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 {RX_IL_2_AGC_AV, 121, write_il2agc_table}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 {TX_LEVELS, 128, write_tx_levels_table}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 {TX_CAL_CHAN, 128, write_tx_calchan_table}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 {TX_CAL_TEMP, 40, write_tx_caltemp_table}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 {RX_CAL_CHAN, 40, write_rx_calchan_table}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 {RX_CAL_TEMP, 44, write_rx_caltemp_table}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 {RX_AGC_PARAMS, 8, write_rx_agcparams_table}, |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 {0, 0, 0} |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 }; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 cmd_rftr(argc, argv) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 char **argv; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 u16 index; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 struct table_map *tp; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 u_char table_data[MAX_RF_TABLE_SIZE]; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 int rc; |
290
94234e9c843b
fc-tmsync: rftr save to file implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
275
diff
changeset
|
195 FILE *of; |
273
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 if (keyword_or_num(argv[1], rf_table_arg, &index)) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 return(ERROR_USAGE); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
199 for (tp = table_map; tp->index; tp++) { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
200 if (tp->index == index) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 break; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
202 } |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 if (!tp->index) { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
204 printf("error: table index %u not supported, use fc-tmsh\n", |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 index); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206 return(ERROR_USAGE); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 } |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 rc = do_rftr(index, table_data, tp->size); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 if (rc) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 return(rc); |
290
94234e9c843b
fc-tmsync: rftr save to file implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
275
diff
changeset
|
211 if (argv[2]) { |
94234e9c843b
fc-tmsync: rftr save to file implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
275
diff
changeset
|
212 of = fopen(argv[2], "w"); |
94234e9c843b
fc-tmsync: rftr save to file implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
275
diff
changeset
|
213 if (!of) { |
94234e9c843b
fc-tmsync: rftr save to file implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
275
diff
changeset
|
214 perror(argv[2]); |
94234e9c843b
fc-tmsync: rftr save to file implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
275
diff
changeset
|
215 return(ERROR_UNIX); |
94234e9c843b
fc-tmsync: rftr save to file implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
275
diff
changeset
|
216 } |
94234e9c843b
fc-tmsync: rftr save to file implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
275
diff
changeset
|
217 tp->func(table_data, of); |
94234e9c843b
fc-tmsync: rftr save to file implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
275
diff
changeset
|
218 fclose(of); |
94234e9c843b
fc-tmsync: rftr save to file implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
275
diff
changeset
|
219 } else |
94234e9c843b
fc-tmsync: rftr save to file implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
275
diff
changeset
|
220 tp->func(table_data, stdout); |
273
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
221 return(0); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
222 } |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
223 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
224 cmd_ttr(argc, argv) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
225 char **argv; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
226 { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
227 unsigned index; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
228 u_char ramp_data[32]; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
229 int rc; |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
230 |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
231 index = strtoul(argv[1], 0, 0); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
232 if (index >= 16) { |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
233 printf("error: index out of range\n"); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
234 return(ERROR_USAGE); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
235 } |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
236 rc = do_ttr(index, ramp_data); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
237 if (rc) |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
238 return(rc); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
239 write_tx_ramp(ramp_data, stdout); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
240 return(0); |
18a8fb3d845b
fc-tmsync: user command wrappers implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
241 } |
291
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
242 |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
243 cmd_ttr_all(argc, argv) |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
244 char **argv; |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
245 { |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
246 u_char table[512]; |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
247 int rc, i; |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
248 FILE *of; |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
249 |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
250 for (i = 0; i < 16; i++) { |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
251 rc = do_ttr(i, table + i * 32); |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
252 if (rc) |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
253 return(rc); |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
254 } |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
255 of = fopen(argv[1], "w"); |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
256 if (!of) { |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
257 perror(argv[1]); |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
258 return(ERROR_UNIX); |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
259 } |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
260 write_tx_ramps_table(table, of); |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
261 fclose(of); |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
262 return(0); |
dd97e75620a7
fc-tmsync: ttr-all implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
290
diff
changeset
|
263 } |
844
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
264 |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
265 static struct kwtab misc_param_arg[] = { |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
266 {"adc-interval", ADC_INTERVAL}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
267 {"adc-enable", ADC_ENA_FLAG}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
268 {"converted-adc0", CONVERTED_ADC0}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
269 {"converted-adc1", CONVERTED_ADC1}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
270 {"converted-adc2", CONVERTED_ADC2}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
271 {"converted-adc3", CONVERTED_ADC3}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
272 {"converted-adc4", CONVERTED_ADC4}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
273 {"converted-adc5", CONVERTED_ADC5}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
274 {"converted-adc6", CONVERTED_ADC6}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
275 {"converted-adc7", CONVERTED_ADC7}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
276 {"converted-adc8", CONVERTED_ADC8}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
277 {"raw-adc0", RAW_ADC0}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
278 {"raw-adc1", RAW_ADC1}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
279 {"raw-adc2", RAW_ADC2}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
280 {"raw-adc3", RAW_ADC3}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
281 {"raw-adc4", RAW_ADC4}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
282 {"raw-adc5", RAW_ADC5}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
283 {"raw-adc6", RAW_ADC6}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
284 {"raw-adc7", RAW_ADC7}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
285 {"raw-adc8", RAW_ADC8}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
286 {"adc0-coeff-a", ADC0_COEFF_A}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
287 {"adc1-coeff-a", ADC1_COEFF_A}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
288 {"adc2-coeff-a", ADC2_COEFF_A}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
289 {"adc3-coeff-a", ADC3_COEFF_A}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
290 {"adc4-coeff-a", ADC4_COEFF_A}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
291 {"adc5-coeff-a", ADC5_COEFF_A}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
292 {"adc6-coeff-a", ADC6_COEFF_A}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
293 {"adc7-coeff-a", ADC7_COEFF_A}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
294 {"adc8-coeff-a", ADC8_COEFF_A}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
295 {"adc0-coeff-b", ADC0_COEFF_B}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
296 {"adc1-coeff-b", ADC1_COEFF_B}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
297 {"adc2-coeff-b", ADC2_COEFF_B}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
298 {"adc3-coeff-b", ADC3_COEFF_B}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
299 {"adc4-coeff-b", ADC4_COEFF_B}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
300 {"adc5-coeff-b", ADC5_COEFF_B}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
301 {"adc6-coeff-b", ADC6_COEFF_B}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
302 {"adc7-coeff-b", ADC7_COEFF_B}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
303 {"adc8-coeff-b", ADC8_COEFF_B}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
304 {"sleep-mode", SLEEP_MODE}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
305 {"current-tm-mode", CURRENT_TM_MODE}, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
306 {0, 0} |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
307 }; |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
308 |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
309 cmd_mpr(argc, argv) |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
310 char **argv; |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
311 { |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
312 u16 index, val; |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
313 int rc; |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
314 |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
315 if (keyword_or_num(argv[1], misc_param_arg, &index)) |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
316 return(ERROR_USAGE); |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
317 rc = do_mpr(index, &val); |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
318 if (rc) |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
319 return(rc); |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
320 if (val >= 0x8000) |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
321 printf("read value: 0x%04X (%u or %d)\n", val, val, |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
322 (int)val - 65536); |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
323 else |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
324 printf("read value: 0x%04X (%u)\n", val, val); |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
325 return(0); |
4694c7686ccd
fc-tmsync: add mpr command
Mychaela Falconia <falcon@freecalypso.org>
parents:
291
diff
changeset
|
326 } |
845
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
327 |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
328 cmd_madc(argc, argv) |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
329 char **argv; |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
330 { |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
331 u16 val; |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
332 int rc; |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
333 |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
334 rc = do_mpr(CONVERTED_ADC0, &val); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
335 if (rc) |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
336 return(rc); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
337 printf("VBAT=%u\n", val); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
338 rc = do_mpr(CONVERTED_ADC1, &val); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
339 if (rc) |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
340 return(rc); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
341 printf("VCHG=%u\n", val); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
342 rc = do_mpr(RAW_ADC2, &val); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
343 if (rc) |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
344 return(rc); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
345 printf("ICHG=%u\n", val); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
346 rc = do_mpr(CONVERTED_ADC3, &val); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
347 if (rc) |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
348 return(rc); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
349 printf("VBACKUP=%u\n", val); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
350 rc = do_mpr(RAW_ADC4, &val); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
351 if (rc) |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
352 return(rc); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
353 printf("ADIN1=0x%04X\n", val); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
354 rc = do_mpr(RAW_ADC5, &val); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
355 if (rc) |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
356 return(rc); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
357 printf("ADIN2=0x%04X\n", val); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
358 rc = do_mpr(RAW_ADC6, &val); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
359 if (rc) |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
360 return(rc); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
361 printf("ADIN3=0x%04X\n", val); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
362 rc = do_mpr(RAW_ADC7, &val); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
363 if (rc) |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
364 return(rc); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
365 printf("ADIN4=0x%04X\n", val); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
366 return(0); |
aec320fe2653
fc-tmsync: new madc command reads all 8 MADC channels
Mychaela Falconia <falcon@freecalypso.org>
parents:
844
diff
changeset
|
367 } |