annotate rvinterf/etmsync/dspapidump.c @ 1034:405b5469abc4 default tip

top README: repository change notice
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 12 Jun 2016 19:06:34 +0000
parents 2a867e5768e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
921
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
2 * This utility uses ETM in synchronous mode to read and dump the contents
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
3 * of the DSP API RAM in a target Calypso GSM device while the firmware is
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
4 * running.
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
5 */
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
6
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
7 #include <sys/types.h>
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
8 #include <stdio.h>
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
9 #include <stdlib.h>
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
10 #include <string.h>
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
11 #include <strings.h>
990
2a867e5768e9 fc-dspapidump fix: be independent of host byte order
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
12 #include <stdint.h>
921
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
13 #include <endian.h>
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
14 #include "exitcodes.h"
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
15
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
16 #define APIF_ADDR 0xFFD00000
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
17 #define API_SIZE_IN_WORDS 0x2000
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
18
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
19 single_op_main()
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
20 {
990
2a867e5768e9 fc-dspapidump fix: be independent of host byte order
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
21 uint16_t buf[64], *linebase;
921
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
22 unsigned off;
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
23 int rc, i, j;
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
24
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
25 for (off = 0; off < API_SIZE_IN_WORDS; ) {
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
26 rc = do_memory_read_16(APIF_ADDR + off * 2, buf, 0x40);
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
27 if (rc)
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
28 return(rc);
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
29 for (i = 0; i < 8; i++) {
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
30 printf("%04X:", off);
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
31 linebase = buf + i * 8;
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
32 for (j = 0; j < 8; j++)
990
2a867e5768e9 fc-dspapidump fix: be independent of host byte order
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents: 921
diff changeset
33 printf(" %04X", le16toh(linebase[j]));
921
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
34 putchar('\n');
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
35 off += 8;
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
36 }
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
37 }
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
38 return(0);
38c7078712ab fc-dspapidump utility written, compiles
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
39 }