changeset 18:af77b95feeba

autocal/l1tmops.c: rxpw and txpw implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 22 May 2017 18:36:26 +0000
parents 0645344feee5
children f67f46e56355
files autocal/l1tmops.c
diffstat 1 files changed, 52 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/autocal/l1tmops.c	Mon May 22 18:30:24 2017 +0000
+++ b/autocal/l1tmops.c	Mon May 22 18:36:26 2017 +0000
@@ -135,3 +135,55 @@
 	}
 	return(0);
 }
+
+do_rxpw(index, value)
+{
+	u_char cmdpkt[7];
+
+	cmdpkt[1] = RX_PARAM_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 rxpw\n",
+			rvi_msg[3]);
+		exit(ERROR_TARGET);
+	}
+	if (rvi_msg_len != 6) {
+		fprintf(stderr, "DUT error: rxpw response wrong length\n");
+		exit(ERROR_TARGET);
+	}
+	if (rvi_msg[4] != index) {
+		fprintf(stderr, "DUT error: rxpw response wrong index\n");
+		exit(ERROR_TARGET);
+	}
+	return(0);
+}
+
+do_txpw(index, value)
+{
+	u_char cmdpkt[7];
+
+	cmdpkt[1] = TX_PARAM_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 txpw\n",
+			rvi_msg[3]);
+		exit(ERROR_TARGET);
+	}
+	if (rvi_msg_len != 6) {
+		fprintf(stderr, "DUT error: txpw response wrong length\n");
+		exit(ERROR_TARGET);
+	}
+	if (rvi_msg[4] != index) {
+		fprintf(stderr, "DUT error: txpw response wrong index\n");
+		exit(ERROR_TARGET);
+	}
+	return(0);
+}