annotate autocal/l1tmops.c @ 20:7ac866c3baf6

autocal: set_std_band() function replaced with RFPW_STD_BAND() macro
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 22 May 2017 20:35:42 +0000
parents af77b95feeba
children d6ef94518117
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>
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <rvinterf/pktmux.h>
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <rvinterf/tm3.h>
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <rvinterf/l1tm.h>
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include <rvinterf/exitcodes.h>
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 extern u_char rvi_msg[];
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 extern int rvi_msg_len;
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 l1tm_pkt_exch(outbuf, outlen)
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 u_char *outbuf;
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 {
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 int i, c;
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 outbuf[0] = RVT_TM_HEADER;
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 c = 0;
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 for (i = 1; i <= outlen; i++)
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 c ^= outbuf[i];
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 outbuf[i] = c;
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 target_pkt_exch(outbuf, outlen + 2);
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 if (rvi_msg[1] != RVT_TM_HEADER) {
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 fprintf(stderr,
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 "DUT error: response packet is not on TM channel\n");
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 exit(ERROR_TARGET);
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 }
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 if (rvi_msg_len < 5) {
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 fprintf(stderr, "DUT error: TM response packet is too short\n");
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 exit(ERROR_TARGET);
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 }
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 c = 0;
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 for (i = 2; i < rvi_msg_len; i++)
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 c ^= rvi_msg[i];
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 if (c) {
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 fprintf(stderr, "DUT error: TM response bad checksum\n");
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 exit(ERROR_TARGET);
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 }
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 if (rvi_msg[2] != outbuf[1]) {
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 fprintf(stderr, "DUT error: TM response has wrong CID\n");
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 exit(ERROR_TARGET);
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 }
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 return(0);
1c4abfe8bcd9 autocal/l1tmops.c started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 }
17
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
50
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
51 do_tms(arg)
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 u_char cmdpkt[5];
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 cmdpkt[1] = TM_MODE_SET;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
56 cmdpkt[2] = arg;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
57 cmdpkt[3] = arg >> 8;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
58 l1tm_pkt_exch(cmdpkt, 3);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
59 if (rvi_msg[3]) {
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
60 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
61 rvi_msg[3]);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
62 exit(ERROR_TARGET);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
63 }
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
64 if (rvi_msg_len != 5) {
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
65 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
66 exit(ERROR_TARGET);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
67 }
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
68 return(0);
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
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
71 do_rfe(arg)
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 u_char cmdpkt[5];
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 cmdpkt[1] = RF_ENABLE;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
76 cmdpkt[2] = arg;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
77 cmdpkt[3] = arg >> 8;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
78 l1tm_pkt_exch(cmdpkt, 3);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
79 if (rvi_msg[3]) {
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
80 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
81 rvi_msg[3]);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
82 exit(ERROR_TARGET);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
83 }
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
84 return(0);
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
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
87 do_rfpw(index, value)
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 u_char cmdpkt[7];
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 cmdpkt[1] = RF_PARAM_WRITE;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
92 cmdpkt[2] = index;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
93 cmdpkt[3] = index >> 8;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
94 cmdpkt[4] = value;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
95 cmdpkt[5] = value >> 8;
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
96 l1tm_pkt_exch(cmdpkt, 5);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
97 if (rvi_msg[3]) {
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
98 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
99 rvi_msg[3]);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
100 exit(ERROR_TARGET);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
101 }
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
102 if (rvi_msg_len != 6) {
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
103 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
104 exit(ERROR_TARGET);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
105 }
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
106 if (rvi_msg[4] != index) {
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
107 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
108 exit(ERROR_TARGET);
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
109 }
0645344feee5 autocal/l1tmops.c: started implementing basic operations
Mychaela Falconia <falcon@freecalypso.org>
parents: 16
diff changeset
110 return(0);
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
18
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
113 do_rxpw(index, value)
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
114 {
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
115 u_char cmdpkt[7];
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 cmdpkt[1] = RX_PARAM_WRITE;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
118 cmdpkt[2] = index;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
119 cmdpkt[3] = index >> 8;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
120 cmdpkt[4] = value;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
121 cmdpkt[5] = value >> 8;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
122 l1tm_pkt_exch(cmdpkt, 5);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
123 if (rvi_msg[3]) {
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
124 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
125 rvi_msg[3]);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
126 exit(ERROR_TARGET);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
127 }
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
128 if (rvi_msg_len != 6) {
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
129 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
130 exit(ERROR_TARGET);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
131 }
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
132 if (rvi_msg[4] != index) {
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
133 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
134 exit(ERROR_TARGET);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
135 }
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
136 return(0);
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
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
139 do_txpw(index, value)
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 u_char cmdpkt[7];
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 cmdpkt[1] = TX_PARAM_WRITE;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
144 cmdpkt[2] = index;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
145 cmdpkt[3] = index >> 8;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
146 cmdpkt[4] = value;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
147 cmdpkt[5] = value >> 8;
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
148 l1tm_pkt_exch(cmdpkt, 5);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
149 if (rvi_msg[3]) {
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
150 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
151 rvi_msg[3]);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
152 exit(ERROR_TARGET);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
153 }
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
154 if (rvi_msg_len != 6) {
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
155 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
156 exit(ERROR_TARGET);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
157 }
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
158 if (rvi_msg[4] != index) {
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
159 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
160 exit(ERROR_TARGET);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
161 }
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
162 return(0);
af77b95feeba autocal/l1tmops.c: rxpw and txpw implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 17
diff changeset
163 }