• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <linux/nl80211.h>
35 
36 //
37 // Loopback mode
38 //
39 // LOBYTE is MAC LB mode, HIBYTE is MII LB mode
40 #define CARD_LB_NONE            MAKEWORD(MAC_LB_NONE, 0)
41 #define CARD_LB_MAC             MAKEWORD(MAC_LB_INTERNAL, 0)   // PHY must ISO, avoid MAC loopback packet go out
42 #define CARD_LB_PHY             MAKEWORD(MAC_LB_EXT, 0)
43 
44 #define DEFAULT_MSDU_LIFETIME           512  // ms
45 #define DEFAULT_MSDU_LIFETIME_RES_64us  8000 // 64us
46 
47 #define DEFAULT_MGN_LIFETIME            8    // ms
48 #define DEFAULT_MGN_LIFETIME_RES_64us   125  // 64us
49 
50 #define CB_MAX_CHANNEL_24G      14
51 #define CB_MAX_CHANNEL_5G       42
52 #define CB_MAX_CHANNEL          (CB_MAX_CHANNEL_24G+CB_MAX_CHANNEL_5G)
53 
54 typedef enum _CARD_PHY_TYPE {
55 	PHY_TYPE_AUTO,
56 	PHY_TYPE_11B,
57 	PHY_TYPE_11G,
58 	PHY_TYPE_11A
59 } CARD_PHY_TYPE, *PCARD_PHY_TYPE;
60 
61 typedef enum _CARD_PKT_TYPE {
62 	PKT_TYPE_802_11_BCN,
63 	PKT_TYPE_802_11_MNG,
64 	PKT_TYPE_802_11_DATA,
65 	PKT_TYPE_802_11_ALL
66 } CARD_PKT_TYPE, *PCARD_PKT_TYPE;
67 
68 typedef enum _CARD_STATUS_TYPE {
69 	CARD_STATUS_MEDIA_CONNECT,
70 	CARD_STATUS_MEDIA_DISCONNECT,
71 	CARD_STATUS_PMKID
72 } CARD_STATUS_TYPE, *PCARD_STATUS_TYPE;
73 
74 struct vnt_private;
75 
76 void CARDvSetRSPINF(struct vnt_private *, CARD_PHY_TYPE ePHYType);
77 void vUpdateIFS(struct vnt_private *);
78 void CARDvUpdateBasicTopRate(struct vnt_private *);
79 bool CARDbAddBasicRate(struct vnt_private *, unsigned short wRateIdx);
80 bool CARDbIsOFDMinBasicRate(struct vnt_private *);
81 void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode);
82 bool CARDbSoftwareReset(struct vnt_private *);
83 void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterval);
84 void CARDvUpdateNextTBTT(void __iomem *dwIoBase, u64 qwTSF, unsigned short wBeaconInterval);
85 bool CARDbGetCurrentTSF(void __iomem *dwIoBase, u64 *pqwCurrTSF);
86 u64 CARDqGetNextTBTT(u64 qwTSF, unsigned short wBeaconInterval);
87 u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2);
88 bool CARDbSetTxPower(struct vnt_private *, unsigned long ulTxPower);
89 unsigned char CARDbyGetPktType(struct vnt_private *);
90 void CARDvSafeResetTx(struct vnt_private *);
91 void CARDvSafeResetRx(struct vnt_private *);
92 bool CARDbRadioPowerOff(struct vnt_private *);
93 bool CARDbRadioPowerOn(struct vnt_private *);
94 bool CARDbIsShortPreamble(struct vnt_private *);
95 bool CARDbIsShorSlotTime(struct vnt_private *);
96 bool CARDbSetPhyParameter(struct vnt_private *, CARD_PHY_TYPE ePHYType,
97 			  unsigned short wCapInfo, unsigned char byERPField,
98 			  void *pvSupportRateIEs, void *pvExtSupportRateIEs);
99 bool CARDbUpdateTSF(struct vnt_private *, unsigned char byRxRate,
100 		    u64 qwBSSTimestamp, u64 qwLocalTSF);
101 bool CARDbStopTxPacket(struct vnt_private *, CARD_PKT_TYPE ePktType);
102 bool CARDbStartTxPacket(struct vnt_private *, CARD_PKT_TYPE ePktType);
103 bool CARDbSetBeaconPeriod(struct vnt_private *, unsigned short wBeaconInterval);
104 bool CARDbSetBSSID(struct vnt_private *,
105 		   unsigned char *pbyBSSID, enum nl80211_iftype);
106 
107 bool CARDbPowerDown(struct vnt_private *);
108 
109 bool CARDbSetTxDataRate(struct vnt_private *, unsigned short wDataRate);
110 
111 bool CARDbRemoveKey(struct vnt_private *, unsigned char *pbyBSSID);
112 
113 bool
114 CARDbAdd_PMKID_Candidate(
115 	struct vnt_private *,
116 	unsigned char *pbyBSSID,
117 	bool bRSNCapExist,
118 	unsigned short wRSNCap
119 );
120 
121 void *
122 CARDpGetCurrentAddress(
123 	struct vnt_private *
124 );
125 
126 bool
127 CARDbStartMeasure(
128 	struct vnt_private *,
129 	void *pvMeasureEIDs,
130 	unsigned int uNumOfMeasureEIDs
131 );
132 
133 bool
134 CARDbChannelSwitch(
135 	struct vnt_private *,
136 	unsigned char byMode,
137 	unsigned char byNewChannel,
138 	unsigned char byCount
139 );
140 
141 bool
142 CARDbSetQuiet(
143 	struct vnt_private *,
144 	bool bResetQuiet,
145 	unsigned char byQuietCount,
146 	unsigned char byQuietPeriod,
147 	unsigned short wQuietDuration,
148 	unsigned short wQuietOffset
149 );
150 
151 bool
152 CARDbStartQuiet(
153 	struct vnt_private *
154 );
155 
156 void
157 CARDvSetPowerConstraint(
158 	struct vnt_private *,
159 	unsigned char byChannel,
160 	char byPower
161 );
162 
163 void
164 CARDvGetPowerCapability(
165 	struct vnt_private *,
166 	unsigned char *pbyMinPower,
167 	unsigned char *pbyMaxPower
168 );
169 
170 char
171 CARDbyGetTransmitPower(
172 	struct vnt_private *
173 );
174 
175 #endif // __CARD_H__
176