If we don't have a NEWAVIINDEX chunk, but have an OpenDML index,
[mplayer/greg.git] / libdha / sysdep / pci_os2.c
blobddfc0c0ea6d657c811c820dba857628652c4a098
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 */
6 #define INCL_DOSFILEMGR
7 #include <os2.h>
9 static USHORT callgate[3] = {0,0,0};
11 static __inline__ int enable_os_io(void)
13 HFILE hfd;
14 ULONG dlen,action;
15 APIRET rc;
16 static char *ioDrvPath = "/dev/fastio$";
18 if (DosOpen((PSZ)ioDrvPath, (PHFILE)&hfd, (PULONG)&action,
19 (ULONG)0, FILE_SYSTEM, FILE_OPEN,
20 OPEN_SHARE_DENYNONE|OPEN_FLAGS_NOINHERIT|OPEN_ACCESS_READONLY,
21 (ULONG)0) != 0) {
22 fprintf(stderr,"Error opening fastio$ driver...\n");
23 fprintf(stderr,"Please install xf86sup.sys in config.sys!\n");
24 return(42);
26 callgate[0] = callgate[1] = 0;
28 /* Get callgate from driver for fast io to ports and other stuff */
30 rc = DosDevIOCtl(hfd, (ULONG)0x76, (ULONG)0x64,
31 NULL, 0, NULL,
32 (ULONG*)&callgate[2], sizeof(USHORT), &dlen);
33 if (rc) {
34 fprintf(stderr,"xf86-OS/2: EnableIOPorts failed, rc=%d, dlen=%d; emergency exit\n",
35 rc,dlen);
36 DosClose(hfd);
37 return(42);
40 /* Calling callgate with function 13 sets IOPL for the program */
42 asm volatile ("movl $13,%%ebx;.byte 0xff,0x1d;.long _callgate"
43 : /*no outputs */
44 : /*no inputs */
45 : "eax","ebx","ecx","edx","cc");
47 DosClose(hfd);
48 return(0);
51 static __inline__ int disable_os_io(void)
53 /* Nothing to do */
54 return(0);