• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /* For memory mapped IO */
24 
25 #define VNSvInPortB(dwIOAddress, pbyData) \
26 	(*(pbyData) = ioread8(dwIOAddress))
27 
28 #define VNSvInPortW(dwIOAddress, pwData) \
29 	(*(pwData) = ioread16(dwIOAddress))
30 
31 #define VNSvInPortD(dwIOAddress, pdwData) \
32 	(*(pdwData) = ioread32(dwIOAddress))
33 
34 #define VNSvOutPortB(dwIOAddress, byData) \
35 	iowrite8((u8)(byData), dwIOAddress)
36 
37 #define VNSvOutPortW(dwIOAddress, wData) \
38 	iowrite16((u16)(wData), dwIOAddress)
39 
40 #define VNSvOutPortD(dwIOAddress, dwData) \
41 	iowrite32((u32)(dwData), dwIOAddress)
42 
43 #define PCAvDelayByIO(uDelayUnit)				\
44 do {								\
45 	unsigned char byData;					\
46 	unsigned long ii;					\
47 								\
48 	if (uDelayUnit <= 50) {					\
49 		udelay(uDelayUnit);				\
50 	} else {						\
51 		for (ii = 0; ii < (uDelayUnit); ii++)		\
52 			byData = inb(0x61);			\
53 	}							\
54 } while (0)
55 
56 /*---------------------  Export Classes  ----------------------------*/
57 
58 /*---------------------  Export Variables  --------------------------*/
59 
60 /*---------------------  Export Functions  --------------------------*/
61 
62 #endif /* __UPC_H__ */
63