FreeCalypso > hg > fc-rfcal-tools
annotate autocal/l1meas.c @ 47:e86779d5445c
autocal: preparations for receiving auto stats and rfe completion
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 27 May 2017 06:46:17 +0000 |
parents | 98abe6bd2042 |
children | 201f27bd8dca |
rev | line source |
---|---|
45
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * In this module we are going to implement the functions for making |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * measurements on the DUT via L1TM. |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <sys/types.h> |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdio.h> |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdlib.h> |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <rvinterf/pktmux.h> |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <rvinterf/tm3.h> |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <rvinterf/l1tm.h> |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include <rvinterf/exitcodes.h> |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 extern u_char rvi_msg[]; |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 extern int rvi_msg_len; |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 do_scw(index, value) |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 { |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 u_char cmdpkt[7]; |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 cmdpkt[1] = STATS_CONFIG_WRITE; |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 cmdpkt[2] = index; |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 cmdpkt[3] = index >> 8; |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 cmdpkt[4] = value; |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 cmdpkt[5] = value >> 8; |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 l1tm_pkt_exch(cmdpkt, 5); |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 if (rvi_msg[3]) { |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 fprintf(stderr, "DUT error %u in response to scw\n", |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 rvi_msg[3]); |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 exit(ERROR_TARGET); |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 } |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 if (rvi_msg_len != 6) { |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 fprintf(stderr, "DUT error: scw response wrong length\n"); |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 exit(ERROR_TARGET); |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 } |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 if (rvi_msg[4] != index) { |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 fprintf(stderr, "DUT error: scw response wrong index\n"); |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 exit(ERROR_TARGET); |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 } |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 return(0); |
98abe6bd2042
autocal: scw implemented for Rx cal
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 } |