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