comparison libdha/libdha.h @ 3973:138800dfbe22

preliminary support of direct hardware access
author nick
date Fri, 04 Jan 2002 10:32:26 +0000
parents
children 0d9de811e312
comparison
equal deleted inserted replaced
3972:f021941d26c9 3973:138800dfbe22
1 /*
2 libgha.h - Library for direct hardware access
3 Copyrights:
4 1996/10/27 - Robin Cutshaw (robin@xfree86.org)
5 XFree86 3.3.3 implementation
6 1999 - Øyvind Aabling.
7 Modified for GATOS/win/gfxdump.
8 2002 - library implementation by Nick Kurshev
9
10 supported O/S's: SVR4, UnixWare, SCO, Solaris,
11 FreeBSD, NetBSD, 386BSD, BSDI BSD/386,
12 Linux, Mach/386, ISC
13 DOS (WATCOM 9.5 compiler), Win9x (with mapdev.vxd)
14 Licence: GPL
15 */
16 #ifndef LIBDHA_H
17 #define LIBDHA_H
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 #define MAX_DEV_PER_VENDOR_CFG1 64
24 #define MAX_PCI_DEVICES_PER_BUS 32
25 #define MAX_PCI_DEVICES 64
26 #define PCI_MULTIFUNC_DEV 0x80
27
28 typedef struct pciinfo_s
29 {
30 int bus,card,func ; /* PCI/AGP bus:card:func */
31 unsigned short vendor,device ; /* Card vendor+device ID */
32 unsigned base0,base1,base2,baserom ; /* Memory and I/O base addresses */
33 }pciinfo_t;
34
35 /* Fill array pci_list which must have size MAX_PCI_DEVICES
36 and return 0 if sucessful */
37 extern int pci_scan(pciinfo_t *pci_list,unsigned *num_card);
38
39
40
41 extern unsigned char INREG8(unsigned idx);
42 extern unsigned short INREG16(unsigned idx);
43 extern unsigned INREG32(unsigned idx);
44 #define INREG(idx) INREG32(idx)
45 extern void OUTREG8(unsigned idx,unsigned char val);
46 extern void OUTREG16(unsigned idx,unsigned short val);
47 extern void OUTREG32(unsigned idx,unsigned val);
48 #define OUTREG(idx,val) OUTREG32(idx,val)
49
50 extern void * map_phys_mem(unsigned base, unsigned size);
51 extern void unmap_phys_mem(void *ptr, unsigned size);
52
53 #ifdef __cplusplus
54 }
55 #endif
56
57 #endif