pio.h revision 1.3.4.3 1 1.3 cgd /*
2 1.3.4.1 mycroft * Functions to provide access to i386 programmed I/O instructions.
3 1.3.4.1 mycroft *
4 1.3.4.3 mycroft * $Id: pio.h,v 1.3.4.3 1993/12/19 10:39:23 mycroft Exp $
5 1.3 cgd */
6 1.1 cgd
7 1.3.4.1 mycroft static __inline u_char
8 1.3.4.1 mycroft inb(u_short port)
9 1.3.4.1 mycroft {
10 1.3.4.1 mycroft u_char data;
11 1.3.4.1 mycroft __asm __volatile("inb %1,%0" : "=a" (data) : "d" (port));
12 1.3.4.1 mycroft return data;
13 1.3.4.1 mycroft }
14 1.3.4.1 mycroft
15 1.3.4.1 mycroft static __inline void
16 1.3.4.1 mycroft insb(u_short port, void *addr, int cnt)
17 1.3.4.1 mycroft {
18 1.3.4.3 mycroft __asm __volatile("cld\n\trep\n\tinsb" :
19 1.3.4.2 mycroft : "d" (port), "D" (addr), "c" (cnt) : "D", "c");
20 1.3.4.1 mycroft }
21 1.3.4.1 mycroft
22 1.3.4.1 mycroft static __inline u_short
23 1.3.4.1 mycroft inw(u_short port)
24 1.3.4.1 mycroft {
25 1.3.4.1 mycroft u_short data;
26 1.3.4.1 mycroft __asm __volatile("inw %1,%0" : "=a" (data) : "d" (port));
27 1.3.4.1 mycroft return data;
28 1.3.4.1 mycroft }
29 1.3.4.1 mycroft
30 1.3.4.1 mycroft static __inline void
31 1.3.4.1 mycroft insw(u_short port, void *addr, int cnt)
32 1.3.4.1 mycroft {
33 1.3.4.3 mycroft __asm __volatile("cld\n\trep\n\tinsw" :
34 1.3.4.2 mycroft : "d" (port), "D" (addr), "c" (cnt) : "D", "c");
35 1.3.4.1 mycroft }
36 1.3.4.1 mycroft
37 1.3.4.1 mycroft static __inline u_int
38 1.3.4.1 mycroft inl(u_short port)
39 1.3.4.1 mycroft {
40 1.3.4.1 mycroft u_int data;
41 1.3.4.1 mycroft __asm __volatile("inl %1,%0" : "=a" (data) : "d" (port));
42 1.3.4.1 mycroft return data;
43 1.3.4.1 mycroft }
44 1.3.4.1 mycroft
45 1.3.4.1 mycroft static __inline void
46 1.3.4.1 mycroft insl(u_short port, void *addr, int cnt)
47 1.3.4.1 mycroft {
48 1.3.4.3 mycroft __asm __volatile("cld\n\trep\n\tinsl" :
49 1.3.4.2 mycroft : "d" (port), "D" (addr), "c" (cnt) : "D", "c");
50 1.3.4.1 mycroft }
51 1.3.4.1 mycroft
52 1.3.4.1 mycroft static __inline void
53 1.3.4.1 mycroft outb(u_short port, u_char data)
54 1.3.4.1 mycroft {
55 1.3.4.1 mycroft __asm __volatile("outb %0,%1" : : "a" (data), "d" (port));
56 1.3.4.1 mycroft }
57 1.3.4.1 mycroft
58 1.3.4.1 mycroft static __inline void
59 1.3.4.1 mycroft outsb(u_short port, void *addr, int cnt)
60 1.3.4.1 mycroft {
61 1.3.4.3 mycroft __asm __volatile("cld\n\trep\n\toutsb" :
62 1.3.4.2 mycroft : "d" (port), "S" (addr), "c" (cnt) : "S", "c");
63 1.3.4.1 mycroft }
64 1.3.4.1 mycroft
65 1.3.4.1 mycroft static __inline void
66 1.3.4.1 mycroft outw(u_short port, u_short data)
67 1.3.4.1 mycroft {
68 1.3.4.1 mycroft __asm __volatile("outw %0,%1" : : "a" (data), "d" (port));
69 1.3.4.1 mycroft }
70 1.3.4.1 mycroft
71 1.3.4.1 mycroft static __inline void
72 1.3.4.1 mycroft outsw(u_short port, void *addr, int cnt)
73 1.3.4.1 mycroft {
74 1.3.4.3 mycroft __asm __volatile("cld\n\trep\n\toutsw" :
75 1.3.4.2 mycroft : "d" (port), "S" (addr), "c" (cnt) : "S", "c");
76 1.3.4.1 mycroft }
77 1.3.4.1 mycroft
78 1.3.4.1 mycroft static __inline void
79 1.3.4.1 mycroft outl(u_short port, u_int data)
80 1.3.4.1 mycroft {
81 1.3.4.1 mycroft __asm __volatile("outl %0,%1" : : "a" (data), "d" (port));
82 1.3.4.1 mycroft }
83 1.3.4.1 mycroft
84 1.3.4.1 mycroft static __inline void
85 1.3.4.1 mycroft outsl(u_short port, void *addr, int cnt)
86 1.3.4.1 mycroft {
87 1.3.4.3 mycroft __asm __volatile("cld\n\trep\n\toutsl" :
88 1.3.4.2 mycroft : "d" (port), "S" (addr), "c" (cnt) : "S", "c");
89 1.3.4.1 mycroft }
90