io.h 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* Copyright (C) 1996, 1999 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 02111-1307 USA. */
  15. #ifndef _SYS_IO_H
  16. #define _SYS_IO_H 1
  17. #include <features.h>
  18. __BEGIN_DECLS
  19. #if defined __UCLIBC_LINUX_SPECIFIC__
  20. /* If TURN_ON is TRUE, request for permission to do direct i/o on the
  21. port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O
  22. permission off for that range. This call requires root privileges.
  23. Portability note: not all Linux platforms support this call. Most
  24. platforms based on the PC I/O architecture probably will, however.
  25. E.g., Linux/Alpha for Alpha PCs supports this. */
  26. extern int ioperm (unsigned long int __from, unsigned long int __num,
  27. int __turn_on) __THROW;
  28. /* Set the I/O privilege level to LEVEL. If LEVEL>3, permission to
  29. access any I/O port is granted. This call requires root
  30. privileges. */
  31. extern int iopl (int __level) __THROW;
  32. #endif /* __UCLIBC_LINUX_SPECIFIC__ */
  33. /* Return the physical address of the DENSE I/O memory or NULL if none
  34. is available (e.g. on a jensen). */
  35. extern unsigned long int _bus_base (void) __THROW __attribute__ ((const));
  36. extern unsigned long int bus_base (void) __THROW __attribute__ ((const));
  37. /* Return the physical address of the SPARSE I/O memory. */
  38. extern unsigned long _bus_base_sparse (void) __THROW __attribute__ ((const));
  39. extern unsigned long bus_base_sparse (void) __THROW __attribute__ ((const));
  40. /* Return the HAE shift used by the SPARSE I/O memory. */
  41. extern int _hae_shift (void) __THROW __attribute__ ((const));
  42. extern int hae_shift (void) __THROW __attribute__ ((const));
  43. /* Previous three are deprecated in favour of the following, which
  44. knows about multiple PCI "hoses". Provide the PCI bus and dfn
  45. numbers just as to pciconfig_read/write. */
  46. enum __pciconfig_iobase_which
  47. {
  48. IOBASE_HOSE = 0, /* Return hose index. */
  49. IOBASE_SPARSE_MEM = 1, /* Return physical memory addresses. */
  50. IOBASE_DENSE_MEM = 2,
  51. IOBASE_SPARSE_IO = 3,
  52. IOBASE_DENSE_IO = 4
  53. };
  54. extern long pciconfig_iobase(enum __pciconfig_iobase_which __which,
  55. unsigned long int __bus,
  56. unsigned long int __dfn)
  57. __THROW __attribute__ ((const));
  58. /* Access PCI space protected from machine checks. */
  59. extern int pciconfig_read (unsigned long int __bus,
  60. unsigned long int __dfn,
  61. unsigned long int __off,
  62. unsigned long int __len,
  63. unsigned char *__buf) __THROW;
  64. extern int pciconfig_write (unsigned long int __bus,
  65. unsigned long int __dfn,
  66. unsigned long int __off,
  67. unsigned long int __len,
  68. unsigned char *__buf) __THROW;
  69. /* Userspace declarations. */
  70. extern unsigned int inb (unsigned long __port) __THROW;
  71. extern unsigned int inw (unsigned long __port) __THROW;
  72. extern unsigned int inl (unsigned long __port) __THROW;
  73. extern void outb (unsigned char __b, unsigned long __port) __THROW;
  74. extern void outw (unsigned short __w, unsigned long __port) __THROW;
  75. extern void outl (unsigned int __l, unsigned long __port) __THROW;
  76. __END_DECLS
  77. #endif /* _SYS_IO_H */