changeset 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 751f8d9efed0
children 201f27bd8dca
files autocal/l1stats.h autocal/l1tmops.c autocal/rvinterf.c
diffstat 3 files changed, 42 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autocal/l1stats.h	Sat May 27 06:46:17 2017 +0000
@@ -0,0 +1,23 @@
+/*
+ * Here we define our internal structure in which we pass
+ * the stats read from L1TM.
+ */
+
+struct l1stats {
+	int		type;
+	unsigned	bitmask;
+	unsigned	rssi;
+	unsigned	dsp_pm;
+	int		angle_mean;
+	unsigned	angle_var;
+	int		angle_min;
+	int		angle_max;
+	unsigned	snr_mean;
+	unsigned	snr_var;
+	unsigned	toa_mean;
+	unsigned	toa_var;
+	unsigned	frame_number;
+	unsigned	runs;
+	unsigned	successes;
+	unsigned	bsic;
+};
--- a/autocal/l1tmops.c	Sat May 27 06:25:59 2017 +0000
+++ b/autocal/l1tmops.c	Sat May 27 06:46:17 2017 +0000
@@ -27,6 +27,14 @@
 		c ^= outbuf[i];
 	outbuf[i] = c;
 	target_pkt_exch(outbuf, outlen + 2);
+	l1tm_resp_sanity_check(outbuf[1]);
+	return(0);
+}
+
+l1tm_resp_sanity_check(cid)
+{
+	int i, c;
+
 	if (rvi_msg[1] != RVT_TM_HEADER) {
 		fprintf(stderr,
 			"DUT error: response packet is not on TM channel\n");
@@ -43,7 +51,7 @@
 		fprintf(stderr, "DUT error: TM response bad checksum\n");
 		exit(ERROR_TARGET);
 	}
-	if (rvi_msg[2] != outbuf[1]) {
+	if (rvi_msg[2] != cid) {
 		fprintf(stderr, "DUT error: TM response has wrong CID\n");
 		exit(ERROR_TARGET);
 	}
--- a/autocal/rvinterf.c	Sat May 27 06:25:59 2017 +0000
+++ b/autocal/rvinterf.c	Sat May 27 06:46:17 2017 +0000
@@ -163,3 +163,13 @@
 	}
 	return(0);
 }
+
+collect_extra_pkt_from_target()
+{
+	collect_rvi_msg();
+	if (rvi_msg[0] != RVI2CLI_PKT_FROM_TARGET) {
+		fprintf(stderr, "error: unexpected message from rvinterf\n");
+		exit(ERROR_RVINTERF);
+	}
+	return(0);
+}