Blame man2/outb.2

Packit 7cfc04
.\" Copyright (c) 1995 Paul Gortmaker
Packit 7cfc04
.\" (gpg109@rsphy1.anu.edu.au)
Packit 7cfc04
.\" Wed Nov 29 10:58:54 EST 1995
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
Packit 7cfc04
.\" This is free documentation; you can redistribute it and/or
Packit 7cfc04
.\" modify it under the terms of the GNU General Public License as
Packit 7cfc04
.\" published by the Free Software Foundation; either version 2 of
Packit 7cfc04
.\" the License, or (at your option) any later version.
Packit 7cfc04
.\"
Packit 7cfc04
.\" The GNU General Public License's references to "object code"
Packit 7cfc04
.\" and "executables" are to be interpreted as the output of any
Packit 7cfc04
.\" document formatting or typesetting system, including
Packit 7cfc04
.\" intermediate and printed output.
Packit 7cfc04
.\"
Packit 7cfc04
.\" This manual is distributed in the hope that it will be useful,
Packit 7cfc04
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 7cfc04
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 7cfc04
.\" GNU General Public License for more details.
Packit 7cfc04
.\"
Packit 7cfc04
.\" You should have received a copy of the GNU General Public
Packit 7cfc04
.\" License along with this manual; if not, see
Packit 7cfc04
.\" <http://www.gnu.org/licenses/>.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.TH OUTB 2 2017-09-15 "Linux" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
outb, outw, outl, outsb, outsw, outsl,
Packit 7cfc04
inb, inw, inl, insb, insw, insl,
Packit 7cfc04
outb_p, outw_p, outl_p, inb_p, inw_p, inl_p \- port I/O
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.nf
Packit 7cfc04
.B #include <sys/io.h>
Packit 7cfc04
.PP
Packit 7cfc04
.BI "unsigned char inb(unsigned short int " port );
Packit 7cfc04
.BI "unsigned char inb_p(unsigned short int " port );
Packit 7cfc04
.BI "unsigned short int inw(unsigned short int " port );
Packit 7cfc04
.BI "unsigned short int inw_p(unsigned short int " port );
Packit 7cfc04
.BI "unsigned int inl(unsigned short int " port );
Packit 7cfc04
.BI "unsigned int inl_p(unsigned short int " port );
Packit 7cfc04
.PP
Packit 7cfc04
.BI "void outb(unsigned char " value ", unsigned short int " port );
Packit 7cfc04
.BI "void outb_p(unsigned char " value ", unsigned short int " port );
Packit 7cfc04
.BI "void outw(unsigned short int " value ", unsigned short int " port );
Packit 7cfc04
.BI "void outw_p(unsigned short int " value ", unsigned short int " port );
Packit 7cfc04
.BI "void outl(unsigned int " value ", unsigned short int " port );
Packit 7cfc04
.BI "void outl_p(unsigned int " value ", unsigned short int " port );
Packit 7cfc04
.PP
Packit 7cfc04
.BI "void insb(unsigned short int " port ", void *" addr ,
Packit 7cfc04
.BI "           unsigned long int " count );
Packit 7cfc04
.BI "void insw(unsigned short int " port ", void *" addr ,
Packit 7cfc04
.BI "           unsigned long int " count );
Packit 7cfc04
.BI "void insl(unsigned short int " port ", void *" addr ,
Packit 7cfc04
.BI "           unsigned long int " count );
Packit 7cfc04
.BI "void outsb(unsigned short int " port ", const void *" addr ,
Packit 7cfc04
.BI "           unsigned long int " count );
Packit 7cfc04
.BI "void outsw(unsigned short int " port ", const void *" addr ,
Packit 7cfc04
.BI "           unsigned long int " count );
Packit 7cfc04
.BI "void outsl(unsigned short int " port ", const void *" addr ,
Packit 7cfc04
.BI "           unsigned long int " count );
Packit 7cfc04
.fi
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
This family of functions is used to do low-level port input and output.
Packit 7cfc04
The out* functions do port output, the in* functions do port input;
Packit 7cfc04
the b-suffix functions are byte-width and the w-suffix functions
Packit 7cfc04
word-width; the _p-suffix functions pause until the I/O completes.
Packit 7cfc04
.PP
Packit 7cfc04
They are primarily designed for internal kernel use,
Packit 7cfc04
but can be used from user space.
Packit 7cfc04
.\" , given the following information
Packit 7cfc04
.\" in addition to that given in
Packit 7cfc04
.\" .BR outb (9).
Packit 7cfc04
.PP
Packit 7cfc04
You must compile with \fB\-O\fP or \fB\-O2\fP or similar.
Packit 7cfc04
The functions
Packit 7cfc04
are defined as inline macros, and will not be substituted in without
Packit 7cfc04
optimization enabled, causing unresolved references at link time.
Packit 7cfc04
.PP
Packit 7cfc04
You use
Packit 7cfc04
.BR ioperm (2)
Packit 7cfc04
or alternatively
Packit 7cfc04
.BR iopl (2)
Packit 7cfc04
to tell the kernel to allow the user space application to access the
Packit 7cfc04
I/O ports in question.
Packit 7cfc04
Failure to do this will cause the application
Packit 7cfc04
to receive a segmentation fault.
Packit 7cfc04
.SH CONFORMING TO
Packit 7cfc04
.BR outb ()
Packit 7cfc04
and friends are hardware-specific.
Packit 7cfc04
The
Packit 7cfc04
.I value
Packit 7cfc04
argument is passed first and the
Packit 7cfc04
.I port
Packit 7cfc04
argument is passed second,
Packit 7cfc04
which is the opposite order from most DOS implementations.
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR ioperm (2),
Packit 7cfc04
.BR iopl (2)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.