This source file includes following definitions.
- outb
- inb
- outb_p
- inb_p
1 #ifndef _ASM_IO_H
2 #define _ASM_IO_H
3
4
5
6
7
8
9
10
11
12
13
14
15 #ifdef SLOW_IO_BY_JUMPING
16 #define __SLOW_DOWN_IO __asm__ __volatile__("jmp 1f\n1:\tjmp 1f\n1:")
17 #else
18 #define __SLOW_DOWN_IO __asm__ __volatile__("outb %al,$0x80")
19 #endif
20
21 #ifdef REALLY_SLOW_IO
22 #define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; }
23 #else
24 #define SLOW_DOWN_IO __SLOW_DOWN_IO
25 #endif
26
27 extern inline void outb(char value, unsigned short port)
28 {
29 __asm__ __volatile__ ("outb %%al,%%dx"
30 ::"a" ((char) value),"d" ((unsigned short) port));
31 }
32
33 extern inline unsigned int inb(unsigned short port)
34 {
35 unsigned int _v;
36 __asm__ __volatile__ ("inb %%dx,%%al"
37 :"=a" (_v):"d" ((unsigned short) port),"0" (0));
38 return _v;
39 }
40
41 extern inline void outb_p(char value, unsigned short port)
42 {
43 __asm__ __volatile__ ("outb %%al,%%dx"
44 ::"a" ((char) value),"d" ((unsigned short) port));
45 SLOW_DOWN_IO;
46 }
47
48 extern inline unsigned int inb_p(unsigned short port)
49 {
50 unsigned int _v;
51 __asm__ __volatile__ ("inb %%dx,%%al"
52 :"=a" (_v):"d" ((unsigned short) port),"0" (0));
53 SLOW_DOWN_IO;
54 return _v;
55 }
56
57 #endif