io.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. #ifndef _SYS_IO_H
  17. #define _SYS_IO_H 1
  18. #include <features.h>
  19. __BEGIN_DECLS
  20. #if defined __UCLIBC_LINUX_SPECIFIC__
  21. /* If TURN_ON is TRUE, request for permission to do direct i/o on the
  22. port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O
  23. permission off for that range. This call requires root privileges.
  24. Portability note: not all Linux platforms support this call. Most
  25. platforms based on the PC I/O architecture probably will, however.
  26. E.g., Linux/Alpha for Alpha PCs supports this. */
  27. extern int ioperm (unsigned long int __from, unsigned long int __num,
  28. int __turn_on);
  29. /* Set the I/O privilege level to LEVEL. If LEVEL>3, permission to
  30. access any I/O port is granted. This call requires root
  31. privileges. */
  32. extern int iopl (int __level);
  33. #endif /* __UCLIBC_LINUX_SPECIFIC__ */
  34. extern unsigned int _inb (unsigned long int __port);
  35. extern unsigned int _inb (unsigned long int __port);
  36. extern unsigned int _inw (unsigned long int __port);
  37. extern unsigned int _inl (unsigned long int __port);
  38. extern void _outb (unsigned char __val, unsigned long int __port);
  39. extern void _outw (unsigned short __val, unsigned long int __port);
  40. extern void _outl (unsigned int __val, unsigned long int __port);
  41. #define inb _inb
  42. #define inw _inw
  43. #define inl _inl
  44. #define outb _outb
  45. #define outw _outw
  46. #define outl _outl
  47. /* Access PCI space protected from machine checks. */
  48. extern int pciconfig_read (unsigned long int __bus, unsigned long int __dfn,
  49. unsigned long int __off, unsigned long int __len,
  50. unsigned char *__buf);
  51. extern int pciconfig_write (unsigned long int __bus, unsigned long int __dfn,
  52. unsigned long int __off, unsigned long int __len,
  53. unsigned char *__buf);
  54. __END_DECLS
  55. #endif /* _SYS_IO_H */