annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
278
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 * Basic FFS2 operations
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 */
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 #include <sys/types.h>
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 #include <stdio.h>
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 #include <stdlib.h>
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 #include "etm.h"
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 #include "ffs.h"
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 #include "tmffs2.h"
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 #include "exitcodes.h"
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 extern u_char rvi_msg[];
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 extern int rvi_msg_len;
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 cmd_ffs2ver()
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 {
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 u_char cmdpkt[4];
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 int rc;
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 cmdpkt[1] = ETM_FFS2;
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 cmdpkt[2] = TMFFS_VERSION;
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 rc = etm_pkt_exch(cmdpkt, 2);
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 if (rc)
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 return(rc);
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 if (rvi_msg[3]) {
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 printf("FFS2 error %d\n", rvi_msg[3]);
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 return(ERROR_TARGET);
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 }
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 if (rvi_msg_len != 7) {
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 printf("error: FFS2 version response has wrong length\n");
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32 return(ERROR_TARGET);
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 }
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 printf("FFS2 version: %02X.%02X\n", rvi_msg[5], rvi_msg[4]);
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 return(0);
f77480d3dd21 fc-fsio: first ffs2ver command implemented
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 }