io.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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, see
  13. <http://www.gnu.org/licenses/>. */
  14. #ifndef _SYS_IO_H
  15. #define _SYS_IO_H 1
  16. #include <features.h>
  17. __BEGIN_DECLS
  18. #if defined __UCLIBC_LINUX_SPECIFIC__
  19. /* If TURN_ON is TRUE, request for permission to do direct i/o on the
  20. port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O
  21. permission off for that range. This call requires root privileges.
  22. Portability note: not all Linux platforms support this call. Most
  23. platforms based on the PC I/O architecture probably will, however.
  24. E.g., Linux/Alpha for Alpha PCs supports this. */
  25. extern int ioperm (unsigned long int __from, unsigned long int __num,
  26. int __turn_on) __THROW;
  27. /* Set the I/O privilege level to LEVEL. If LEVEL>3, permission to
  28. access any I/O port is granted. This call requires root
  29. privileges. */
  30. extern int iopl (int __level) __THROW;
  31. #endif /* __UCLIBC_LINUX_SPECIFIC__ */
  32. /* Return the physical address of the DENSE I/O memory or NULL if none
  33. is available (e.g. on a jensen). */
  34. extern unsigned long int _bus_base (void) __THROW __attribute__ ((const));
  35. extern unsigned long int bus_base (void) __THROW __attribute__ ((const));
  36. /* Return the physical address of the SPARSE I/O memory. */
  37. extern unsigned long _bus_base_sparse (void) __THROW __attribute__ ((const));
  38. extern unsigned long bus_base_sparse (void) __THROW __attribute__ ((const));
  39. /* Return the HAE shift used by the SPARSE I/O memory. */
  40. extern int _hae_shift (void) __THROW __attribute__ ((const));
  41. extern int hae_shift (void) __THROW __attribute__ ((const));
  42. /* Previous three are deprecated in favour of the following, which
  43. knows about multiple PCI "hoses". Provide the PCI bus and dfn
  44. numbers just as to pciconfig_read/write. */
  45. enum __pciconfig_iobase_which
  46. {
  47. IOBASE_HOSE = 0, /* Return hose index. */
  48. IOBASE_SPARSE_MEM = 1, /* Return physical memory addresses. */
  49. IOBASE_DENSE_MEM = 2,
  50. IOBASE_SPARSE_IO = 3,
  51. IOBASE_DENSE_IO = 4
  52. };
  53. extern long pciconfig_iobase(enum __pciconfig_iobase_which __which,
  54. unsigned long int __bus,
  55. unsigned long int __dfn)
  56. __THROW __attribute__ ((const));
  57. /* Access PCI space protected from machine checks. */
  58. extern int pciconfig_read (unsigned long int __bus,
  59. unsigned long int __dfn,
  60. unsigned long int __off,
  61. unsigned long int __len,
  62. unsigned char *__buf) __THROW;
  63. extern int pciconfig_write (unsigned long int __bus,
  64. unsigned long int __dfn,
  65. unsigned long int __off,
  66. unsigned long int __len,
  67. unsigned char *__buf) __THROW;
  68. /* Userspace declarations. */
  69. extern unsigned int inb (unsigned long __port) __THROW;
  70. extern unsigned int inw (unsigned long __port) __THROW;
  71. extern unsigned int inl (unsigned long __port) __THROW;
  72. extern void outb (unsigned char __b, unsigned long __port) __THROW;
  73. extern void outw (unsigned short __w, unsigned long __port) __THROW;
  74. extern void outl (unsigned int __l, unsigned long __port) __THROW;
  75. __END_DECLS
  76. #endif /* _SYS_IO_H */