FreeCalypso > hg > fc-rfcal-tools
annotate autocal/l1tmops.c @ 29:d6ef94518117
autocal/l1tmops.c: rftw and me implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 22 May 2017 23:50:32 +0000 |
parents | 7ac866c3baf6 |
children | e86779d5445c |
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); |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 if (rvi_msg[1] != RVT_TM_HEADER) { |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 fprintf(stderr, |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 "DUT error: response packet is not on TM channel\n"); |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 exit(ERROR_TARGET); |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 } |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 if (rvi_msg_len < 5) { |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 fprintf(stderr, "DUT error: TM response packet is too short\n"); |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 exit(ERROR_TARGET); |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 } |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 c = 0; |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 for (i = 2; i < rvi_msg_len; i++) |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 c ^= rvi_msg[i]; |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 if (c) { |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 fprintf(stderr, "DUT error: TM response bad checksum\n"); |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 exit(ERROR_TARGET); |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 } |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 if (rvi_msg[2] != outbuf[1]) { |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 fprintf(stderr, "DUT error: TM response has wrong CID\n"); |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 exit(ERROR_TARGET); |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 } |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 return(0); |
1c4abfe8bcd9
autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 } |
17
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
52 |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
53 do_tms(arg) |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
54 { |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
55 u_char cmdpkt[5]; |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
56 |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
57 cmdpkt[1] = TM_MODE_SET; |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
58 cmdpkt[2] = arg; |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
59 cmdpkt[3] = arg >> 8; |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
60 l1tm_pkt_exch(cmdpkt, 3); |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
61 if (rvi_msg[3]) { |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
62 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
|
63 rvi_msg[3]); |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
64 exit(ERROR_TARGET); |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
65 } |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
66 if (rvi_msg_len != 5) { |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
67 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
|
68 exit(ERROR_TARGET); |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
69 } |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
70 return(0); |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
71 } |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
72 |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
73 do_rfe(arg) |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
74 { |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
75 u_char cmdpkt[5]; |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
76 |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
77 cmdpkt[1] = RF_ENABLE; |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
78 cmdpkt[2] = arg; |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
79 cmdpkt[3] = arg >> 8; |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
80 l1tm_pkt_exch(cmdpkt, 3); |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
81 if (rvi_msg[3]) { |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
82 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
|
83 rvi_msg[3]); |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
84 exit(ERROR_TARGET); |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
85 } |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
86 return(0); |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
87 } |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
88 |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
89 do_rfpw(index, value) |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
90 { |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
91 u_char cmdpkt[7]; |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
92 |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
93 cmdpkt[1] = RF_PARAM_WRITE; |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
94 cmdpkt[2] = index; |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
95 cmdpkt[3] = index >> 8; |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
96 cmdpkt[4] = value; |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
97 cmdpkt[5] = value >> 8; |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
98 l1tm_pkt_exch(cmdpkt, 5); |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
99 if (rvi_msg[3]) { |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
100 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
|
101 rvi_msg[3]); |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
102 exit(ERROR_TARGET); |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
103 } |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
104 if (rvi_msg_len != 6) { |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
105 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
|
106 exit(ERROR_TARGET); |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
107 } |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
108 if (rvi_msg[4] != index) { |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
109 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
|
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 return(0); |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
113 } |
0645344feee5
autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents:
16
diff
changeset
|
114 |
18
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
115 do_rxpw(index, value) |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
116 { |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
117 u_char cmdpkt[7]; |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
118 |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
119 cmdpkt[1] = RX_PARAM_WRITE; |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
120 cmdpkt[2] = index; |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
121 cmdpkt[3] = index >> 8; |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
122 cmdpkt[4] = value; |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
123 cmdpkt[5] = value >> 8; |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
124 l1tm_pkt_exch(cmdpkt, 5); |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
125 if (rvi_msg[3]) { |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
126 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
|
127 rvi_msg[3]); |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
128 exit(ERROR_TARGET); |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
129 } |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
130 if (rvi_msg_len != 6) { |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
131 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
|
132 exit(ERROR_TARGET); |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
133 } |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
134 if (rvi_msg[4] != index) { |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
135 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
|
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 return(0); |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
139 } |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
140 |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
141 do_txpw(index, value) |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
142 { |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
143 u_char cmdpkt[7]; |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
144 |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
145 cmdpkt[1] = TX_PARAM_WRITE; |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
146 cmdpkt[2] = index; |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
147 cmdpkt[3] = index >> 8; |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
148 cmdpkt[4] = value; |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
149 cmdpkt[5] = value >> 8; |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
150 l1tm_pkt_exch(cmdpkt, 5); |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
151 if (rvi_msg[3]) { |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
152 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
|
153 rvi_msg[3]); |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
154 exit(ERROR_TARGET); |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
155 } |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
156 if (rvi_msg_len != 6) { |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
157 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
|
158 exit(ERROR_TARGET); |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
159 } |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
160 if (rvi_msg[4] != index) { |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
161 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
|
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 return(0); |
af77b95feeba
autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
17
diff
changeset
|
165 } |
29
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
166 |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
167 do_rftw(index, table, size) |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
168 u_char *table; |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
169 { |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
170 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
|
171 |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
172 cmdpkt[1] = RF_TABLE_WRITE; |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
173 cmdpkt[2] = index; |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
174 bcopy(table, cmdpkt + 3, size); |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
175 l1tm_pkt_exch(cmdpkt, size + 2); |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
176 if (rvi_msg[3]) { |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
177 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
|
178 rvi_msg[3]); |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
179 exit(ERROR_TARGET); |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
180 } |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
181 if (rvi_msg_len != 6) { |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
182 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
|
183 exit(ERROR_TARGET); |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
184 } |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
185 if (rvi_msg[4] != index) { |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
186 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
|
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 return(0); |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
190 } |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
191 |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
192 misc_enable(arg) |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
193 { |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
194 u_char cmdpkt[5]; |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
195 |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
196 cmdpkt[1] = MISC_ENABLE; |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
197 cmdpkt[2] = arg; |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
198 cmdpkt[3] = arg >> 8; |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
199 l1tm_pkt_exch(cmdpkt, 3); |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
200 if (rvi_msg[3]) { |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
201 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
|
202 rvi_msg[3]); |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
203 exit(ERROR_TARGET); |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
204 } |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
205 if (rvi_msg_len != 6) { |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
206 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
|
207 exit(ERROR_TARGET); |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
208 } |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
209 if (rvi_msg[4] != arg) { |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
210 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
|
211 exit(ERROR_TARGET); |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
212 } |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
213 return(0); |
d6ef94518117
autocal/l1tmops.c: rftw and me implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
20
diff
changeset
|
214 } |