changeset 271:dc9dbb2f74e7

etmsync l1tmops module: rfpr implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 16 Nov 2017 19:14:52 +0000
parents 095ffce023d4
children 3e272b956ef4
files rvinterf/etmsync/l1tmops.c
diffstat 1 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/etmsync/l1tmops.c	Thu Nov 16 19:00:05 2017 +0000
+++ b/rvinterf/etmsync/l1tmops.c	Thu Nov 16 19:14:52 2017 +0000
@@ -36,6 +36,32 @@
 	return(0);
 }
 
+do_rfpr(index, retp)
+	u_short *retp;
+{
+	u_char cmdpkt[5];
+
+	cmdpkt[1] = RF_PARAM_READ;
+	cmdpkt[2] = index;
+	cmdpkt[3] = index >> 8;
+	etm_pkt_exch(cmdpkt, 3);
+	if (rvi_msg[3]) {
+		fprintf(stderr, "target error %u in response to rfpr\n",
+			rvi_msg[3]);
+		exit(ERROR_TARGET);
+	}
+	if (rvi_msg_len != 8) {
+		fprintf(stderr, "target error: rfpr response wrong length\n");
+		exit(ERROR_TARGET);
+	}
+	if (rvi_msg[4] != index) {
+		fprintf(stderr, "target error: rfpr response wrong index\n");
+		exit(ERROR_TARGET);
+	}
+	*retp = rvi_msg[5] | (rvi_msg[6] << 8);
+	return(0);
+}
+
 do_rfpw(index, value)
 {
 	u_char cmdpkt[7];