Mercurial > mplayer.hg
annotate libdha/sysdep/AsmMacros_x86.h @ 9697:5025150738eb
10000l (YUV vs. YVU swscale fix/cleanup)
author | michael |
---|---|
date | Thu, 27 Mar 2003 16:04:53 +0000 |
parents | 9dbb9c710480 |
children | e687fa1d55c6 |
rev | line source |
---|---|
4164 | 1 /* |
2 This file is based on: | |
3 $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 2001/11/16 21:13:34 tsi Exp $ | |
4 Modified for readability by Nick Kurshev | |
5 */ | |
6 | |
7 #ifndef __ASM_MACROS_X86_H | |
8 #define __ASM_MACROS_X86_H | |
9 | |
10 #if defined (WINNT) | |
11 #error This stuff is not ported on your system | |
12 #else | |
13 | |
4474 | 14 #include "config.h" |
15 | |
16 #ifdef CONFIG_DHAHELPER | |
17 #include <sys/ioctl.h> | |
18 #include "../kernelhelper/dhahelper.h" | |
19 | |
20 extern int dhahelper_fd; | |
21 extern int dhahelper_initialized; | |
22 #endif | |
23 | |
8503
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
24 #ifdef CONFIG_SVGAHELPER |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
25 #include <sys/ioctl.h> |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
26 #include <svgalib_helper.h> |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
27 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
28 extern int svgahelper_fd; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
29 extern int svgahelper_initialized; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
30 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
31 static __inline__ void svga_outb(short port, char value) |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
32 { |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
33 io_t iov; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
34 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
35 iov.val = value; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
36 iov.port = port; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
37 ioctl(svgahelper_fd, SVGALIB_HELPER_IOCSOUTB, &iov); |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
38 } |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
39 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
40 static __inline__ void svga_outw(short port, char value) |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
41 { |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
42 io_t iov; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
43 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
44 iov.val = value; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
45 iov.port = port; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
46 ioctl(svgahelper_fd, SVGALIB_HELPER_IOCSOUTW, &iov); |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
47 } |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
48 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
49 static __inline__ void svga_outl(short port, unsigned int value) |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
50 { |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
51 io_t iov; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
52 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
53 iov.val = value; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
54 iov.port = port; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
55 ioctl(svgahelper_fd, SVGALIB_HELPER_IOCSOUTL, &iov); |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
56 } |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
57 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
58 static __inline__ unsigned int svga_inb(short port) |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
59 { |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
60 io_t iov; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
61 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
62 iov.port = port; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
63 ioctl(svgahelper_fd, SVGALIB_HELPER_IOCGINB, &iov); |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
64 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
65 return iov.val; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
66 } |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
67 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
68 static __inline__ unsigned int svga_inw(short port) |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
69 { |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
70 io_t iov; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
71 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
72 iov.port = port; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
73 ioctl(svgahelper_fd, SVGALIB_HELPER_IOCGINW, &iov); |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
74 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
75 return iov.val; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
76 } |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
77 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
78 static __inline__ unsigned int svga_inl(short port) |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
79 { |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
80 io_t iov; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
81 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
82 iov.port = port; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
83 ioctl(svgahelper_fd, SVGALIB_HELPER_IOCGINL, &iov); |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
84 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
85 return iov.val; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
86 } |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
87 #endif /* CONIFG_SVGAHELPER */ |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
88 |
4164 | 89 static __inline__ void outb(short port,char val) |
90 { | |
8503
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
91 #ifdef CONFIG_SVGAHELPER |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
92 if (svgahelper_initialized == 1) |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
93 { |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
94 svga_outb(port, val); |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
95 return; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
96 } |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
97 #endif |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
98 |
4474 | 99 #ifdef CONFIG_DHAHELPER |
100 if (dhahelper_initialized == 1) | |
101 { | |
102 dhahelper_port_t _port; | |
103 | |
104 _port.operation = PORT_OP_WRITE; | |
105 _port.addr = port; | |
106 _port.size = 1; | |
107 _port.value = val; | |
108 if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0) | |
109 return; | |
110 } | |
111 else | |
112 #endif | |
4164 | 113 __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port)); |
4474 | 114 return; |
4164 | 115 } |
116 | |
117 static __inline__ void outw(short port,short val) | |
118 { | |
8503
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
119 #ifdef CONFIG_SVGAHELPER |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
120 if (svgahelper_initialized == 1) |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
121 { |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
122 svga_outw(port, val); |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
123 return; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
124 } |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
125 #endif |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
126 |
4474 | 127 #ifdef CONFIG_DHAHELPER |
128 if (dhahelper_initialized == 1) | |
129 { | |
130 dhahelper_port_t _port; | |
131 | |
132 _port.operation = PORT_OP_WRITE; | |
133 _port.addr = port; | |
134 _port.size = 2; | |
135 _port.value = val; | |
136 if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0) | |
137 return; | |
138 } | |
139 else | |
140 #endif | |
4164 | 141 __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port)); |
4474 | 142 return; |
4164 | 143 } |
144 | |
145 static __inline__ void outl(short port,unsigned int val) | |
146 { | |
8503
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
147 #ifdef CONFIG_SVGAHELPER |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
148 if (svgahelper_initialized == 1) |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
149 { |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
150 svga_outl(port, val); |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
151 return; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
152 } |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
153 #endif |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
154 |
4474 | 155 #ifdef CONFIG_DHAHELPER |
156 if (dhahelper_initialized == 1) | |
157 { | |
158 dhahelper_port_t _port; | |
159 | |
160 _port.operation = PORT_OP_WRITE; | |
161 _port.addr = port; | |
162 _port.size = 4; | |
163 _port.value = val; | |
164 if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0) | |
165 return; | |
166 } | |
167 else | |
168 #endif | |
4164 | 169 __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port)); |
4474 | 170 return; |
4164 | 171 } |
172 | |
173 static __inline__ unsigned int inb(short port) | |
174 { | |
8503
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
175 unsigned char ret = 0; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
176 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
177 #ifdef CONFIG_SVGAHELPER |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
178 if (svgahelper_initialized == 1) |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
179 { |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
180 return svga_inb(port); |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
181 } |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
182 #endif |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
183 |
4474 | 184 #ifdef CONFIG_DHAHELPER |
185 if (dhahelper_initialized == 1) | |
186 { | |
187 dhahelper_port_t _port; | |
188 | |
189 _port.operation = PORT_OP_READ; | |
190 _port.addr = port; | |
191 _port.size = 1; | |
192 if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0) | |
193 return _port.value; | |
194 } | |
195 else | |
196 #endif | |
4164 | 197 __asm__ __volatile__("inb %1,%0" : |
198 "=a" (ret) : | |
199 "d" (port)); | |
200 return ret; | |
201 } | |
202 | |
203 static __inline__ unsigned int inw(short port) | |
204 { | |
8503
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
205 unsigned short ret = 0; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
206 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
207 #ifdef CONFIG_SVGAHELPER |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
208 if (svgahelper_initialized == 1) |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
209 { |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
210 return svga_inw(port); |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
211 } |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
212 #endif |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
213 |
4474 | 214 #ifdef CONFIG_DHAHELPER |
215 if (dhahelper_initialized == 1) | |
216 { | |
217 dhahelper_port_t _port; | |
218 | |
219 _port.operation = PORT_OP_READ; | |
220 _port.addr = port; | |
221 _port.size = 2; | |
222 if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0) | |
223 return _port.value; | |
224 } | |
225 else | |
226 #endif | |
4164 | 227 __asm__ __volatile__("inw %1,%0" : |
228 "=a" (ret) : | |
229 "d" (port)); | |
230 return ret; | |
231 } | |
232 | |
233 static __inline__ unsigned int inl(short port) | |
234 { | |
8503
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
235 unsigned int ret = 0; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
236 |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
237 #ifdef CONFIG_SVGAHELPER |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
238 if (svgahelper_initialized == 1) |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
239 { |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
240 return svga_inl(port); |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
241 } |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
242 #endif |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
243 |
4474 | 244 #ifdef CONFIG_DHAHELPER |
245 if (dhahelper_initialized == 1) | |
246 { | |
247 dhahelper_port_t _port; | |
248 | |
249 _port.operation = PORT_OP_READ; | |
250 _port.addr = port; | |
251 _port.size = 4; | |
252 if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0) | |
253 return _port.value; | |
254 } | |
255 else | |
256 #endif | |
4164 | 257 __asm__ __volatile__("inl %1,%0" : |
258 "=a" (ret) : | |
259 "d" (port)); | |
260 return ret; | |
261 } | |
262 | |
263 static __inline__ void intr_disable() | |
264 { | |
8503
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
265 #ifdef CONFIG_SVGAHELPER |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
266 if (svgahelper_initialized == 1) |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
267 return; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
268 #endif |
4164 | 269 __asm__ __volatile__("cli"); |
270 } | |
271 | |
272 static __inline__ void intr_enable() | |
273 { | |
8503
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
274 #ifdef CONFIG_SVGAHELPER |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
275 if (svgahelper_initialized == 1) |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
276 return; |
9dbb9c710480
svgalib kernelhelper support (based on patch by Matan Ziv-Av <matan@svgalib.org>) and some reordering/cleanup (part #1 ;)
alex
parents:
4474
diff
changeset
|
277 #endif |
4164 | 278 __asm__ __volatile__("sti"); |
279 } | |
280 | |
281 #endif | |
282 | |
283 #endif |