xref: /netbsd-src/sys/arch/mac68k/include/pio.h (revision ae1bfcddc410612bc8c58b807e1830becb69a24c)
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 
33 
34 #define inl(y) \
35 ({ unsigned long _tmp__; \
36 	asm volatile("inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \
37 	_tmp__; })
38 
39 #define inw(y) \
40 ({ unsigned short _tmp__; \
41 	asm volatile(".byte 0x66; inl %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \
42 	_tmp__; })
43 
44 #define inb(y) \
45 ({ unsigned char _tmp__; \
46 	asm volatile("inb %1, %0" : "=a" (_tmp__) : "d" ((unsigned short)(y))); \
47 	_tmp__; })
48 
49 
50 #define outl(x, y) \
51 { asm volatile("outl %0, %1" : : "a" (y) , "d" ((unsigned short)(x))); }
52 
53 
54 #define outw(x, y) \
55 {asm volatile(".byte 0x66; outl %0, %1" : : "a" ((unsigned short)(y)) , "d" ((unsigned short)(x))); }
56 
57 
58 #define outb(x, y) \
59 { asm volatile("outb %0, %1" : : "a" ((unsigned char)(y)) , "d" ((unsigned short)(x))); }
60