Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.5 KiB

  1. /*++
  2. Copyright (c) 1989-1995 Microsoft Corporation
  3. Module Name:
  4. ioaccess.h
  5. Abstract:
  6. Definitions of function prototypes for accessing I/O ports and
  7. memory on I/O adapters from display drivers.
  8. Cloned from parts of nti386.h.
  9. Author:
  10. --*/
  11. //
  12. // Memory barriers on AMD64, X86 and IA64 are not required since the Io
  13. // Operations are always garanteed to be executed in order
  14. //
  15. #if defined(_AMD64_) || defined(_X86_) || defined(_IA64_)
  16. #define MEMORY_BARRIER() 0
  17. #else
  18. #error "No Target Architecture"
  19. #endif
  20. //
  21. // I/O space read and write macros.
  22. //
  23. #if defined(_X86_)
  24. #define READ_REGISTER_UCHAR(Register) (*(volatile UCHAR *)(Register))
  25. #define READ_REGISTER_USHORT(Register) (*(volatile USHORT *)(Register))
  26. #define READ_REGISTER_ULONG(Register) (*(volatile ULONG *)(Register))
  27. #define WRITE_REGISTER_UCHAR(Register, Value) (*(volatile UCHAR *)(Register) = (Value))
  28. #define WRITE_REGISTER_USHORT(Register, Value) (*(volatile USHORT *)(Register) = (Value))
  29. #define WRITE_REGISTER_ULONG(Register, Value) (*(volatile ULONG *)(Register) = (Value))
  30. #define READ_PORT_UCHAR(Port) inp (Port)
  31. #define READ_PORT_USHORT(Port) inpw (Port)
  32. #define READ_PORT_ULONG(Port) inpd (Port)
  33. #define WRITE_PORT_UCHAR(Port, Value) outp ((Port), (Value))
  34. #define WRITE_PORT_USHORT(Port, Value) outpw ((Port), (Value))
  35. #define WRITE_PORT_ULONG(Port, Value) outpd ((Port), (Value))
  36. #endif