1 /* 2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. 3 * All rights reserved. 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * File: upc.h 16 * 17 * Purpose: Macros to access device 18 * 19 * Author: Tevin Chen 20 * 21 * Date: Mar 17, 1997 22 * 23 */ 24 25 #ifndef __UPC_H__ 26 #define __UPC_H__ 27 28 #include "device.h" 29 30 /*--------------------- Export Definitions -------------------------*/ 31 32 33 /* For memory mapped IO */ 34 35 36 #define VNSvInPortB(dwIOAddress, pbyData) \ 37 (*(pbyData) = ioread8(dwIOAddress)) 38 39 #define VNSvInPortW(dwIOAddress, pwData) \ 40 (*(pwData) = ioread16(dwIOAddress)) 41 42 #define VNSvInPortD(dwIOAddress, pdwData) \ 43 (*(pdwData) = ioread32(dwIOAddress)) 44 45 #define VNSvOutPortB(dwIOAddress, byData) \ 46 iowrite8((u8)(byData), dwIOAddress) 47 48 #define VNSvOutPortW(dwIOAddress, wData) \ 49 iowrite16((u16)(wData), dwIOAddress) 50 51 #define VNSvOutPortD(dwIOAddress, dwData) \ 52 iowrite32((u32)(dwData), dwIOAddress) 53 54 #define PCAvDelayByIO(uDelayUnit) \ 55 do { \ 56 unsigned char byData; \ 57 unsigned long ii; \ 58 \ 59 if (uDelayUnit <= 50) { \ 60 udelay(uDelayUnit); \ 61 } else { \ 62 for (ii = 0; ii < (uDelayUnit); ii++) \ 63 byData = inb(0x61); \ 64 } \ 65 } while (0) 66 67 /*--------------------- Export Classes ----------------------------*/ 68 69 /*--------------------- Export Variables --------------------------*/ 70 71 /*--------------------- Export Functions --------------------------*/ 72 73 #endif /* __UPC_H__ */ 74