]>
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 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
28 * Revision 1.2 1998/09/30 21:20:45 wsanchez
29 * Merged in IntelMerge1 (mburg: Intel support)
31 * Revision 1.1.2.1 1998/09/30 18:18:50 mburg
32 * Changes for Intel port
34 * Revision 1.1.1.1 1998/03/07 02:25:38 wsanchez
35 * Import of OSF Mach kernel (~mburg)
37 * Revision 1.1.8.2 1996/07/31 09:46:36 paire
38 * Merged with nmk20b7_shared (1.1.11.2 -> 1.1.11.1)
41 * Revision 1.1.11.2 1996/06/13 12:38:25 bernadat
42 * Do not use inline macros when MACH_ASSERT is configured.
45 * Revision 1.1.11.1 1996/05/14 13:50:23 paire
46 * Added new linl and loutl __inline__.
47 * Added conditional compilation for [l]{in|oub}[bwl]() __inline__.
50 * Revision 1.1.8.1 1994/09/23 02:00:28 ezf
51 * change marker to not FREE
52 * [1994/09/22 21:25:52 ezf]
54 * Revision 1.1.4.5 1993/08/09 19:40:41 dswartz
55 * Add ANSI prototypes - CR#9523
56 * [1993/08/06 17:45:57 dswartz]
58 * Revision 1.1.4.4 1993/06/11 15:17:37 jeffc
59 * CR9176 - ANSI C violations: inb/outb macros must be changed from
60 * ({ ... }) to inline functions, with proper type definitions. Callers
61 * must pass proper types to these functions: 386 I/O port addresses
62 * are unsigned shorts (not pointers).
63 * [1993/06/10 14:26:10 jeffc]
65 * Revision 1.1.4.3 1993/06/07 22:09:28 jeffc
66 * CR9176 - ANSI C violations: trailing tokens on CPP
67 * directives, extra semicolons after decl_ ..., asm keywords
68 * [1993/06/07 19:00:26 jeffc]
70 * Revision 1.1.4.2 1993/06/04 15:28:45 jeffc
71 * CR9176 - ANSI problems -
72 * Added casts to get macros to take caddr_t as an I/O space address.
73 * [1993/06/04 13:45:55 jeffc]
75 * Revision 1.1 1992/09/30 02:25:51 robert
82 * Revision 2.5 91/05/14 16:14:20 mrt
83 * Correcting copyright
85 * Revision 2.4 91/02/05 17:13:56 mrt
86 * Changed to new Mach copyright
87 * [91/02/01 17:37:08 mrt]
89 * Revision 2.3 90/12/20 16:36:37 jeffreyh
90 * changes for __STDC__
93 * Revision 2.2 90/11/26 14:48:41 rvb
95 * [90/11/22 10:09:38 rvb]
99 * Now we know how types are factor in.
100 * Cleaned up a bunch: eliminated ({ for output and flushed unused
104 * This is how its done in gcc:
111 * Mach Operating System
112 * Copyright (c) 1991,1990 Carnegie Mellon University
113 * All Rights Reserved.
115 * Permission to use, copy, modify and distribute this software and its
116 * documentation is hereby granted, provided that both the copyright
117 * notice and this permission notice appear in all copies of the
118 * software, derivative works or modified versions, and any portions
119 * thereof, and that both notices appear in supporting documentation.
121 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
122 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
123 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
125 * Carnegie Mellon requests users of this software to return to
127 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
128 * School of Computer Science
129 * Carnegie Mellon University
130 * Pittsburgh PA 15213-3890
132 * any improvements or extensions that they make and grant Carnegie Mellon
133 * the rights to redistribute these changes.
140 typedef unsigned short i386_ioport_t
;
142 /* read a longword */
143 extern unsigned long inl(
145 /* read a shortword */
146 extern unsigned short inw(
149 extern unsigned char inb(
151 /* write a longword */
154 unsigned long datum
);
158 unsigned short datum
);
159 /* write a longword */
162 unsigned char datum
);
164 /* input an array of longwords */
169 /* output an array of longwords */
175 /* input an array of words */
180 /* output an array of words */
186 /* input an array of bytes */
191 /* output an array of bytes */
197 extern __inline__
unsigned long inl(
201 __asm__
volatile("inl %1, %0" : "=a" (datum
) : "d" (port
));
205 extern __inline__
unsigned short inw(
208 unsigned short datum
;
209 __asm__
volatile(".byte 0x66; inl %1, %0" : "=a" (datum
) : "d" (port
));
213 extern __inline__
unsigned char inb(
217 __asm__
volatile("inb %1, %0" : "=a" (datum
) : "d" (port
));
221 extern __inline__
void outl(
225 __asm__
volatile("outl %0, %1" : : "a" (datum
), "d" (port
));
228 extern __inline__
void outw(
230 unsigned short datum
)
232 __asm__
volatile(".byte 0x66; outl %0, %1" : : "a" (datum
), "d" (port
));
235 extern __inline__
void outb(
239 __asm__
volatile("outb %0, %1" : : "a" (datum
), "d" (port
));
242 #endif /* I386_PIO_H */