|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 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. ! 11: * ! 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 ! 18: * under the License. ! 19: * ! 20: * @APPLE_LICENSE_HEADER_END@ ! 21: */ ! 22: /* ! 23: * @OSF_COPYRIGHT@ ! 24: */ ! 25: /* ! 26: * HISTORY ! 27: * ! 28: * Revision 1.1.2.1 1998/10/13 00:40:44 ehewitt ! 29: * Added support for Intel. ! 30: * ! 31: * Revision 1.1.1.1 1998/09/22 21:05:37 wsanchez ! 32: * Import of Mac OS X kernel (~semeria) ! 33: * ! 34: * Revision 1.1.1.1 1998/03/07 02:25:38 wsanchez ! 35: * Import of OSF Mach kernel (~mburg) ! 36: * ! 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) ! 39: * [96/06/10 paire] ! 40: * ! 41: * Revision 1.1.11.2 1996/06/13 12:38:25 bernadat ! 42: * Do not use inline macros when MACH_ASSERT is configured. ! 43: * [96/05/24 bernadat] ! 44: * ! 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__. ! 48: * [95/11/24 paire] ! 49: * ! 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] ! 53: * ! 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] ! 57: * ! 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] ! 64: * ! 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] ! 69: * ! 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] ! 74: * ! 75: * Revision 1.1 1992/09/30 02:25:51 robert ! 76: * Initial revision ! 77: * ! 78: * $EndLog$ ! 79: */ ! 80: /* CMU_HIST */ ! 81: /* ! 82: * Revision 2.5 91/05/14 16:14:20 mrt ! 83: * Correcting copyright ! 84: * ! 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] ! 88: * ! 89: * Revision 2.3 90/12/20 16:36:37 jeffreyh ! 90: * changes for __STDC__ ! 91: * [90/12/07 jeffreyh] ! 92: * ! 93: * Revision 2.2 90/11/26 14:48:41 rvb ! 94: * Pulled from 2.5 ! 95: * [90/11/22 10:09:38 rvb] ! 96: * ! 97: * [90/08/14 mg32] ! 98: * ! 99: * Now we know how types are factor in. ! 100: * Cleaned up a bunch: eliminated ({ for output and flushed unused ! 101: * output variables. ! 102: * [90/08/14 rvb] ! 103: * ! 104: * This is how its done in gcc: ! 105: * Created. ! 106: * [90/03/26 rvb] ! 107: * ! 108: */ ! 109: /* CMU_ENDHIST */ ! 110: /* ! 111: * Mach Operating System ! 112: * Copyright (c) 1991,1990 Carnegie Mellon University ! 113: * All Rights Reserved. ! 114: * ! 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. ! 120: * ! 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. ! 124: * ! 125: * Carnegie Mellon requests users of this software to return to ! 126: * ! 127: * Software Distribution Coordinator or [email protected] ! 128: * School of Computer Science ! 129: * Carnegie Mellon University ! 130: * Pittsburgh PA 15213-3890 ! 131: * ! 132: * any improvements or extensions that they make and grant Carnegie Mellon ! 133: * the rights to redistribute these changes. ! 134: */ ! 135: /* ! 136: */ ! 137: #ifndef I386_PIO_H ! 138: #define I386_PIO_H ! 139: //#include <cpus.h> ! 140: //#include <mach_assert.h> ! 141: #define MACH_ASSERT 0 ! 142: ! 143: typedef unsigned short i386_ioport_t; ! 144: ! 145: /* read a longword */ ! 146: extern unsigned long inl( ! 147: i386_ioport_t port); ! 148: /* read a shortword */ ! 149: extern unsigned short inw( ! 150: i386_ioport_t port); ! 151: /* read a byte */ ! 152: extern unsigned char inb( ! 153: i386_ioport_t port); ! 154: /* write a longword */ ! 155: extern void outl( ! 156: i386_ioport_t port, ! 157: unsigned long datum); ! 158: /* write a word */ ! 159: extern void outw( ! 160: i386_ioport_t port, ! 161: unsigned short datum); ! 162: /* write a longword */ ! 163: extern void outb( ! 164: i386_ioport_t port, ! 165: unsigned char datum); ! 166: ! 167: /* input an array of longwords */ ! 168: extern void linl( ! 169: i386_ioport_t port, ! 170: int * data, ! 171: int count); ! 172: /* output an array of longwords */ ! 173: extern void loutl( ! 174: i386_ioport_t port, ! 175: int * data, ! 176: int count); ! 177: ! 178: /* input an array of words */ ! 179: extern void linw( ! 180: i386_ioport_t port, ! 181: int * data, ! 182: int count); ! 183: /* output an array of words */ ! 184: extern void loutw( ! 185: i386_ioport_t port, ! 186: int * data, ! 187: int count); ! 188: ! 189: /* input an array of bytes */ ! 190: extern void linb( ! 191: i386_ioport_t port, ! 192: char * data, ! 193: int count); ! 194: /* output an array of bytes */ ! 195: extern void loutb( ! 196: i386_ioport_t port, ! 197: char * data, ! 198: int count); ! 199: ! 200: #if defined(__GNUC__) && (!MACH_ASSERT) ! 201: extern __inline__ unsigned long inl( ! 202: i386_ioport_t port) ! 203: { ! 204: unsigned long datum; ! 205: __asm__ volatile("inl %1, %0" : "=a" (datum) : "d" (port)); ! 206: return(datum); ! 207: } ! 208: ! 209: extern __inline__ unsigned short inw( ! 210: i386_ioport_t port) ! 211: { ! 212: unsigned short datum; ! 213: __asm__ volatile(".byte 0x66; inl %1, %0" : "=a" (datum) : "d" (port)); ! 214: return(datum); ! 215: } ! 216: ! 217: extern __inline__ unsigned char inb( ! 218: i386_ioport_t port) ! 219: { ! 220: unsigned char datum; ! 221: __asm__ volatile("inb %1, %0" : "=a" (datum) : "d" (port)); ! 222: return(datum); ! 223: } ! 224: ! 225: extern __inline__ void outl( ! 226: i386_ioport_t port, ! 227: unsigned long datum) ! 228: { ! 229: __asm__ volatile("outl %0, %1" : : "a" (datum), "d" (port)); ! 230: } ! 231: ! 232: extern __inline__ void outw( ! 233: i386_ioport_t port, ! 234: unsigned short datum) ! 235: { ! 236: __asm__ volatile(".byte 0x66; outl %0, %1" : : "a" (datum), "d" (port)); ! 237: } ! 238: ! 239: extern __inline__ void outb( ! 240: i386_ioport_t port, ! 241: unsigned char datum) ! 242: { ! 243: __asm__ volatile("outb %0, %1" : : "a" (datum), "d" (port)); ! 244: } ! 245: #endif /* defined(__GNUC__) && (!MACH_ASSERT) */ ! 246: #endif /* I386_PIO_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.