annotate rvinterf/tmsh/omr.c @ 978:1ee80bcb0fd0

fc-tmsh: omr (old-style memory read) command implemented
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Thu, 10 Dec 2015 04:05:55 +0000
parents
children ebdf5afa9fb5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
978
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
2 * Old-style memory read command
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
3 */
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
4
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
5 #include <sys/types.h>
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
6 #include <stdio.h>
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
7 #include <string.h>
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
8 #include <strings.h>
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
9 #include <stdlib.h>
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
10 #include "pktmux.h"
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
11 #include "limits.h"
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
12 #include "localtypes.h"
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
13 #include "tm3.h"
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
14
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
15 extern u_char rvi_msg[];
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
16 extern int rvi_msg_len;
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
17
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
18 void
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
19 cmd_omr(argc, argv)
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
20 char **argv;
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
21 {
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
22 u32 addr, size;
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
23 u_char cmdpkt[11];
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
24
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
25 addr = strtoul(argv[1], 0, 16);
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
26 size = strtoul(argv[2], 0, 0);
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
27 if (size < 1 || size > TM3_MEMREAD_MAX) {
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
28 printf("error: count argument outside valid range\n");
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
29 return;
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
30 }
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
31 cmdpkt[1] = MEM_READ;
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
32 cmdpkt[2] = addr;
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
33 cmdpkt[3] = addr >> 8;
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
34 cmdpkt[4] = addr >> 16;
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
35 cmdpkt[5] = addr >> 24;
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
36 cmdpkt[6] = size;
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
37 cmdpkt[7] = 0;
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
38 cmdpkt[8] = 0;
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
39 cmdpkt[9] = 0;
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
40 send_etm_cmd(cmdpkt, 9);
1ee80bcb0fd0 fc-tmsh: omr (old-style memory read) command implemented
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
41 }