| 1 |
.\" Copyright (c) 1995 Paul Gortmaker |
| 2 |
.\" ([email protected]) |
| 3 |
.\" Wed Nov 29 10:58:54 EST 1995 |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
.\" |
| 7 |
.TH outb 2 2024-05-02 "Linux man-pages 6.9.1" |
| 8 |
.SH NAME |
| 9 |
outb, outw, outl, outsb, outsw, outsl, |
| 10 |
inb, inw, inl, insb, insw, insl, |
| 11 |
outb_p, outw_p, outl_p, inb_p, inw_p, inl_p \- port I/O |
| 12 |
.SH LIBRARY |
| 13 |
Standard C library |
| 14 |
.RI ( libc ", " \-lc ) |
| 15 |
.SH SYNOPSIS |
| 16 |
.nf |
| 17 |
.B #include <sys/io.h> |
| 18 |
.P |
| 19 |
.BI "unsigned char inb(unsigned short " port ); |
| 20 |
.BI "unsigned char inb_p(unsigned short " port ); |
| 21 |
.BI "unsigned short inw(unsigned short " port ); |
| 22 |
.BI "unsigned short inw_p(unsigned short " port ); |
| 23 |
.BI "unsigned int inl(unsigned short " port ); |
| 24 |
.BI "unsigned int inl_p(unsigned short " port ); |
| 25 |
.P |
| 26 |
.BI "void outb(unsigned char " value ", unsigned short " port ); |
| 27 |
.BI "void outb_p(unsigned char " value ", unsigned short " port ); |
| 28 |
.BI "void outw(unsigned short " value ", unsigned short " port ); |
| 29 |
.BI "void outw_p(unsigned short " value ", unsigned short " port ); |
| 30 |
.BI "void outl(unsigned int " value ", unsigned short " port ); |
| 31 |
.BI "void outl_p(unsigned int " value ", unsigned short " port ); |
| 32 |
.P |
| 33 |
.BI "void insb(unsigned short " port ", void " addr [. count ], |
| 34 |
.BI " unsigned long " count ); |
| 35 |
.BI "void insw(unsigned short " port ", void " addr [. count ], |
| 36 |
.BI " unsigned long " count ); |
| 37 |
.BI "void insl(unsigned short " port ", void " addr [. count ], |
| 38 |
.BI " unsigned long " count ); |
| 39 |
.BI "void outsb(unsigned short " port ", const void " addr [. count ], |
| 40 |
.BI " unsigned long " count ); |
| 41 |
.BI "void outsw(unsigned short " port ", const void " addr [. count ], |
| 42 |
.BI " unsigned long " count ); |
| 43 |
.BI "void outsl(unsigned short " port ", const void " addr [. count ], |
| 44 |
.BI " unsigned long " count ); |
| 45 |
.fi |
| 46 |
.SH DESCRIPTION |
| 47 |
This family of functions is used to do low-level port input and output. |
| 48 |
The out* functions do port output, the in* functions do port input; |
| 49 |
the b-suffix functions are byte-width and the w-suffix functions |
| 50 |
word-width; the _p-suffix functions pause until the I/O completes. |
| 51 |
.P |
| 52 |
They are primarily designed for internal kernel use, |
| 53 |
but can be used from user space. |
| 54 |
.\" , given the following information |
| 55 |
.\" in addition to that given in |
| 56 |
.\" .BR outb (9). |
| 57 |
.P |
| 58 |
You must compile with \fB\-O\fP or \fB\-O2\fP or similar. |
| 59 |
The functions |
| 60 |
are defined as inline macros, and will not be substituted in without |
| 61 |
optimization enabled, causing unresolved references at link time. |
| 62 |
.P |
| 63 |
You use |
| 64 |
.BR ioperm (2) |
| 65 |
or alternatively |
| 66 |
.BR iopl (2) |
| 67 |
to tell the kernel to allow the user space application to access the |
| 68 |
I/O ports in question. |
| 69 |
Failure to do this will cause the application |
| 70 |
to receive a segmentation fault. |
| 71 |
.SH VERSIONS |
| 72 |
.BR outb () |
| 73 |
and friends are hardware-specific. |
| 74 |
The |
| 75 |
.I value |
| 76 |
argument is passed first and the |
| 77 |
.I port |
| 78 |
argument is passed second, |
| 79 |
which is the opposite order from most DOS implementations. |
| 80 |
.SH STANDARDS |
| 81 |
None. |
| 82 |
.SH SEE ALSO |
| 83 |
.BR ioperm (2), |
| 84 |
.BR iopl (2) |