Mercurial > mplayer.hg
annotate libdha/sysdep/pci_freebsd.c @ 13939:25db6ab99ff3
More detailed Debian package building instructions, based on a patch by
Guillaume Poirier <guillaume dot poirier at ifsic dot univ-rennes1 dot fr>
author | diego |
---|---|
date | Sun, 14 Nov 2004 14:24:18 +0000 |
parents | 1faf2566907b |
children | 806cd20f1c8f |
rev | line source |
---|---|
4164 | 1 /* |
2 This file is based on: | |
3 $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $ | |
4 Modified for readability by Nick Kurshev | |
5 */ | |
4174
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
6 #include <errno.h> |
4164 | 7 #include <sys/file.h> |
5944
1faf2566907b
Fix build on FreeBSD 5.0 or later, should be downward compatible (verified on FreeBSD 4.5 at sf compilefamr.
atmos4
parents:
4174
diff
changeset
|
8 /* machine/console.h seems to be outdated by recent FreeBSD * |
1faf2566907b
Fix build on FreeBSD 5.0 or later, should be downward compatible (verified on FreeBSD 4.5 at sf compilefamr.
atmos4
parents:
4174
diff
changeset
|
9 * however pcvt_ioctl.h seems to exist for very long time */ |
1faf2566907b
Fix build on FreeBSD 5.0 or later, should be downward compatible (verified on FreeBSD 4.5 at sf compilefamr.
atmos4
parents:
4174
diff
changeset
|
10 /* #include <machine/console.h>*/ |
1faf2566907b
Fix build on FreeBSD 5.0 or later, should be downward compatible (verified on FreeBSD 4.5 at sf compilefamr.
atmos4
parents:
4174
diff
changeset
|
11 #include <machine/pcvt_ioctl.h> |
4164 | 12 #ifndef GCCUSESGAS |
13 #define GCCUSESGAS | |
14 #endif | |
15 | |
16 static int io_fd; | |
17 | |
4174
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
18 static __inline__ int enable_os_io(void) |
4164 | 19 { |
20 io_fd = -1 ; | |
21 if ((io_fd = open("/dev/console", O_RDWR, 0)) < 0) { | |
22 perror("/dev/console"); | |
4174
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
23 return(errno); |
4164 | 24 } |
25 if (ioctl(io_fd, KDENABIO, 0) < 0) { | |
26 perror("ioctl(KDENABIO)"); | |
4174
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
27 return(errno); |
4164 | 28 } |
4174
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
29 return(0); |
4164 | 30 } |
31 | |
4174
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
32 static __inline__ int disable_os_io(void) |
4164 | 33 { |
34 if (ioctl(io_fd, KDDISABIO, 0) < 0) { | |
35 perror("ioctl(KDDISABIO)"); | |
36 close(io_fd); | |
4174
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
37 return(errno); |
4164 | 38 } |
39 close(io_fd); | |
4174
4cfb6b9a6da3
api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents:
4164
diff
changeset
|
40 return(0); |
4164 | 41 } |