view 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 source

/*
 * 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);
}