]>
git.saurik.com Git - apple/xnu.git/blob - bsd/dev/arm/pio.h
2 * Copyright (c) 2000-2007 AppleInc. All rights reserved.
10 * Revision 1.2 1998/09/30 21:20:45 wsanchez
11 * Merged in IntelMerge1 (mburg: Intel support)
13 * Revision 1.1.2.1 1998/09/30 18:18:50 mburg
14 * Changes for Intel port
16 * Revision 1.1.1.1 1998/03/07 02:25:38 wsanchez
17 * Import of OSF Mach kernel (~mburg)
19 * Revision 1.1.8.2 1996/07/31 09:46:36 paire
20 * Merged with nmk20b7_shared (1.1.11.2 -> 1.1.11.1)
23 * Revision 1.1.11.2 1996/06/13 12:38:25 bernadat
24 * Do not use inline macros when MACH_ASSERT is configured.
27 * Revision 1.1.11.1 1996/05/14 13:50:23 paire
28 * Added new linl and loutl __inline__.
29 * Added conditional compilation for [l]{in|oub}[bwl]() __inline__.
32 * Revision 1.1.8.1 1994/09/23 02:00:28 ezf
33 * change marker to not FREE
34 * [1994/09/22 21:25:52 ezf]
36 * Revision 1.1.4.5 1993/08/09 19:40:41 dswartz
37 * Add ANSI prototypes - CR#9523
38 * [1993/08/06 17:45:57 dswartz]
40 * Revision 1.1.4.4 1993/06/11 15:17:37 jeffc
41 * CR9176 - ANSI C violations: inb/outb macros must be changed from
42 * ({ ... }) to inline functions, with proper type definitions. Callers
43 * must pass proper types to these functions: 386 I/O port addresses
44 * are unsigned shorts (not pointers).
45 * [1993/06/10 14:26:10 jeffc]
47 * Revision 1.1.4.3 1993/06/07 22:09:28 jeffc
48 * CR9176 - ANSI C violations: trailing tokens on CPP
49 * directives, extra semicolons after decl_ ..., asm keywords
50 * [1993/06/07 19:00:26 jeffc]
52 * Revision 1.1.4.2 1993/06/04 15:28:45 jeffc
53 * CR9176 - ANSI problems -
54 * Added casts to get macros to take caddr_t as an I/O space address.
55 * [1993/06/04 13:45:55 jeffc]
57 * Revision 1.1 1992/09/30 02:25:51 robert
64 * Revision 2.5 91/05/14 16:14:20 mrt
65 * Correcting copyright
67 * Revision 2.4 91/02/05 17:13:56 mrt
68 * Changed to new Mach copyright
69 * [91/02/01 17:37:08 mrt]
71 * Revision 2.3 90/12/20 16:36:37 jeffreyh
72 * changes for __STDC__
75 * Revision 2.2 90/11/26 14:48:41 rvb
77 * [90/11/22 10:09:38 rvb]
81 * Now we know how types are factor in.
82 * Cleaned up a bunch: eliminated ({ for output and flushed unused
86 * This is how its done in gcc:
93 * Mach Operating System
94 * Copyright (c) 1991,1990 Carnegie Mellon University
95 * All Rights Reserved.
97 * Permission to use, copy, modify and distribute this software and its
98 * documentation is hereby granted, provided that both the copyright
99 * notice and this permission notice appear in all copies of the
100 * software, derivative works or modified versions, and any portions
101 * thereof, and that both notices appear in supporting documentation.
103 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
104 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
105 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
107 * Carnegie Mellon requests users of this software to return to
109 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
110 * School of Computer Science
111 * Carnegie Mellon University
112 * Pittsburgh PA 15213-3890
114 * any improvements or extensions that they make and grant Carnegie Mellon
115 * the rights to redistribute these changes.
122 typedef unsigned short i386_ioport_t
;
124 /* read a longword */
125 extern unsigned long inl(
127 /* read a shortword */
128 extern unsigned short inw(
131 extern unsigned char inb(
133 /* write a longword */
136 unsigned long datum
);
140 unsigned short datum
);
141 /* write a longword */
144 unsigned char datum
);
146 /* input an array of longwords */
151 /* output an array of longwords */
157 /* input an array of words */
162 /* output an array of words */
168 /* input an array of bytes */
173 /* output an array of bytes */
179 extern __inline__
unsigned long inl(
183 __asm__
volatile("inl %1, %0" : "=a" (datum
) : "d" (port
));
187 extern __inline__
unsigned short inw(
190 unsigned short datum
;
191 __asm__
volatile(".byte 0x66; inl %1, %0" : "=a" (datum
) : "d" (port
));
195 extern __inline__
unsigned char inb(
199 __asm__
volatile("inb %1, %0" : "=a" (datum
) : "d" (port
));
203 extern __inline__
void outl(
207 __asm__
volatile("outl %0, %1" : : "a" (datum
), "d" (port
));
210 extern __inline__
void outw(
212 unsigned short datum
)
214 __asm__
volatile(".byte 0x66; outl %0, %1" : : "a" (datum
), "d" (port
));
217 extern __inline__
void outb(
221 __asm__
volatile("outb %0, %1" : : "a" (datum
), "d" (port
));
224 #endif /* ARM_PIO_H */