blob: 96f5b6c46e82ed06f5924e9b70b8a59c0708bf45 [file] [log] [blame]
Forest Bond5449c682009-04-25 10:30:44 -04001/*
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 Bond5449c682009-04-25 10:30:44 -040029#ifndef __CARD_H__
30#define __CARD_H__
31
Forest Bond5449c682009-04-25 10:30:44 -040032#include "ttype.h"
Charles Clément7b6a0012010-08-01 17:15:50 +020033#include <linux/types.h>
Malcolm Priestleya9873672014-08-30 22:25:49 +010034#include <linux/nl80211.h>
Forest Bond5449c682009-04-25 10:30:44 -040035
Forest Bond5449c682009-04-25 10:30:44 -040036//
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
Forest Bond5449c682009-04-25 10:30:44 -040044#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
Igor Bezukh7745bd62014-07-25 18:34:23 +030051#define CB_MAX_CHANNEL_5G 42
Forest Bond5449c682009-04-25 10:30:44 -040052#define CB_MAX_CHANNEL (CB_MAX_CHANNEL_24G+CB_MAX_CHANNEL_5G)
53
54typedef enum _CARD_PHY_TYPE {
Joe Perchesd4945f02013-03-18 10:44:40 -070055 PHY_TYPE_AUTO,
56 PHY_TYPE_11B,
57 PHY_TYPE_11G,
58 PHY_TYPE_11A
Forest Bond5449c682009-04-25 10:30:44 -040059} CARD_PHY_TYPE, *PCARD_PHY_TYPE;
60
61typedef enum _CARD_PKT_TYPE {
Joe Perchesd4945f02013-03-18 10:44:40 -070062 PKT_TYPE_802_11_BCN,
63 PKT_TYPE_802_11_MNG,
64 PKT_TYPE_802_11_DATA,
65 PKT_TYPE_802_11_ALL
Forest Bond5449c682009-04-25 10:30:44 -040066} CARD_PKT_TYPE, *PCARD_PKT_TYPE;
67
68typedef enum _CARD_STATUS_TYPE {
Joe Perchesd4945f02013-03-18 10:44:40 -070069 CARD_STATUS_MEDIA_CONNECT,
70 CARD_STATUS_MEDIA_DISCONNECT,
71 CARD_STATUS_PMKID
Forest Bond5449c682009-04-25 10:30:44 -040072} CARD_STATUS_TYPE, *PCARD_STATUS_TYPE;
73
Malcolm Priestleyd0522702014-08-10 15:46:57 +010074struct vnt_private;
75
76void CARDvSetRSPINF(struct vnt_private *, CARD_PHY_TYPE ePHYType);
77void vUpdateIFS(struct vnt_private *);
78void CARDvUpdateBasicTopRate(struct vnt_private *);
79bool CARDbAddBasicRate(struct vnt_private *, unsigned short wRateIdx);
80bool CARDbIsOFDMinBasicRate(struct vnt_private *);
Guillaume Clement16834402014-07-22 22:08:26 +020081void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode);
Malcolm Priestleyd0522702014-08-10 15:46:57 +010082bool CARDbSoftwareReset(struct vnt_private *);
Guillaume Clement16834402014-07-22 22:08:26 +020083void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterval);
Malcolm Priestley0fc2a762014-08-10 12:21:58 +010084void CARDvUpdateNextTBTT(void __iomem *dwIoBase, u64 qwTSF, unsigned short wBeaconInterval);
85bool CARDbGetCurrentTSF(void __iomem *dwIoBase, u64 *pqwCurrTSF);
86u64 CARDqGetNextTBTT(u64 qwTSF, unsigned short wBeaconInterval);
87u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2);
Malcolm Priestleyd0522702014-08-10 15:46:57 +010088bool CARDbSetTxPower(struct vnt_private *, unsigned long ulTxPower);
89unsigned char CARDbyGetPktType(struct vnt_private *);
90void CARDvSafeResetTx(struct vnt_private *);
91void CARDvSafeResetRx(struct vnt_private *);
92bool CARDbRadioPowerOff(struct vnt_private *);
93bool CARDbRadioPowerOn(struct vnt_private *);
94bool CARDbIsShortPreamble(struct vnt_private *);
95bool CARDbIsShorSlotTime(struct vnt_private *);
96bool CARDbSetPhyParameter(struct vnt_private *, CARD_PHY_TYPE ePHYType,
97 unsigned short wCapInfo, unsigned char byERPField,
98 void *pvSupportRateIEs, void *pvExtSupportRateIEs);
99bool CARDbUpdateTSF(struct vnt_private *, unsigned char byRxRate,
100 u64 qwBSSTimestamp, u64 qwLocalTSF);
101bool CARDbStopTxPacket(struct vnt_private *, CARD_PKT_TYPE ePktType);
102bool CARDbStartTxPacket(struct vnt_private *, CARD_PKT_TYPE ePktType);
103bool CARDbSetBeaconPeriod(struct vnt_private *, unsigned short wBeaconInterval);
104bool CARDbSetBSSID(struct vnt_private *,
Malcolm Priestleya9873672014-08-30 22:25:49 +0100105 unsigned char *pbyBSSID, enum nl80211_iftype);
Forest Bond5449c682009-04-25 10:30:44 -0400106
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100107bool CARDbPowerDown(struct vnt_private *);
Forest Bond5449c682009-04-25 10:30:44 -0400108
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100109bool CARDbSetTxDataRate(struct vnt_private *, unsigned short wDataRate);
Forest Bond5449c682009-04-25 10:30:44 -0400110
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100111bool CARDbRemoveKey(struct vnt_private *, unsigned char *pbyBSSID);
Forest Bond5449c682009-04-25 10:30:44 -0400112
Charles Clément7b6a0012010-08-01 17:15:50 +0200113bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700114CARDbAdd_PMKID_Candidate(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100115 struct vnt_private *,
Joe Perchesd4945f02013-03-18 10:44:40 -0700116 unsigned char *pbyBSSID,
117 bool bRSNCapExist,
118 unsigned short wRSNCap
119);
Forest Bond5449c682009-04-25 10:30:44 -0400120
Charles Clément830a6192010-05-07 12:30:20 -0700121void *
Joe Perchesd4945f02013-03-18 10:44:40 -0700122CARDpGetCurrentAddress(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100123 struct vnt_private *
Joe Perchesd4945f02013-03-18 10:44:40 -0700124);
Forest Bond5449c682009-04-25 10:30:44 -0400125
Charles Clément7b6a0012010-08-01 17:15:50 +0200126bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700127CARDbStartMeasure(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100128 struct vnt_private *,
Joe Perchesd4945f02013-03-18 10:44:40 -0700129 void *pvMeasureEIDs,
130 unsigned int uNumOfMeasureEIDs
131);
Forest Bond5449c682009-04-25 10:30:44 -0400132
Charles Clément7b6a0012010-08-01 17:15:50 +0200133bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700134CARDbChannelSwitch(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100135 struct vnt_private *,
Joe Perchesd4945f02013-03-18 10:44:40 -0700136 unsigned char byMode,
137 unsigned char byNewChannel,
138 unsigned char byCount
139);
Forest Bond5449c682009-04-25 10:30:44 -0400140
Charles Clément7b6a0012010-08-01 17:15:50 +0200141bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700142CARDbSetQuiet(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100143 struct vnt_private *,
Joe Perchesd4945f02013-03-18 10:44:40 -0700144 bool bResetQuiet,
145 unsigned char byQuietCount,
146 unsigned char byQuietPeriod,
147 unsigned short wQuietDuration,
148 unsigned short wQuietOffset
149);
Forest Bond5449c682009-04-25 10:30:44 -0400150
Charles Clément7b6a0012010-08-01 17:15:50 +0200151bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700152CARDbStartQuiet(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100153 struct vnt_private *
Joe Perchesd4945f02013-03-18 10:44:40 -0700154);
Forest Bond5449c682009-04-25 10:30:44 -0400155
Charles Clément6b35b7b2010-05-07 12:30:19 -0700156void
Joe Perchesd4945f02013-03-18 10:44:40 -0700157CARDvSetPowerConstraint(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100158 struct vnt_private *,
Joe Perchesd4945f02013-03-18 10:44:40 -0700159 unsigned char byChannel,
160 char byPower
161);
Forest Bond5449c682009-04-25 10:30:44 -0400162
Charles Clément6b35b7b2010-05-07 12:30:19 -0700163void
Joe Perchesd4945f02013-03-18 10:44:40 -0700164CARDvGetPowerCapability(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100165 struct vnt_private *,
Joe Perchesd4945f02013-03-18 10:44:40 -0700166 unsigned char *pbyMinPower,
167 unsigned char *pbyMaxPower
168);
Forest Bond5449c682009-04-25 10:30:44 -0400169
Charles Clémentec28c7f2010-05-28 12:34:18 -0700170char
Joe Perchesd4945f02013-03-18 10:44:40 -0700171CARDbyGetTransmitPower(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100172 struct vnt_private *
Joe Perchesd4945f02013-03-18 10:44:40 -0700173);
Forest Bond5449c682009-04-25 10:30:44 -0400174
Forest Bond5449c682009-04-25 10:30:44 -0400175#endif // __CARD_H__