Merge remote-tracking branch 'spi/fix/rockchip' into spi-linus
[cascardo/linux.git] / drivers / staging / vt6655 / card.h
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  * 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.
18  *
19  * File: card.h
20  *
21  * Purpose: Provide functions to setup NIC operation mode
22  *
23  * Author: Tevin Chen
24  *
25  * Date: May 21, 1996
26  *
27  */
28
29 #ifndef __CARD_H__
30 #define __CARD_H__
31
32 #include "ttype.h"
33 #include <linux/types.h>
34
35 //
36 // Loopback mode
37 //
38 // LOBYTE is MAC LB mode, HIBYTE is MII LB mode
39 #define CARD_LB_NONE            MAKEWORD(MAC_LB_NONE, 0)
40 #define CARD_LB_MAC             MAKEWORD(MAC_LB_INTERNAL, 0)   // PHY must ISO, avoid MAC loopback packet go out
41 #define CARD_LB_PHY             MAKEWORD(MAC_LB_EXT, 0)
42
43 #define DEFAULT_MSDU_LIFETIME           512  // ms
44 #define DEFAULT_MSDU_LIFETIME_RES_64us  8000 // 64us
45
46 #define DEFAULT_MGN_LIFETIME            8    // ms
47 #define DEFAULT_MGN_LIFETIME_RES_64us   125  // 64us
48
49 #define CB_MAX_CHANNEL_24G      14
50 #define CB_MAX_CHANNEL_5G       42
51 #define CB_MAX_CHANNEL          (CB_MAX_CHANNEL_24G+CB_MAX_CHANNEL_5G)
52
53 typedef enum _CARD_PHY_TYPE {
54         PHY_TYPE_AUTO,
55         PHY_TYPE_11B,
56         PHY_TYPE_11G,
57         PHY_TYPE_11A
58 } CARD_PHY_TYPE, *PCARD_PHY_TYPE;
59
60 typedef enum _CARD_PKT_TYPE {
61         PKT_TYPE_802_11_BCN,
62         PKT_TYPE_802_11_MNG,
63         PKT_TYPE_802_11_DATA,
64         PKT_TYPE_802_11_ALL
65 } CARD_PKT_TYPE, *PCARD_PKT_TYPE;
66
67 typedef enum _CARD_STATUS_TYPE {
68         CARD_STATUS_MEDIA_CONNECT,
69         CARD_STATUS_MEDIA_DISCONNECT,
70         CARD_STATUS_PMKID
71 } CARD_STATUS_TYPE, *PCARD_STATUS_TYPE;
72
73 typedef enum _CARD_OP_MODE {
74         OP_MODE_INFRASTRUCTURE,
75         OP_MODE_ADHOC,
76         OP_MODE_AP,
77         OP_MODE_UNKNOWN
78 } CARD_OP_MODE, *PCARD_OP_MODE;
79
80 void CARDvSetRSPINF(void *pDeviceHandler, CARD_PHY_TYPE ePHYType);
81 void vUpdateIFS(void *pDeviceHandler);
82 void CARDvUpdateBasicTopRate(void *pDeviceHandler);
83 bool CARDbAddBasicRate(void *pDeviceHandler, unsigned short wRateIdx);
84 bool CARDbIsOFDMinBasicRate(void *pDeviceHandler);
85 void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode);
86 bool CARDbSoftwareReset(void *pDeviceHandler);
87 void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterval);
88 void CARDvUpdateNextTBTT(void __iomem *dwIoBase, QWORD qwTSF, unsigned short wBeaconInterval);
89 bool CARDbGetCurrentTSF(void __iomem *dwIoBase, PQWORD pqwCurrTSF);
90 QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval);
91 QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2);
92 bool CARDbSetTxPower(void *pDeviceHandler, unsigned long ulTxPower);
93 unsigned char CARDbyGetPktType(void *pDeviceHandler);
94 void CARDvSafeResetTx(void *pDeviceHandler);
95 void CARDvSafeResetRx(void *pDeviceHandler);
96
97 bool CARDbRadioPowerOff(void *pDeviceHandler);
98 bool CARDbRadioPowerOn(void *pDeviceHandler);
99 bool CARDbIsShortPreamble(void *pDeviceHandler);
100 bool CARDbIsShorSlotTime(void *pDeviceHandler);
101 bool CARDbSetPhyParameter(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, unsigned short wCapInfo, unsigned char byERPField, void *pvSupportRateIEs, void *pvExtSupportRateIEs);
102 bool CARDbUpdateTSF(void *pDeviceHandler, unsigned char byRxRate, QWORD qwBSSTimestamp, QWORD qwLocalTSF);
103 bool CARDbStopTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType);
104 bool CARDbStartTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType);
105 bool CARDbSetBeaconPeriod(void *pDeviceHandler, unsigned short wBeaconInterval);
106 bool CARDbSetBSSID(void *pDeviceHandler, unsigned char *pbyBSSID, CARD_OP_MODE eOPMode);
107
108 bool
109 CARDbPowerDown(
110         void *pDeviceHandler
111 );
112
113 bool CARDbSetTxDataRate(
114         void *pDeviceHandler,
115         unsigned short wDataRate
116 );
117
118 bool CARDbRemoveKey(void *pDeviceHandler, unsigned char *pbyBSSID);
119
120 bool
121 CARDbAdd_PMKID_Candidate(
122         void *pDeviceHandler,
123         unsigned char *pbyBSSID,
124         bool bRSNCapExist,
125         unsigned short wRSNCap
126 );
127
128 void *
129 CARDpGetCurrentAddress(
130         void *pDeviceHandler
131 );
132
133 bool
134 CARDbStartMeasure(
135         void *pDeviceHandler,
136         void *pvMeasureEIDs,
137         unsigned int uNumOfMeasureEIDs
138 );
139
140 bool
141 CARDbChannelSwitch(
142         void *pDeviceHandler,
143         unsigned char byMode,
144         unsigned char byNewChannel,
145         unsigned char byCount
146 );
147
148 bool
149 CARDbSetQuiet(
150         void *pDeviceHandler,
151         bool bResetQuiet,
152         unsigned char byQuietCount,
153         unsigned char byQuietPeriod,
154         unsigned short wQuietDuration,
155         unsigned short wQuietOffset
156 );
157
158 bool
159 CARDbStartQuiet(
160         void *pDeviceHandler
161 );
162
163 void
164 CARDvSetPowerConstraint(
165         void *pDeviceHandler,
166         unsigned char byChannel,
167         char byPower
168 );
169
170 void
171 CARDvGetPowerCapability(
172         void *pDeviceHandler,
173         unsigned char *pbyMinPower,
174         unsigned char *pbyMaxPower
175 );
176
177 char
178 CARDbyGetTransmitPower(
179         void *pDeviceHandler
180 );
181
182 #endif // __CARD_H__