]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
37839358 A |
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. | |
1c79356b | 11 | * |
37839358 A |
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 | |
1c79356b A |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
37839358 A |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
1c79356b A |
19 | * |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* | |
23 | * @OSF_COPYRIGHT@ | |
24 | */ | |
25 | /* | |
26 | * Mach Operating System | |
27 | * Copyright (c) 1991,1990 Carnegie Mellon University | |
28 | * All Rights Reserved. | |
29 | * | |
30 | * Permission to use, copy, modify and distribute this software and its | |
31 | * documentation is hereby granted, provided that both the copyright | |
32 | * notice and this permission notice appear in all copies of the | |
33 | * software, derivative works or modified versions, and any portions | |
34 | * thereof, and that both notices appear in supporting documentation. | |
35 | * | |
36 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
37 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | |
38 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
39 | * | |
40 | * Carnegie Mellon requests users of this software to return to | |
41 | * | |
42 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
43 | * School of Computer Science | |
44 | * Carnegie Mellon University | |
45 | * Pittsburgh PA 15213-3890 | |
46 | * | |
47 | * any improvements or extensions that they make and grant Carnegie Mellon | |
48 | * the rights to redistribute these changes. | |
49 | */ | |
50 | /* | |
51 | */ | |
52 | #ifndef I386_PIO_H | |
53 | #define I386_PIO_H | |
1c79356b A |
54 | #include <mach_assert.h> |
55 | ||
56 | typedef unsigned short i386_ioport_t; | |
57 | ||
58 | /* read a longword */ | |
59 | extern unsigned long inl( | |
60 | i386_ioport_t port); | |
61 | /* read a shortword */ | |
62 | extern unsigned short inw( | |
63 | i386_ioport_t port); | |
64 | /* read a byte */ | |
65 | extern unsigned char inb( | |
66 | i386_ioport_t port); | |
67 | /* write a longword */ | |
68 | extern void outl( | |
69 | i386_ioport_t port, | |
70 | unsigned long datum); | |
71 | /* write a word */ | |
72 | extern void outw( | |
73 | i386_ioport_t port, | |
74 | unsigned short datum); | |
75 | /* write a longword */ | |
76 | extern void outb( | |
77 | i386_ioport_t port, | |
78 | unsigned char datum); | |
79 | ||
80 | /* input an array of longwords */ | |
81 | extern void linl( | |
82 | i386_ioport_t port, | |
83 | int * data, | |
84 | int count); | |
85 | /* output an array of longwords */ | |
86 | extern void loutl( | |
87 | i386_ioport_t port, | |
88 | int * data, | |
89 | int count); | |
90 | ||
91 | /* input an array of words */ | |
92 | extern void linw( | |
93 | i386_ioport_t port, | |
94 | int * data, | |
95 | int count); | |
96 | /* output an array of words */ | |
97 | extern void loutw( | |
98 | i386_ioport_t port, | |
99 | int * data, | |
100 | int count); | |
101 | ||
102 | /* input an array of bytes */ | |
103 | extern void linb( | |
104 | i386_ioport_t port, | |
105 | char * data, | |
106 | int count); | |
107 | /* output an array of bytes */ | |
108 | extern void loutb( | |
109 | i386_ioport_t port, | |
110 | char * data, | |
111 | int count); | |
112 | ||
113 | #if defined(__GNUC__) && (!MACH_ASSERT) | |
114 | extern __inline__ unsigned long inl( | |
115 | i386_ioport_t port) | |
116 | { | |
117 | unsigned long datum; | |
118 | __asm__ volatile("inl %1, %0" : "=a" (datum) : "d" (port)); | |
119 | return(datum); | |
120 | } | |
121 | ||
122 | extern __inline__ unsigned short inw( | |
123 | i386_ioport_t port) | |
124 | { | |
125 | unsigned short datum; | |
126 | __asm__ volatile(".byte 0x66; inl %1, %0" : "=a" (datum) : "d" (port)); | |
127 | return(datum); | |
128 | } | |
129 | ||
130 | extern __inline__ unsigned char inb( | |
131 | i386_ioport_t port) | |
132 | { | |
133 | unsigned char datum; | |
134 | __asm__ volatile("inb %1, %0" : "=a" (datum) : "d" (port)); | |
135 | return(datum); | |
136 | } | |
137 | ||
138 | extern __inline__ void outl( | |
139 | i386_ioport_t port, | |
140 | unsigned long datum) | |
141 | { | |
142 | __asm__ volatile("outl %0, %1" : : "a" (datum), "d" (port)); | |
143 | } | |
144 | ||
145 | extern __inline__ void outw( | |
146 | i386_ioport_t port, | |
147 | unsigned short datum) | |
148 | { | |
149 | __asm__ volatile(".byte 0x66; outl %0, %1" : : "a" (datum), "d" (port)); | |
150 | } | |
151 | ||
152 | extern __inline__ void outb( | |
153 | i386_ioport_t port, | |
154 | unsigned char datum) | |
155 | { | |
156 | __asm__ volatile("outb %0, %1" : : "a" (datum), "d" (port)); | |
157 | } | |
158 | #endif /* defined(__GNUC__) && (!MACH_ASSERT) */ | |
159 | #endif /* I386_PIO_H */ |