blob: 2f1a05ef44a1665acf55657a3a1716e5e3bdc22d [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
Charles Clément830a6192010-05-07 12:30:20 -070080void CARDvSetRSPINF(void *pDeviceHandler, CARD_PHY_TYPE ePHYType);
81void vUpdateIFS(void *pDeviceHandler);
82void CARDvUpdateBasicTopRate(void *pDeviceHandler);
Charles Clément7b6a0012010-08-01 17:15:50 +020083bool CARDbAddBasicRate(void *pDeviceHandler, unsigned short wRateIdx);
84bool CARDbIsOFDMinBasicRate(void *pDeviceHandler);
Guillaume Clement16834402014-07-22 22:08:26 +020085void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode);
Charles Clément7b6a0012010-08-01 17:15:50 +020086bool CARDbSoftwareReset(void *pDeviceHandler);
Guillaume Clement16834402014-07-22 22:08:26 +020087void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterval);
88void CARDvUpdateNextTBTT(void __iomem *dwIoBase, QWORD qwTSF, unsigned short wBeaconInterval);
89bool CARDbGetCurrentTSF(void __iomem *dwIoBase, PQWORD pqwCurrTSF);
Charles Clément2986db52010-06-24 11:02:26 -070090QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval);
Charles Clément3fc9b582010-06-24 11:02:27 -070091QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2);
Charles Clément7b6a0012010-08-01 17:15:50 +020092bool CARDbSetTxPower(void *pDeviceHandler, unsigned long ulTxPower);
Charles Clément3fc9b582010-06-24 11:02:27 -070093unsigned char CARDbyGetPktType(void *pDeviceHandler);
Charles Clément830a6192010-05-07 12:30:20 -070094void CARDvSafeResetTx(void *pDeviceHandler);
95void CARDvSafeResetRx(void *pDeviceHandler);
Forest Bond5449c682009-04-25 10:30:44 -040096
Charles Clément7b6a0012010-08-01 17:15:50 +020097bool CARDbRadioPowerOff(void *pDeviceHandler);
98bool CARDbRadioPowerOn(void *pDeviceHandler);
Charles Clément7b6a0012010-08-01 17:15:50 +020099bool CARDbIsShortPreamble(void *pDeviceHandler);
100bool CARDbIsShorSlotTime(void *pDeviceHandler);
101bool CARDbSetPhyParameter(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, unsigned short wCapInfo, unsigned char byERPField, void *pvSupportRateIEs, void *pvExtSupportRateIEs);
102bool CARDbUpdateTSF(void *pDeviceHandler, unsigned char byRxRate, QWORD qwBSSTimestamp, QWORD qwLocalTSF);
103bool CARDbStopTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType);
104bool CARDbStartTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType);
105bool CARDbSetBeaconPeriod(void *pDeviceHandler, unsigned short wBeaconInterval);
106bool CARDbSetBSSID(void *pDeviceHandler, unsigned char *pbyBSSID, CARD_OP_MODE eOPMode);
Forest Bond5449c682009-04-25 10:30:44 -0400107
Charles Clément7b6a0012010-08-01 17:15:50 +0200108bool
Forest Bond5449c682009-04-25 10:30:44 -0400109CARDbPowerDown(
Joe Perchesd4945f02013-03-18 10:44:40 -0700110 void *pDeviceHandler
111);
Forest Bond5449c682009-04-25 10:30:44 -0400112
Charles Clément7b6a0012010-08-01 17:15:50 +0200113bool CARDbSetTxDataRate(
Joe Perchesd4945f02013-03-18 10:44:40 -0700114 void *pDeviceHandler,
115 unsigned short wDataRate
116);
Forest Bond5449c682009-04-25 10:30:44 -0400117
Joe Perchesd4945f02013-03-18 10:44:40 -0700118bool CARDbRemoveKey(void *pDeviceHandler, unsigned char *pbyBSSID);
Forest Bond5449c682009-04-25 10:30:44 -0400119
Charles Clément7b6a0012010-08-01 17:15:50 +0200120bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700121CARDbAdd_PMKID_Candidate(
122 void *pDeviceHandler,
123 unsigned char *pbyBSSID,
124 bool bRSNCapExist,
125 unsigned short wRSNCap
126);
Forest Bond5449c682009-04-25 10:30:44 -0400127
Charles Clément830a6192010-05-07 12:30:20 -0700128void *
Joe Perchesd4945f02013-03-18 10:44:40 -0700129CARDpGetCurrentAddress(
130 void *pDeviceHandler
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 -0700134CARDbStartMeasure(
135 void *pDeviceHandler,
136 void *pvMeasureEIDs,
137 unsigned int uNumOfMeasureEIDs
138);
Forest Bond5449c682009-04-25 10:30:44 -0400139
Charles Clément7b6a0012010-08-01 17:15:50 +0200140bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700141CARDbChannelSwitch(
142 void *pDeviceHandler,
143 unsigned char byMode,
144 unsigned char byNewChannel,
145 unsigned char byCount
146);
Forest Bond5449c682009-04-25 10:30:44 -0400147
Charles Clément7b6a0012010-08-01 17:15:50 +0200148bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700149CARDbSetQuiet(
150 void *pDeviceHandler,
151 bool bResetQuiet,
152 unsigned char byQuietCount,
153 unsigned char byQuietPeriod,
154 unsigned short wQuietDuration,
155 unsigned short wQuietOffset
156);
Forest Bond5449c682009-04-25 10:30:44 -0400157
Charles Clément7b6a0012010-08-01 17:15:50 +0200158bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700159CARDbStartQuiet(
160 void *pDeviceHandler
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 -0700164CARDvSetPowerConstraint(
165 void *pDeviceHandler,
166 unsigned char byChannel,
167 char byPower
168);
Forest Bond5449c682009-04-25 10:30:44 -0400169
Charles Clément6b35b7b2010-05-07 12:30:19 -0700170void
Joe Perchesd4945f02013-03-18 10:44:40 -0700171CARDvGetPowerCapability(
172 void *pDeviceHandler,
173 unsigned char *pbyMinPower,
174 unsigned char *pbyMaxPower
175);
Forest Bond5449c682009-04-25 10:30:44 -0400176
Charles Clémentec28c7f2010-05-28 12:34:18 -0700177char
Joe Perchesd4945f02013-03-18 10:44:40 -0700178CARDbyGetTransmitPower(
179 void *pDeviceHandler
180);
Forest Bond5449c682009-04-25 10:30:44 -0400181
Forest Bond5449c682009-04-25 10:30:44 -0400182#endif // __CARD_H__