blob: e5bde092055308ec79a8866d04df980628ac1877 [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
Nicky Chorley79bffc52014-10-26 06:30:29 +000036/*
37 * Loopback mode
38 *
39 * LOBYTE is MAC LB mode, HIBYTE is MII LB mode
40 */
Forest Bond5449c682009-04-25 10:30:44 -040041#define CARD_LB_NONE MAKEWORD(MAC_LB_NONE, 0)
Nicky Chorley79bffc52014-10-26 06:30:29 +000042#define CARD_LB_MAC MAKEWORD(MAC_LB_INTERNAL, 0) /* PHY must ISO, avoid MAC loopback packet go out */
Forest Bond5449c682009-04-25 10:30:44 -040043#define CARD_LB_PHY MAKEWORD(MAC_LB_EXT, 0)
44
Nicky Chorley79bffc52014-10-26 06:30:29 +000045#define DEFAULT_MSDU_LIFETIME 512 /* ms */
46#define DEFAULT_MSDU_LIFETIME_RES_64us 8000 /* 64us */
Forest Bond5449c682009-04-25 10:30:44 -040047
Nicky Chorley79bffc52014-10-26 06:30:29 +000048#define DEFAULT_MGN_LIFETIME 8 /* ms */
49#define DEFAULT_MGN_LIFETIME_RES_64us 125 /* 64us */
Forest Bond5449c682009-04-25 10:30:44 -040050
51#define CB_MAX_CHANNEL_24G 14
Igor Bezukh7745bd62014-07-25 18:34:23 +030052#define CB_MAX_CHANNEL_5G 42
Forest Bond5449c682009-04-25 10:30:44 -040053#define CB_MAX_CHANNEL (CB_MAX_CHANNEL_24G+CB_MAX_CHANNEL_5G)
54
55typedef enum _CARD_PHY_TYPE {
Joe Perchesd4945f02013-03-18 10:44:40 -070056 PHY_TYPE_AUTO,
57 PHY_TYPE_11B,
58 PHY_TYPE_11G,
59 PHY_TYPE_11A
Forest Bond5449c682009-04-25 10:30:44 -040060} CARD_PHY_TYPE, *PCARD_PHY_TYPE;
61
62typedef enum _CARD_PKT_TYPE {
Joe Perchesd4945f02013-03-18 10:44:40 -070063 PKT_TYPE_802_11_BCN,
64 PKT_TYPE_802_11_MNG,
65 PKT_TYPE_802_11_DATA,
66 PKT_TYPE_802_11_ALL
Forest Bond5449c682009-04-25 10:30:44 -040067} CARD_PKT_TYPE, *PCARD_PKT_TYPE;
68
69typedef enum _CARD_STATUS_TYPE {
Joe Perchesd4945f02013-03-18 10:44:40 -070070 CARD_STATUS_MEDIA_CONNECT,
71 CARD_STATUS_MEDIA_DISCONNECT,
72 CARD_STATUS_PMKID
Forest Bond5449c682009-04-25 10:30:44 -040073} CARD_STATUS_TYPE, *PCARD_STATUS_TYPE;
74
Malcolm Priestleyd0522702014-08-10 15:46:57 +010075struct vnt_private;
76
77void CARDvSetRSPINF(struct vnt_private *, CARD_PHY_TYPE ePHYType);
78void vUpdateIFS(struct vnt_private *);
79void CARDvUpdateBasicTopRate(struct vnt_private *);
80bool CARDbAddBasicRate(struct vnt_private *, unsigned short wRateIdx);
81bool CARDbIsOFDMinBasicRate(struct vnt_private *);
Guillaume Clement16834402014-07-22 22:08:26 +020082void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode);
Malcolm Priestleyd0522702014-08-10 15:46:57 +010083bool CARDbSoftwareReset(struct vnt_private *);
Guillaume Clement16834402014-07-22 22:08:26 +020084void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterval);
Malcolm Priestley0fc2a762014-08-10 12:21:58 +010085void CARDvUpdateNextTBTT(void __iomem *dwIoBase, u64 qwTSF, unsigned short wBeaconInterval);
86bool CARDbGetCurrentTSF(void __iomem *dwIoBase, u64 *pqwCurrTSF);
87u64 CARDqGetNextTBTT(u64 qwTSF, unsigned short wBeaconInterval);
88u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2);
Malcolm Priestleyd0522702014-08-10 15:46:57 +010089bool CARDbSetTxPower(struct vnt_private *, unsigned long ulTxPower);
90unsigned char CARDbyGetPktType(struct vnt_private *);
91void CARDvSafeResetTx(struct vnt_private *);
92void CARDvSafeResetRx(struct vnt_private *);
93bool CARDbRadioPowerOff(struct vnt_private *);
94bool CARDbRadioPowerOn(struct vnt_private *);
95bool CARDbIsShortPreamble(struct vnt_private *);
96bool CARDbIsShorSlotTime(struct vnt_private *);
97bool CARDbSetPhyParameter(struct vnt_private *, CARD_PHY_TYPE ePHYType,
98 unsigned short wCapInfo, unsigned char byERPField,
99 void *pvSupportRateIEs, void *pvExtSupportRateIEs);
100bool CARDbUpdateTSF(struct vnt_private *, unsigned char byRxRate,
101 u64 qwBSSTimestamp, u64 qwLocalTSF);
102bool CARDbStopTxPacket(struct vnt_private *, CARD_PKT_TYPE ePktType);
103bool CARDbStartTxPacket(struct vnt_private *, CARD_PKT_TYPE ePktType);
104bool CARDbSetBeaconPeriod(struct vnt_private *, unsigned short wBeaconInterval);
105bool CARDbSetBSSID(struct vnt_private *,
Malcolm Priestleya9873672014-08-30 22:25:49 +0100106 unsigned char *pbyBSSID, enum nl80211_iftype);
Forest Bond5449c682009-04-25 10:30:44 -0400107
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100108bool CARDbPowerDown(struct vnt_private *);
Forest Bond5449c682009-04-25 10:30:44 -0400109
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100110bool CARDbSetTxDataRate(struct vnt_private *, unsigned short wDataRate);
Forest Bond5449c682009-04-25 10:30:44 -0400111
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100112bool CARDbRemoveKey(struct vnt_private *, unsigned char *pbyBSSID);
Forest Bond5449c682009-04-25 10:30:44 -0400113
Charles Clément7b6a0012010-08-01 17:15:50 +0200114bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700115CARDbAdd_PMKID_Candidate(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100116 struct vnt_private *,
Joe Perchesd4945f02013-03-18 10:44:40 -0700117 unsigned char *pbyBSSID,
118 bool bRSNCapExist,
119 unsigned short wRSNCap
120);
Forest Bond5449c682009-04-25 10:30:44 -0400121
Charles Clément830a6192010-05-07 12:30:20 -0700122void *
Joe Perchesd4945f02013-03-18 10:44:40 -0700123CARDpGetCurrentAddress(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100124 struct vnt_private *
Joe Perchesd4945f02013-03-18 10:44:40 -0700125);
Forest Bond5449c682009-04-25 10:30:44 -0400126
Charles Clément7b6a0012010-08-01 17:15:50 +0200127bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700128CARDbStartMeasure(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100129 struct vnt_private *,
Joe Perchesd4945f02013-03-18 10:44:40 -0700130 void *pvMeasureEIDs,
131 unsigned int uNumOfMeasureEIDs
132);
Forest Bond5449c682009-04-25 10:30:44 -0400133
Charles Clément7b6a0012010-08-01 17:15:50 +0200134bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700135CARDbChannelSwitch(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100136 struct vnt_private *,
Joe Perchesd4945f02013-03-18 10:44:40 -0700137 unsigned char byMode,
138 unsigned char byNewChannel,
139 unsigned char byCount
140);
Forest Bond5449c682009-04-25 10:30:44 -0400141
Charles Clément7b6a0012010-08-01 17:15:50 +0200142bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700143CARDbSetQuiet(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100144 struct vnt_private *,
Joe Perchesd4945f02013-03-18 10:44:40 -0700145 bool bResetQuiet,
146 unsigned char byQuietCount,
147 unsigned char byQuietPeriod,
148 unsigned short wQuietDuration,
149 unsigned short wQuietOffset
150);
Forest Bond5449c682009-04-25 10:30:44 -0400151
Charles Clément7b6a0012010-08-01 17:15:50 +0200152bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700153CARDbStartQuiet(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100154 struct vnt_private *
Joe Perchesd4945f02013-03-18 10:44:40 -0700155);
Forest Bond5449c682009-04-25 10:30:44 -0400156
Charles Clément6b35b7b2010-05-07 12:30:19 -0700157void
Joe Perchesd4945f02013-03-18 10:44:40 -0700158CARDvSetPowerConstraint(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100159 struct vnt_private *,
Joe Perchesd4945f02013-03-18 10:44:40 -0700160 unsigned char byChannel,
161 char byPower
162);
Forest Bond5449c682009-04-25 10:30:44 -0400163
Charles Clément6b35b7b2010-05-07 12:30:19 -0700164void
Joe Perchesd4945f02013-03-18 10:44:40 -0700165CARDvGetPowerCapability(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100166 struct vnt_private *,
Joe Perchesd4945f02013-03-18 10:44:40 -0700167 unsigned char *pbyMinPower,
168 unsigned char *pbyMaxPower
169);
Forest Bond5449c682009-04-25 10:30:44 -0400170
Charles Clémentec28c7f2010-05-28 12:34:18 -0700171char
Joe Perchesd4945f02013-03-18 10:44:40 -0700172CARDbyGetTransmitPower(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100173 struct vnt_private *
Joe Perchesd4945f02013-03-18 10:44:40 -0700174);
Forest Bond5449c682009-04-25 10:30:44 -0400175
Nicky Chorley79bffc52014-10-26 06:30:29 +0000176#endif /* __CARD_H__ */