|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1993 NeXT Computer, Inc. ! 3: * ! 4: * Primitives for IO port access. ! 5: * ! 6: * HISTORY ! 7: * ! 8: * 30Mar94 Doug Mitchell ! 9: * Custom version for debugging - real functions, not static __inline__. ! 10: * 16Feb93 David E. Bohman at NeXT ! 11: * Created. ! 12: */ ! 13: ! 14: #import "ioPorts.h" ! 15: ! 16: #if USE_COMPILED_IO ! 17: ! 18: #import <driverkit/i386/driverTypes.h> ! 19: ! 20: unsigned char ! 21: inb( ! 22: IOEISAPortAddress port ! 23: ) ! 24: { ! 25: unsigned char data; ! 26: ! 27: asm volatile( ! 28: "inb %1,%0" ! 29: ! 30: : "=a" (data) ! 31: : "d" (port)); ! 32: ! 33: return (data); ! 34: } ! 35: ! 36: unsigned short ! 37: inw( ! 38: IOEISAPortAddress port ! 39: ) ! 40: { ! 41: unsigned short data; ! 42: ! 43: asm volatile( ! 44: "inw %1,%0" ! 45: ! 46: : "=a" (data) ! 47: : "d" (port)); ! 48: ! 49: return (data); ! 50: } ! 51: ! 52: unsigned long ! 53: inl( ! 54: IOEISAPortAddress port ! 55: ) ! 56: { ! 57: unsigned long data; ! 58: ! 59: asm volatile( ! 60: "inl %1,%0" ! 61: ! 62: : "=a" (data) ! 63: : "d" (port)); ! 64: ! 65: return (data); ! 66: } ! 67: ! 68: void ! 69: outb( ! 70: IOEISAPortAddress port, ! 71: unsigned char data ! 72: ) ! 73: { ! 74: static int xxx; ! 75: ! 76: asm volatile( ! 77: "outb %2,%1; lock; incl %0" ! 78: ! 79: : "=m" (xxx) ! 80: : "d" (port), "a" (data), "0" (xxx) ! 81: : "cc"); ! 82: } ! 83: ! 84: void ! 85: outw( ! 86: IOEISAPortAddress port, ! 87: unsigned short data ! 88: ) ! 89: { ! 90: static int xxx; ! 91: ! 92: asm volatile( ! 93: "outw %2,%1; lock; incl %0" ! 94: ! 95: : "=m" (xxx) ! 96: : "d" (port), "a" (data), "0" (xxx) ! 97: : "cc"); ! 98: } ! 99: ! 100: void ! 101: outl( ! 102: IOEISAPortAddress port, ! 103: unsigned long data ! 104: ) ! 105: { ! 106: static int xxx; ! 107: ! 108: asm volatile( ! 109: "outl %2,%1; lock; incl %0" ! 110: ! 111: : "=m" (xxx) ! 112: : "d" (port), "a" (data), "0" (xxx) ! 113: : "cc"); ! 114: } ! 115: ! 116: #else USE_COMPILED_IO ! 117: ! 118: /* this file is a nop */ ! 119: ! 120: #endif USE_COMPILED_IO ! 121:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.