FreeCalypso > hg > freecalypso-ui-dev
annotate lcdpoll/memops.c @ 7:d584d7b50f10
README: simplified way of setting TR_BAUD_CONFIG to TR_BAUD_812500
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Mar 2018 04:13:40 +0000 |
parents | 06e900c54ae3 |
children |
rev | line source |
---|---|
3
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * Functions for ETM memory read requests |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <sys/types.h> |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdio.h> |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdlib.h> |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <string.h> |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <strings.h> |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <rvinterf/etm.h> |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <rvinterf/limits.h> |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include <rvinterf/localtypes.h> |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include <rvinterf/exitcodes.h> |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #ifndef MAX_MEMREAD_BYTES |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #define MAX_MEMREAD_BYTES 238 |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #endif |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 #ifndef MAX_MEMREAD_16BIT |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 #define MAX_MEMREAD_16BIT 119 |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 #endif |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #ifndef MAX_MEMREAD_32BIT |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #define MAX_MEMREAD_32BIT 59 |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 #endif |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 extern u_char rvi_msg[]; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 extern int rvi_msg_len; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 do_memory_read(memaddr, databuf, nbytes) |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 u32 memaddr; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 u_char *databuf; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 { |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 u_char cmdpkt[10]; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 int rc; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 if (nbytes > MAX_MEMREAD_BYTES) { |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 printf("error: # of bytes to read may not exceed %d\n", |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 MAX_MEMREAD_BYTES); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 return(ERROR_USAGE); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 } |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 cmdpkt[1] = ETM_CORE; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 cmdpkt[2] = TMCORE_OPC_MEM; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 cmdpkt[3] = 0x01; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 cmdpkt[4] = nbytes; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 cmdpkt[5] = memaddr; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 cmdpkt[6] = memaddr >> 8; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 cmdpkt[7] = memaddr >> 16; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 cmdpkt[8] = memaddr >> 24; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 rc = etm_pkt_exch(cmdpkt, 8); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 if (rc) |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 return(rc); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 if (rvi_msg[3]) { |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 printf("ETM error response to mem read request: 0x%02X\n", |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 rvi_msg[3]); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 return(ERROR_TARGET); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 } |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 if (rvi_msg_len != nbytes + 7) { |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 printf("error: mem read response has wrong length\n"); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 return(ERROR_TARGET); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 } |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 if (rvi_msg[4] != TMCORE_OPC_MEM || rvi_msg[5] != 0x01) { |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 printf("error: mem read response has wrong opcode\n"); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 return(ERROR_TARGET); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 } |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 bcopy(rvi_msg + 6, databuf, nbytes); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 return(0); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 } |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 do_memory_read_16(memaddr, databuf, nwords) |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 u32 memaddr; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 u_char *databuf; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 { |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 u_char cmdpkt[10]; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 int rc; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 if (nwords > MAX_MEMREAD_16BIT) { |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 printf("error: # of 16-bit words to read may not exceed %d\n", |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 MAX_MEMREAD_16BIT); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 return(ERROR_USAGE); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 } |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 cmdpkt[1] = ETM_CORE; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 cmdpkt[2] = TMCORE_OPC_MEM; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 cmdpkt[3] = 0x02; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 cmdpkt[4] = nwords; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 cmdpkt[5] = memaddr; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 cmdpkt[6] = memaddr >> 8; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 cmdpkt[7] = memaddr >> 16; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 cmdpkt[8] = memaddr >> 24; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 rc = etm_pkt_exch(cmdpkt, 8); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 if (rc) |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 return(rc); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 if (rvi_msg[3]) { |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 printf("ETM error response to mem read 16 request: 0x%02X\n", |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 rvi_msg[3]); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 return(ERROR_TARGET); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 } |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 if (rvi_msg_len != nwords * 2 + 7) { |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 printf("error: mem read 16 response has wrong length\n"); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 return(ERROR_TARGET); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 } |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 if (rvi_msg[4] != TMCORE_OPC_MEM || rvi_msg[5] != 0x02) { |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 printf("error: mem read 16 response has wrong opcode\n"); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 return(ERROR_TARGET); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 } |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 bcopy(rvi_msg + 6, databuf, nwords * 2); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 return(0); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 } |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 do_memory_read_32(memaddr, databuf, nwords) |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 u32 memaddr; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 u_char *databuf; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 { |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 u_char cmdpkt[10]; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 int rc; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 if (nwords > MAX_MEMREAD_32BIT) { |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 printf("error: # of 32-bit words to read may not exceed %d\n", |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 MAX_MEMREAD_32BIT); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 return(ERROR_USAGE); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 } |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 cmdpkt[1] = ETM_CORE; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 cmdpkt[2] = TMCORE_OPC_MEM; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 cmdpkt[3] = 0x04; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 cmdpkt[4] = nwords; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 cmdpkt[5] = memaddr; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 cmdpkt[6] = memaddr >> 8; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 cmdpkt[7] = memaddr >> 16; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 cmdpkt[8] = memaddr >> 24; |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 rc = etm_pkt_exch(cmdpkt, 8); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 if (rc) |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 return(rc); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 if (rvi_msg[3]) { |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 printf("ETM error response to mem read 32 request: 0x%02X\n", |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 rvi_msg[3]); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 return(ERROR_TARGET); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 } |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 if (rvi_msg_len != nwords * 4 + 7) { |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 printf("error: mem read 32 response has wrong length\n"); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 return(ERROR_TARGET); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 } |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 if (rvi_msg[4] != TMCORE_OPC_MEM || rvi_msg[5] != 0x04 && rvi_msg[5]) { |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 printf("error: mem read 32 response has wrong opcode\n"); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 return(ERROR_TARGET); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 } |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 bcopy(rvi_msg + 6, databuf, nwords * 4); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 return(0); |
06e900c54ae3
fc-lcdpoll program put together, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 } |