The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/i386/pio.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* 
    2  * Mach Operating System
    3  * Copyright (c) 1993,1992,1991,1990 Carnegie Mellon University
    4  * All Rights Reserved.
    5  * 
    6  * Permission to use, copy, modify and distribute this software and its
    7  * documentation is hereby granted, provided that both the copyright
    8  * notice and this permission notice appear in all copies of the
    9  * software, derivative works or modified versions, and any portions
   10  * thereof, and that both notices appear in supporting documentation.
   11  * 
   12  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   13  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
   14  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   15  * 
   16  * Carnegie Mellon requests users of this software to return to
   17  * 
   18  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   19  *  School of Computer Science
   20  *  Carnegie Mellon University
   21  *  Pittsburgh PA 15213-3890
   22  * 
   23  * any improvements or extensions that they make and grant Carnegie Mellon
   24  * the rights to redistribute these changes.
   25  */
   26 /* 
   27  * HISTORY
   28  * $Log:        pio.h,v $
   29  * Revision 2.7  93/11/17  16:38:57  dbg
   30  *      Fixed outb and friends to be expressions.  Added declarations
   31  *      for strings IO functions (linb, loutb).
   32  *      [93/10/28            dbg]
   33  * 
   34  * Revision 2.6  93/01/14  17:29:31  danner
   35  *      altered malformed error message
   36  *      [92/12/18            danner]
   37  *      Took the warning inside ifndef __GNUC__ outside of comments. This
   38  *      will make the compiler find the error instead of having to find
   39  *      out about it manually.
   40  *      Protected against multiple inclusions.
   41  *      [92/11/30            jvh]
   42  * 
   43  * Revision 2.5  91/05/14  16:14:20  mrt
   44  *      Correcting copyright
   45  * 
   46  * Revision 2.4  91/02/05  17:13:56  mrt
   47  *      Changed to new Mach copyright
   48  *      [91/02/01  17:37:08  mrt]
   49  * 
   50  * Revision 2.3  90/12/20  16:36:37  jeffreyh
   51  *      changes for __STDC__
   52  *      [90/12/07            jeffreyh]
   53  * 
   54  * Revision 2.2  90/11/26  14:48:41  rvb
   55  *      Pulled from 2.5
   56  *      [90/11/22  10:09:38  rvb]
   57  * 
   58  *      [90/08/14            mg32]
   59  * 
   60  *      Now we know how types are factored in.
   61  *      Cleaned up a bunch: eliminated ({ for output and flushed unused
   62  *      output variables.
   63  *      [90/08/14            rvb]
   64  * 
   65  *      This is how its done in gcc:
   66  *              Created.
   67  *      [90/03/26            rvb]
   68  * 
   69  */
   70 
   71 #ifndef _I386_PIO_H_
   72 #define _I386_PIO_H_
   73 
   74 #ifdef  __GNUC__
   75 
   76 #define inl(y) \
   77     ({  unsigned long _tmp__; \
   78         asm volatile("inl %1, %0" \
   79                      : "=a" (_tmp__) \
   80                      : "d" ((unsigned short)(y))); \
   81         _tmp__; })
   82 
   83 #define inw(y) \
   84     ({  unsigned short _tmp__; \
   85         asm volatile(".byte 0x66; inl %1, %0" \
   86                      : "=a" (_tmp__) \
   87                      : "d" ((unsigned short)(y))); \
   88         _tmp__; })
   89 
   90 #define inb(y) \
   91     ({  unsigned char _tmp__; \
   92         asm volatile("inb %1, %0" \
   93                      : "=a" (_tmp__) \
   94                      : "d" ((unsigned short)(y))); \
   95         _tmp__; })
   96 
   97 
   98 #define outl(x, y) \
   99     ({  asm volatile("outl %0, %1" \
  100                      : : "a" (y) , "d" ((unsigned short)(x))); \
  101         (void)0; })
  102 
  103 
  104 #define outw(x, y) \
  105     ({  asm volatile(".byte 0x66; outl %0, %1" \
  106                      : : "a" ((unsigned short)(y)), \
  107                          "d" ((unsigned short)(x))); \
  108         (void)0; })
  109 
  110 
  111 #define outb(x, y) \
  112     ({  asm volatile("outb %0, %1" \
  113                      : : "a" ((unsigned char)(y)), \
  114                          "d" ((unsigned short)(x))); \
  115         (void)0; })
  116 
  117 #else   /* not __GNUC__ */
  118 
  119 extern unsigned long    inl(unsigned short port);
  120 extern unsigned short   inw(unsigned short port);
  121 extern unsigned char    inb(unsigned short port);
  122 extern void             outl(unsigned short port, unsigned long data);
  123 extern void             outb(unsigned short port, unsigned short data);
  124 extern void             outw(unsigned short port, unsigned char data);
  125 
  126 #endif  /* __GNUC__ */
  127 
  128 extern void linb(
  129         unsigned short  port,
  130         unsigned char   *data,
  131         unsigned int    count);
  132 
  133 extern void linw(
  134         unsigned short  port,
  135         unsigned short  *data,
  136         unsigned int    count);
  137 
  138 extern void loutb(
  139         unsigned short  port,
  140         unsigned char   *data,
  141         unsigned int    count);
  142 
  143 extern void loutw(
  144         unsigned short  port,
  145         unsigned short  *data,
  146         unsigned int    count);
  147 
  148 
  149 #endif /* _I386_PIO_H_ */

Cache object: d187ddd3b5410013e0d3cf4b1f44f123


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.