annotate rvinterf/etmsync/memops.c @ 982:461f7ee5f254

fc-olddump: brown paper bag
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Thu, 10 Dec 2015 05:35:42 +0000
parents ce0ded19a769
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
911
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
2 * Functions for reading memory regions and Calypso die ID via ETM
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
3 */
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
4
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
5 #include <sys/types.h>
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
6 #include <stdio.h>
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
7 #include <stdlib.h>
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
8 #include <string.h>
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
9 #include <strings.h>
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
10 #include "etm.h"
977
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
11 #include "tm3.h"
911
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
12 #include "limits.h"
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
13 #include "localtypes.h"
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
14 #include "exitcodes.h"
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
15
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
16 extern u_char rvi_msg[];
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
17 extern int rvi_msg_len;
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
18
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
19 do_memory_read(memaddr, databuf, nbytes)
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
20 u32 memaddr;
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
21 u_char *databuf;
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
22 {
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
23 u_char cmdpkt[10];
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
24 int rc;
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
25
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
26 if (nbytes > MAX_MEMREAD_BYTES) {
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
27 printf("error: # of bytes to read may not exceed %d\n",
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
28 MAX_MEMREAD_BYTES);
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
29 return(ERROR_USAGE);
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
30 }
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
31 cmdpkt[1] = ETM_CORE;
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
32 cmdpkt[2] = TMCORE_OPC_MEM;
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
33 cmdpkt[3] = 0x01;
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
34 cmdpkt[4] = nbytes;
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
35 cmdpkt[5] = memaddr;
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
36 cmdpkt[6] = memaddr >> 8;
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
37 cmdpkt[7] = memaddr >> 16;
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
38 cmdpkt[8] = memaddr >> 24;
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
39 rc = etm_pkt_exch(cmdpkt, 8);
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
40 if (rc)
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
41 return(rc);
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
42 if (rvi_msg[3]) {
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
43 printf("ETM error response to mem read request: 0x%02X\n",
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
44 rvi_msg[3]);
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
45 return(ERROR_TARGET);
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
46 }
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
47 if (rvi_msg_len != nbytes + 7) {
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
48 printf("error: mem read response has wrong length\n");
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
49 return(ERROR_TARGET);
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
50 }
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
51 if (rvi_msg[4] != TMCORE_OPC_MEM || rvi_msg[5] != 0x01) {
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
52 printf("error: mem read response has wrong opcode\n");
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
53 return(ERROR_TARGET);
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
54 }
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
55 bcopy(rvi_msg + 6, databuf, nbytes);
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
56 return(0);
42719fa3e6af etmsync: memory read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff changeset
57 }
912
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
58
921
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
59 do_memory_read_16(memaddr, databuf, nwords)
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
60 u32 memaddr;
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
61 u_char *databuf;
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
62 {
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
63 u_char cmdpkt[10];
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
64 int rc;
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
65
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
66 if (nwords > MAX_MEMREAD_16BIT) {
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
67 printf("error: # of 16-bit words to read may not exceed %d\n",
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
68 MAX_MEMREAD_16BIT);
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
69 return(ERROR_USAGE);
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
70 }
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
71 cmdpkt[1] = ETM_CORE;
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
72 cmdpkt[2] = TMCORE_OPC_MEM;
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
73 cmdpkt[3] = 0x02;
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
74 cmdpkt[4] = nwords;
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
75 cmdpkt[5] = memaddr;
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
76 cmdpkt[6] = memaddr >> 8;
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
77 cmdpkt[7] = memaddr >> 16;
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
78 cmdpkt[8] = memaddr >> 24;
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
79 rc = etm_pkt_exch(cmdpkt, 8);
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
80 if (rc)
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
81 return(rc);
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
82 if (rvi_msg[3]) {
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
83 printf("ETM error response to mem read 16 request: 0x%02X\n",
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
84 rvi_msg[3]);
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
85 return(ERROR_TARGET);
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
86 }
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
87 if (rvi_msg_len != nwords * 2 + 7) {
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
88 printf("error: mem read 16 response has wrong length\n");
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
89 return(ERROR_TARGET);
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
90 }
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
91 if (rvi_msg[4] != TMCORE_OPC_MEM || rvi_msg[5] != 0x02) {
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
92 printf("error: mem read 16 response has wrong opcode\n");
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
93 return(ERROR_TARGET);
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
94 }
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
95 bcopy(rvi_msg + 6, databuf, nwords * 2);
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
96 return(0);
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
97 }
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 912
diff changeset
98
977
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
99 do_memory_read_tm3(memaddr, databuf, nbytes)
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
100 u32 memaddr;
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
101 u_char *databuf;
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
102 {
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
103 u_char cmdpkt[11];
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
104 int rc;
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
105
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
106 if (nbytes > TM3_MEMREAD_MAX) {
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
107 printf("error: # of bytes to read may not exceed %d\n",
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
108 TM3_MEMREAD_MAX);
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
109 return(ERROR_USAGE);
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
110 }
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
111 cmdpkt[1] = MEM_READ;
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
112 cmdpkt[2] = memaddr;
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
113 cmdpkt[3] = memaddr >> 8;
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
114 cmdpkt[4] = memaddr >> 16;
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
115 cmdpkt[5] = memaddr >> 24;
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
116 cmdpkt[6] = nbytes;
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
117 cmdpkt[7] = 0;
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
118 cmdpkt[8] = 0;
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
119 cmdpkt[9] = 0;
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
120 rc = etm_pkt_exch(cmdpkt, 9);
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
121 if (rc)
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
122 return(rc);
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
123 if (rvi_msg[3]) {
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
124 printf("TM3 error response to mem read request: 0x%02X\n",
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
125 rvi_msg[3]);
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
126 return(ERROR_TARGET);
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
127 }
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
128 if (rvi_msg_len != nbytes + 9) {
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
129 printf("error: mem read response has wrong length\n");
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
130 return(ERROR_TARGET);
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
131 }
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
132 if (rvi_msg[4] != nbytes || rvi_msg[5] || rvi_msg[6] || rvi_msg[7]) {
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
133 printf("error: mem read response has wrong length echo\n");
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
134 return(ERROR_TARGET);
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
135 }
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
136 bcopy(rvi_msg + 8, databuf, nbytes);
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
137 return(0);
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
138 }
ce0ded19a769 rvinterf: first attempt at TM3 memory read: omemdump command in fc-fsio
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
139
912
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
140 do_dieid_read(databuf)
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
141 u_char *databuf;
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
142 {
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
143 u_char cmdpkt[4];
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
144 int rc;
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
145
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
146 cmdpkt[1] = ETM_CORE;
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
147 cmdpkt[2] = TMCORE_OPC_DIEID;
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
148 rc = etm_pkt_exch(cmdpkt, 2);
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
149 if (rc)
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
150 return(rc);
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
151 if (rvi_msg[3]) {
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
152 printf("ETM error response to die ID read request: 0x%02X\n",
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
153 rvi_msg[3]);
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
154 return(ERROR_TARGET);
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
155 }
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
156 if (rvi_msg_len != 14) {
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
157 printf("error: die ID read response has wrong length\n");
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
158 return(ERROR_TARGET);
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
159 }
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
160 if (rvi_msg[4] != TMCORE_OPC_DIEID) {
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
161 printf("error: die ID read response has wrong opcode\n");
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
162 return(ERROR_TARGET);
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
163 }
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
164 bcopy(rvi_msg + 5, databuf, 8);
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
165 return(0);
f50c71442d50 etmsync: die ID read implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents: 911
diff changeset
166 }