comparison rvinterf/etmsync/dspapidump.c @ 990:2a867e5768e9

fc-dspapidump fix: be independent of host byte order
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sat, 12 Dec 2015 20:07:51 +0000
parents 38c7078712ab
children
comparison
equal deleted inserted replaced
989:0b7abc72e49e 990:2a867e5768e9
7 #include <sys/types.h> 7 #include <sys/types.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
11 #include <strings.h> 11 #include <strings.h>
12 #include <stdint.h>
12 #include <endian.h> 13 #include <endian.h>
13 #include "localtypes.h"
14 #include "exitcodes.h" 14 #include "exitcodes.h"
15 15
16 #define APIF_ADDR 0xFFD00000 16 #define APIF_ADDR 0xFFD00000
17 #define API_SIZE_IN_WORDS 0x2000 17 #define API_SIZE_IN_WORDS 0x2000
18 18
19 single_op_main() 19 single_op_main()
20 { 20 {
21 u16 buf[64], *linebase; 21 uint16_t buf[64], *linebase;
22 unsigned off; 22 unsigned off;
23 int rc, i, j; 23 int rc, i, j;
24 24
25 for (off = 0; off < API_SIZE_IN_WORDS; ) { 25 for (off = 0; off < API_SIZE_IN_WORDS; ) {
26 rc = do_memory_read_16(APIF_ADDR + off * 2, buf, 0x40); 26 rc = do_memory_read_16(APIF_ADDR + off * 2, buf, 0x40);
28 return(rc); 28 return(rc);
29 for (i = 0; i < 8; i++) { 29 for (i = 0; i < 8; i++) {
30 printf("%04X:", off); 30 printf("%04X:", off);
31 linebase = buf + i * 8; 31 linebase = buf + i * 8;
32 for (j = 0; j < 8; j++) 32 for (j = 0; j < 8; j++)
33 printf(" %04X", linebase[j]); 33 printf(" %04X", le16toh(linebase[j]));
34 putchar('\n'); 34 putchar('\n');
35 off += 8; 35 off += 8;
36 } 36 }
37 } 37 }
38 return(0); 38 return(0);