Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

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