diff autocal/l1meas.c @ 45:98abe6bd2042

autocal: scw implemented for Rx cal
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 27 May 2017 05:48:04 +0000
parents
children 201f27bd8dca
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/autocal/l1meas.c	Sat May 27 05:48:04 2017 +0000
@@ -0,0 +1,41 @@
+/*
+ * In this module we are going to implement the functions for making
+ * measurements on the DUT via L1TM.
+ */
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <rvinterf/pktmux.h>
+#include <rvinterf/tm3.h>
+#include <rvinterf/l1tm.h>
+#include <rvinterf/exitcodes.h>
+
+extern u_char rvi_msg[];
+extern int rvi_msg_len;
+
+do_scw(index, value)
+{
+	u_char cmdpkt[7];
+
+	cmdpkt[1] = STATS_CONFIG_WRITE;
+	cmdpkt[2] = index;
+	cmdpkt[3] = index >> 8;
+	cmdpkt[4] = value;
+	cmdpkt[5] = value >> 8;
+	l1tm_pkt_exch(cmdpkt, 5);
+	if (rvi_msg[3]) {
+		fprintf(stderr, "DUT error %u in response to scw\n",
+			rvi_msg[3]);
+		exit(ERROR_TARGET);
+	}
+	if (rvi_msg_len != 6) {
+		fprintf(stderr, "DUT error: scw response wrong length\n");
+		exit(ERROR_TARGET);
+	}
+	if (rvi_msg[4] != index) {
+		fprintf(stderr, "DUT error: scw response wrong index\n");
+		exit(ERROR_TARGET);
+	}
+	return(0);
+}