diff rvinterf/etmsync/fsbasics.c @ 278:f77480d3dd21

fc-fsio: first ffs2ver command implemented
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 24 Feb 2014 04:41:57 +0000
parents
children 36ad667341fc
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rvinterf/etmsync/fsbasics.c	Mon Feb 24 04:41:57 2014 +0000
@@ -0,0 +1,36 @@
+/*
+ * Basic FFS2 operations
+ */
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "etm.h"
+#include "ffs.h"
+#include "tmffs2.h"
+#include "exitcodes.h"
+
+extern u_char rvi_msg[];
+extern int rvi_msg_len;
+
+cmd_ffs2ver()
+{
+	u_char cmdpkt[4];
+	int rc;
+
+	cmdpkt[1] = ETM_FFS2;
+	cmdpkt[2] = TMFFS_VERSION;
+	rc = etm_pkt_exch(cmdpkt, 2);
+	if (rc)
+		return(rc);
+	if (rvi_msg[3]) {
+		printf("FFS2 error %d\n", rvi_msg[3]);
+		return(ERROR_TARGET);
+	}
+	if (rvi_msg_len != 7) {
+		printf("error: FFS2 version response has wrong length\n");
+		return(ERROR_TARGET);
+	}
+	printf("FFS2 version: %02X.%02X\n", rvi_msg[5], rvi_msg[4]);
+	return(0);
+}