comparison rvinterf/etmsync/memops.c @ 977:ce0ded19a769

rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Thu, 10 Dec 2015 04:00:08 +0000
parents 38c7078712ab
children
comparison
equal deleted inserted replaced
976:ca65f5adf1af 977:ce0ded19a769
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 #include <strings.h> 9 #include <strings.h>
10 #include "etm.h" 10 #include "etm.h"
11 #include "tm3.h"
11 #include "limits.h" 12 #include "limits.h"
12 #include "localtypes.h" 13 #include "localtypes.h"
13 #include "exitcodes.h" 14 #include "exitcodes.h"
14 15
15 extern u_char rvi_msg[]; 16 extern u_char rvi_msg[];
93 } 94 }
94 bcopy(rvi_msg + 6, databuf, nwords * 2); 95 bcopy(rvi_msg + 6, databuf, nwords * 2);
95 return(0); 96 return(0);
96 } 97 }
97 98
99 do_memory_read_tm3(memaddr, databuf, nbytes)
100 u32 memaddr;
101 u_char *databuf;
102 {
103 u_char cmdpkt[11];
104 int rc;
105
106 if (nbytes > TM3_MEMREAD_MAX) {
107 printf("error: # of bytes to read may not exceed %d\n",
108 TM3_MEMREAD_MAX);
109 return(ERROR_USAGE);
110 }
111 cmdpkt[1] = MEM_READ;
112 cmdpkt[2] = memaddr;
113 cmdpkt[3] = memaddr >> 8;
114 cmdpkt[4] = memaddr >> 16;
115 cmdpkt[5] = memaddr >> 24;
116 cmdpkt[6] = nbytes;
117 cmdpkt[7] = 0;
118 cmdpkt[8] = 0;
119 cmdpkt[9] = 0;
120 rc = etm_pkt_exch(cmdpkt, 9);
121 if (rc)
122 return(rc);
123 if (rvi_msg[3]) {
124 printf("TM3 error response to mem read request: 0x%02X\n",
125 rvi_msg[3]);
126 return(ERROR_TARGET);
127 }
128 if (rvi_msg_len != nbytes + 9) {
129 printf("error: mem read response has wrong length\n");
130 return(ERROR_TARGET);
131 }
132 if (rvi_msg[4] != nbytes || rvi_msg[5] || rvi_msg[6] || rvi_msg[7]) {
133 printf("error: mem read response has wrong length echo\n");
134 return(ERROR_TARGET);
135 }
136 bcopy(rvi_msg + 8, databuf, nbytes);
137 return(0);
138 }
139
98 do_dieid_read(databuf) 140 do_dieid_read(databuf)
99 u_char *databuf; 141 u_char *databuf;
100 { 142 {
101 u_char cmdpkt[4]; 143 u_char cmdpkt[4];
102 int rc; 144 int rc;