This source file includes following definitions.
- __outw
- __outwc
- __inw
- __inwc
- __outw_p
- __outwc_p
- __inw_p
- __inwc_p
1 #ifndef _ASM_IOW_H
2 #define _ASM_IOW_H
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 extern inline void __outw(unsigned short value, unsigned short port)
23 {
24 __asm__ __volatile__ ("outw %w0,%w1"
25 :
26 :"a" (value),"d" (port));
27 }
28
29
30 extern inline void __outwc(unsigned short value, unsigned short port)
31 {
32 __asm__ __volatile__ ("outw %w0,%1"
33 :
34 :"a" (value),"i" (port));
35 }
36
37
38 extern inline unsigned int __inw(unsigned short port)
39 {
40 unsigned int _v;
41 __asm__ __volatile__ ("inw %w1,%w0"
42 :"=a" (_v):"d" (port),"0" (0));
43 return _v;
44 }
45
46
47 extern inline unsigned int __inwc(unsigned short port)
48 {
49 unsigned int _v;
50 __asm__ __volatile__ ("inw %1,%w0"
51 :"=a" (_v):"i" (port),"0" (0));
52 return _v;
53 }
54
55 extern inline void __outw_p(unsigned short value, unsigned short port)
56 {
57 __asm__ __volatile__ ("outw %w0,%w1"
58 :
59 :"a" (value),"d" (port));
60 SLOW_DOWN_IO;
61 }
62
63 extern inline void __outwc_p(unsigned short value, unsigned short port)
64 {
65 __asm__ __volatile__ ("outw %w0,%1"
66 :
67 :"a" (value),"i" (port));
68 SLOW_DOWN_IO;
69 }
70
71 extern inline unsigned int __inw_p(unsigned short port)
72 {
73 unsigned int _v;
74 __asm__ __volatile__ ("inw %w1,%w0"
75 :"=a" (_v):"d" (port),"0" (0));
76 SLOW_DOWN_IO;
77 return _v;
78 }
79
80 extern inline unsigned int __inwc_p(unsigned short port)
81 {
82 unsigned int _v;
83 __asm__ __volatile__ ("inw %1,%w0"
84 :"=a" (_v):"i" (port),"0" (0));
85 SLOW_DOWN_IO;
86 return _v;
87 }
88
89
90
91
92
93
94 #define outw(val,port) \
95 ((__builtin_constant_p((port)) && (port) < 256) ? \
96 __outwc((val),(port)) : \
97 __outw((val),(port)))
98
99 #define inw(port) \
100 ((__builtin_constant_p((port)) && (port) < 256) ? \
101 __inwc(port) : \
102 __inw(port))
103
104 #define outw_p(val,port) \
105 ((__builtin_constant_p((port)) && (port) < 256) ? \
106 __outwc_p((val),(port)) : \
107 __outw_p((val),(port)))
108
109 #define inw_p(port) \
110 ((__builtin_constant_p((port)) && (port) < 256) ? \
111 __inwc_p(port) : \
112 __inw_p(port))
113
114 #endif
115
116
117
118 #define port_read(port,buf,nr) \
119 __asm__("cld;rep;insw": :"d" (port),"D" (buf),"c" (nr):"cx","di")
120 #define port_write(port,buf,nr) \
121 __asm__("cld;rep;outsw": :"d" (port),"S" (buf),"c" (nr):"cx","si")
122
123 #define port_read_b(port,buf,nr) \
124 __asm__("cld;rep;insb": :"d" (port),"D" (buf),"c" (nr):"cx","di")
125 #define port_write_b(port,buf,nr) \
126 __asm__("cld;rep;outsb": :"d" (port),"S" (buf),"c" (nr):"cx","si")