diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-01-13 23:36:01 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-01-13 23:36:01 +0000 |
commit | 9baa6d2f372d3e09280e1103d7bfcf048f6457ec (patch) | |
tree | cf3bfc3fb392fe58ed612a5a09c11d176eb17e99 /src/video_out/libdha/mmi.c | |
parent | 989188f25474868841d8a5148873a5995be58c6f (diff) | |
download | xine-lib-9baa6d2f372d3e09280e1103d7bfcf048f6457ec.tar.gz xine-lib-9baa6d2f372d3e09280e1103d7bfcf048f6457ec.tar.bz2 |
big vidix driver update by James Stembridge
CVS patchset: 3907
CVS date: 2003/01/13 23:36:01
Diffstat (limited to 'src/video_out/libdha/mmi.c')
-rw-r--r-- | src/video_out/libdha/mmi.c | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/src/video_out/libdha/mmi.c b/src/video_out/libdha/mmi.c index 68d3429f2..5fb1531be 100644 --- a/src/video_out/libdha/mmi.c +++ b/src/video_out/libdha/mmi.c @@ -1,6 +1,7 @@ /* Memory manager interface */ #include <stdio.h> #include <sys/ioctl.h> +#include <sys/mman.h> /* mlock */ #include <errno.h> #include <unistd.h> #include <fcntl.h> @@ -9,7 +10,7 @@ static int libdha_fd=-1; -#define ALLOWED_VER 2 +#define ALLOWED_VER 0x10 int bm_open( void ) { int retv; @@ -55,3 +56,50 @@ int bm_virt_to_bus( void * virt_addr, unsigned long length, unsigned long * barr if(libdha_fd > 0) return ioctl(libdha_fd,DHAHELPER_VIRT_TO_BUS,&vmi); return ENXIO; } + +void * bm_alloc_pa( unsigned long length ) +{ + dhahelper_mem_t vmi; + vmi.length = length; + if(libdha_fd > 0) + { + if(ioctl(libdha_fd,DHAHELPER_ALLOC_PA,&vmi) == 0) + return vmi.addr; + } + return 0; +} + +void bm_free_pa( void * virt_addr, unsigned long length ) +{ + dhahelper_mem_t vmi; + vmi.addr = virt_addr; + vmi.length = length; + if(libdha_fd > 0) + { + ioctl(libdha_fd,DHAHELPER_FREE_PA,&vmi); + } +} + +int bm_lock_mem( const void *addr, unsigned long length ) +{ + dhahelper_mem_t vmi; + vmi.addr = (void *) addr; + vmi.length = length; + if(libdha_fd > 0) + { + return ioctl(libdha_fd,DHAHELPER_LOCK_MEM,&vmi); + } + return mlock(addr,length); +} + +int bm_unlock_mem( const void * addr, unsigned long length ) +{ + dhahelper_mem_t vmi; + vmi.addr = (void *) addr; + vmi.length = length; + if(libdha_fd > 0) + { + return ioctl(libdha_fd,DHAHELPER_UNLOCK_MEM,&vmi); + } + return munlock(addr,length); +} |