2002-01-04 10:32:26 +00:00
|
|
|
/*
|
2007-04-22 14:05:41 +00:00
|
|
|
* VIDIX Direct Hardware Access (DHA).
|
|
|
|
* Copyright (C) 2002 Nick Kurshev
|
|
|
|
*
|
2008-05-12 17:33:35 +00:00
|
|
|
* 1996/10/27 - Robin Cutshaw (robin@xfree86.org)
|
|
|
|
* XFree86 3.3.3 implementation
|
|
|
|
* 1999 - Øyvind Aabling.
|
|
|
|
* Modified for GATOS/win/gfxdump.
|
|
|
|
*
|
|
|
|
* 2002 - library implementation by Nick Kurshev
|
|
|
|
* - dhahelper and some changes by Alex Beregszaszi
|
|
|
|
*
|
|
|
|
* supported OSes: SVR4, UnixWare, SCO, Solaris,
|
|
|
|
* FreeBSD, NetBSD, 386BSD, BSDI BSD/386,
|
|
|
|
* Linux, Mach/386, ISC
|
|
|
|
* DOS (WATCOM 9.5 compiler), Win9x (with mapdev.vxd)
|
|
|
|
* original location: www.linuxvideo.org/gatos
|
|
|
|
*
|
2007-04-22 14:05:41 +00:00
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
2008-05-12 17:39:36 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2007-04-22 14:05:41 +00:00
|
|
|
*/
|
|
|
|
|
2008-02-22 17:32:36 +00:00
|
|
|
#ifndef MPLAYER_DHA_H
|
|
|
|
#define MPLAYER_DHA_H
|
2002-01-04 10:32:26 +00:00
|
|
|
|
2008-06-07 11:45:25 +00:00
|
|
|
#ifndef DEV_SVGA
|
|
|
|
#define DEV_SVGA "/dev/svga"
|
|
|
|
#endif
|
|
|
|
|
2002-01-04 10:32:26 +00:00
|
|
|
#define MAX_DEV_PER_VENDOR_CFG1 64
|
|
|
|
#define MAX_PCI_DEVICES_PER_BUS 32
|
2008-10-18 16:07:18 +00:00
|
|
|
#define MAX_PCI_DEVICES 256
|
2002-01-04 10:32:26 +00:00
|
|
|
#define PCI_MULTIFUNC_DEV 0x80
|
2003-03-31 00:14:36 +00:00
|
|
|
#define PCI_COMMAND_IO 0x1 /* Enable response to I/O space */
|
2002-01-04 10:32:26 +00:00
|
|
|
|
|
|
|
typedef struct pciinfo_s
|
|
|
|
{
|
2002-01-16 08:43:22 +00:00
|
|
|
int bus,card,func; /* PCI/AGP bus:card:func */
|
2003-03-31 00:14:36 +00:00
|
|
|
unsigned short command; /* Device control register */
|
2002-01-16 08:43:22 +00:00
|
|
|
unsigned short vendor,device; /* Card vendor+device ID */
|
|
|
|
unsigned base0,base1,base2,baserom; /* Memory and I/O base addresses */
|
2002-01-20 12:12:58 +00:00
|
|
|
// unsigned base0_limit, base1_limit, base2_limit, baserom_limit;
|
2002-01-04 10:32:26 +00:00
|
|
|
}pciinfo_t;
|
|
|
|
|
2002-01-15 15:59:53 +00:00
|
|
|
/* needed for mga_vid */
|
2008-12-03 23:01:03 +00:00
|
|
|
int pci_config_read(unsigned char bus, unsigned char dev, unsigned char func,
|
2002-01-20 12:12:58 +00:00
|
|
|
unsigned char cmd, int len, unsigned long *val);
|
2002-01-04 10:32:26 +00:00
|
|
|
/* Fill array pci_list which must have size MAX_PCI_DEVICES
|
|
|
|
and return 0 if sucessful */
|
2008-12-03 23:01:03 +00:00
|
|
|
int pci_scan(pciinfo_t *pci_list,unsigned *num_card);
|
2002-01-04 10:32:26 +00:00
|
|
|
|
|
|
|
|
2002-01-16 08:43:22 +00:00
|
|
|
/* Enables/disables accessing to IO space from application side.
|
|
|
|
Should return 0 if o'k or errno on error. */
|
2008-12-03 23:01:03 +00:00
|
|
|
int enable_app_io(void);
|
|
|
|
int disable_app_io(void);
|
2002-01-04 10:32:26 +00:00
|
|
|
|
2008-12-03 23:01:03 +00:00
|
|
|
unsigned char INPORT8(unsigned idx);
|
|
|
|
unsigned short INPORT16(unsigned idx);
|
|
|
|
unsigned INPORT32(unsigned idx);
|
2002-01-05 18:16:19 +00:00
|
|
|
#define INPORT(idx) INPORT32(idx)
|
2008-12-03 23:01:03 +00:00
|
|
|
void OUTPORT8(unsigned idx, unsigned char val);
|
|
|
|
void OUTPORT16(unsigned idx, unsigned short val);
|
|
|
|
void OUTPORT32(unsigned idx, unsigned val);
|
2002-01-05 18:16:19 +00:00
|
|
|
#define OUTPORT(idx,val) OUTPORT32(idx,val)
|
2002-01-04 10:32:26 +00:00
|
|
|
|
2008-12-03 23:01:03 +00:00
|
|
|
void * map_phys_mem(unsigned long base, unsigned long size);
|
|
|
|
void unmap_phys_mem(void *ptr, unsigned long size);
|
2002-01-04 10:32:26 +00:00
|
|
|
|
2002-02-02 12:14:56 +00:00
|
|
|
/* These are the region types */
|
|
|
|
#define MTRR_TYPE_UNCACHABLE 0
|
|
|
|
#define MTRR_TYPE_WRCOMB 1
|
|
|
|
#define MTRR_TYPE_WRTHROUGH 4
|
|
|
|
#define MTRR_TYPE_WRPROT 5
|
|
|
|
#define MTRR_TYPE_WRBACK 6
|
2008-12-03 23:01:03 +00:00
|
|
|
int mtrr_set_type(unsigned base, unsigned size, int type);
|
2002-02-02 12:14:56 +00:00
|
|
|
|
2008-02-22 17:32:36 +00:00
|
|
|
#endif /* MPLAYER_DHA_H */
|