annotate rvinterf/tmsh/l1cmd.c @ 355:8fee530f7850

uptools/libcoding: implemented 8859-1 -> GSM7 encoding table
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 06 Feb 2018 19:27:19 +0000
parents 92c982f67247
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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;
287
92c982f67247 fc-tmsh converted to link with librftab
Mychaela Falconia <falcon@freecalypso.org>
parents: 131
diff changeset
318 rc = read_rf_table_ext(argv[2], cmdpkt + 3, 0, &format, &size);
122
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 }
124
8e37317f5de0 fc-tmsh: rftr command implemented, rftw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 123
diff changeset
334
8e37317f5de0 fc-tmsh: rftr command implemented, rftw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 123
diff changeset
335 cmd_rftr(argc, argv)
8e37317f5de0 fc-tmsh: rftr command implemented, rftw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 123
diff changeset
336 char **argv;
8e37317f5de0 fc-tmsh: rftr command implemented, rftw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 123
diff changeset
337 {
8e37317f5de0 fc-tmsh: rftr command implemented, rftw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 123
diff changeset
338 u16 index;
8e37317f5de0 fc-tmsh: rftr command implemented, rftw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 123
diff changeset
339 u_char cmdpkt[4];
8e37317f5de0 fc-tmsh: rftr command implemented, rftw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 123
diff changeset
340
8e37317f5de0 fc-tmsh: rftr command implemented, rftw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 123
diff changeset
341 if (keyword_or_num(argv[1], rf_table_arg, &index))
8e37317f5de0 fc-tmsh: rftr command implemented, rftw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 123
diff changeset
342 return(ERROR_USAGE);
8e37317f5de0 fc-tmsh: rftr command implemented, rftw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 123
diff changeset
343 cmdpkt[1] = RF_TABLE_READ;
8e37317f5de0 fc-tmsh: rftr command implemented, rftw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 123
diff changeset
344 cmdpkt[2] = index;
8e37317f5de0 fc-tmsh: rftr command implemented, rftw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 123
diff changeset
345 send_etm_cmd(cmdpkt, 2);
8e37317f5de0 fc-tmsh: rftr command implemented, rftw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 123
diff changeset
346 return(0);
8e37317f5de0 fc-tmsh: rftr command implemented, rftw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 123
diff changeset
347 }
125
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
348
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
349 static struct kwtab rx_param_arg[] = {
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
350 {"agc-gain", RX_AGC_GAIN},
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
351 {"timeslot", RX_TIMESLOT},
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
352 {"agc-enable", RX_AGC_ENA_FLAG},
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
353 {"pm-enable", RX_PM_ENABLE},
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
354 {"front-delay", RX_FRONT_DELAY},
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
355 {"flags-cal", RX_FLAGS_CAL},
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
356 {"flags-platform", RX_FLAGS_PLATFORM},
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
357 {"flags-iq-swap", RX_FLAGS_IQ_SWAP},
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
358 {"flags-all", RX_FLAGS_ALL},
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
359 {"gprs-slots", RX_GPRS_SLOTS},
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
360 {"gprs-coding", RX_GPRS_CODING},
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
361 {0, 0}
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
362 };
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
363
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
364 cmd_rxpw(argc, argv)
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
365 char **argv;
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
366 {
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
367 u16 index, value;
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
368 u_char cmdpkt[7];
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
369
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
370 if (keyword_or_num(argv[1], rx_param_arg, &index))
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
371 return(ERROR_USAGE);
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
372 value = strtol(argv[2], 0, 0);
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
373 cmdpkt[1] = RX_PARAM_WRITE;
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
374 cmdpkt[2] = index;
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
375 cmdpkt[3] = index >> 8;
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
376 cmdpkt[4] = value;
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
377 cmdpkt[5] = value >> 8;
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
378 send_etm_cmd(cmdpkt, 5);
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
379 return(0);
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
380 }
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
381
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
382 cmd_rxpr(argc, argv)
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
383 char **argv;
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
384 {
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
385 u16 index;
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
386 u_char cmdpkt[5];
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
387
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
388 if (keyword_or_num(argv[1], rx_param_arg, &index))
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
389 return(ERROR_USAGE);
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
390 cmdpkt[1] = RX_PARAM_READ;
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
391 cmdpkt[2] = index;
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
392 cmdpkt[3] = index >> 8;
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
393 send_etm_cmd(cmdpkt, 3);
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
394 return(0);
ca4fa5681f08 fc-tmsh: rxpw and rxpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 124
diff changeset
395 }
126
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
396
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
397 static struct kwtab tx_param_arg[] = {
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
398 {"pwr-level", TX_PWR_LEVEL},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
399 {"apc-dac", TX_APC_DAC},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
400 {"ramp-template", TX_RAMP_TEMPLATE},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
401 {"chan-cal-table", TX_CHAN_CAL_TABLE},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
402 {"burst-type", TX_BURST_TYPE},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
403 {"burst-data", TX_BURST_DATA},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
404 {"timing-advance", TX_TIMING_ADVANCE},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
405 {"training-seq", TX_TRAINING_SEQ},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
406 {"pwr-skip", TX_PWR_SKIP},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
407 {"flags-cal", TX_FLAGS_CAL},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
408 {"flags-platform", TX_FLAGS_PLATFORM},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
409 {"flags-iq-swap", TX_FLAGS_IQ_SWAP},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
410 {"flags-all", TX_FLAGS_ALL},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
411 {"gprs-power0", TX_GPRS_POWER0},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
412 {"gprs-power1", TX_GPRS_POWER1},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
413 {"gprs-power2", TX_GPRS_POWER2},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
414 {"gprs-power3", TX_GPRS_POWER3},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
415 {"gprs-power4", TX_GPRS_POWER4},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
416 {"gprs-power5", TX_GPRS_POWER5},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
417 {"gprs-power6", TX_GPRS_POWER6},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
418 {"gprs-power7", TX_GPRS_POWER7},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
419 {"gprs-slots", TX_GPRS_SLOTS},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
420 {"gprs-coding", TX_GPRS_CODING},
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
421 {0, 0}
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
422 };
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
423
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
424 cmd_txpw(argc, argv)
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
425 char **argv;
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
426 {
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
427 u16 index, value;
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
428 u_char cmdpkt[7];
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
429
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
430 if (keyword_or_num(argv[1], tx_param_arg, &index))
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
431 return(ERROR_USAGE);
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
432 value = strtol(argv[2], 0, 0);
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
433 cmdpkt[1] = TX_PARAM_WRITE;
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
434 cmdpkt[2] = index;
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
435 cmdpkt[3] = index >> 8;
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
436 cmdpkt[4] = value;
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
437 cmdpkt[5] = value >> 8;
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
438 send_etm_cmd(cmdpkt, 5);
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
439 return(0);
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
440 }
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
441
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
442 cmd_txpr(argc, argv)
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
443 char **argv;
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
444 {
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
445 u16 index;
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
446 u_char cmdpkt[5];
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
447
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
448 if (keyword_or_num(argv[1], tx_param_arg, &index))
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
449 return(ERROR_USAGE);
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
450 cmdpkt[1] = TX_PARAM_READ;
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
451 cmdpkt[2] = index;
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
452 cmdpkt[3] = index >> 8;
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
453 send_etm_cmd(cmdpkt, 3);
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
454 return(0);
777172bcea3c fc-tmsh: txpw and txpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 125
diff changeset
455 }
128
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
456
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
457 cmd_ttw(argc, argv)
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
458 char **argv;
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
459 {
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
460 unsigned index;
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
461 u_char cmdpkt[36];
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
462 int rc;
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
463
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
464 index = strtoul(argv[1], 0, 0);
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
465 if (index >= 16) {
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
466 printf("error: index out of range\n");
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
467 return(ERROR_USAGE);
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
468 }
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
469 cmdpkt[1] = TX_TEMPLATE_WRITE;
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
470 cmdpkt[2] = index;
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
471 rc = read_tx_ramp_template(argv[2], cmdpkt + 3);
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
472 if (rc)
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
473 return(rc);
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
474 send_etm_cmd(cmdpkt, 34);
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
475 return(0);
d76970e1895e fc-tmsh: ttw command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 126
diff changeset
476 }
129
bf610ca0f1b1 fc-tmsh: ttr command implemented, ttw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
477
bf610ca0f1b1 fc-tmsh: ttr command implemented, ttw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
478 cmd_ttr(argc, argv)
bf610ca0f1b1 fc-tmsh: ttr command implemented, ttw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
479 char **argv;
bf610ca0f1b1 fc-tmsh: ttr command implemented, ttw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
480 {
bf610ca0f1b1 fc-tmsh: ttr command implemented, ttw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
481 unsigned index;
bf610ca0f1b1 fc-tmsh: ttr command implemented, ttw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
482 u_char cmdpkt[4];
bf610ca0f1b1 fc-tmsh: ttr command implemented, ttw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
483
bf610ca0f1b1 fc-tmsh: ttr command implemented, ttw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
484 index = strtoul(argv[1], 0, 0);
bf610ca0f1b1 fc-tmsh: ttr command implemented, ttw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
485 if (index >= 16) {
bf610ca0f1b1 fc-tmsh: ttr command implemented, ttw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
486 printf("error: index out of range\n");
bf610ca0f1b1 fc-tmsh: ttr command implemented, ttw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
487 return(ERROR_USAGE);
bf610ca0f1b1 fc-tmsh: ttr command implemented, ttw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
488 }
bf610ca0f1b1 fc-tmsh: ttr command implemented, ttw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
489 cmdpkt[1] = TX_TEMPLATE_READ;
bf610ca0f1b1 fc-tmsh: ttr command implemented, ttw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
490 cmdpkt[2] = index;
bf610ca0f1b1 fc-tmsh: ttr command implemented, ttw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
491 send_etm_cmd(cmdpkt, 2);
bf610ca0f1b1 fc-tmsh: ttr command implemented, ttw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
492 return(0);
bf610ca0f1b1 fc-tmsh: ttr command implemented, ttw command hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents: 128
diff changeset
493 }
130
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
494
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
495 static struct kwtab misc_param_arg[] = {
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
496 {"adc-interval", ADC_INTERVAL},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
497 {"adc-enable", ADC_ENA_FLAG},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
498 {"converted-adc0", CONVERTED_ADC0},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
499 {"converted-adc1", CONVERTED_ADC1},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
500 {"converted-adc2", CONVERTED_ADC2},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
501 {"converted-adc3", CONVERTED_ADC3},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
502 {"converted-adc4", CONVERTED_ADC4},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
503 {"converted-adc5", CONVERTED_ADC5},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
504 {"converted-adc6", CONVERTED_ADC6},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
505 {"converted-adc7", CONVERTED_ADC7},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
506 {"converted-adc8", CONVERTED_ADC8},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
507 {"raw-adc0", RAW_ADC0},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
508 {"raw-adc1", RAW_ADC1},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
509 {"raw-adc2", RAW_ADC2},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
510 {"raw-adc3", RAW_ADC3},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
511 {"raw-adc4", RAW_ADC4},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
512 {"raw-adc5", RAW_ADC5},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
513 {"raw-adc6", RAW_ADC6},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
514 {"raw-adc7", RAW_ADC7},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
515 {"raw-adc8", RAW_ADC8},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
516 {"adc0-coeff-a", ADC0_COEFF_A},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
517 {"adc1-coeff-a", ADC1_COEFF_A},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
518 {"adc2-coeff-a", ADC2_COEFF_A},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
519 {"adc3-coeff-a", ADC3_COEFF_A},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
520 {"adc4-coeff-a", ADC4_COEFF_A},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
521 {"adc5-coeff-a", ADC5_COEFF_A},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
522 {"adc6-coeff-a", ADC6_COEFF_A},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
523 {"adc7-coeff-a", ADC7_COEFF_A},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
524 {"adc8-coeff-a", ADC8_COEFF_A},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
525 {"adc0-coeff-b", ADC0_COEFF_B},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
526 {"adc1-coeff-b", ADC1_COEFF_B},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
527 {"adc2-coeff-b", ADC2_COEFF_B},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
528 {"adc3-coeff-b", ADC3_COEFF_B},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
529 {"adc4-coeff-b", ADC4_COEFF_B},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
530 {"adc5-coeff-b", ADC5_COEFF_B},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
531 {"adc6-coeff-b", ADC6_COEFF_B},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
532 {"adc7-coeff-b", ADC7_COEFF_B},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
533 {"adc8-coeff-b", ADC8_COEFF_B},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
534 {"sleep-mode", SLEEP_MODE},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
535 {"current-tm-mode", CURRENT_TM_MODE},
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
536 {0, 0}
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
537 };
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
538
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
539 cmd_mpw(argc, argv)
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
540 char **argv;
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
541 {
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
542 u16 index, value;
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
543 u_char cmdpkt[7];
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
544
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
545 if (keyword_or_num(argv[1], misc_param_arg, &index))
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
546 return(ERROR_USAGE);
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
547 value = strtol(argv[2], 0, 0);
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
548 cmdpkt[1] = MISC_PARAM_WRITE;
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
549 cmdpkt[2] = index;
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
550 cmdpkt[3] = index >> 8;
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
551 cmdpkt[4] = value;
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
552 cmdpkt[5] = value >> 8;
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
553 send_etm_cmd(cmdpkt, 5);
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
554 return(0);
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
555 }
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
556
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
557 cmd_mpr(argc, argv)
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
558 char **argv;
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
559 {
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
560 u16 index;
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
561 u_char cmdpkt[5];
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
562
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
563 if (keyword_or_num(argv[1], misc_param_arg, &index))
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
564 return(ERROR_USAGE);
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
565 cmdpkt[1] = MISC_PARAM_READ;
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
566 cmdpkt[2] = index;
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
567 cmdpkt[3] = index >> 8;
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
568 send_etm_cmd(cmdpkt, 3);
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
569 return(0);
d3e2b619ff89 fc-tmsh: mpw and mpr implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 129
diff changeset
570 }
131
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
571
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
572 static struct kwtab me_arg[] = {
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
573 {"mkdirs", CFG_WRITE_MKDIRS},
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
574 {"save-rf-cal", CFG_WRITE_RF_CAL},
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
575 {"save-rf-cfg", CFG_WRITE_RF_CFG},
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
576 {"save-tx-cal", CFG_WRITE_TX_CAL},
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
577 {"save-tx-cfg", CFG_WRITE_TX_CFG},
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
578 {"save-rx-cal", CFG_WRITE_RX_CAL},
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
579 {"save-rx-cfg", CFG_WRITE_RX_CFG},
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
580 {"save-sys-cal", CFG_WRITE_SYS_CAL},
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
581 {"save-sys-cfg", CFG_WRITE_SYS_CFG},
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
582 {0, 0}
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
583 };
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
584
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
585 cmd_me(argc, argv)
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
586 char **argv;
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
587 {
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
588 u16 arg;
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
589 u_char cmdpkt[5];
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
590
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
591 if (keyword_or_num(argv[1], me_arg, &arg))
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
592 return(ERROR_USAGE);
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
593 cmdpkt[1] = MISC_ENABLE;
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
594 cmdpkt[2] = arg;
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
595 cmdpkt[3] = arg >> 8;
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
596 send_etm_cmd(cmdpkt, 3);
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
597 return(0);
cae9cb333c2c fc-tmsh: me command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 130
diff changeset
598 }