Back to index

glibc  2.9
io.h
Go to the documentation of this file.
00001 /* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003      Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef       _SYS_IO_H
00021 #define       _SYS_IO_H     1
00022 
00023 #include <features.h>
00024 
00025 __BEGIN_DECLS
00026 
00027 /* If TURN_ON is TRUE, request for permission to do direct i/o on the
00028    port numbers in the range [FROM,FROM+NUM-1].  Otherwise, turn I/O
00029    permission off for that range.  This call requires root privileges.
00030 
00031    Portability note: not all Linux platforms support this call.  Most
00032    platforms based on the PC I/O architecture probably will, however.
00033    E.g., Linux/Alpha for Alpha PCs supports this.  */
00034 extern int ioperm (unsigned long int __from, unsigned long int __num,
00035                  int __turn_on);
00036 
00037 /* Set the I/O privilege level to LEVEL.  If LEVEL>3, permission to
00038    access any I/O port is granted.  This call requires root
00039    privileges. */
00040 extern int iopl (int __level);
00041 
00042 extern unsigned int _inb (unsigned long int __port);
00043 extern unsigned int _inb (unsigned long int __port);
00044 extern unsigned int _inw (unsigned long int __port);
00045 extern unsigned int _inl (unsigned long int __port);
00046 extern void _outb (unsigned char __val, unsigned long int __port);
00047 extern void _outw (unsigned short __val, unsigned long int __port);
00048 extern void _outl (unsigned int __val, unsigned long int __port);
00049 
00050 #define inb   _inb
00051 #define inw   _inw
00052 #define inl   _inl
00053 #define outb  _outb
00054 #define outw  _outw
00055 #define outl  _outl
00056 
00057 /* Access PCI space protected from machine checks.  */
00058 extern int pciconfig_read (unsigned long int __bus, unsigned long int __dfn,
00059                         unsigned long int __off, unsigned long int __len,
00060                         unsigned char *__buf);
00061 
00062 extern int pciconfig_write (unsigned long int __bus, unsigned long int __dfn,
00063                          unsigned long int __off, unsigned long int __len,
00064                          unsigned char *__buf);
00065 
00066 __END_DECLS
00067 
00068 #endif /* _SYS_IO_H */