]>
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 * 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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
29 * Revision 1.2 1998/09/30 21:20:45 wsanchez
30 * Merged in IntelMerge1 (mburg: Intel support)
32 * Revision 1.1.2.1 1998/09/30 18:18:50 mburg
33 * Changes for Intel port
35 * Revision 1.1.1.1 1998/03/07 02:25:38 wsanchez
36 * Import of OSF Mach kernel (~mburg)
38 * Revision 1.1.8.2 1996/07/31 09:46:36 paire
39 * Merged with nmk20b7_shared (1.1.11.2 -> 1.1.11.1)
42 * Revision 1.1.11.2 1996/06/13 12:38:25 bernadat
43 * Do not use inline macros when MACH_ASSERT is configured.
46 * Revision 1.1.11.1 1996/05/14 13:50:23 paire
47 * Added new linl and loutl __inline__.
48 * Added conditional compilation for [l]{in|oub}[bwl]() __inline__.
51 * Revision 1.1.8.1 1994/09/23 02:00:28 ezf
52 * change marker to not FREE
53 * [1994/09/22 21:25:52 ezf]
55 * Revision 1.1.4.5 1993/08/09 19:40:41 dswartz
56 * Add ANSI prototypes - CR#9523
57 * [1993/08/06 17:45:57 dswartz]
59 * Revision 1.1.4.4 1993/06/11 15:17:37 jeffc
60 * CR9176 - ANSI C violations: inb/outb macros must be changed from
61 * ({ ... }) to inline functions, with proper type definitions. Callers
62 * must pass proper types to these functions: 386 I/O port addresses
63 * are unsigned shorts (not pointers).
64 * [1993/06/10 14:26:10 jeffc]
66 * Revision 1.1.4.3 1993/06/07 22:09:28 jeffc
67 * CR9176 - ANSI C violations: trailing tokens on CPP
68 * directives, extra semicolons after decl_ ..., asm keywords
69 * [1993/06/07 19:00:26 jeffc]
71 * Revision 1.1.4.2 1993/06/04 15:28:45 jeffc
72 * CR9176 - ANSI problems -
73 * Added casts to get macros to take caddr_t as an I/O space address.
74 * [1993/06/04 13:45:55 jeffc]
76 * Revision 1.1 1992/09/30 02:25:51 robert
83 * Revision 2.5 91/05/14 16:14:20 mrt
84 * Correcting copyright
86 * Revision 2.4 91/02/05 17:13:56 mrt
87 * Changed to new Mach copyright
88 * [91/02/01 17:37:08 mrt]
90 * Revision 2.3 90/12/20 16:36:37 jeffreyh
91 * changes for __STDC__
94 * Revision 2.2 90/11/26 14:48:41 rvb
96 * [90/11/22 10:09:38 rvb]
100 * Now we know how types are factor in.
101 * Cleaned up a bunch: eliminated ({ for output and flushed unused
105 * This is how its done in gcc:
112 * Mach Operating System
113 * Copyright (c) 1991,1990 Carnegie Mellon University
114 * All Rights Reserved.
116 * Permission to use, copy, modify and distribute this software and its
117 * documentation is hereby granted, provided that both the copyright
118 * notice and this permission notice appear in all copies of the
119 * software, derivative works or modified versions, and any portions
120 * thereof, and that both notices appear in supporting documentation.
122 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
123 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
124 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
126 * Carnegie Mellon requests users of this software to return to
128 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
129 * School of Computer Science
130 * Carnegie Mellon University
131 * Pittsburgh PA 15213-3890
133 * any improvements or extensions that they make and grant Carnegie Mellon
134 * the rights to redistribute these changes.
141 typedef unsigned short i386_ioport_t
;
143 /* read a longword */
144 extern unsigned long inl(
146 /* read a shortword */
147 extern unsigned short inw(
150 extern unsigned char inb(
152 /* write a longword */
155 unsigned long datum
);
159 unsigned short datum
);
160 /* write a longword */
163 unsigned char datum
);
165 /* input an array of longwords */
170 /* output an array of longwords */
176 /* input an array of words */
181 /* output an array of words */
187 /* input an array of bytes */
192 /* output an array of bytes */
198 extern __inline__
unsigned long inl(
202 __asm__
volatile("inl %1, %0" : "=a" (datum
) : "d" (port
));
206 extern __inline__
unsigned short inw(
209 unsigned short datum
;
210 __asm__
volatile(".byte 0x66; inl %1, %0" : "=a" (datum
) : "d" (port
));
214 extern __inline__
unsigned char inb(
218 __asm__
volatile("inb %1, %0" : "=a" (datum
) : "d" (port
));
222 extern __inline__
void outl(
226 __asm__
volatile("outl %0, %1" : : "a" (datum
), "d" (port
));
229 extern __inline__
void outw(
231 unsigned short datum
)
233 __asm__
volatile(".byte 0x66; outl %0, %1" : : "a" (datum
), "d" (port
));
236 extern __inline__
void outb(
240 __asm__
volatile("outb %0, %1" : : "a" (datum
), "d" (port
));
243 #endif /* I386_PIO_H */