changeset 272:3e272b956ef4

etmsync l1tmops module: ttr implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 16 Nov 2017 19:26:24 +0000
parents dc9dbb2f74e7
children 18a8fb3d845b
files rvinterf/etmsync/l1tmops.c
diffstat 1 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/etmsync/l1tmops.c	Thu Nov 16 19:14:52 2017 +0000
+++ b/rvinterf/etmsync/l1tmops.c	Thu Nov 16 19:26:24 2017 +0000
@@ -112,3 +112,28 @@
 	bcopy(rvi_msg + 5, table, size);
 	return(0);
 }
+
+do_ttr(index, buf)
+	u_char *buf;
+{
+	u_char cmdpkt[4];
+
+	cmdpkt[1] = TX_TEMPLATE_READ;
+	cmdpkt[2] = index;
+	etm_pkt_exch(cmdpkt, 2);
+	if (rvi_msg[3]) {
+		fprintf(stderr, "target error %u in response to ttr\n",
+			rvi_msg[3]);
+		exit(ERROR_TARGET);
+	}
+	if (rvi_msg_len != 38) {
+		fprintf(stderr, "target error: ttr response wrong length\n");
+		exit(ERROR_TARGET);
+	}
+	if (rvi_msg[4] != index) {
+		fprintf(stderr, "target error: ttr response wrong index\n");
+		exit(ERROR_TARGET);
+	}
+	bcopy(rvi_msg + 5, buf, 32);
+	return(0);
+}