readv2: Note preadv2(..., RWF_NOWAIT) bug in BUGS section
[man-pages.git] / man2 / outb.2
blob63a749e9fd1f21bdf50c3e2b652fa6a4f261bb51
1 .\" Copyright (c) 1995 Paul Gortmaker
2 .\" (gpg109@rsphy1.anu.edu.au)
3 .\" Wed Nov 29 10:58:54 EST 1995
4 .\"
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.
10 .\"
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.
15 .\"
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.
20 .\"
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/>.
24 .\" %%%LICENSE_END
25 .\"
26 .TH OUTB 2 2020-11-01 "Linux" "Linux Programmer's Manual"
27 .SH NAME
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
31 .SH SYNOPSIS
32 .nf
33 .B #include <sys/io.h>
34 .PP
35 .BI "unsigned char inb(unsigned short " port );
36 .BI "unsigned char inb_p(unsigned short " port );
37 .BI "unsigned short inw(unsigned short " port );
38 .BI "unsigned short inw_p(unsigned short " port );
39 .BI "unsigned int inl(unsigned short " port );
40 .BI "unsigned int inl_p(unsigned short " port );
41 .PP
42 .BI "void outb(unsigned char " value ", unsigned short " port );
43 .BI "void outb_p(unsigned char " value ", unsigned short " port );
44 .BI "void outw(unsigned short " value ", unsigned short " port );
45 .BI "void outw_p(unsigned short " value ", unsigned short " port );
46 .BI "void outl(unsigned int " value ", unsigned short " port );
47 .BI "void outl_p(unsigned int " value ", unsigned short " port );
48 .PP
49 .BI "void insb(unsigned short " port ", void *" addr ,
50 .BI "           unsigned long " count );
51 .BI "void insw(unsigned short " port ", void *" addr ,
52 .BI "           unsigned long " count );
53 .BI "void insl(unsigned short " port ", void *" addr ,
54 .BI "           unsigned long " count );
55 .BI "void outsb(unsigned short " port ", const void *" addr ,
56 .BI "           unsigned long " count );
57 .BI "void outsw(unsigned short " port ", const void *" addr ,
58 .BI "           unsigned long " count );
59 .BI "void outsl(unsigned short " port ", const void *" addr ,
60 .BI "           unsigned long " count );
61 .fi
62 .SH DESCRIPTION
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.
67 .PP
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
72 .\" .BR outb (9).
73 .PP
74 You must compile with \fB\-O\fP or \fB\-O2\fP or similar.
75 The functions
76 are defined as inline macros, and will not be substituted in without
77 optimization enabled, causing unresolved references at link time.
78 .PP
79 You use
80 .BR ioperm (2)
81 or alternatively
82 .BR iopl (2)
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.
87 .SH CONFORMING TO
88 .BR outb ()
89 and friends are hardware-specific.
90 The
91 .I value
92 argument is passed first and the
93 .I port
94 argument is passed second,
95 which is the opposite order from most DOS implementations.
96 .SH SEE ALSO
97 .BR ioperm (2),
98 .BR iopl (2)