1 .\" Copyright (c) 1995 Paul Gortmaker
2 .\" (gpg109@rsphy1.anu.edu.au)
3 .\" Wed Nov 29 10:58:54 EST 1995
5 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
6 .\" This is free documentation; you can redistribute it and/or
7 .\" modify it under the terms of the GNU General Public License as
8 .\" published by the Free Software Foundation; either version 2 of
9 .\" the License, or (at your option) any later version.
11 .\" The GNU General Public License's references to "object code"
12 .\" and "executables" are to be interpreted as the output of any
13 .\" document formatting or typesetting system, including
14 .\" intermediate and printed output.
16 .\" This manual is distributed in the hope that it will be useful,
17 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
18 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 .\" GNU General Public License for more details.
21 .\" You should have received a copy of the GNU General Public
22 .\" License along with this manual; if not, see
23 .\" <http://www.gnu.org/licenses/>.
26 .TH OUTB 2 2017-09-15 "Linux" "Linux Programmer's Manual"
28 outb, outw, outl, outsb, outsw, outsl,
29 inb, inw, inl, insb, insw, insl,
30 outb_p, outw_p, outl_p, inb_p, inw_p, inl_p \- port I/O
33 .B #include <sys/io.h>
35 .BI "unsigned char inb(unsigned short int " port );
36 .BI "unsigned char inb_p(unsigned short int " port );
37 .BI "unsigned short int inw(unsigned short int " port );
38 .BI "unsigned short int inw_p(unsigned short int " port );
39 .BI "unsigned int inl(unsigned short int " port );
40 .BI "unsigned int inl_p(unsigned short int " port );
42 .BI "void outb(unsigned char " value ", unsigned short int " port );
43 .BI "void outb_p(unsigned char " value ", unsigned short int " port );
44 .BI "void outw(unsigned short int " value ", unsigned short int " port );
45 .BI "void outw_p(unsigned short int " value ", unsigned short int " port );
46 .BI "void outl(unsigned int " value ", unsigned short int " port );
47 .BI "void outl_p(unsigned int " value ", unsigned short int " port );
49 .BI "void insb(unsigned short int " port ", void *" addr ,
50 .BI " unsigned long int " count );
51 .BI "void insw(unsigned short int " port ", void *" addr ,
52 .BI " unsigned long int " count );
53 .BI "void insl(unsigned short int " port ", void *" addr ,
54 .BI " unsigned long int " count );
55 .BI "void outsb(unsigned short int " port ", const void *" addr ,
56 .BI " unsigned long int " count );
57 .BI "void outsw(unsigned short int " port ", const void *" addr ,
58 .BI " unsigned long int " count );
59 .BI "void outsl(unsigned short int " port ", const void *" addr ,
60 .BI " unsigned long int " count );
63 This family of functions is used to do low-level port input and output.
64 The out* functions do port output, the in* functions do port input;
65 the b-suffix functions are byte-width and the w-suffix functions
66 word-width; the _p-suffix functions pause until the I/O completes.
68 They are primarily designed for internal kernel use,
69 but can be used from user space.
70 .\" , given the following information
71 .\" in addition to that given in
74 You must compile with \fB\-O\fP or \fB\-O2\fP or similar.
76 are defined as inline macros, and will not be substituted in without
77 optimization enabled, causing unresolved references at link time.
83 to tell the kernel to allow the user space application to access the
84 I/O ports in question.
85 Failure to do this will cause the application
86 to receive a segmentation fault.
89 and friends are hardware-specific.
92 argument is passed first and the
94 argument is passed second,
95 which is the opposite order from most DOS implementations.