diff autocal/l1tmops.c @ 17:0645344feee5

autocal/l1tmops.c: started implementing basic operations
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 22 May 2017 18:30:24 +0000
parents 1c4abfe8bcd9
children af77b95feeba
line wrap: on
line diff
--- a/autocal/l1tmops.c	Mon May 22 17:45:30 2017 +0000
+++ b/autocal/l1tmops.c	Mon May 22 18:30:24 2017 +0000
@@ -47,3 +47,91 @@
 	}
 	return(0);
 }
+
+do_tms(arg)
+{
+	u_char cmdpkt[5];
+
+	cmdpkt[1] = TM_MODE_SET;
+	cmdpkt[2] = arg;
+	cmdpkt[3] = arg >> 8;
+	l1tm_pkt_exch(cmdpkt, 3);
+	if (rvi_msg[3]) {
+		fprintf(stderr, "DUT error %u in response to tms\n",
+			rvi_msg[3]);
+		exit(ERROR_TARGET);
+	}
+	if (rvi_msg_len != 5) {
+		fprintf(stderr, "DUT error: tms response wrong length\n");
+		exit(ERROR_TARGET);
+	}
+	return(0);
+}
+
+do_rfe(arg)
+{
+	u_char cmdpkt[5];
+
+	cmdpkt[1] = RF_ENABLE;
+	cmdpkt[2] = arg;
+	cmdpkt[3] = arg >> 8;
+	l1tm_pkt_exch(cmdpkt, 3);
+	if (rvi_msg[3]) {
+		fprintf(stderr, "DUT error %u in response to rfe\n",
+			rvi_msg[3]);
+		exit(ERROR_TARGET);
+	}
+	return(0);
+}
+
+do_rfpw(index, value)
+{
+	u_char cmdpkt[7];
+
+	cmdpkt[1] = RF_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 rfpw\n",
+			rvi_msg[3]);
+		exit(ERROR_TARGET);
+	}
+	if (rvi_msg_len != 6) {
+		fprintf(stderr, "DUT error: rfpw response wrong length\n");
+		exit(ERROR_TARGET);
+	}
+	if (rvi_msg[4] != index) {
+		fprintf(stderr, "DUT error: rfpw response wrong index\n");
+		exit(ERROR_TARGET);
+	}
+	return(0);
+}
+
+set_std_band(std, band)
+{
+	u_char cmdpkt[7];
+
+	cmdpkt[1] = RF_PARAM_WRITE;
+	cmdpkt[2] = STD_BAND_FLAG;
+	cmdpkt[3] = 0;
+	cmdpkt[4] = std;
+	cmdpkt[5] = band;
+	l1tm_pkt_exch(cmdpkt, 5);
+	if (rvi_msg[3]) {
+		fprintf(stderr, "DUT error %u in response to rfpw\n",
+			rvi_msg[3]);
+		exit(ERROR_TARGET);
+	}
+	if (rvi_msg_len != 6) {
+		fprintf(stderr, "DUT error: rfpw response wrong length\n");
+		exit(ERROR_TARGET);
+	}
+	if (rvi_msg[4] != STD_BAND_FLAG) {
+		fprintf(stderr, "DUT error: rfpw response wrong index\n");
+		exit(ERROR_TARGET);
+	}
+	return(0);
+}