home *** CD-ROM | disk | FTP | other *** search
/ Zodiac Super OZ / MEDIADEPOT.ISO / FILES / 13 / DJCRX201.ZIP / include / inlines / pc.h < prev   
C/C++ Source or Header  |  1995-07-24  |  1KB  |  71 lines

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. #ifndef __dj_include_Inline_pc_h_
  3. #define __dj_include_Inline_pc_h_
  4.  
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8.  
  9. extern __inline__ unsigned char
  10. inportb (unsigned short _port)
  11. {
  12.   unsigned char rv;
  13.   __asm__ __volatile__ ("inb %1, %0"
  14.       : "=a" (rv)
  15.       : "d" (_port));
  16.   return rv;
  17. }
  18.  
  19. extern __inline__ unsigned short
  20. inportw (unsigned short _port)
  21. {
  22.   unsigned short rv;
  23.   __asm__ __volatile__ ("inw %1, %0"
  24.       : "=a" (rv)
  25.       : "d" (_port));
  26.   return rv;
  27. }
  28.  
  29. extern __inline__ unsigned long
  30. inportl (unsigned short _port)
  31. {
  32.   unsigned long rv;
  33.   __asm__ __volatile__ ("inl %1, %0"
  34.       : "=a" (rv)
  35.       : "d" (_port));
  36.   return rv;
  37. }
  38.  
  39. extern __inline__ void
  40. outportb (unsigned short _port, unsigned char _data)
  41. {
  42.   __asm__ __volatile__ ("outb %1, %0"
  43.       :
  44.       : "d" (_port),
  45.         "a" (_data));
  46. }
  47.  
  48. extern __inline__ void
  49. outportw (unsigned short _port, unsigned short _data)
  50. {
  51.   __asm__ __volatile__ ("outw %1, %0"
  52.       :
  53.       : "d" (_port),
  54.         "a" (_data));
  55. }
  56.  
  57. extern __inline__ void
  58. outportl (unsigned short _port, unsigned long _data)
  59. {
  60.   __asm__ __volatile__ ("outl %1, %0"
  61.       :
  62.       : "d" (_port),
  63.         "a" (_data));
  64. }
  65.  
  66. #ifdef __cplusplus
  67. }
  68. #endif
  69.  
  70. #endif
  71.