xref: /netbsd-src/sys/arch/mac68k/include/pio.h (revision 5f7096188587a2c7c95fa3c69b78e1ec9c7923d0)
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.
6  */
7 /*
8  * HISTORY
9  * pio.h,v
10  * Revision 1.1  1993/03/21  18:09:48  cgd
11  * after 0.2.2 "stable" patches applied
12  *
13  * Revision 1.1  1992/05/27  00:48:30  balsup
14  * machkern/cor merge
15  *
16  * Revision 1.1  1991/10/10  20:11:39  balsup
17  * Initial revision
18  *
19  * Revision 2.2  91/04/02  11:52:29  mbj
20  * 	[90/08/14            mg32]
21  *
22  * 	Now we know how types are factor in.
23  * 	Cleaned up a bunch: eliminated ({ for output and flushed unused
24  * 	output variables.
25  * 	[90/08/14            rvb]
26  *
27  * 	This is how its done in gcc:
28  * 		Created.
29  * 	[90/03/26            rvb]
30  *
31  */
32 #ident "$Id: pio.h,v 1.1.1.1 1993/09/29 06:09:22 briggs Exp $"
33 
34 
35 #define inl(y) \
36 ({ unsigned long _tmp__; \
37 	asm volatile("inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \
38 	_tmp__; })
39 
40 #define inw(y) \
41 ({ unsigned short _tmp__; \
42 	asm volatile(".byte 0x66; inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \
43 	_tmp__; })
44 
45 #define inb(y) \
46 ({ unsigned char _tmp__; \
47 	asm volatile("inb %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \
48 	_tmp__; })
49 
50 
51 #define outl(x, y) \
52 { asm volatile("outl %0, %1" : : "a" (y) , "d" ((unsigned short)(x))); }
53 
54 
55 #define outw(x, y) \
56 {asm volatile(".byte 0x66; outl %0, %1" : : "a" ((unsigned short)(y)) , "d" ((unsigned short)(x))); }
57 
58 
59 #define outb(x, y) \
60 { asm volatile("outb %0, %1" : : "a" ((unsigned char)(y)) , "d" ((unsigned short)(x))); }
61