1OUTB(2)                    Linux Programmer's Manual                   OUTB(2)
2
3
4

NAME

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

SYNOPSIS

10       #include <sys/io.h>
11
12       unsigned char inb(unsigned short port);
13       unsigned char inb_p(unsigned short port);
14       unsigned short inw(unsigned short port);
15       unsigned short inw_p(unsigned short port);
16       unsigned int inl(unsigned short port);
17       unsigned int inl_p(unsigned short port);
18
19       void outb(unsigned char value, unsigned short port);
20       void outb_p(unsigned char value, unsigned short port);
21       void outw(unsigned short value, unsigned short port);
22       void outw_p(unsigned short value, unsigned short port);
23       void outl(unsigned int value, unsigned short port);
24       void outl_p(unsigned int value, unsigned short port);
25
26       void insb(unsigned short port, void *addr,
27                  unsigned long count);
28       void insw(unsigned short port, void *addr,
29                  unsigned long count);
30       void insl(unsigned short port, void *addr,
31                  unsigned long count);
32       void outsb(unsigned short port, const void *addr,
33                  unsigned long count);
34       void outsw(unsigned short port, const void *addr,
35                  unsigned long count);
36       void outsl(unsigned short port, const void *addr,
37                  unsigned long count);
38

DESCRIPTION

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

CONFORMING TO

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 or‐
60       der from most DOS implementations.
61

SEE ALSO

63       ioperm(2), iopl(2)
64

COLOPHON

66       This  page  is  part of release 5.12 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                             2020-11-01                           OUTB(2)
Impressum