| 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 | int i; |
| 12 | |
| 13 | printf("hi\n"); |
| 14 | |
| 15 | memdev = open("/dev/mem", O_RDWR); |
| 16 | memregs = mmap(NULL, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, memdev, 0xc0000000); |
| 17 | |
| 18 | for (i = 0; i < 2; i++) |
| 19 | printf("%02x %04x %08x\n", ((char *)memregs)[0x2011], |
| 20 | ((short *)memregs)[0x1198/2], ((int *)memregs)[0xbcdc/4]); |
| 21 | |
| 22 | //sleep(1000); |
| 23 | |
| 24 | return 0; |
| 25 | } |
| 26 | |