FreeCalypso > hg > freecalypso-tools
annotate rvinterf/tmsh/l1cmd.c @ 123:bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 19 Feb 2017 09:07:52 +0000 |
parents | cad9129d0f03 |
children | 8e37317f5de0 |
rev | line source |
---|---|
112
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * In this module we are going to implement commands which send |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * TM3 command packets to the L1TM firmware component: RF calibration |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * and test modes. |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 */ |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <sys/types.h> |
117
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
8 #include <ctype.h> |
112
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <stdio.h> |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <string.h> |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <strings.h> |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include <stdlib.h> |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include "pktmux.h" |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 #include "limits.h" |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #include "localtypes.h" |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #include "tm3.h" |
117
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
17 #include "l1tm.h" |
112
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 #include "exitcodes.h" |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 cmd_tminit(argc, argv) |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 char **argv; |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 { |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 u_char cmdpkt[3]; |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 cmdpkt[1] = TM_INIT; |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 send_etm_cmd(cmdpkt, 1); |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 return(0); |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 } |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 cmd_tms(argc, argv) |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 char **argv; |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 { |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 u16 arg; |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 u_char cmdpkt[5]; |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 arg = strtoul(argv[1], 0, 0); |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 cmdpkt[1] = TM_MODE_SET; |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 cmdpkt[2] = arg; |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 cmdpkt[3] = arg >> 8; |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 send_etm_cmd(cmdpkt, 3); |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 return(0); |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 } |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 cmd_tm3ver(argc, argv) |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 char **argv; |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 { |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 u16 arg; |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 u_char cmdpkt[5]; |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 arg = strtoul(argv[1], 0, 16); |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 cmdpkt[1] = VERSION_GET; |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 cmdpkt[2] = arg; |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 cmdpkt[3] = arg >> 8; |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 send_etm_cmd(cmdpkt, 3); |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 return(0); |
2825d79bb151
fc-tmsh: beginning of L1TM command support
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 } |
113
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
57 |
117
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
58 static |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
59 is_num_string(argstr) |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
60 char *argstr; |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
61 { |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
62 char *cp = argstr; |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
63 |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
64 if (!isdigit(*cp++)) |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
65 return(0); |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
66 while (*cp) { |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
67 if (!isdigit(*cp++)) |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
68 return(0); |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
69 } |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
70 return(1); |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
71 } |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
72 |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
73 struct kwtab { |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
74 char *kw; |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
75 int val; |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
76 }; |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
77 |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
78 static |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
79 keyword_or_num(argstr, kwtab, valp) |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
80 char *argstr; |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
81 struct kwtab *kwtab; |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
82 u16 *valp; |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
83 { |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
84 struct kwtab *tp; |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
85 |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
86 if (is_num_string(argstr)) { |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
87 *valp = atoi(argstr); |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
88 return(0); |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
89 } |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
90 for (tp = kwtab; tp->kw; tp++) { |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
91 if (!strcmp(tp->kw, argstr)) { |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
92 *valp = tp->val; |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
93 return(0); |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
94 } |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
95 } |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
96 printf("error: non-numeric argument not understood\n"); |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
97 return(ERROR_USAGE); |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
98 } |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
99 |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
100 static struct kwtab rfe_arg[] = { |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
101 {"stop-all", STOP_ALL}, |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
102 {"rx-tch", RX_TCH}, |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
103 {"tx-tch", TX_TCH}, |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
104 {"rx-tx-tch", RX_TX_TCH}, |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
105 {"rx-tx-pdtch", RX_TX_PDTCH}, |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
106 {"rx-tch-cont", RX_TCH_CONT}, |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
107 {"tx-tch-cont", TX_TCH_CONT}, |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
108 {"bcch-loop", BCCH_LOOP}, |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
109 {"sb-loop", SB_LOOP}, |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
110 {"fb1-loop", FB1_LOOP}, |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
111 {"fb0-loop", FB0_LOOP}, |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
112 {"single-pm", SINGLE_PM}, |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
113 {"rx-tx-pdtch-mon", RX_TX_PDTCH_MON}, |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
114 {"rx-tx-mon-tch", RX_TX_MON_TCH}, |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
115 {"rx-tx-mon", RX_TX_MON}, |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
116 {0, 0} |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
117 }; |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
118 |
113
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
119 cmd_rfe(argc, argv) |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
120 char **argv; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
121 { |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
122 u16 arg; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
123 u_char cmdpkt[5]; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
124 |
117
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
125 if (keyword_or_num(argv[1], rfe_arg, &arg)) |
c91500530216
fc-tmsh: l1tm keyword argument framework implemented, used in rfe command
Mychaela Falconia <falcon@freecalypso.org>
parents:
115
diff
changeset
|
126 return(ERROR_USAGE); |
113
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
127 cmdpkt[1] = RF_ENABLE; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
128 cmdpkt[2] = arg; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
129 cmdpkt[3] = arg >> 8; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
130 send_etm_cmd(cmdpkt, 3); |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
131 return(0); |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
132 } |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
133 |
118
9aeabcbe6a3d
fc-tmsh: scw and scr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
117
diff
changeset
|
134 static struct kwtab stats_config_arg[] = { |
9aeabcbe6a3d
fc-tmsh: scw and scr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
117
diff
changeset
|
135 {"loops", LOOPS}, |
9aeabcbe6a3d
fc-tmsh: scw and scr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
117
diff
changeset
|
136 {"auto-result-loops", AUTO_RESULT_LOOPS}, |
9aeabcbe6a3d
fc-tmsh: scw and scr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
117
diff
changeset
|
137 {"auto-reset-loops", AUTO_RESET_LOOPS}, |
9aeabcbe6a3d
fc-tmsh: scw and scr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
117
diff
changeset
|
138 {"stat-gprs-slots", STAT_GPRS_SLOTS}, |
9aeabcbe6a3d
fc-tmsh: scw and scr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
117
diff
changeset
|
139 {"stat-type", STAT_TYPE}, |
9aeabcbe6a3d
fc-tmsh: scw and scr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
117
diff
changeset
|
140 {"stat-bitmask", STAT_BITMASK}, |
9aeabcbe6a3d
fc-tmsh: scw and scr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
117
diff
changeset
|
141 {0, 0} |
9aeabcbe6a3d
fc-tmsh: scw and scr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
117
diff
changeset
|
142 }; |
9aeabcbe6a3d
fc-tmsh: scw and scr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
117
diff
changeset
|
143 |
113
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
144 cmd_scw(argc, argv) |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
145 char **argv; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
146 { |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
147 u16 index, value; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
148 u_char cmdpkt[7]; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
149 |
118
9aeabcbe6a3d
fc-tmsh: scw and scr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
117
diff
changeset
|
150 if (keyword_or_num(argv[1], stats_config_arg, &index)) |
9aeabcbe6a3d
fc-tmsh: scw and scr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
117
diff
changeset
|
151 return(ERROR_USAGE); |
113
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
152 value = strtoul(argv[2], 0, 0); |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
153 cmdpkt[1] = STATS_CONFIG_WRITE; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
154 cmdpkt[2] = index; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
155 cmdpkt[3] = index >> 8; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
156 cmdpkt[4] = value; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
157 cmdpkt[5] = value >> 8; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
158 send_etm_cmd(cmdpkt, 5); |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
159 return(0); |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
160 } |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
161 |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
162 cmd_scr(argc, argv) |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
163 char **argv; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
164 { |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
165 u16 index; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
166 u_char cmdpkt[5]; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
167 |
118
9aeabcbe6a3d
fc-tmsh: scw and scr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
117
diff
changeset
|
168 if (keyword_or_num(argv[1], stats_config_arg, &index)) |
9aeabcbe6a3d
fc-tmsh: scw and scr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
117
diff
changeset
|
169 return(ERROR_USAGE); |
113
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
170 cmdpkt[1] = STATS_CONFIG_READ; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
171 cmdpkt[2] = index; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
172 cmdpkt[3] = index >> 8; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
173 send_etm_cmd(cmdpkt, 3); |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
174 return(0); |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
175 } |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
176 |
119
6ce20d48e9ee
fc-tmsh: sr command accepts keyword argument
Mychaela Falconia <falcon@freecalypso.org>
parents:
118
diff
changeset
|
177 static struct kwtab stats_read_arg[] = { |
6ce20d48e9ee
fc-tmsh: sr command accepts keyword argument
Mychaela Falconia <falcon@freecalypso.org>
parents:
118
diff
changeset
|
178 {"accum", ACCUMULATED_RX_STATS}, |
6ce20d48e9ee
fc-tmsh: sr command accepts keyword argument
Mychaela Falconia <falcon@freecalypso.org>
parents:
118
diff
changeset
|
179 {"most-recent", MOST_RECENT_RX_STATS}, |
6ce20d48e9ee
fc-tmsh: sr command accepts keyword argument
Mychaela Falconia <falcon@freecalypso.org>
parents:
118
diff
changeset
|
180 {0, 0} |
6ce20d48e9ee
fc-tmsh: sr command accepts keyword argument
Mychaela Falconia <falcon@freecalypso.org>
parents:
118
diff
changeset
|
181 }; |
6ce20d48e9ee
fc-tmsh: sr command accepts keyword argument
Mychaela Falconia <falcon@freecalypso.org>
parents:
118
diff
changeset
|
182 |
113
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
183 cmd_sr(argc, argv) |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
184 char **argv; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
185 { |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
186 u16 type, bitmask; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
187 u_char cmdpkt[7]; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
188 |
119
6ce20d48e9ee
fc-tmsh: sr command accepts keyword argument
Mychaela Falconia <falcon@freecalypso.org>
parents:
118
diff
changeset
|
189 if (keyword_or_num(argv[1], stats_read_arg, &type)) |
6ce20d48e9ee
fc-tmsh: sr command accepts keyword argument
Mychaela Falconia <falcon@freecalypso.org>
parents:
118
diff
changeset
|
190 return(ERROR_USAGE); |
113
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
191 bitmask = strtoul(argv[2], 0, 16); |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
192 cmdpkt[1] = STATS_READ; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
193 cmdpkt[2] = type; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
194 cmdpkt[3] = type >> 8; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
195 cmdpkt[4] = bitmask; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
196 cmdpkt[5] = bitmask >> 8; |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
197 send_etm_cmd(cmdpkt, 5); |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
198 return(0); |
816d91739a32
fc-tmsh: rfe, scw, scr and sr commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
199 } |
114
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
200 |
120
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
201 static struct kwtab rf_param_arg[] = { |
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
202 {"bcch-arfcn", BCCH_ARFCN}, |
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
203 {"tch-arfcn", TCH_ARFCN}, |
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
204 {"mon-arfcn", MON_ARFCN}, |
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
205 {"pdtch-arfcn", PDTCH_ARFCN}, |
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
206 {"std-band", STD_BAND_FLAG}, |
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
207 {"afc-enable", AFC_ENA_FLAG}, |
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
208 {"afc-dac-val", AFC_DAC_VALUE}, |
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
209 {"init-afc-dac", INITIAL_AFC_DAC}, |
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
210 {"multislot-class", MULTISLOT_CLASS}, |
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
211 {0, 0} |
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
212 }; |
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
213 |
114
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
214 cmd_rfpw2(argc, argv) |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
215 char **argv; |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
216 { |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
217 u16 index, value; |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
218 u_char cmdpkt[7]; |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
219 |
120
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
220 if (keyword_or_num(argv[1], rf_param_arg, &index)) |
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
221 return(ERROR_USAGE); |
114
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
222 value = strtol(argv[2], 0, 0); |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
223 cmdpkt[1] = RF_PARAM_WRITE; |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
224 cmdpkt[2] = index; |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
225 cmdpkt[3] = index >> 8; |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
226 cmdpkt[4] = value; |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
227 cmdpkt[5] = value >> 8; |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
228 send_etm_cmd(cmdpkt, 5); |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
229 return(0); |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
230 } |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
231 |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
232 cmd_rfpw3(argc, argv) |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
233 char **argv; |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
234 { |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
235 u16 index; |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
236 u8 val1, val2; |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
237 u_char cmdpkt[7]; |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
238 |
120
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
239 if (keyword_or_num(argv[1], rf_param_arg, &index)) |
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
240 return(ERROR_USAGE); |
114
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
241 val1 = strtoul(argv[2], 0, 0); |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
242 val2 = strtoul(argv[3], 0, 0); |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
243 cmdpkt[1] = RF_PARAM_WRITE; |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
244 cmdpkt[2] = index; |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
245 cmdpkt[3] = index >> 8; |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
246 cmdpkt[4] = val1; |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
247 cmdpkt[5] = val2; |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
248 send_etm_cmd(cmdpkt, 5); |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
249 return(0); |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
250 } |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
251 |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
252 cmd_rfpw(argc, argv) |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
253 char **argv; |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
254 { |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
255 switch (argc) { |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
256 case 3: |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
257 return cmd_rfpw2(argc, argv); |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
258 case 4: |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
259 return cmd_rfpw3(argc, argv); |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
260 default: |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
261 fprintf(stderr, "BUG: wrong argc in cmd_rfpw()\n"); |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
262 return(ERROR_BUG); |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
263 } |
eb54195fded6
fc-tmsh: rfpw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
113
diff
changeset
|
264 } |
115
c41511b79b1d
fc-tmsh: rfpr command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
114
diff
changeset
|
265 |
c41511b79b1d
fc-tmsh: rfpr command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
114
diff
changeset
|
266 cmd_rfpr(argc, argv) |
c41511b79b1d
fc-tmsh: rfpr command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
114
diff
changeset
|
267 char **argv; |
c41511b79b1d
fc-tmsh: rfpr command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
114
diff
changeset
|
268 { |
c41511b79b1d
fc-tmsh: rfpr command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
114
diff
changeset
|
269 u16 index; |
c41511b79b1d
fc-tmsh: rfpr command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
114
diff
changeset
|
270 u_char cmdpkt[5]; |
c41511b79b1d
fc-tmsh: rfpr command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
114
diff
changeset
|
271 |
120
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
272 if (keyword_or_num(argv[1], rf_param_arg, &index)) |
12dbb47ad3f7
fc-tmsh: rfpw and rfpr accept keyword arguments
Mychaela Falconia <falcon@freecalypso.org>
parents:
119
diff
changeset
|
273 return(ERROR_USAGE); |
115
c41511b79b1d
fc-tmsh: rfpr command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
114
diff
changeset
|
274 cmdpkt[1] = RF_PARAM_READ; |
c41511b79b1d
fc-tmsh: rfpr command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
114
diff
changeset
|
275 cmdpkt[2] = index; |
c41511b79b1d
fc-tmsh: rfpr command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
114
diff
changeset
|
276 cmdpkt[3] = index >> 8; |
c41511b79b1d
fc-tmsh: rfpr command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
114
diff
changeset
|
277 send_etm_cmd(cmdpkt, 3); |
c41511b79b1d
fc-tmsh: rfpr command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
114
diff
changeset
|
278 return(0); |
c41511b79b1d
fc-tmsh: rfpr command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
114
diff
changeset
|
279 } |
122
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
280 |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
281 static struct kwtab rf_table_arg[] = { |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
282 {"rx-agc-table", RX_AGC_TABLE}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
283 {"afcparams", AFC_PARAMS}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
284 {"rx-agc-global-params", RX_AGC_GLOBAL_PARAMS}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
285 {"rx-il2agc-max", RX_IL_2_AGC_MAX}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
286 {"rx-il2agc-pwr", RX_IL_2_AGC_PWR}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
287 {"rx-il2agc-av", RX_IL_2_AGC_AV}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
288 {"tx-levels", TX_LEVELS}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
289 {"tx-calchan", TX_CAL_CHAN}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
290 {"tx-caltemp", TX_CAL_TEMP}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
291 {"tx-cal-extreme", TX_CAL_EXTREME}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
292 {"rx-calchan", RX_CAL_CHAN}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
293 {"rx-caltemp", RX_CAL_TEMP}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
294 {"rx-cal-level", RX_CAL_LEVEL}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
295 {"rx-agcparams", RX_AGC_PARAMS}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
296 {"rx-agcparams-pcs", RX_AGC_PARAMS_PCS}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
297 {"tx-data-buffer", TX_DATA_BUFFER}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
298 {"rlc-tx-buffer-cs1", RLC_TX_BUFFER_CS1}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
299 {"rlc-tx-buffer-cs2", RLC_TX_BUFFER_CS2}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
300 {"rlc-tx-buffer-cs3", RLC_TX_BUFFER_CS3}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
301 {"rlc-tx-buffer-cs4", RLC_TX_BUFFER_CS4}, |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
302 {0, 0} |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
303 }; |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
304 |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
305 cmd_rftw(argc, argv) |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
306 char **argv; |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
307 { |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
308 u16 index; |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
309 u_char cmdpkt[MAX_RF_TABLE_SIZE + 4]; |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
310 int rc; |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
311 char *format; |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
312 unsigned size; |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
313 |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
314 if (keyword_or_num(argv[1], rf_table_arg, &index)) |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
315 return(ERROR_USAGE); |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
316 cmdpkt[1] = RF_TABLE_WRITE; |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
317 cmdpkt[2] = index; |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
318 rc = read_rf_table(argv[2], cmdpkt + 3, &format, &size); |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
319 if (rc) |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
320 return(rc); |
123
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
122
diff
changeset
|
321 if (argc > 3) { |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
122
diff
changeset
|
322 if (strcmp(argv[3], "force")) { |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
122
diff
changeset
|
323 printf("error: unexpected 3rd argument\n"); |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
122
diff
changeset
|
324 return(ERROR_USAGE); |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
122
diff
changeset
|
325 } |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
122
diff
changeset
|
326 } else { |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
122
diff
changeset
|
327 rc = rftw_index_format_check(index, format); |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
122
diff
changeset
|
328 if (rc) |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
122
diff
changeset
|
329 return(rc); |
bc23c1cd30ae
fc-tmsh: rftw format consistency check implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
122
diff
changeset
|
330 } |
122
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
331 send_etm_cmd(cmdpkt, size + 2); |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
332 return(0); |
cad9129d0f03
fc-tmsh: rftw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
120
diff
changeset
|
333 } |