1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. 4 * All rights reserved. 5 * 6 * File: upc.h 7 * 8 * Purpose: Macros to access device 9 * 10 * Author: Tevin Chen 11 * 12 * Date: Mar 17, 1997 13 * 14 */ 15 16 #ifndef __UPC_H__ 17 #define __UPC_H__ 18 19 #include "device.h" 20 21 /*--------------------- Export Definitions -------------------------*/ 22 23 24 /* For memory mapped IO */ 25 26 27 #define VNSvInPortB(dwIOAddress, pbyData) \ 28 (*(pbyData) = ioread8(dwIOAddress)) 29 30 #define VNSvInPortW(dwIOAddress, pwData) \ 31 (*(pwData) = ioread16(dwIOAddress)) 32 33 #define VNSvInPortD(dwIOAddress, pdwData) \ 34 (*(pdwData) = ioread32(dwIOAddress)) 35 36 #define VNSvOutPortB(dwIOAddress, byData) \ 37 iowrite8((u8)(byData), dwIOAddress) 38 39 #define VNSvOutPortW(dwIOAddress, wData) \ 40 iowrite16((u16)(wData), dwIOAddress) 41 42 #define VNSvOutPortD(dwIOAddress, dwData) \ 43 iowrite32((u32)(dwData), dwIOAddress) 44 45 #define PCAvDelayByIO(uDelayUnit) \ 46 do { \ 47 unsigned char byData; \ 48 unsigned long ii; \ 49 \ 50 if (uDelayUnit <= 50) { \ 51 udelay(uDelayUnit); \ 52 } else { \ 53 for (ii = 0; ii < (uDelayUnit); ii++) \ 54 byData = inb(0x61); \ 55 } \ 56 } while (0) 57 58 /*--------------------- Export Classes ----------------------------*/ 59 60 /*--------------------- Export Variables --------------------------*/ 61 62 /*--------------------- Export Functions --------------------------*/ 63 64 #endif /* __UPC_H__ */ 65