|
|
1.1 root 1: /*
2: * Mach Operating System
3: * Copyright (c) 1990 Carnegie-Mellon University
4: * All rights reserved. The CMU software License Agreement specifies
5: * the terms and conditions for use and redistribution.
1.1.1.2 ! root 6: *
! 7: * pio.h,v 1.3 1993/06/06 04:16:22 cgd Exp
1.1 root 8: */
9: /*
10: * HISTORY
1.1.1.2 ! root 11: * pio.h,v
! 12: * Revision 1.3 1993/06/06 04:16:22 cgd
! 13: * incorporate Bruce Evans' interrupt changes, as hacked by Rod grimes,
! 14: * for patchkit patch 158. it appears to work well.
! 15: *
! 16: * Revision 1.2 1993/05/22 08:00:27 cgd
! 17: * add rcsids to everything and clean up headers
! 18: *
! 19: * Revision 1.1 1993/03/21 18:09:48 cgd
1.1 root 20: * after 0.2.2 "stable" patches applied
21: *
22: * Revision 1.1 1992/05/27 00:48:30 balsup
23: * machkern/cor merge
24: *
25: * Revision 1.1 1991/10/10 20:11:39 balsup
26: * Initial revision
27: *
28: * Revision 2.2 91/04/02 11:52:29 mbj
29: * [90/08/14 mg32]
30: *
31: * Now we know how types are factor in.
32: * Cleaned up a bunch: eliminated ({ for output and flushed unused
33: * output variables.
34: * [90/08/14 rvb]
35: *
36: * This is how its done in gcc:
37: * Created.
38: * [90/03/26 rvb]
39: *
40: */
41:
42:
43: #define inl(y) \
44: ({ unsigned long _tmp__; \
45: asm volatile("inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \
46: _tmp__; })
47:
48: #define inw(y) \
49: ({ unsigned short _tmp__; \
50: asm volatile(".byte 0x66; inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \
51: _tmp__; })
52:
1.1.1.2 ! root 53: /*
! 54: * only do this if it has not already be defined.. this is a crock for the
! 55: * patch kit for right now. Need to clean up all the inx, outx stuff for
! 56: * 0.1.5 to use 1 common header file, that has Bruces fast mode inb/outb
! 57: * stuff in it. Rgrimes 5/27/93
! 58: */
! 59: #ifndef inb
1.1 root 60: #define inb(y) \
61: ({ unsigned char _tmp__; \
62: asm volatile("inb %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \
63: _tmp__; })
1.1.1.2 ! root 64: #endif
1.1 root 65:
66:
67: #define outl(x, y) \
68: { asm volatile("outl %0, %1" : : "a" (y) , "d" ((unsigned short)(x))); }
69:
70:
71: #define outw(x, y) \
72: {asm volatile(".byte 0x66; outl %0, %1" : : "a" ((unsigned short)(y)) , "d" ((unsigned short)(x))); }
73:
74:
75: #define outb(x, y) \
76: { asm volatile("outb %0, %1" : : "a" ((unsigned char)(y)) , "d" ((unsigned short)(x))); }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.