comparison 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
comparison
equal deleted inserted replaced
977:ce0ded19a769 978:1ee80bcb0fd0
1 /*
2 * Old-style memory read command
3 */
4
5 #include <sys/types.h>
6 #include <stdio.h>
7 #include <string.h>
8 #include <strings.h>
9 #include <stdlib.h>
10 #include "pktmux.h"
11 #include "limits.h"
12 #include "localtypes.h"
13 #include "tm3.h"
14
15 extern u_char rvi_msg[];
16 extern int rvi_msg_len;
17
18 void
19 cmd_omr(argc, argv)
20 char **argv;
21 {
22 u32 addr, size;
23 u_char cmdpkt[11];
24
25 addr = strtoul(argv[1], 0, 16);
26 size = strtoul(argv[2], 0, 0);
27 if (size < 1 || size > TM3_MEMREAD_MAX) {
28 printf("error: count argument outside valid range\n");
29 return;
30 }
31 cmdpkt[1] = MEM_READ;
32 cmdpkt[2] = addr;
33 cmdpkt[3] = addr >> 8;
34 cmdpkt[4] = addr >> 16;
35 cmdpkt[5] = addr >> 24;
36 cmdpkt[6] = size;
37 cmdpkt[7] = 0;
38 cmdpkt[8] = 0;
39 cmdpkt[9] = 0;
40 send_etm_cmd(cmdpkt, 9);
41 }