[Mplayer-cvslog] CVS: main/libdha Makefile,1.17,1.18 config.h,1.2,1.3 libdha.c,1.7,1.8 pci.c,1.9,1.10
Alex Beregszaszi
alex at mplayerhq.hu
Fri Dec 20 22:07:29 CET 2002
Update of /cvsroot/mplayer/main/libdha
In directory mail:/var/tmp.root/cvs-serv7528
Modified Files:
Makefile config.h libdha.c pci.c
Log Message:
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan at svgalib.org>) and some reordering/cleanup (part #1 ;)
Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libdha/Makefile,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- Makefile 15 Dec 2002 18:22:55 -0000 1.17
+++ Makefile 20 Dec 2002 21:07:11 -0000 1.18
@@ -28,6 +28,11 @@
endif
endif
+# If you want libdha to use svgalib_helper for hardware access,
+# uncomment this statement, and change the -I to the correct directory
+# that includes svgalib_helper.o:
+#CFLAGS += -DDEV_SVGA=\"/dev/svga\" -DCONFIG_SVGAHELPER -Isvgalib_helper/
+
.SUFFIXES: .c .o
# .PHONY: all clean
Index: config.h
===================================================================
RCS file: /cvsroot/mplayer/main/libdha/config.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- config.h 22 Oct 2002 15:09:36 -0000 1.2
+++ config.h 20 Dec 2002 21:07:11 -0000 1.3
@@ -9,4 +9,8 @@
#endif
#endif
+#if defined(__powerpc__) && defined(CONFIG_SVGAHELPER)
+#undef CONFIG_SVGAHELPER
+#endif
+
#endif /* LIBDHA_CONFIG_H */
Index: libdha.c
===================================================================
RCS file: /cvsroot/mplayer/main/libdha/libdha.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- libdha.c 19 Apr 2002 16:33:54 -0000 1.7
+++ libdha.c 20 Dec 2002 21:07:11 -0000 1.8
@@ -66,21 +66,40 @@
#endif
#ifdef CONFIG_DHAHELPER
-
#include "kernelhelper/dhahelper.h"
+#endif
+
+#ifdef CONFIG_SVGAHELPER
+#include <svgalib_helper.h>
+#endif
static int mem=-1;
void *map_phys_mem(unsigned long base, unsigned long size)
-{
+{
#ifdef ARCH_ALPHA
/* TODO: move it into sysdep */
base += bus_base();
#endif
+
+#ifdef CONFIG_SVGAHELPER
+ if ( (mem = open(DEV_SVGA,O_RDWR)) == -1) {
+ perror("libdha: SVGAlib kernelhelper failed");
+#ifdef CONFIG_DHAHELPER
+ goto dha_helper_way;
+#else
+ goto dev_mem_way;
+#endif
+ }
+ else
+ goto mmap;
+#endif
+
+#ifdef CONFIG_DHAHELPER
+dha_helper_way:
if ( (mem = open("/dev/dhahelper",O_RDWR)) < 0)
{
- if ( (mem = open(DEV_MEM,O_RDWR)) == -1) {
- perror("libdha: open(/dev/mem) failed") ; exit(1) ;
- }
+ perror("libdha: DHA kernelhelper failed");
+ goto dev_mem_way;
}
else
{
@@ -93,37 +112,41 @@
if (ioctl(mem, DHAHELPER_MEMORY, &mem_req) < 0)
{
- perror("libdha: failed mapping throught kernel helper");
- return NULL;
+ perror("libdha: DHA kernelhelper failed");
+ close(mem);
+ goto dev_mem_way;
}
+ else
+ goto mmap;
}
- return mmap(0,size,PROT_READ|PROT_WRITE,MAP_SHARED,mem,base) ;
-}
-#else
-
-static int mem=-1;
-void *map_phys_mem(unsigned long base, unsigned long size)
-{
-#ifdef ARCH_ALPHA
-/* TODO: move it into sysdep */
- base += bus_base();
#endif
- if ( (mem = open(DEV_MEM,O_RDWR)) == -1) {
- perror("libdha: open(/dev/mem) failed") ; exit(1) ;
+
+dev_mem_way:
+ if ( (mem = open(DEV_MEM,O_RDWR)) == -1)
+ {
+ perror("libdha: opening /dev/mem failed");
+ exit(1);
}
- return mmap(0,size,PROT_READ|PROT_WRITE,MAP_SHARED,mem,base) ;
+
+mmap:
+ return mmap(0,size,PROT_READ|PROT_WRITE,MAP_SHARED,mem,base);
}
#endif /* CONFIG_DHAHELPER */
void unmap_phys_mem(void *ptr, unsigned long size)
{
- int res=munmap(ptr,size) ;
- if (res == -1) { perror("libdha: munmap() failed") ; exit(1) ; }
+ int res = munmap(ptr,size);
+
+ if (res == -1)
+ {
+ perror("libdha: unmapping memory failed");
+ exit(1);
+ }
close(mem);
+ mem = -1;
}
-#endif
-unsigned char INPORT8(unsigned idx)
+unsigned char INPORT8(unsigned idx)
{
return inb(idx);
}
@@ -133,23 +156,22 @@
return inw(idx);
}
-unsigned INPORT32(unsigned idx)
+unsigned INPORT32(unsigned idx)
{
return inl(idx);
}
-void OUTPORT8(unsigned idx,unsigned char val)
+void OUTPORT8(unsigned idx,unsigned char val)
{
outb(idx,val);
}
-void OUTPORT16(unsigned idx,unsigned short val)
+void OUTPORT16(unsigned idx,unsigned short val)
{
outw(idx,val);
}
-void OUTPORT32(unsigned idx,unsigned val)
+void OUTPORT32(unsigned idx,unsigned val)
{
outl(idx,val);
}
-
Index: pci.c
===================================================================
RCS file: /cvsroot/mplayer/main/libdha/pci.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- pci.c 19 Apr 2002 16:33:54 -0000 1.9
+++ pci.c 20 Dec 2002 21:07:11 -0000 1.10
@@ -478,6 +478,7 @@
#endif
/* cpu depended stuff */
+#ifndef CONFIG_SVGAHELPER
#if defined(__alpha__)
#include "sysdep/pci_alpha.c"
#elif defined(__ia64__)
@@ -491,7 +492,7 @@
#else
#include "sysdep/pci_x86.c"
#endif
-
+#endif
static int pcicards=0 ;
static pciinfo_t *pci_lst;
More information about the MPlayer-cvslog
mailing list