]> bbs.cooldavid.org Git - net-next-2.6.git/blame - drivers/staging/rt2860/iface/rtmp_pci.h
Staging: rt28x0: run *.h files through Lindent
[net-next-2.6.git] / drivers / staging / rt2860 / iface / rtmp_pci.h
CommitLineData
ca97b838
BZ
1/*
2 *************************************************************************
3 * Ralink Tech Inc.
4 * 5F., No.36, Taiyuan St., Jhubei City,
5 * Hsinchu County 302,
6 * Taiwan, R.O.C.
7 *
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
24 * *
25 *************************************************************************
26*/
27
28#ifndef __RTMP_PCI_H__
29#define __RTMP_PCI_H__
30
31#define RT28XX_HANDLE_DEV_ASSIGN(handle, dev_p) \
32 ((POS_COOKIE)handle)->pci_dev = dev_p;
33
ca97b838
BZ
34#ifdef LINUX
35// set driver data
36#define RT28XX_DRVDATA_SET(_a) pci_set_drvdata(_a, net_dev);
37
38#define RT28XX_PUT_DEVICE(dev_p)
39
ca97b838 40#define SA_SHIRQ IRQF_SHARED
ca97b838
BZ
41
42#ifdef PCI_MSI_SUPPORT
43#define RTMP_MSI_ENABLE(_pAd) \
44 { POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \
45 (_pAd)->HaveMsi = pci_enable_msi(_pObj->pci_dev) == 0 ? TRUE : FALSE; \
46 }
47
48#define RTMP_MSI_DISABLE(_pAd) \
49 { POS_COOKIE _pObj = (POS_COOKIE)(_pAd->OS_Cookie); \
50 if (_pAd->HaveMsi == TRUE) \
51 pci_disable_msi(_pObj->pci_dev); \
52 _pAd->HaveMsi = FALSE; \
53 }
54#else
55#define RTMP_MSI_ENABLE(_pAd) do{}while(0)
56#define RTMP_MSI_DISABLE(_pAd) do{}while(0)
57#endif // PCI_MSI_SUPPORT //
58
59#define RTMP_PCI_DEV_UNMAP() \
60{ if (net_dev->base_addr) { \
61 iounmap((void *)(net_dev->base_addr)); \
62 release_mem_region(pci_resource_start(dev_p, 0), \
63 pci_resource_len(dev_p, 0)); } \
64 if (net_dev->irq) pci_release_regions(dev_p); }
65
ca97b838
BZ
66#define PCI_REG_READ_WORD(pci_dev, offset, Configuration) \
67 if (pci_read_config_word(pci_dev, offset, &reg16) == 0) \
68 Configuration = le2cpu16(reg16); \
69 else \
70 Configuration = 0;
71
72#define PCI_REG_WIRTE_WORD(pci_dev, offset, Configuration) \
73 reg16 = cpu2le16(Configuration); \
74 pci_write_config_word(pci_dev, offset, reg16);
75
76#endif // LINUX //
77
ca97b838 78#endif // __RTMP_PCI_H__ //