1129198Scognet/* $NetBSD: katelib.h,v 1.3 2001/11/23 19:21:48 thorpej Exp $ */ 2129198Scognet 3139735Simp/*- 4129198Scognet * Copyright (c) 1994-1996 Mark Brinicombe. 5129198Scognet * Copyright (c) 1994 Brini. 6129198Scognet * All rights reserved. 7129198Scognet * 8129198Scognet * This code is derived from software written for Brini by Mark Brinicombe 9129198Scognet * 10129198Scognet * Redistribution and use in source and binary forms, with or without 11129198Scognet * modification, are permitted provided that the following conditions 12129198Scognet * are met: 13129198Scognet * 1. Redistributions of source code must retain the above copyright 14129198Scognet * notice, this list of conditions and the following disclaimer. 15129198Scognet * 2. Redistributions in binary form must reproduce the above copyright 16129198Scognet * notice, this list of conditions and the following disclaimer in the 17129198Scognet * documentation and/or other materials provided with the distribution. 18129198Scognet * 3. All advertising materials mentioning features or use of this software 19129198Scognet * must display the following acknowledgement: 20129198Scognet * This product includes software developed by Brini. 21129198Scognet * 4. The name of the company nor the name of the author may be used to 22129198Scognet * endorse or promote products derived from this software without specific 23129198Scognet * prior written permission. 24129198Scognet * 25129198Scognet * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED 26129198Scognet * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 27129198Scognet * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28129198Scognet * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 29129198Scognet * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 30129198Scognet * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 31129198Scognet * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32129198Scognet * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33129198Scognet * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34129198Scognet * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35129198Scognet * SUCH DAMAGE. 36129198Scognet * 37129198Scognet * RiscBSD kernel project 38129198Scognet * 39129198Scognet * katelib.h 40129198Scognet * 41129198Scognet * Prototypes for machine specific functions. Most of these 42129198Scognet * could be inlined. 43129198Scognet * 44129198Scognet * This should not really be a separate header file. Eventually I will merge 45129198Scognet * this into other header files once I have decided where the declarations 46236992Simp * should go. 47129198Scognet * 48129198Scognet * Created : 18/09/94 49129198Scognet * 50129198Scognet * Based on kate/katelib/prototypes.h 51129198Scognet * 52129198Scognet * $FreeBSD$ 53129198Scognet */ 54129198Scognet 55129198Scognet/* 56129198Scognet * USE OF THIS FILE IS DEPRECATED 57129198Scognet */ 58129198Scognet 59129198Scognet#ifndef _MACHINE_KATELIB_H_ 60129198Scognet#define _MACHINE_KATELIB_H_ 61129198Scognet#include <sys/types.h> 62129198Scognet#include <machine/cpufunc.h> 63129198Scognet 64129198Scognet#ifdef _KERNEL 65129198Scognet 66129198Scognet/* Assembly modules */ 67129198Scognet 68129198Scognet/* In blockio.S */ 69129198Scognet#include <machine/blockio.h> 70129198Scognet 71129198Scognet/* Macros for reading and writing words, shorts, bytes */ 72129198Scognet 73129198Scognet#define WriteWord(a, b) \ 74129198Scognet*((volatile unsigned int *)(a)) = (b) 75129198Scognet 76129198Scognet#define ReadWord(a) \ 77129198Scognet(*((volatile unsigned int *)(a))) 78129198Scognet 79129198Scognet#define WriteShort(a, b) \ 80129198Scognet*((volatile unsigned int *)(a)) = ((b) | ((b) << 16)) 81129198Scognet 82129198Scognet#define ReadShort(a) \ 83129198Scognet((*((volatile unsigned int *)(a))) & 0xffff) 84129198Scognet 85129198Scognet#define WriteByte(a, b) \ 86129198Scognet*((volatile unsigned char *)(a)) = (b) 87129198Scognet 88129198Scognet#define ReadByte(a) \ 89129198Scognet(*((volatile unsigned char *)(a))) 90129198Scognet 91129198Scognet/* Define in/out macros */ 92129198Scognet 93129198Scognet#define inb(port) ReadByte((port)) 94129198Scognet#define outb(port, byte) WriteByte((port), (byte)) 95129198Scognet#define inw(port) ReadShort((port)) 96129198Scognet#define outw(port, word) WriteShort((port), (word)) 97129198Scognet#define inl(port) ReadWord((port)) 98129198Scognet#define outl(port, lword) WriteWord((port), (lword)) 99129198Scognet 100129198Scognet#endif 101129198Scognet 102129198Scognet#endif /* !_MACHINE_KATELIB_H_ */ 103129198Scognet/* End of katelib.h */ 104