diff options
author | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-05-30 19:17:20 +0000 |
---|---|---|
committer | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-05-30 19:17:20 +0000 |
commit | f3617303c1d4da10d923c883132447f84c2be45a (patch) | |
tree | 98732e957b9439373c2ce2cd177b30caa548c06f /vidix/dhahelper/test.c | |
parent | 508a697e942e7ebdcc8a7858481cc80c5d7d045c (diff) | |
download | mpv-f3617303c1d4da10d923c883132447f84c2be45a.tar.bz2 mpv-f3617303c1d4da10d923c883132447f84c2be45a.tar.xz |
Rename kernelhelper to dhahelper, that name is more fitting.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26933 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'vidix/dhahelper/test.c')
-rw-r--r-- | vidix/dhahelper/test.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/vidix/dhahelper/test.c b/vidix/dhahelper/test.c new file mode 100644 index 0000000000..8e795f77df --- /dev/null +++ b/vidix/dhahelper/test.c @@ -0,0 +1,60 @@ +#include <string.h> +#include <stdio.h> +#include <sys/ioctl.h> +#include <unistd.h> +#include <errno.h> +#include <fcntl.h> +#include <sys/mman.h> + +#include "dhahelper.h" + +int main(int argc, char *argv[]) +{ + int fd; + int ret; + + fd = open("/dev/dhahelper", O_RDWR); + + ioctl(fd, DHAHELPER_GET_VERSION, &ret); + + printf("api version: %d\n", ret); + if (ret != API_VERSION) + printf("incompatible api!\n"); + + { + dhahelper_memory_t mem; + + mem.operation = MEMORY_OP_MAP; + //mem.start = 0xe0000000; + mem.start = 0xe4000008; + mem.offset = 0; + mem.size = 0x4000; + mem.ret = 0; + + ret = ioctl(fd, DHAHELPER_MEMORY, &mem); + + printf("ret: %s\n", strerror(errno)); + + mem.ret = (int)mmap(NULL, (size_t)mem.size, PROT_READ, MAP_SHARED, fd, (off_t)0); + printf("allocated to %x\n", mem.ret); + + if (argc > 1) + if (mem.ret != 0) + { + int i; + + for (i = 0; i < 256; i++) + printf("[%x] ", *(int *)(mem.ret+i)); + printf("\n"); + } + + munmap((void *)mem.ret, mem.size); + + mem.operation = MEMORY_OP_UNMAP; + mem.start = mem.ret; + + ioctl(fd, DHAHELPER_MEMORY, &mem); + } + + return 0; +} |