]>
git.saurik.com Git - apple/xnu.git/blob - bsd/dev/i386/pio.h
2 * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
36 * Revision 1.2 1998/09/30 21:20:45 wsanchez
37 * Merged in IntelMerge1 (mburg: Intel support)
39 * Revision 1.1.2.1 1998/09/30 18:18:50 mburg
40 * Changes for Intel port
42 * Revision 1.1.1.1 1998/03/07 02:25:38 wsanchez
43 * Import of OSF Mach kernel (~mburg)
45 * Revision 1.1.8.2 1996/07/31 09:46:36 paire
46 * Merged with nmk20b7_shared (1.1.11.2 -> 1.1.11.1)
49 * Revision 1.1.11.2 1996/06/13 12:38:25 bernadat
50 * Do not use inline macros when MACH_ASSERT is configured.
53 * Revision 1.1.11.1 1996/05/14 13:50:23 paire
54 * Added new linl and loutl __inline__.
55 * Added conditional compilation for [l]{in|oub}[bwl]() __inline__.
58 * Revision 1.1.8.1 1994/09/23 02:00:28 ezf
59 * change marker to not FREE
60 * [1994/09/22 21:25:52 ezf]
62 * Revision 1.1.4.5 1993/08/09 19:40:41 dswartz
63 * Add ANSI prototypes - CR#9523
64 * [1993/08/06 17:45:57 dswartz]
66 * Revision 1.1.4.4 1993/06/11 15:17:37 jeffc
67 * CR9176 - ANSI C violations: inb/outb macros must be changed from
68 * ({ ... }) to inline functions, with proper type definitions. Callers
69 * must pass proper types to these functions: 386 I/O port addresses
70 * are unsigned shorts (not pointers).
71 * [1993/06/10 14:26:10 jeffc]
73 * Revision 1.1.4.3 1993/06/07 22:09:28 jeffc
74 * CR9176 - ANSI C violations: trailing tokens on CPP
75 * directives, extra semicolons after decl_ ..., asm keywords
76 * [1993/06/07 19:00:26 jeffc]
78 * Revision 1.1.4.2 1993/06/04 15:28:45 jeffc
79 * CR9176 - ANSI problems -
80 * Added casts to get macros to take caddr_t as an I/O space address.
81 * [1993/06/04 13:45:55 jeffc]
83 * Revision 1.1 1992/09/30 02:25:51 robert
90 * Revision 2.5 91/05/14 16:14:20 mrt
91 * Correcting copyright
93 * Revision 2.4 91/02/05 17:13:56 mrt
94 * Changed to new Mach copyright
95 * [91/02/01 17:37:08 mrt]
97 * Revision 2.3 90/12/20 16:36:37 jeffreyh
98 * changes for __STDC__
101 * Revision 2.2 90/11/26 14:48:41 rvb
103 * [90/11/22 10:09:38 rvb]
107 * Now we know how types are factor in.
108 * Cleaned up a bunch: eliminated ({ for output and flushed unused
112 * This is how its done in gcc:
119 * Mach Operating System
120 * Copyright (c) 1991,1990 Carnegie Mellon University
121 * All Rights Reserved.
123 * Permission to use, copy, modify and distribute this software and its
124 * documentation is hereby granted, provided that both the copyright
125 * notice and this permission notice appear in all copies of the
126 * software, derivative works or modified versions, and any portions
127 * thereof, and that both notices appear in supporting documentation.
129 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
130 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
131 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
133 * Carnegie Mellon requests users of this software to return to
135 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
136 * School of Computer Science
137 * Carnegie Mellon University
138 * Pittsburgh PA 15213-3890
140 * any improvements or extensions that they make and grant Carnegie Mellon
141 * the rights to redistribute these changes.
148 typedef unsigned short i386_ioport_t
;
150 /* read a longword */
151 extern unsigned long inl(
153 /* read a shortword */
154 extern unsigned short inw(
157 extern unsigned char inb(
159 /* write a longword */
162 unsigned long datum
);
166 unsigned short datum
);
167 /* write a longword */
170 unsigned char datum
);
172 /* input an array of longwords */
177 /* output an array of longwords */
183 /* input an array of words */
188 /* output an array of words */
194 /* input an array of bytes */
199 /* output an array of bytes */
205 extern __inline__
unsigned long inl(
209 __asm__
volatile("inl %1, %0" : "=a" (datum
) : "d" (port
));
213 extern __inline__
unsigned short inw(
216 unsigned short datum
;
217 __asm__
volatile(".byte 0x66; inl %1, %0" : "=a" (datum
) : "d" (port
));
221 extern __inline__
unsigned char inb(
225 __asm__
volatile("inb %1, %0" : "=a" (datum
) : "d" (port
));
229 extern __inline__
void outl(
233 __asm__
volatile("outl %0, %1" : : "a" (datum
), "d" (port
));
236 extern __inline__
void outw(
238 unsigned short datum
)
240 __asm__
volatile(".byte 0x66; outl %0, %1" : : "a" (datum
), "d" (port
));
243 extern __inline__
void outb(
247 __asm__
volatile("outb %0, %1" : : "a" (datum
), "d" (port
));
250 #endif /* I386_PIO_H */