jbd: Fix a race between checkpointing code and journal_get_write_access()
[linux/fpc-iii.git] / drivers / staging / vt6655 / upc.h
blob113fc2c88c11355514475a9a302266b01dae531a
1 /*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
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.
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.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 * File: upc.h
21 * Purpose: Macros to access device
23 * Author: Tevin Chen
25 * Date: Mar 17, 1997
30 #ifndef __UPC_H__
31 #define __UPC_H__
33 #if !defined(DEVICE_H)
34 #include "device.h"
35 #endif
36 #if !defined(__TTYPE_H__)
37 #include "ttype.h"
38 #endif
40 /*--------------------- Export Definitions -------------------------*/
44 // For IO mapped
47 #ifdef IO_MAP
49 #define VNSvInPortB(dwIOAddress, pbyData) { \
50 *(pbyData) = inb(dwIOAddress); \
54 #define VNSvInPortW(dwIOAddress, pwData) { \
55 *(pwData) = inw(dwIOAddress); \
58 #define VNSvInPortD(dwIOAddress, pdwData) { \
59 *(pdwData) = inl(dwIOAddress); \
63 #define VNSvOutPortB(dwIOAddress, byData) { \
64 outb(byData, dwIOAddress); \
68 #define VNSvOutPortW(dwIOAddress, wData) { \
69 outw(wData, dwIOAddress); \
72 #define VNSvOutPortD(dwIOAddress, dwData) { \
73 outl(dwData, dwIOAddress); \
76 #else
79 // For memory mapped IO
83 #define VNSvInPortB(dwIOAddress, pbyData) { \
84 volatile BYTE* pbyAddr = ((PBYTE)(dwIOAddress)); \
85 *(pbyData) = readb(pbyAddr); \
89 #define VNSvInPortW(dwIOAddress, pwData) { \
90 volatile WORD* pwAddr = ((PWORD)(dwIOAddress)); \
91 *(pwData) = readw(pwAddr); \
94 #define VNSvInPortD(dwIOAddress, pdwData) { \
95 volatile DWORD* pdwAddr = ((PDWORD)(dwIOAddress)); \
96 *(pdwData) = readl(pdwAddr); \
100 #define VNSvOutPortB(dwIOAddress, byData) { \
101 volatile BYTE* pbyAddr = ((PBYTE)(dwIOAddress)); \
102 writeb((BYTE)byData, pbyAddr); \
106 #define VNSvOutPortW(dwIOAddress, wData) { \
107 volatile WORD* pwAddr = ((PWORD)(dwIOAddress)); \
108 writew((WORD)wData, pwAddr); \
111 #define VNSvOutPortD(dwIOAddress, dwData) { \
112 volatile DWORD* pdwAddr = ((PDWORD)(dwIOAddress)); \
113 writel((DWORD)dwData, pdwAddr); \
116 #endif
120 // ALWAYS IO-Mapped IO when in 16-bit/32-bit environment
122 #define PCBvInPortB(dwIOAddress, pbyData) { \
123 *(pbyData) = inb(dwIOAddress); \
126 #define PCBvInPortW(dwIOAddress, pwData) { \
127 *(pwData) = inw(dwIOAddress); \
130 #define PCBvInPortD(dwIOAddress, pdwData) { \
131 *(pdwData) = inl(dwIOAddress); \
134 #define PCBvOutPortB(dwIOAddress, byData) { \
135 outb(byData, dwIOAddress); \
138 #define PCBvOutPortW(dwIOAddress, wData) { \
139 outw(wData, dwIOAddress); \
142 #define PCBvOutPortD(dwIOAddress, dwData) { \
143 outl(dwData, dwIOAddress); \
147 #define PCAvDelayByIO(uDelayUnit) { \
148 BYTE byData; \
149 ULONG ii; \
151 if (uDelayUnit <= 50) { \
152 udelay(uDelayUnit); \
154 else { \
155 for (ii = 0; ii < (uDelayUnit); ii++) \
156 byData = inb(0x61); \
161 /*--------------------- Export Classes ----------------------------*/
163 /*--------------------- Export Variables --------------------------*/
165 /*--------------------- Export Functions --------------------------*/
170 #endif // __UPC_H__