annotate vidix/sysdep/pci_win32.c @ 23091:52488bb09d90

Consistently use quotes instead of angled brackets in #include statements for non-system headers.
author diego
date Wed, 25 Apr 2007 07:34:56 +0000
parents a9e111b88c4a
children 9c4ad35fabc5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
1 /*
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
2 This file is based on:
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
3 $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
4 Modified for readability by Nick Kurshev
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
5 */
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
6 #include <windows.h>
12056
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
7 #include <ddk/ntddk.h>
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
8 #include "../dhahelperwin/dhahelper.h"
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
9
12056
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
10 static HANDLE hDriver;
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
11 extern int IsWinNT();
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
12
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
13
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
14
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
15
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
16
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
17 static __inline__ int enable_os_io(void)
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
18 {
12056
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
19 if(IsWinNT()){
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
20 DWORD dwBytesReturned;
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
21 hDriver = CreateFile("\\\\.\\DHAHELPER",GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
22 if(!DeviceIoControl(hDriver, IOCTL_DHAHELPER_ENABLEDIRECTIO, NULL,0, NULL, 0, &dwBytesReturned, NULL)){
17971
fd0d4b94b5ec Change some printf calls to fprintf.
diego
parents: 12056
diff changeset
23 fprintf(stderr,"Unable to enable directio please install dhahelper.sys.\n");
12056
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
24 return(1);
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
25 }
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
26 }
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(0);
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
28 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
29
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
30 static __inline__ int disable_os_io(void)
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
31 {
12056
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
32 if(IsWinNT()){
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
33 DWORD dwBytesReturned;
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
34 DeviceIoControl(hDriver, IOCTL_DHAHELPER_DISABLEDIRECTIO, NULL,0, NULL, 0, &dwBytesReturned, NULL);
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
35 CloseHandle(hDriver);
3a727f52c4a2 windows xp support
faust3
parents: 4174
diff changeset
36 }
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(0);
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
38 }