annotate libdha/sysdep/AsmMacros_x86.h @ 22250:42b869296a06

liblzo support fix, take X: forgotten variable setting.
author diego
date Sun, 18 Feb 2007 21:51:39 +0000
parents 62705b2298ff
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
1 /*
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
2 This file is based on:
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
3 $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/AsmMacros.h,v 1.1 2001/11/16 21:13:34 tsi Exp $
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
4 Modified for readability by Nick Kurshev
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
5 */
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
6
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
7 #ifndef __ASM_MACROS_X86_H
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
8 #define __ASM_MACROS_X86_H
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
9
10980
e687fa1d55c6 port libdha to mingw
faust3
parents: 8503
diff changeset
10 //#if defined (WINNT)
e687fa1d55c6 port libdha to mingw
faust3
parents: 8503
diff changeset
11 //#error This stuff is not ported on your system
e687fa1d55c6 port libdha to mingw
faust3
parents: 8503
diff changeset
12 //#else
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
13
4474
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
14 #include "config.h"
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
15
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
16 #ifdef CONFIG_DHAHELPER
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
17 #include <sys/ioctl.h>
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
18 #include "../kernelhelper/dhahelper.h"
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
19
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
20 extern int dhahelper_fd;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
21 extern int dhahelper_initialized;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
22 #endif
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
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
12078
62705b2298ff svgalib 1.9.18 compile fix, still wont work for me though...
atmos4
parents: 10980
diff changeset
28 #ifndef SVGALIB_HELPER_IOC_MAGIC
62705b2298ff svgalib 1.9.18 compile fix, still wont work for me though...
atmos4
parents: 10980
diff changeset
29 /* svgalib 1.9.18+ compatibility ::atmos */
62705b2298ff svgalib 1.9.18 compile fix, still wont work for me though...
atmos4
parents: 10980
diff changeset
30 #define SVGALIB_HELPER_IOCSOUTB SVGAHELPER_OUTB
62705b2298ff svgalib 1.9.18 compile fix, still wont work for me though...
atmos4
parents: 10980
diff changeset
31 #define SVGALIB_HELPER_IOCSOUTW SVGAHELPER_OUTW
62705b2298ff svgalib 1.9.18 compile fix, still wont work for me though...
atmos4
parents: 10980
diff changeset
32 #define SVGALIB_HELPER_IOCSOUTL SVGAHELPER_OUTL
62705b2298ff svgalib 1.9.18 compile fix, still wont work for me though...
atmos4
parents: 10980
diff changeset
33 #define SVGALIB_HELPER_IOCGINB SVGAHELPER_INB
62705b2298ff svgalib 1.9.18 compile fix, still wont work for me though...
atmos4
parents: 10980
diff changeset
34 #define SVGALIB_HELPER_IOCGINW SVGAHELPER_INW
62705b2298ff svgalib 1.9.18 compile fix, still wont work for me though...
atmos4
parents: 10980
diff changeset
35 #define SVGALIB_HELPER_IOCGINL SVGAHELPER_INL
62705b2298ff svgalib 1.9.18 compile fix, still wont work for me though...
atmos4
parents: 10980
diff changeset
36 #endif
62705b2298ff svgalib 1.9.18 compile fix, still wont work for me though...
atmos4
parents: 10980
diff changeset
37
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
38 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
39 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
40
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 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
42 {
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 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
44
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.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
46 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
47 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
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
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 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
51 {
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 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
53
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.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
55 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
56 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
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
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 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
60 {
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 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
62
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 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
64 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
65 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
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_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
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_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
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_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
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_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
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
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 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
89 {
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
90 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
91
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 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
93 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
94
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 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
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 /* 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
98
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
99 static __inline__ void outb(short port,char val)
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
100 {
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
101 #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
102 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
103 {
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
104 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
105 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
106 }
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
107 #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
108
4474
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
109 #ifdef CONFIG_DHAHELPER
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
110 if (dhahelper_initialized == 1)
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
111 {
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
112 dhahelper_port_t _port;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
113
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
114 _port.operation = PORT_OP_WRITE;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
115 _port.addr = port;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
116 _port.size = 1;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
117 _port.value = val;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
118 if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0)
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
119 return;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
120 }
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
121 else
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
122 #endif
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
123 __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port));
4474
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
124 return;
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
125 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
126
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
127 static __inline__ void outw(short port,short val)
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
128 {
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
129 #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
130 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
131 {
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
132 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
133 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
134 }
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
135 #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
136
4474
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
137 #ifdef CONFIG_DHAHELPER
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
138 if (dhahelper_initialized == 1)
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
139 {
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
140 dhahelper_port_t _port;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
141
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
142 _port.operation = PORT_OP_WRITE;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
143 _port.addr = port;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
144 _port.size = 2;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
145 _port.value = val;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
146 if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0)
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
147 return;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
148 }
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
149 else
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
150 #endif
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
151 __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port));
4474
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
152 return;
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
153 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
154
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
155 static __inline__ void outl(short port,unsigned int val)
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
156 {
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
157 #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
158 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
159 {
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
160 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
161 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
162 }
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
163 #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
164
4474
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
165 #ifdef CONFIG_DHAHELPER
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
166 if (dhahelper_initialized == 1)
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
167 {
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
168 dhahelper_port_t _port;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
169
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
170 _port.operation = PORT_OP_WRITE;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
171 _port.addr = port;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
172 _port.size = 4;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
173 _port.value = val;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
174 if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0)
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
175 return;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
176 }
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
177 else
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
178 #endif
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
179 __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port));
4474
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
180 return;
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
181 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
182
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
183 static __inline__ unsigned int inb(short port)
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
184 {
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
185 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
186
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
187 #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
188 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
189 {
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
190 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
191 }
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
192 #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
193
4474
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
194 #ifdef CONFIG_DHAHELPER
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
195 if (dhahelper_initialized == 1)
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
196 {
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
197 dhahelper_port_t _port;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
198
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
199 _port.operation = PORT_OP_READ;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
200 _port.addr = port;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
201 _port.size = 1;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
202 if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0)
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
203 return _port.value;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
204 }
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
205 else
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
206 #endif
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
207 __asm__ __volatile__("inb %1,%0" :
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
208 "=a" (ret) :
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
209 "d" (port));
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
210 return ret;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
211 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
212
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
213 static __inline__ unsigned int inw(short port)
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
214 {
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
215 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
216
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
217 #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
218 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
219 {
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
220 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
221 }
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
222 #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
223
4474
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
224 #ifdef CONFIG_DHAHELPER
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
225 if (dhahelper_initialized == 1)
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
226 {
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
227 dhahelper_port_t _port;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
228
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
229 _port.operation = PORT_OP_READ;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
230 _port.addr = port;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
231 _port.size = 2;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
232 if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0)
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
233 return _port.value;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
234 }
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
235 else
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
236 #endif
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
237 __asm__ __volatile__("inw %1,%0" :
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
238 "=a" (ret) :
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
239 "d" (port));
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
240 return ret;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
241 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
242
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
243 static __inline__ unsigned int inl(short port)
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
244 {
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
245 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
246
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
247 #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
248 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
249 {
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
250 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
251 }
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
252 #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
253
4474
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
254 #ifdef CONFIG_DHAHELPER
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
255 if (dhahelper_initialized == 1)
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
256 {
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
257 dhahelper_port_t _port;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
258
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
259 _port.operation = PORT_OP_READ;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
260 _port.addr = port;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
261 _port.size = 4;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
262 if (ioctl(dhahelper_fd, DHAHELPER_PORT, &_port) == 0)
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
263 return _port.value;
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
264 }
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
265 else
05ac3586db02 added support for dhahelper
alex
parents: 4164
diff changeset
266 #endif
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
267 __asm__ __volatile__("inl %1,%0" :
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
268 "=a" (ret) :
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
269 "d" (port));
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
270 return ret;
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
271 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
272
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
273 static __inline__ void intr_disable()
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
274 {
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
275 #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
276 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
277 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
278 #endif
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
279 __asm__ __volatile__("cli");
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
280 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
281
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
282 static __inline__ void intr_enable()
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
283 {
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
284 #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
285 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
286 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
287 #endif
4164
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
288 __asm__ __volatile__("sti");
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
289 }
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
290
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
291 #endif
2e3262002acb Improved readability and new stuffs
nick
parents:
diff changeset
292
10980
e687fa1d55c6 port libdha to mingw
faust3
parents: 8503
diff changeset
293 //#endif