FreeBSD/Linux Kernel Cross Reference
sys/i386/pio.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: pio.h,v $
29 * Revision 2.6 93/01/14 17:29:31 danner
30 * altered malformed error message
31 * [92/12/18 danner]
32 * Took the warning inside ifndef __GNUC__ outside of comments. This
33 * will make the compiler find the error instead of having to find
34 * out about it manually.
35 * Protected against multiple inclusions.
36 * [92/11/30 jvh]
37 *
38 * Revision 2.5 91/05/14 16:14:20 mrt
39 * Correcting copyright
40 *
41 * Revision 2.4 91/02/05 17:13:56 mrt
42 * Changed to new Mach copyright
43 * [91/02/01 17:37:08 mrt]
44 *
45 * Revision 2.3 90/12/20 16:36:37 jeffreyh
46 * changes for __STDC__
47 * [90/12/07 jeffreyh]
48 *
49 * Revision 2.2 90/11/26 14:48:41 rvb
50 * Pulled from 2.5
51 * [90/11/22 10:09:38 rvb]
52 *
53 * [90/08/14 mg32]
54 *
55 * Now we know how types are factor in.
56 * Cleaned up a bunch: eliminated ({ for output and flushed unused
57 * output variables.
58 * [90/08/14 rvb]
59 *
60 * This is how its done in gcc:
61 * Created.
62 * [90/03/26 rvb]
63 *
64 */
65
66 #ifndef _I386_PIO_H_
67 #define _I386_PIO_H_
68
69 #ifndef __GNUC__
70 #error You do not stand a chance. This file is gcc only.
71 #endif __GNUC__
72
73 #define inl(y) \
74 ({ unsigned long _tmp__; \
75 asm volatile("inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \
76 _tmp__; })
77
78 #define inw(y) \
79 ({ unsigned short _tmp__; \
80 asm volatile(".byte 0x66; inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \
81 _tmp__; })
82
83 #define inb(y) \
84 ({ unsigned char _tmp__; \
85 asm volatile("inb %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \
86 _tmp__; })
87
88
89 #define outl(x, y) \
90 { asm volatile("outl %0, %1" : : "a" (y) , "d" ((unsigned short)(x))); }
91
92
93 #define outw(x, y) \
94 {asm volatile(".byte 0x66; outl %0, %1" : : "a" ((unsigned short)(y)) , "d" ((unsigned short)(x))); }
95
96
97 #define outb(x, y) \
98 { asm volatile("outb %0, %1" : : "a" ((unsigned char)(y)) , "d" ((unsigned short)(x))); }
99
100 #endif /* _I386_PIO_H_ */
Cache object: 244d6d52680755ef88ef90569424c173
|