annotate autocal/l1tmops.c @ 126:105e3a60edb8

txlevels: rf3166-850 added
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 24 Dec 2019 07:05:36 +0000
parents 81e8f7e99d89
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * In this module we are going to implement the functions for executing
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * various L1TM operations on the DUT.
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <sys/types.h>
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdio.h>
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdlib.h>
29
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
9 #include <string.h>
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
10 #include <strings.h>
16
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <rvinterf/pktmux.h>
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include <rvinterf/tm3.h>
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include <rvinterf/l1tm.h>
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 #include <rvinterf/exitcodes.h>
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 extern u_char rvi_msg[];
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 extern int rvi_msg_len;
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 l1tm_pkt_exch(outbuf, outlen)
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 u_char *outbuf;
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 {
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 int i, c;
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 outbuf[0] = RVT_TM_HEADER;
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 c = 0;
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 for (i = 1; i <= outlen; i++)
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 c ^= outbuf[i];
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 outbuf[i] = c;
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 target_pkt_exch(outbuf, outlen + 2);
47
e86779d5445c autocal: preparations for receiving auto stats and rfe completion
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
30 l1tm_resp_sanity_check(outbuf[1]);
e86779d5445c autocal: preparations for receiving auto stats and rfe completion
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
31 return(0);
e86779d5445c autocal: preparations for receiving auto stats and rfe completion
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
32 }
e86779d5445c autocal: preparations for receiving auto stats and rfe completion
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
33
e86779d5445c autocal: preparations for receiving auto stats and rfe completion
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
34 l1tm_resp_sanity_check(cid)
e86779d5445c autocal: preparations for receiving auto stats and rfe completion
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
35 {
e86779d5445c autocal: preparations for receiving auto stats and rfe completion
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
36 int i, c;
e86779d5445c autocal: preparations for receiving auto stats and rfe completion
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
37
16
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 if (rvi_msg[1] != RVT_TM_HEADER) {
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 fprintf(stderr,
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 "DUT error: response packet is not on TM channel\n");
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 exit(ERROR_TARGET);
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 }
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 if (rvi_msg_len < 5) {
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 fprintf(stderr, "DUT error: TM response packet is too short\n");
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 exit(ERROR_TARGET);
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 }
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 c = 0;
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 for (i = 2; i < rvi_msg_len; i++)
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 c ^= rvi_msg[i];
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 if (c) {
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 fprintf(stderr, "DUT error: TM response bad checksum\n");
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 exit(ERROR_TARGET);
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 }
47
e86779d5445c autocal: preparations for receiving auto stats and rfe completion
Mychaela Falconia <falcon@freecalypso.org>
parents: 29
diff changeset
54 if (rvi_msg[2] != cid) {
16
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 fprintf(stderr, "DUT error: TM response has wrong CID\n");
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 exit(ERROR_TARGET);
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 }
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 return(0);
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 }
17
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
60
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
61 do_tms(arg)
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
62 {
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
63 u_char cmdpkt[5];
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
64
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
65 cmdpkt[1] = TM_MODE_SET;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
66 cmdpkt[2] = arg;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
67 cmdpkt[3] = arg >> 8;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
68 l1tm_pkt_exch(cmdpkt, 3);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
69 if (rvi_msg[3]) {
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
70 fprintf(stderr, "DUT error %u in response to tms\n",
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
71 rvi_msg[3]);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
72 exit(ERROR_TARGET);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
73 }
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
74 if (rvi_msg_len != 5) {
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
75 fprintf(stderr, "DUT error: tms response wrong length\n");
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
76 exit(ERROR_TARGET);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
77 }
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
78 return(0);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
79 }
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
80
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
81 do_rfe(arg)
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
82 {
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
83 u_char cmdpkt[5];
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
84
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
85 cmdpkt[1] = RF_ENABLE;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
86 cmdpkt[2] = arg;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
87 cmdpkt[3] = arg >> 8;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
88 l1tm_pkt_exch(cmdpkt, 3);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
89 if (rvi_msg[3]) {
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
90 fprintf(stderr, "DUT error %u in response to rfe\n",
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
91 rvi_msg[3]);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
92 exit(ERROR_TARGET);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
93 }
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
94 return(0);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
95 }
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
96
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
97 do_rfpw(index, value)
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
98 {
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
99 u_char cmdpkt[7];
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
100
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
101 cmdpkt[1] = RF_PARAM_WRITE;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
102 cmdpkt[2] = index;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
103 cmdpkt[3] = index >> 8;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
104 cmdpkt[4] = value;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
105 cmdpkt[5] = value >> 8;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
106 l1tm_pkt_exch(cmdpkt, 5);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
107 if (rvi_msg[3]) {
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
108 fprintf(stderr, "DUT error %u in response to rfpw\n",
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
109 rvi_msg[3]);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
110 exit(ERROR_TARGET);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
111 }
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
112 if (rvi_msg_len != 6) {
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
113 fprintf(stderr, "DUT error: rfpw response wrong length\n");
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
114 exit(ERROR_TARGET);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
115 }
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
116 if (rvi_msg[4] != index) {
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
117 fprintf(stderr, "DUT error: rfpw response wrong index\n");
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
118 exit(ERROR_TARGET);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
119 }
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
120 return(0);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
121 }
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
122
18
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
123 do_rxpw(index, value)
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
124 {
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
125 u_char cmdpkt[7];
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
126
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
127 cmdpkt[1] = RX_PARAM_WRITE;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
128 cmdpkt[2] = index;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
129 cmdpkt[3] = index >> 8;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
130 cmdpkt[4] = value;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
131 cmdpkt[5] = value >> 8;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
132 l1tm_pkt_exch(cmdpkt, 5);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
133 if (rvi_msg[3]) {
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
134 fprintf(stderr, "DUT error %u in response to rxpw\n",
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
135 rvi_msg[3]);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
136 exit(ERROR_TARGET);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
137 }
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
138 if (rvi_msg_len != 6) {
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
139 fprintf(stderr, "DUT error: rxpw response wrong length\n");
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
140 exit(ERROR_TARGET);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
141 }
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
142 if (rvi_msg[4] != index) {
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
143 fprintf(stderr, "DUT error: rxpw response wrong index\n");
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
144 exit(ERROR_TARGET);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
145 }
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
146 return(0);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
147 }
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
148
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
149 do_txpw(index, value)
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
150 {
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
151 u_char cmdpkt[7];
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
152
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
153 cmdpkt[1] = TX_PARAM_WRITE;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
154 cmdpkt[2] = index;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
155 cmdpkt[3] = index >> 8;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
156 cmdpkt[4] = value;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
157 cmdpkt[5] = value >> 8;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
158 l1tm_pkt_exch(cmdpkt, 5);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
159 if (rvi_msg[3]) {
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
160 fprintf(stderr, "DUT error %u in response to txpw\n",
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
161 rvi_msg[3]);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
162 exit(ERROR_TARGET);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
163 }
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
164 if (rvi_msg_len != 6) {
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
165 fprintf(stderr, "DUT error: txpw response wrong length\n");
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
166 exit(ERROR_TARGET);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
167 }
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
168 if (rvi_msg[4] != index) {
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
169 fprintf(stderr, "DUT error: txpw response wrong index\n");
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
170 exit(ERROR_TARGET);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
171 }
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
172 return(0);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
173 }
29
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
174
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
175 do_rftw(index, table, size)
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
176 u_char *table;
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
177 {
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
178 u_char cmdpkt[MAX_RF_TABLE_SIZE + 4];
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
179
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
180 cmdpkt[1] = RF_TABLE_WRITE;
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
181 cmdpkt[2] = index;
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
182 bcopy(table, cmdpkt + 3, size);
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
183 l1tm_pkt_exch(cmdpkt, size + 2);
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
184 if (rvi_msg[3]) {
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
185 fprintf(stderr, "DUT error %u in response to rftw\n",
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
186 rvi_msg[3]);
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
187 exit(ERROR_TARGET);
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
188 }
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
189 if (rvi_msg_len != 6) {
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
190 fprintf(stderr, "DUT error: rftw response wrong length\n");
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
191 exit(ERROR_TARGET);
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
192 }
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
193 if (rvi_msg[4] != index) {
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
194 fprintf(stderr, "DUT error: rftw response wrong index\n");
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
195 exit(ERROR_TARGET);
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
196 }
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
197 return(0);
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
198 }
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
199
59
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
200 do_rftr(index, table, size)
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
201 u_char *table;
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
202 {
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
203 u_char cmdpkt[4];
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
204
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
205 cmdpkt[1] = RF_TABLE_READ;
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
206 cmdpkt[2] = index;
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
207 l1tm_pkt_exch(cmdpkt, 2);
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
208 if (rvi_msg[3]) {
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
209 fprintf(stderr, "DUT error %u in response to rftr\n",
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
210 rvi_msg[3]);
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
211 exit(ERROR_TARGET);
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
212 }
60
81e8f7e99d89 fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 59
diff changeset
213 if (rvi_msg_len < size + 6) {
81e8f7e99d89 fc-rfcal-rxband: upload of GMagic to DUT implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 59
diff changeset
214 fprintf(stderr, "DUT error: rftr response too short\n");
59
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
215 exit(ERROR_TARGET);
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
216 }
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
217 if (rvi_msg[4] != index) {
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
218 fprintf(stderr, "DUT error: rftr response wrong index\n");
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
219 exit(ERROR_TARGET);
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
220 }
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
221 bcopy(rvi_msg + 5, table, size);
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
222 return(0);
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
223 }
c87067884da7 autocal/l1tmops.c: do_rftr() added
Mychaela Falconia <falcon@freecalypso.org>
parents: 47
diff changeset
224
29
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
225 misc_enable(arg)
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
226 {
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
227 u_char cmdpkt[5];
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
228
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
229 cmdpkt[1] = MISC_ENABLE;
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
230 cmdpkt[2] = arg;
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
231 cmdpkt[3] = arg >> 8;
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
232 l1tm_pkt_exch(cmdpkt, 3);
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
233 if (rvi_msg[3]) {
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
234 fprintf(stderr, "DUT error %u in response to me\n",
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
235 rvi_msg[3]);
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
236 exit(ERROR_TARGET);
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
237 }
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
238 if (rvi_msg_len != 6) {
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
239 fprintf(stderr, "DUT error: me response wrong length\n");
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
240 exit(ERROR_TARGET);
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
241 }
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
242 if (rvi_msg[4] != arg) {
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
243 fprintf(stderr, "DUT error: me response wrong index\n");
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
244 exit(ERROR_TARGET);
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
245 }
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
246 return(0);
d6ef94518117 autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 20
diff changeset
247 }