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