1OUTB(2) Linux Programmer's Manual OUTB(2)
2
3
4
6 outb, outw, outl, outsb, outsw, outsl, inb, inw, inl, insb, insw, insl,
7 outb_p, outw_p, outl_p, inb_p, inw_p, inl_p - port I/O
8
10 #include <sys/io.h>
11
12 unsigned char inb(unsigned short int port);
13 unsigned char inb_p(unsigned short int port);
14 unsigned short int inw(unsigned short int port);
15 unsigned short int inw_p(unsigned short int port);
16 unsigned int inl(unsigned short int port);
17 unsigned int inl_p(unsigned short int port);
18
19 void outb(unsigned char value, unsigned short int port);
20 void outb_p(unsigned char value, unsigned short int port);
21 void outw(unsigned short int value, unsigned short int port);
22 void outw_p(unsigned short int value, unsigned short int port);
23 void outl(unsigned int value, unsigned short int port);
24 void outl_p(unsigned int value, unsigned short int port);
25
26 void insb(unsigned short int port, void *addr,
27 unsigned long int count);
28 void insw(unsigned short int port, void *addr,
29 unsigned long int count);
30 void insl(unsigned short int port, void *addr,
31 unsigned long int count);
32 void outsb(unsigned short int port, const void *addr,
33 unsigned long int count);
34 void outsw(unsigned short int port, const void *addr,
35 unsigned long int count);
36 void outsl(unsigned short int port, const void *addr,
37 unsigned long int count);
38
40 This family of functions is used to do low-level port input and output.
41 The out* functions do port output, the in* functions do port input; the
42 b-suffix functions are byte-width and the w-suffix functions word-
43 width; the _p-suffix functions pause until the I/O completes.
44
45 They are primarily designed for internal kernel use, but can be used
46 from user space.
47
48 You must compile with -O or -O2 or similar. The functions are defined
49 as inline macros, and will not be substituted in without optimization
50 enabled, causing unresolved references at link time.
51
52 You use ioperm(2) or alternatively iopl(2) to tell the kernel to allow
53 the user space application to access the I/O ports in question. Fail‐
54 ure to do this will cause the application to receive a segmentation
55 fault.
56
58 outb() and friends are hardware-specific. The value argument is passed
59 first and the port argument is passed second, which is the opposite
60 order from most DOS implementations.
61
63 ioperm(2), iopl(2)
64
66 This page is part of release 4.15 of the Linux man-pages project. A
67 description of the project, information about reporting bugs, and the
68 latest version of this page, can be found at
69 https://www.kernel.org/doc/man-pages/.
70
71
72
73Linux 2017-09-15 OUTB(2)