Commit | Line | Data |
---|---|---|
1 | #include <stdio.h> | |
2 | #include <sys/types.h> | |
3 | #include <sys/stat.h> | |
4 | #include <fcntl.h> | |
5 | #include <sys/mman.h> | |
6 | ||
7 | int main() | |
8 | { | |
9 | volatile void *memregs; | |
10 | int memdev; | |
11 | ||
12 | printf("hi\n"); | |
13 | ||
14 | memdev = open("/dev/mem", O_RDWR); | |
15 | memregs = mmap(NULL, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, memdev, 0xc0000000); | |
16 | printf("%02x %04x %08x\n", ((char *)memregs)[0x2011], ((short *)memregs)[0x1198/2], ((int *)memregs)[0xbcdc/4]); | |
17 | //sleep(1000); | |
18 | ||
19 | return 0; | |
20 | } | |
21 |