memdump: a debugging utility to dump memory over a serial port
[profile/ivi/syslinux.git] / memdump / io.h
1 #ifndef IO_H
2 #define IO_H
3
4 static inline void outb(unsigned char v, unsigned short p)
5 {
6   asm volatile("outb %1,%0" : : "d" (p), "a" (v));
7 }
8
9 static inline unsigned char inb(unsigned short p)
10 {
11   unsigned char v;
12   asm volatile("inb %1,%0" : "=a" (v) : "d" (p));
13   return v;
14 }
15
16 static inline void outw(unsigned short v, unsigned short p)
17 {
18   asm volatile("outw %1,%0" : : "d" (p), "a" (v));
19 }
20
21 static inline unsigned short inw(unsigned short p)
22 {
23   unsigned short v;
24   asm volatile("inw %1,%0" : "=a" (v) : "d" (p));
25   return v;
26 }
27
28 static inline void outl(unsigned int v, unsigned short p)
29 {
30   asm volatile("outl %1,%0" : : "d" (p), "a" (v));
31 }
32
33 static inline unsigned int inl(unsigned short p)
34 {
35   unsigned int v;
36   asm volatile("inl %1,%0" : "=a" (v) : "d" (p));
37   return v;
38 }
39
40 #endif