comparison 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
comparison
equal deleted inserted replaced
28:ba4b6877e227 29:d6ef94518117
4 */ 4 */
5 5
6 #include <sys/types.h> 6 #include <sys/types.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h>
10 #include <strings.h>
9 #include <rvinterf/pktmux.h> 11 #include <rvinterf/pktmux.h>
10 #include <rvinterf/tm3.h> 12 #include <rvinterf/tm3.h>
11 #include <rvinterf/l1tm.h> 13 #include <rvinterf/l1tm.h>
12 #include <rvinterf/exitcodes.h> 14 #include <rvinterf/exitcodes.h>
13 15
159 fprintf(stderr, "DUT error: txpw response wrong index\n"); 161 fprintf(stderr, "DUT error: txpw response wrong index\n");
160 exit(ERROR_TARGET); 162 exit(ERROR_TARGET);
161 } 163 }
162 return(0); 164 return(0);
163 } 165 }
166
167 do_rftw(index, table, size)
168 u_char *table;
169 {
170 u_char cmdpkt[MAX_RF_TABLE_SIZE + 4];
171
172 cmdpkt[1] = RF_TABLE_WRITE;
173 cmdpkt[2] = index;
174 bcopy(table, cmdpkt + 3, size);
175 l1tm_pkt_exch(cmdpkt, size + 2);
176 if (rvi_msg[3]) {
177 fprintf(stderr, "DUT error %u in response to rftw\n",
178 rvi_msg[3]);
179 exit(ERROR_TARGET);
180 }
181 if (rvi_msg_len != 6) {
182 fprintf(stderr, "DUT error: rftw response wrong length\n");
183 exit(ERROR_TARGET);
184 }
185 if (rvi_msg[4] != index) {
186 fprintf(stderr, "DUT error: rftw response wrong index\n");
187 exit(ERROR_TARGET);
188 }
189 return(0);
190 }
191
192 misc_enable(arg)
193 {
194 u_char cmdpkt[5];
195
196 cmdpkt[1] = MISC_ENABLE;
197 cmdpkt[2] = arg;
198 cmdpkt[3] = arg >> 8;
199 l1tm_pkt_exch(cmdpkt, 3);
200 if (rvi_msg[3]) {
201 fprintf(stderr, "DUT error %u in response to me\n",
202 rvi_msg[3]);
203 exit(ERROR_TARGET);
204 }
205 if (rvi_msg_len != 6) {
206 fprintf(stderr, "DUT error: me response wrong length\n");
207 exit(ERROR_TARGET);
208 }
209 if (rvi_msg[4] != arg) {
210 fprintf(stderr, "DUT error: me response wrong index\n");
211 exit(ERROR_TARGET);
212 }
213 return(0);
214 }