xref: /netbsd-src/sys/arch/arc/include/pio.h (revision 95e1ffb15694e54f29f8baaa4232152b703c2a5a)
1*95e1ffb1Schristos /*	$NetBSD: pio.h,v 1.5 2005/12/11 12:16:39 christos Exp $	*/
25009ff6dSsoda /*	$OpenBSD: pio.h,v 1.3 1997/04/19 17:19:58 pefo Exp $	*/
390d7949cSsoda 
490d7949cSsoda /*
590d7949cSsoda  * Copyright (c) 1995 Per Fogelstrom.  All rights reserved.
690d7949cSsoda  *
790d7949cSsoda  * Redistribution and use in source and binary forms, with or without
890d7949cSsoda  * modification, are permitted provided that the following conditions
990d7949cSsoda  * are met:
1090d7949cSsoda  * 1. Redistributions of source code must retain the above copyright
1190d7949cSsoda  *    notice, this list of conditions and the following disclaimer.
1290d7949cSsoda  * 2. Redistributions in binary form must reproduce the above copyright
1390d7949cSsoda  *    notice, this list of conditions and the following disclaimer in the
1490d7949cSsoda  *    documentation and/or other materials provided with the distribution.
1590d7949cSsoda  * 3. All advertising materials mentioning features or use of this software
1690d7949cSsoda  *    must display the following acknowledgement:
175009ff6dSsoda  *      This product includes software developed by Per Fogelstrom.
1890d7949cSsoda  * 4. The name of the author may not be used to endorse or promote products
1990d7949cSsoda  *    derived from this software without specific prior written permission
2090d7949cSsoda  *
2190d7949cSsoda  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2290d7949cSsoda  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2390d7949cSsoda  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2490d7949cSsoda  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2590d7949cSsoda  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2690d7949cSsoda  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2790d7949cSsoda  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2890d7949cSsoda  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2990d7949cSsoda  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3090d7949cSsoda  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3190d7949cSsoda  */
3290d7949cSsoda 
335009ff6dSsoda #ifndef _ARC_PIO_H_
345009ff6dSsoda #define _ARC_PIO_H_
3590d7949cSsoda /*
3690d7949cSsoda  * I/O macros.
3790d7949cSsoda  */
3890d7949cSsoda 
3990d7949cSsoda #define	outb(a,v)	(*(volatile unsigned char*)(a) = (v))
4090d7949cSsoda #define	outw(a,v)	(*(volatile unsigned short*)(a) = (v))
4190d7949cSsoda #define	out16(a,v)	outw(a,v)
4290d7949cSsoda #define	outl(a,v)	(*(volatile unsigned int*)(a) = (v))
4390d7949cSsoda #define	out32(a,v)	outl(a,v)
4490d7949cSsoda #define	inb(a)		(*(volatile unsigned char*)(a))
4590d7949cSsoda #define	inw(a)		(*(volatile unsigned short*)(a))
4690d7949cSsoda #define	in16(a)		inw(a)
4790d7949cSsoda #define	inl(a)		(*(volatile unsigned int*)(a))
4890d7949cSsoda #define	in32(a)		inl(a)
4990d7949cSsoda 
507fe2a5a0Stsutsui void insb(uint8_t *, uint8_t *,int);
517fe2a5a0Stsutsui void insw(uint16_t *, uint16_t *,int);
527fe2a5a0Stsutsui void insl(uint32_t *, uint32_t *,int);
537fe2a5a0Stsutsui void outsb(uint8_t *, const uint8_t *,int);
547fe2a5a0Stsutsui void outsw(uint16_t *, const uint16_t *,int);
557fe2a5a0Stsutsui void outsl(uint32_t *, const uint32_t *,int);
565009ff6dSsoda 
57e5b560a3Ssoda extern struct arc_bus_space arc_bus_io, arc_bus_mem;
58e5b560a3Ssoda 
595009ff6dSsoda #endif /*_ARC_PIO_H_*/
60