sync with en/mplayer.1 rev. 30611
[mplayer/glamo.git] / vidix / dha.h
blobc590103308309f1d42ebe05f961867d5a5597178
1 /*
2 * VIDIX Direct Hardware Access (DHA).
3 * Copyright (C) 2002 Nick Kurshev
5 * 1996/10/27 - Robin Cutshaw (robin@xfree86.org)
6 * XFree86 3.3.3 implementation
7 * 1999 - Øyvind Aabling.
8 * Modified for GATOS/win/gfxdump.
10 * 2002 - library implementation by Nick Kurshev
11 * - dhahelper and some changes by Alex Beregszaszi
13 * supported OSes: SVR4, UnixWare, SCO, Solaris,
14 * FreeBSD, NetBSD, 386BSD, BSDI BSD/386,
15 * Linux, Mach/386, ISC
16 * DOS (WATCOM 9.5 compiler), Win9x (with mapdev.vxd)
17 * original location: www.linuxvideo.org/gatos
19 * This file is part of MPlayer.
21 * MPlayer is free software; you can redistribute it and/or modify
22 * it under the terms of the GNU General Public License as published by
23 * the Free Software Foundation; either version 2 of the License, or
24 * (at your option) any later version.
26 * MPlayer is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
31 * You should have received a copy of the GNU General Public License along
32 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
33 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
36 #ifndef MPLAYER_DHA_H
37 #define MPLAYER_DHA_H
39 #ifndef DEV_SVGA
40 #define DEV_SVGA "/dev/svga"
41 #endif
43 #define MAX_DEV_PER_VENDOR_CFG1 64
44 #define MAX_PCI_DEVICES_PER_BUS 32
45 #define MAX_PCI_DEVICES 256
46 #define PCI_MULTIFUNC_DEV 0x80
47 #define PCI_COMMAND_IO 0x1 /* Enable response to I/O space */
49 typedef struct pciinfo_s
51 int bus,card,func; /* PCI/AGP bus:card:func */
52 unsigned short command; /* Device control register */
53 unsigned short vendor,device; /* Card vendor+device ID */
54 unsigned base0,base1,base2,baserom; /* Memory and I/O base addresses */
55 // unsigned base0_limit, base1_limit, base2_limit, baserom_limit;
56 }pciinfo_t;
58 /* needed for mga_vid */
59 int pci_config_read(unsigned char bus, unsigned char dev, unsigned char func,
60 unsigned char cmd, int len, unsigned long *val);
61 /* Fill array pci_list which must have size MAX_PCI_DEVICES
62 and return 0 if sucessful */
63 int pci_scan(pciinfo_t *pci_list,unsigned *num_card);
66 /* Enables/disables accessing to IO space from application side.
67 Should return 0 if o'k or errno on error. */
68 int enable_app_io(void);
69 int disable_app_io(void);
71 unsigned char INPORT8(unsigned idx);
72 unsigned short INPORT16(unsigned idx);
73 unsigned INPORT32(unsigned idx);
74 #define INPORT(idx) INPORT32(idx)
75 void OUTPORT8(unsigned idx, unsigned char val);
76 void OUTPORT16(unsigned idx, unsigned short val);
77 void OUTPORT32(unsigned idx, unsigned val);
78 #define OUTPORT(idx,val) OUTPORT32(idx,val)
80 void * map_phys_mem(unsigned long base, unsigned long size);
81 void unmap_phys_mem(void *ptr, unsigned long size);
83 /* These are the region types */
84 #define MTRR_TYPE_UNCACHABLE 0
85 #define MTRR_TYPE_WRCOMB 1
86 #define MTRR_TYPE_WRTHROUGH 4
87 #define MTRR_TYPE_WRPROT 5
88 #define MTRR_TYPE_WRBACK 6
89 int mtrr_set_type(unsigned base, unsigned size, int type);
91 #endif /* MPLAYER_DHA_H */