Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 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 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 29 | #ifndef __CARD_H__ |
| 30 | #define __CARD_H__ |
| 31 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 32 | #include "ttype.h" |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 33 | #include <linux/types.h> |
Malcolm Priestley | a987367 | 2014-08-30 22:25:49 +0100 | [diff] [blame] | 34 | #include <linux/nl80211.h> |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 35 | |
Nicky Chorley | 79bffc5 | 2014-10-26 06:30:29 +0000 | [diff] [blame] | 36 | /* |
| 37 | * Loopback mode |
| 38 | * |
| 39 | * LOBYTE is MAC LB mode, HIBYTE is MII LB mode |
| 40 | */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 41 | #define CARD_LB_NONE MAKEWORD(MAC_LB_NONE, 0) |
Nicky Chorley | 79bffc5 | 2014-10-26 06:30:29 +0000 | [diff] [blame] | 42 | #define CARD_LB_MAC MAKEWORD(MAC_LB_INTERNAL, 0) /* PHY must ISO, avoid MAC loopback packet go out */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 43 | #define CARD_LB_PHY MAKEWORD(MAC_LB_EXT, 0) |
| 44 | |
Nicky Chorley | 79bffc5 | 2014-10-26 06:30:29 +0000 | [diff] [blame] | 45 | #define DEFAULT_MSDU_LIFETIME 512 /* ms */ |
| 46 | #define DEFAULT_MSDU_LIFETIME_RES_64us 8000 /* 64us */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 47 | |
Nicky Chorley | 79bffc5 | 2014-10-26 06:30:29 +0000 | [diff] [blame] | 48 | #define DEFAULT_MGN_LIFETIME 8 /* ms */ |
| 49 | #define DEFAULT_MGN_LIFETIME_RES_64us 125 /* 64us */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 50 | |
| 51 | #define CB_MAX_CHANNEL_24G 14 |
Igor Bezukh | 7745bd6 | 2014-07-25 18:34:23 +0300 | [diff] [blame] | 52 | #define CB_MAX_CHANNEL_5G 42 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 53 | #define CB_MAX_CHANNEL (CB_MAX_CHANNEL_24G+CB_MAX_CHANNEL_5G) |
| 54 | |
| 55 | typedef enum _CARD_PHY_TYPE { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 56 | PHY_TYPE_AUTO, |
| 57 | PHY_TYPE_11B, |
| 58 | PHY_TYPE_11G, |
| 59 | PHY_TYPE_11A |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 60 | } CARD_PHY_TYPE, *PCARD_PHY_TYPE; |
| 61 | |
| 62 | typedef enum _CARD_PKT_TYPE { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 63 | PKT_TYPE_802_11_BCN, |
| 64 | PKT_TYPE_802_11_MNG, |
| 65 | PKT_TYPE_802_11_DATA, |
| 66 | PKT_TYPE_802_11_ALL |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 67 | } CARD_PKT_TYPE, *PCARD_PKT_TYPE; |
| 68 | |
| 69 | typedef enum _CARD_STATUS_TYPE { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 70 | CARD_STATUS_MEDIA_CONNECT, |
| 71 | CARD_STATUS_MEDIA_DISCONNECT, |
| 72 | CARD_STATUS_PMKID |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 73 | } CARD_STATUS_TYPE, *PCARD_STATUS_TYPE; |
| 74 | |
Malcolm Priestley | d052270 | 2014-08-10 15:46:57 +0100 | [diff] [blame] | 75 | struct vnt_private; |
| 76 | |
| 77 | void CARDvSetRSPINF(struct vnt_private *, CARD_PHY_TYPE ePHYType); |
| 78 | void vUpdateIFS(struct vnt_private *); |
| 79 | void CARDvUpdateBasicTopRate(struct vnt_private *); |
| 80 | bool CARDbAddBasicRate(struct vnt_private *, unsigned short wRateIdx); |
| 81 | bool CARDbIsOFDMinBasicRate(struct vnt_private *); |
Guillaume Clement | 1683440 | 2014-07-22 22:08:26 +0200 | [diff] [blame] | 82 | void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode); |
Malcolm Priestley | d052270 | 2014-08-10 15:46:57 +0100 | [diff] [blame] | 83 | bool CARDbSoftwareReset(struct vnt_private *); |
Guillaume Clement | 1683440 | 2014-07-22 22:08:26 +0200 | [diff] [blame] | 84 | void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterval); |
Malcolm Priestley | 0fc2a76 | 2014-08-10 12:21:58 +0100 | [diff] [blame] | 85 | void CARDvUpdateNextTBTT(void __iomem *dwIoBase, u64 qwTSF, unsigned short wBeaconInterval); |
| 86 | bool CARDbGetCurrentTSF(void __iomem *dwIoBase, u64 *pqwCurrTSF); |
| 87 | u64 CARDqGetNextTBTT(u64 qwTSF, unsigned short wBeaconInterval); |
| 88 | u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2); |
Malcolm Priestley | d052270 | 2014-08-10 15:46:57 +0100 | [diff] [blame] | 89 | bool CARDbSetTxPower(struct vnt_private *, unsigned long ulTxPower); |
| 90 | unsigned char CARDbyGetPktType(struct vnt_private *); |
| 91 | void CARDvSafeResetTx(struct vnt_private *); |
| 92 | void CARDvSafeResetRx(struct vnt_private *); |
| 93 | bool CARDbRadioPowerOff(struct vnt_private *); |
| 94 | bool CARDbRadioPowerOn(struct vnt_private *); |
| 95 | bool CARDbIsShortPreamble(struct vnt_private *); |
| 96 | bool CARDbIsShorSlotTime(struct vnt_private *); |
| 97 | bool CARDbSetPhyParameter(struct vnt_private *, CARD_PHY_TYPE ePHYType, |
| 98 | unsigned short wCapInfo, unsigned char byERPField, |
| 99 | void *pvSupportRateIEs, void *pvExtSupportRateIEs); |
| 100 | bool CARDbUpdateTSF(struct vnt_private *, unsigned char byRxRate, |
| 101 | u64 qwBSSTimestamp, u64 qwLocalTSF); |
| 102 | bool CARDbStopTxPacket(struct vnt_private *, CARD_PKT_TYPE ePktType); |
| 103 | bool CARDbStartTxPacket(struct vnt_private *, CARD_PKT_TYPE ePktType); |
| 104 | bool CARDbSetBeaconPeriod(struct vnt_private *, unsigned short wBeaconInterval); |
| 105 | bool CARDbSetBSSID(struct vnt_private *, |
Malcolm Priestley | a987367 | 2014-08-30 22:25:49 +0100 | [diff] [blame] | 106 | unsigned char *pbyBSSID, enum nl80211_iftype); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 107 | |
Malcolm Priestley | d052270 | 2014-08-10 15:46:57 +0100 | [diff] [blame] | 108 | bool CARDbPowerDown(struct vnt_private *); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 109 | |
Malcolm Priestley | d052270 | 2014-08-10 15:46:57 +0100 | [diff] [blame] | 110 | bool CARDbSetTxDataRate(struct vnt_private *, unsigned short wDataRate); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 111 | |
Malcolm Priestley | d052270 | 2014-08-10 15:46:57 +0100 | [diff] [blame] | 112 | bool CARDbRemoveKey(struct vnt_private *, unsigned char *pbyBSSID); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 113 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 114 | bool |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 115 | CARDbAdd_PMKID_Candidate( |
Malcolm Priestley | d052270 | 2014-08-10 15:46:57 +0100 | [diff] [blame] | 116 | struct vnt_private *, |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 117 | unsigned char *pbyBSSID, |
| 118 | bool bRSNCapExist, |
| 119 | unsigned short wRSNCap |
| 120 | ); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 121 | |
Charles Clément | 830a619 | 2010-05-07 12:30:20 -0700 | [diff] [blame] | 122 | void * |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 123 | CARDpGetCurrentAddress( |
Malcolm Priestley | d052270 | 2014-08-10 15:46:57 +0100 | [diff] [blame] | 124 | struct vnt_private * |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 125 | ); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 126 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 127 | bool |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 128 | CARDbStartMeasure( |
Malcolm Priestley | d052270 | 2014-08-10 15:46:57 +0100 | [diff] [blame] | 129 | struct vnt_private *, |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 130 | void *pvMeasureEIDs, |
| 131 | unsigned int uNumOfMeasureEIDs |
| 132 | ); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 133 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 134 | bool |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 135 | CARDbChannelSwitch( |
Malcolm Priestley | d052270 | 2014-08-10 15:46:57 +0100 | [diff] [blame] | 136 | struct vnt_private *, |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 137 | unsigned char byMode, |
| 138 | unsigned char byNewChannel, |
| 139 | unsigned char byCount |
| 140 | ); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 141 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 142 | bool |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 143 | CARDbSetQuiet( |
Malcolm Priestley | d052270 | 2014-08-10 15:46:57 +0100 | [diff] [blame] | 144 | struct vnt_private *, |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 145 | bool bResetQuiet, |
| 146 | unsigned char byQuietCount, |
| 147 | unsigned char byQuietPeriod, |
| 148 | unsigned short wQuietDuration, |
| 149 | unsigned short wQuietOffset |
| 150 | ); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 151 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 152 | bool |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 153 | CARDbStartQuiet( |
Malcolm Priestley | d052270 | 2014-08-10 15:46:57 +0100 | [diff] [blame] | 154 | struct vnt_private * |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 155 | ); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 156 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 157 | void |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 158 | CARDvSetPowerConstraint( |
Malcolm Priestley | d052270 | 2014-08-10 15:46:57 +0100 | [diff] [blame] | 159 | struct vnt_private *, |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 160 | unsigned char byChannel, |
| 161 | char byPower |
| 162 | ); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 163 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 164 | void |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 165 | CARDvGetPowerCapability( |
Malcolm Priestley | d052270 | 2014-08-10 15:46:57 +0100 | [diff] [blame] | 166 | struct vnt_private *, |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 167 | unsigned char *pbyMinPower, |
| 168 | unsigned char *pbyMaxPower |
| 169 | ); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 170 | |
Charles Clément | ec28c7f | 2010-05-28 12:34:18 -0700 | [diff] [blame] | 171 | char |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 172 | CARDbyGetTransmitPower( |
Malcolm Priestley | d052270 | 2014-08-10 15:46:57 +0100 | [diff] [blame] | 173 | struct vnt_private * |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 174 | ); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 175 | |
Nicky Chorley | 79bffc5 | 2014-10-26 06:30:29 +0000 | [diff] [blame] | 176 | #endif /* __CARD_H__ */ |