Annotation of kernel/bsd/dev/ppc/drvPPCATA/io_inline.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.1 (the "License").  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: 
                     25: /*
                     26:  * Copyright (c) 1992 NeXT Computer, Inc.
                     27:  *
                     28:  * Inlines for io space access.
                     29:  *
                     30:  * HISTORY
                     31:  *
                     32:  * 20 May 1992 ? at NeXT
                     33:  *     Created.
                     34:  */
                     35:  
                     36: #import <machine/types.h>
                     37: 
                     38: #ifndef eieio
                     39: #define eieio() \
                     40:         __asm__ volatile("eieio")
                     41: #endif
                     42: 
                     43: typedef u_int32_t io_addr_t; 
                     44: 
                     45: #if    !defined(DEFINE_INLINE_FUNCTIONS)
                     46: static
                     47: #endif
                     48: inline
                     49: unsigned char
                     50: inb(
                     51:     io_addr_t          port
                     52: )
                     53: {
                     54:     unsigned char      data;
                     55:     data = *(volatile u_int8_t *)port; 
                     56:     return (data);
                     57: }
                     58:  
                     59: #if    !defined(DEFINE_INLINE_FUNCTIONS)
                     60: static
                     61: #endif
                     62: inline
                     63: unsigned short
                     64: inw(
                     65:     io_addr_t          port
                     66: )
                     67: {
                     68:     unsigned short     data;
                     69:     
                     70:     data = *(volatile u_int16_t *)port;        
                     71:     return (data);
                     72: }
                     73: 
                     74: #if    !defined(DEFINE_INLINE_FUNCTIONS)
                     75: static
                     76: #endif
                     77: inline
                     78: unsigned short
                     79: inl(
                     80:     io_addr_t          port
                     81: )
                     82: {
                     83:     unsigned long      data;
                     84:     
                     85:     data = *(volatile u_int32_t *)port;        
                     86:     return (data);
                     87: }
                     88: 
                     89: #if    !defined(DEFINE_INLINE_FUNCTIONS)
                     90: static
                     91: #endif
                     92: inline
                     93: void
                     94: outb(
                     95:     io_addr_t          port,
                     96:     unsigned char      data
                     97: )
                     98: {
                     99:     *(volatile u_int8_t *)port = data;
                    100:     eieio();
                    101: }
                    102: 
                    103: #if    !defined(DEFINE_INLINE_FUNCTIONS)
                    104: static
                    105: #endif
                    106: inline
                    107: void
                    108: outw(
                    109:     io_addr_t          port,
                    110:     unsigned short     data
                    111: )
                    112: {
                    113:     *(volatile u_int16_t *)port = data;
                    114:     eieio();
                    115: }
                    116: 
                    117: #if    !defined(DEFINE_INLINE_FUNCTIONS)
                    118: static
                    119: #endif
                    120: inline
                    121: void
                    122: outl(
                    123:     io_addr_t          port,
                    124:     unsigned long      data
                    125: )
                    126: {
                    127:     *(volatile u_int32_t *)port = data;
                    128:     eieio();
                    129: }
                    130: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.