Codebase list ioport / 3b0dc916-05d4-4164-9407-02c1f9f66c3f/main inb.pod
3b0dc916-05d4-4164-9407-02c1f9f66c3f/main

Tree @3b0dc916-05d4-4164-9407-02c1f9f66c3f/main (Download .tar.gz)

inb.pod @3b0dc916-05d4-4164-9407-02c1f9f66c3f/mainraw · history · blame

=head1 NAME

inb, outb, inw, outw, inl, outl - access I/O ports

=head1 SYNOPSIS

 inb ADDRESS
 inw ADDRESS
 inl ADDRESS
 outb ADDRESS DATA
 outw ADDRESS DATA
 outl ADDRESS DATA

=head1 EXAMPLES

 inb 0x278
 outw 0x440 0xffff

=head1 DESCRIPTION

These commands enable command line and script access directly to I/O
ports on PC hardware.

The C<inb>, C<inw> and C<inl> commands perform an input (read)
operation on the given I/O port, and print the result.

The C<outb>, C<outw> and C<outl> commands perform an output (write)
operation to the given I/O port, sending the given data.  Note that
the order of the parameters is ADDRESS DATA.

The size of the operation is selected according to the suffix, with
C<b> meaning byte, C<w> meaning word (16 bits) and C<l> meaning long
(32 bits).

Port numbers are in the range 0-0xffff.  We don't support access to
memory mapped devices.

Hexadecimal numbers (prefixed by C<0x>), decimal numbers, and octal
numbers (prefixed by C<0>), are allowed as parameters.

=head1 RETURN FROM "IN" OPERATIONS

The value read from the port by an "in" operation is normally printed
in decimal.

Use the C<--hex> option to print the result as hexadecimal (C<0x>
prefix is NOT printed).

Use the C<--code> option to turn the result into an exit status.  Note
that Unix/shell can only reliably return exit status in the range
0-0x7f, so this is not particularly useful in practice.

=head1 TYPE AND SIZE OF OPERATION

The type and size of the operation is normally determined by the name
of the command, eg. C<inb> is a read operation of 1 byte.

You can override this by using the C<--read>, C<--write> and/or
C<--size N> options.  For C<--size N>, C<N> should be C<1>, C<2> or
C<4> meaning byte, word and long respectively.

=head1 PERMISSIONS

You would normally need to be root or have the C<CAP_SYS_RAWIO>
capability in order to run these commands.

=head1 WARNING

Using these commands can cause Bad Things to happen to your hardware.

=head1 SEE ALSO

L<iopl(2)>,
L<mem(4)>,
L<http://et.redhat.com/~rjones/ioport>,
L<http://www.faqs.org/docs/Linux-mini/IO-Port-Programming.html>.

=head1 AUTHORS

Richard W.M. Jones <rjones @ redhat . com>

=head1 COPYRIGHT

(C) Copyright 2009 Red Hat Inc.,
L<http://et.redhat.com/~rjones/ioport>.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.