diff rvinterf/etm/interf.c @ 183:85222710dc92

rvinterf/etm: implemented everything except the packet sending command
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 24 Nov 2013 08:03:27 +0000
parents 13a0348ffce4
children 4714fdfca39c
line wrap: on
line diff
--- a/rvinterf/etm/interf.c	Sun Nov 24 06:59:09 2013 +0000
+++ b/rvinterf/etm/interf.c	Sun Nov 24 08:03:27 2013 +0000
@@ -35,8 +35,27 @@
 void
 process_msg_from_rvinterf()
 {
-
-
+	switch (rvi_msg[0]) {
+	case RVI2CLI_PKT_FROM_TARGET:
+		process_pkt_from_target();
+		return;
+	case RVI2CLI_LOCAL_CMD_RESP:
+		if (rvi_msg_len < 2)
+			goto bad;
+		if (rvi_msg[1] == '+')
+			return;
+		tty_cleanup();
+		fprintf(stderr, "Error from rvinterf: %.*s\n", rvi_msg_len - 1,
+			rvi_msg + 1);
+		exit(1);
+	default:
+	bad:
+		tty_cleanup();
+		fprintf(stderr,
+			"Error: unexpected message type %02X from rvinterf\n",
+			rvi_msg[0]);
+		exit(1);
+	}
 }
 
 void