[Mplayer-cvslog] CVS: main/libdha libdha.c,1.3,1.4 libdha.h,1.2,1.3 pci.c,1.4,1.5

Alex Beregszaszi alex at mplayer.dev.hu
Tue Jan 15 16:59:56 CET 2002


Update of /cvsroot/mplayer/main/libdha
In directory mplayer:/var/tmp.root/cvs-serv3325

Modified Files:
	libdha.c libdha.h pci.c 
Log Message:
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid

Index: libdha.c
===================================================================
RCS file: /cvsroot/mplayer/main/libdha/libdha.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- libdha.c	15 Jan 2002 08:33:09 -0000	1.3
+++ libdha.c	15 Jan 2002 15:59:53 -0000	1.4
@@ -7,6 +7,7 @@
     		  Modified for GATOS/win/gfxdump.
 		  
     2002	- library implementation by Nick Kurshev
+		- some changes by Alex Beregszaszi
     
     supported O/S's:	SVR4, UnixWare, SCO, Solaris,
 			FreeBSD, NetBSD, 386BSD, BSDI BSD/386,
@@ -26,6 +27,14 @@
 #include <sys/types.h>
 #include <unistd.h>
 
+/* instead exit() use libdha_exit, and do the 'mother-application' deinit
+   only in this code */
+void libdha_exit(const char *message, int level)
+{
+    printf("libdha: FATAL: %s\n", message);
+    exit(level); /* FIXME */
+}
+
 #if defined(_WIN32)
 #include "sysdep/libdha_win32.c"
 #elif defined (__EMX__)
@@ -97,3 +106,4 @@
 {
   outl(idx,val);
 }
+

Index: libdha.h
===================================================================
RCS file: /cvsroot/mplayer/main/libdha/libdha.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- libdha.h	5 Jan 2002 18:15:11 -0000	1.2
+++ libdha.h	15 Jan 2002 15:59:53 -0000	1.3
@@ -32,6 +32,9 @@
   unsigned	base0,base1,base2,baserom ;	/* Memory and I/O base addresses */
 }pciinfo_t;
 
+/* needed for mga_vid */
+extern int pci_config_read(unsigned char bus, unsigned char dev, unsigned char offset,
+			int len, unsigned long *val);
 			/* Fill array pci_list which must have size MAX_PCI_DEVICES
 			   and return 0 if sucessful */
 extern int  pci_scan(pciinfo_t *pci_list,unsigned *num_card);

Index: pci.c
===================================================================
RCS file: /cvsroot/mplayer/main/libdha/pci.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- pci.c	15 Jan 2002 15:31:30 -0000	1.4
+++ pci.c	15 Jan 2002 15:59:53 -0000	1.5
@@ -122,7 +122,7 @@
 #define PCIBIOS_DEVICE_NOT_FOUND	0x86
 #define PCIBIOS_SUCCESSFUL		0x00
  
-static int pciconfig_read(
+int pciconfig_read(
           unsigned char bus,
           unsigned char dev,
           unsigned char offset,
@@ -144,7 +144,7 @@
 	return PCIBIOS_SUCCESSFUL;
 }
  
-static int pciconfig_write(
+int pciconfig_write(
           unsigned char bus,
           unsigned char dev,
           unsigned char offset,
@@ -528,10 +528,13 @@
     struct pci_config_reg pcr;
     int do_mode1_scan = 0, do_mode2_scan = 0;
     int func, hostbridges=0;
+    int ret = -1;
     
     pci_lst = pci_list;
  
-    enable_os_io();
+    ret = enable_os_io();
+    if (ret != 0)
+	return(ret);
 
     if((pcr._configtype = pci_config_type()) == 0xFFFF) return ENODEV;
  
@@ -694,4 +697,26 @@
  
     return 0 ;
  
+}
+
+#if !defined(ENOTSUP)
+#if defined(EOPNOTSUPP)
+#define ENOTSUP EOPNOTSUPP
+#else
+#warning "ENOTSUP nor EOPNOTSUPP defined!"
+#endif
+#endif
+
+int pci_config_read(unsigned char bus, unsigned char dev,
+		    unsigned char offset, int len, unsigned long *val)
+{
+    if (len != 4)
+    {
+	printf("pci_config_read: reading non-dword not supported!\n");
+	return(ENOTSUP);
+    }
+    
+    *val = pci_config_read_long(bus, dev, offset, 0);
+    
+    return(0);
 }




More information about the MPlayer-cvslog mailing list