annotate vidix/dha.h @ 34582:d0617776d506

Check for allocation error.
author ib
date Thu, 09 Feb 2012 14:37:06 +0000
parents 9e739bdb049c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3973
138800dfbe22 preliminary support of direct hardware access
nick
parents:
diff changeset
1 /*
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
2 * VIDIX Direct Hardware Access (DHA).
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
3 * Copyright (C) 2002 Nick Kurshev
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
4 *
26718
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 26030
diff changeset
5 * 1996/10/27 - Robin Cutshaw (robin@xfree86.org)
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 26030
diff changeset
6 * XFree86 3.3.3 implementation
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 26030
diff changeset
7 * 1999 - Øyvind Aabling.
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 26030
diff changeset
8 * Modified for GATOS/win/gfxdump.
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 26030
diff changeset
9 *
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 26030
diff changeset
10 * 2002 - library implementation by Nick Kurshev
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 26030
diff changeset
11 * - dhahelper and some changes by Alex Beregszaszi
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 26030
diff changeset
12 *
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 26030
diff changeset
13 * supported OSes: SVR4, UnixWare, SCO, Solaris,
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 26030
diff changeset
14 * FreeBSD, NetBSD, 386BSD, BSDI BSD/386,
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 26030
diff changeset
15 * Linux, Mach/386, ISC
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 26030
diff changeset
16 * DOS (WATCOM 9.5 compiler), Win9x (with mapdev.vxd)
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 26030
diff changeset
17 * original location: www.linuxvideo.org/gatos
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 26030
diff changeset
18 *
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
19 * This file is part of MPlayer.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
20 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
21 * MPlayer is free software; you can redistribute it and/or modify
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
22 * it under the terms of the GNU General Public License as published by
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
23 * the Free Software Foundation; either version 2 of the License, or
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
24 * (at your option) any later version.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
25 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
26 * MPlayer is distributed in the hope that it will be useful,
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
29 * GNU General Public License for more details.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
30 *
26719
3abd1629658b Use standard license headers.
diego
parents: 26718
diff changeset
31 * You should have received a copy of the GNU General Public License along
3abd1629658b Use standard license headers.
diego
parents: 26718
diff changeset
32 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
3abd1629658b Use standard license headers.
diego
parents: 26718
diff changeset
33 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
34 */
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
35
26030
a93e46adb54c Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25869
diff changeset
36 #ifndef MPLAYER_DHA_H
a93e46adb54c Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25869
diff changeset
37 #define MPLAYER_DHA_H
3973
138800dfbe22 preliminary support of direct hardware access
nick
parents:
diff changeset
38
26978
53ae66ee504e Add default definition for SVGA device.
diego
parents: 26719
diff changeset
39 #ifndef DEV_SVGA
53ae66ee504e Add default definition for SVGA device.
diego
parents: 26719
diff changeset
40 #define DEV_SVGA "/dev/svga"
53ae66ee504e Add default definition for SVGA device.
diego
parents: 26719
diff changeset
41 #endif
53ae66ee504e Add default definition for SVGA device.
diego
parents: 26719
diff changeset
42
3973
138800dfbe22 preliminary support of direct hardware access
nick
parents:
diff changeset
43 #define MAX_DEV_PER_VENDOR_CFG1 64
138800dfbe22 preliminary support of direct hardware access
nick
parents:
diff changeset
44 #define MAX_PCI_DEVICES_PER_BUS 32
27763
eea0247a150b MAX_PCI_DEVICES 64 is not enough on my system (even though lspci only shows 25 devices), upped to 256
ranma
parents: 26979
diff changeset
45 #define MAX_PCI_DEVICES 256
3973
138800dfbe22 preliminary support of direct hardware access
nick
parents:
diff changeset
46 #define PCI_MULTIFUNC_DEV 0x80
9767
f6d2772efca3 Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents: 5702
diff changeset
47 #define PCI_COMMAND_IO 0x1 /* Enable response to I/O space */
3973
138800dfbe22 preliminary support of direct hardware access
nick
parents:
diff changeset
48
138800dfbe22 preliminary support of direct hardware access
nick
parents:
diff changeset
49 typedef struct pciinfo_s
138800dfbe22 preliminary support of direct hardware access
nick
parents:
diff changeset
50 {
4192
fb092b45c9cc en(dis)able app io should be exported too
nick
parents: 4174
diff changeset
51 int bus,card,func; /* PCI/AGP bus:card:func */
9767
f6d2772efca3 Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents: 5702
diff changeset
52 unsigned short command; /* Device control register */
4192
fb092b45c9cc en(dis)able app io should be exported too
nick
parents: 4174
diff changeset
53 unsigned short vendor,device; /* Card vendor+device ID */
fb092b45c9cc en(dis)able app io should be exported too
nick
parents: 4174
diff changeset
54 unsigned base0,base1,base2,baserom; /* Memory and I/O base addresses */
4277
5f74792b6d5e pci_config_read working
alex
parents: 4192
diff changeset
55 // unsigned base0_limit, base1_limit, base2_limit, baserom_limit;
3973
138800dfbe22 preliminary support of direct hardware access
nick
parents:
diff changeset
56 }pciinfo_t;
138800dfbe22 preliminary support of direct hardware access
nick
parents:
diff changeset
57
4174
4cfb6b9a6da3 api changed: enable/disable_os_io returns error-code (or zero if ok) and pciconfig_read exported for mga_vid
alex
parents: 3995
diff changeset
58 /* needed for mga_vid */
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27763
diff changeset
59 int pci_config_read(unsigned char bus, unsigned char dev, unsigned char func,
4277
5f74792b6d5e pci_config_read working
alex
parents: 4192
diff changeset
60 unsigned char cmd, int len, unsigned long *val);
3973
138800dfbe22 preliminary support of direct hardware access
nick
parents:
diff changeset
61 /* Fill array pci_list which must have size MAX_PCI_DEVICES
138800dfbe22 preliminary support of direct hardware access
nick
parents:
diff changeset
62 and return 0 if sucessful */
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27763
diff changeset
63 int pci_scan(pciinfo_t *pci_list,unsigned *num_card);
3973
138800dfbe22 preliminary support of direct hardware access
nick
parents:
diff changeset
64
138800dfbe22 preliminary support of direct hardware access
nick
parents:
diff changeset
65
4192
fb092b45c9cc en(dis)able app io should be exported too
nick
parents: 4174
diff changeset
66 /* Enables/disables accessing to IO space from application side.
fb092b45c9cc en(dis)able app io should be exported too
nick
parents: 4174
diff changeset
67 Should return 0 if o'k or errno on error. */
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27763
diff changeset
68 int enable_app_io(void);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27763
diff changeset
69 int disable_app_io(void);
3973
138800dfbe22 preliminary support of direct hardware access
nick
parents:
diff changeset
70
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27763
diff changeset
71 unsigned char INPORT8(unsigned idx);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27763
diff changeset
72 unsigned short INPORT16(unsigned idx);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27763
diff changeset
73 unsigned INPORT32(unsigned idx);
3995
0d9de811e312 minor interface changing
nick
parents: 3973
diff changeset
74 #define INPORT(idx) INPORT32(idx)
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27763
diff changeset
75 void OUTPORT8(unsigned idx, unsigned char val);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27763
diff changeset
76 void OUTPORT16(unsigned idx, unsigned short val);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27763
diff changeset
77 void OUTPORT32(unsigned idx, unsigned val);
3995
0d9de811e312 minor interface changing
nick
parents: 3973
diff changeset
78 #define OUTPORT(idx,val) OUTPORT32(idx,val)
3973
138800dfbe22 preliminary support of direct hardware access
nick
parents:
diff changeset
79
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27763
diff changeset
80 void * map_phys_mem(unsigned long base, unsigned long size);
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27763
diff changeset
81 void unmap_phys_mem(void *ptr, unsigned long size);
3973
138800dfbe22 preliminary support of direct hardware access
nick
parents:
diff changeset
82
4476
0d9a096cfd46 MTRR configuring
nick
parents: 4277
diff changeset
83 /* These are the region types */
0d9a096cfd46 MTRR configuring
nick
parents: 4277
diff changeset
84 #define MTRR_TYPE_UNCACHABLE 0
0d9a096cfd46 MTRR configuring
nick
parents: 4277
diff changeset
85 #define MTRR_TYPE_WRCOMB 1
0d9a096cfd46 MTRR configuring
nick
parents: 4277
diff changeset
86 #define MTRR_TYPE_WRTHROUGH 4
0d9a096cfd46 MTRR configuring
nick
parents: 4277
diff changeset
87 #define MTRR_TYPE_WRPROT 5
0d9a096cfd46 MTRR configuring
nick
parents: 4277
diff changeset
88 #define MTRR_TYPE_WRBACK 6
28051
9e739bdb049c Get rid of pointless 'extern' keywords.
diego
parents: 27763
diff changeset
89 int mtrr_set_type(unsigned base, unsigned size, int type);
4476
0d9a096cfd46 MTRR configuring
nick
parents: 4277
diff changeset
90
26030
a93e46adb54c Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25869
diff changeset
91 #endif /* MPLAYER_DHA_H */