blob: f7fd83404f34d4ca3ca983948f595ec907024f6d [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>
Forest Bond5449c682009-04-25 10:30:44 -040034
Forest Bond5449c682009-04-25 10:30:44 -040035//
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
Forest Bond5449c682009-04-25 10:30:44 -040043#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
Igor Bezukh7745bd62014-07-25 18:34:23 +030050#define CB_MAX_CHANNEL_5G 42
Forest Bond5449c682009-04-25 10:30:44 -040051#define CB_MAX_CHANNEL (CB_MAX_CHANNEL_24G+CB_MAX_CHANNEL_5G)
52
53typedef enum _CARD_PHY_TYPE {
Joe Perchesd4945f02013-03-18 10:44:40 -070054 PHY_TYPE_AUTO,
55 PHY_TYPE_11B,
56 PHY_TYPE_11G,
57 PHY_TYPE_11A
Forest Bond5449c682009-04-25 10:30:44 -040058} CARD_PHY_TYPE, *PCARD_PHY_TYPE;
59
60typedef enum _CARD_PKT_TYPE {
Joe Perchesd4945f02013-03-18 10:44:40 -070061 PKT_TYPE_802_11_BCN,
62 PKT_TYPE_802_11_MNG,
63 PKT_TYPE_802_11_DATA,
64 PKT_TYPE_802_11_ALL
Forest Bond5449c682009-04-25 10:30:44 -040065} CARD_PKT_TYPE, *PCARD_PKT_TYPE;
66
67typedef enum _CARD_STATUS_TYPE {
Joe Perchesd4945f02013-03-18 10:44:40 -070068 CARD_STATUS_MEDIA_CONNECT,
69 CARD_STATUS_MEDIA_DISCONNECT,
70 CARD_STATUS_PMKID
Forest Bond5449c682009-04-25 10:30:44 -040071} CARD_STATUS_TYPE, *PCARD_STATUS_TYPE;
72
73typedef enum _CARD_OP_MODE {
Joe Perchesd4945f02013-03-18 10:44:40 -070074 OP_MODE_INFRASTRUCTURE,
75 OP_MODE_ADHOC,
76 OP_MODE_AP,
77 OP_MODE_UNKNOWN
Forest Bond5449c682009-04-25 10:30:44 -040078} CARD_OP_MODE, *PCARD_OP_MODE;
79
Malcolm Priestleyd0522702014-08-10 15:46:57 +010080struct vnt_private;
81
82void CARDvSetRSPINF(struct vnt_private *, CARD_PHY_TYPE ePHYType);
83void vUpdateIFS(struct vnt_private *);
84void CARDvUpdateBasicTopRate(struct vnt_private *);
85bool CARDbAddBasicRate(struct vnt_private *, unsigned short wRateIdx);
86bool CARDbIsOFDMinBasicRate(struct vnt_private *);
Guillaume Clement16834402014-07-22 22:08:26 +020087void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode);
Malcolm Priestleyd0522702014-08-10 15:46:57 +010088bool CARDbSoftwareReset(struct vnt_private *);
Guillaume Clement16834402014-07-22 22:08:26 +020089void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterval);
Malcolm Priestley0fc2a762014-08-10 12:21:58 +010090void CARDvUpdateNextTBTT(void __iomem *dwIoBase, u64 qwTSF, unsigned short wBeaconInterval);
91bool CARDbGetCurrentTSF(void __iomem *dwIoBase, u64 *pqwCurrTSF);
92u64 CARDqGetNextTBTT(u64 qwTSF, unsigned short wBeaconInterval);
93u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2);
Malcolm Priestleyd0522702014-08-10 15:46:57 +010094bool CARDbSetTxPower(struct vnt_private *, unsigned long ulTxPower);
95unsigned char CARDbyGetPktType(struct vnt_private *);
96void CARDvSafeResetTx(struct vnt_private *);
97void CARDvSafeResetRx(struct vnt_private *);
98bool CARDbRadioPowerOff(struct vnt_private *);
99bool CARDbRadioPowerOn(struct vnt_private *);
100bool CARDbIsShortPreamble(struct vnt_private *);
101bool CARDbIsShorSlotTime(struct vnt_private *);
102bool CARDbSetPhyParameter(struct vnt_private *, CARD_PHY_TYPE ePHYType,
103 unsigned short wCapInfo, unsigned char byERPField,
104 void *pvSupportRateIEs, void *pvExtSupportRateIEs);
105bool CARDbUpdateTSF(struct vnt_private *, unsigned char byRxRate,
106 u64 qwBSSTimestamp, u64 qwLocalTSF);
107bool CARDbStopTxPacket(struct vnt_private *, CARD_PKT_TYPE ePktType);
108bool CARDbStartTxPacket(struct vnt_private *, CARD_PKT_TYPE ePktType);
109bool CARDbSetBeaconPeriod(struct vnt_private *, unsigned short wBeaconInterval);
110bool CARDbSetBSSID(struct vnt_private *,
111 unsigned char *pbyBSSID, CARD_OP_MODE eOPMode);
Forest Bond5449c682009-04-25 10:30:44 -0400112
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100113bool CARDbPowerDown(struct vnt_private *);
Forest Bond5449c682009-04-25 10:30:44 -0400114
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100115bool CARDbSetTxDataRate(struct vnt_private *, unsigned short wDataRate);
Forest Bond5449c682009-04-25 10:30:44 -0400116
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100117bool CARDbRemoveKey(struct vnt_private *, unsigned char *pbyBSSID);
Forest Bond5449c682009-04-25 10:30:44 -0400118
Charles Clément7b6a0012010-08-01 17:15:50 +0200119bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700120CARDbAdd_PMKID_Candidate(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100121 struct vnt_private *,
Joe Perchesd4945f02013-03-18 10:44:40 -0700122 unsigned char *pbyBSSID,
123 bool bRSNCapExist,
124 unsigned short wRSNCap
125);
Forest Bond5449c682009-04-25 10:30:44 -0400126
Charles Clément830a6192010-05-07 12:30:20 -0700127void *
Joe Perchesd4945f02013-03-18 10:44:40 -0700128CARDpGetCurrentAddress(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100129 struct vnt_private *
Joe Perchesd4945f02013-03-18 10:44:40 -0700130);
Forest Bond5449c682009-04-25 10:30:44 -0400131
Charles Clément7b6a0012010-08-01 17:15:50 +0200132bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700133CARDbStartMeasure(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100134 struct vnt_private *,
Joe Perchesd4945f02013-03-18 10:44:40 -0700135 void *pvMeasureEIDs,
136 unsigned int uNumOfMeasureEIDs
137);
Forest Bond5449c682009-04-25 10:30:44 -0400138
Charles Clément7b6a0012010-08-01 17:15:50 +0200139bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700140CARDbChannelSwitch(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100141 struct vnt_private *,
Joe Perchesd4945f02013-03-18 10:44:40 -0700142 unsigned char byMode,
143 unsigned char byNewChannel,
144 unsigned char byCount
145);
Forest Bond5449c682009-04-25 10:30:44 -0400146
Charles Clément7b6a0012010-08-01 17:15:50 +0200147bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700148CARDbSetQuiet(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100149 struct vnt_private *,
Joe Perchesd4945f02013-03-18 10:44:40 -0700150 bool bResetQuiet,
151 unsigned char byQuietCount,
152 unsigned char byQuietPeriod,
153 unsigned short wQuietDuration,
154 unsigned short wQuietOffset
155);
Forest Bond5449c682009-04-25 10:30:44 -0400156
Charles Clément7b6a0012010-08-01 17:15:50 +0200157bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700158CARDbStartQuiet(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100159 struct vnt_private *
Joe Perchesd4945f02013-03-18 10:44:40 -0700160);
Forest Bond5449c682009-04-25 10:30:44 -0400161
Charles Clément6b35b7b2010-05-07 12:30:19 -0700162void
Joe Perchesd4945f02013-03-18 10:44:40 -0700163CARDvSetPowerConstraint(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100164 struct vnt_private *,
Joe Perchesd4945f02013-03-18 10:44:40 -0700165 unsigned char byChannel,
166 char byPower
167);
Forest Bond5449c682009-04-25 10:30:44 -0400168
Charles Clément6b35b7b2010-05-07 12:30:19 -0700169void
Joe Perchesd4945f02013-03-18 10:44:40 -0700170CARDvGetPowerCapability(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100171 struct vnt_private *,
Joe Perchesd4945f02013-03-18 10:44:40 -0700172 unsigned char *pbyMinPower,
173 unsigned char *pbyMaxPower
174);
Forest Bond5449c682009-04-25 10:30:44 -0400175
Charles Clémentec28c7f2010-05-28 12:34:18 -0700176char
Joe Perchesd4945f02013-03-18 10:44:40 -0700177CARDbyGetTransmitPower(
Malcolm Priestleyd0522702014-08-10 15:46:57 +0100178 struct vnt_private *
Joe Perchesd4945f02013-03-18 10:44:40 -0700179);
Forest Bond5449c682009-04-25 10:30:44 -0400180
Forest Bond5449c682009-04-25 10:30:44 -0400181#endif // __CARD_H__