diff options
author | alex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-02-02 07:05:52 +0000 |
---|---|---|
committer | alex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-02-02 07:05:52 +0000 |
commit | 7129693a264e033c78077b74392f1692f79b6514 (patch) | |
tree | c544b8a574459f5f107928aba58a56eec9af2b65 /libdha/libdha.c | |
parent | 127e0ba19184e5746fa4941dc6987dba98c2af94 (diff) | |
download | mpv-7129693a264e033c78077b74392f1692f79b6514.tar.bz2 mpv-7129693a264e033c78077b74392f1692f79b6514.tar.xz |
added support for dhahelper
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4475 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libdha/libdha.c')
-rw-r--r-- | libdha/libdha.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/libdha/libdha.c b/libdha/libdha.c index ccc6fc12f4..11309a2546 100644 --- a/libdha/libdha.c +++ b/libdha/libdha.c @@ -7,7 +7,7 @@ Modified for GATOS/win/gfxdump. 2002 - library implementation by Nick Kurshev - - some changes by Alex Beregszaszi + - dhahelper and some changes by Alex Beregszaszi supported O/S's: SVR4, UnixWare, SCO, Solaris, FreeBSD, NetBSD, 386BSD, BSDI BSD/386, @@ -17,6 +17,8 @@ Original location: www.linuxvideo.org/gatos */ +#include "config.h" + #include "libdha.h" #include "AsmMacros.h" #include <stdio.h> @@ -60,14 +62,44 @@ void libdha_exit(const char *message, int level) #define DEV_MEM "/dev/mem" #endif +#ifdef CONFIG_DHAHELPER static int mem=-1; void *map_phys_mem(unsigned base, unsigned size) { + if ( (mem = open("/dev/dhahelper",O_RDWR)) < 0) + { + if ( (mem = open(DEV_MEM,O_RDWR)) == -1) { + perror("libdha: open(/dev/mem) failed") ; exit(1) ; + } + } + else + { + dhahelper_memory_t mem_req; + + mem_req.operation = MEMORY_OP_MAP; + mem_req.start = base; + mem_req.offset = 0; + mem_req.size = size; + + if (ioctl(mem, DHAHELPER_MEMORY, &mem_req) < 0) + { + perror("libdha: failed mapping throught kernel helper"); + return NULL; + } + } + return mmap(0,size,PROT_READ|PROT_WRITE,MAP_SHARED,mem,base) ; +} +#else + +static int mem=-1; +void *map_phys_mem(unsigned base, unsigned size) +{ if ( (mem = open(DEV_MEM,O_RDWR)) == -1) { perror("libdha: open(/dev/mem) failed") ; exit(1) ; } return mmap(0,size,PROT_READ|PROT_WRITE,MAP_SHARED,mem,base) ; } +#endif /* CONFIG_DHAHELPER */ void unmap_phys_mem(void *ptr, unsigned size) { |