blob: e45b2ce58cbef1167a2ef31749713e61f5a9da6f [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
35/*--------------------- Export Definitions -------------------------*/
36//
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
44
45#define DEFAULT_MSDU_LIFETIME 512 // ms
46#define DEFAULT_MSDU_LIFETIME_RES_64us 8000 // 64us
47
48#define DEFAULT_MGN_LIFETIME 8 // ms
49#define DEFAULT_MGN_LIFETIME_RES_64us 125 // 64us
50
51#define CB_MAX_CHANNEL_24G 14
52#define CB_MAX_CHANNEL_5G 42 //[20050104] add channel9(5045MHz), 41==>42
53#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
75typedef enum _CARD_OP_MODE {
Joe Perchesd4945f02013-03-18 10:44:40 -070076 OP_MODE_INFRASTRUCTURE,
77 OP_MODE_ADHOC,
78 OP_MODE_AP,
79 OP_MODE_UNKNOWN
Forest Bond5449c682009-04-25 10:30:44 -040080} CARD_OP_MODE, *PCARD_OP_MODE;
81
82
83
84/*--------------------- Export Classes ----------------------------*/
85
86/*--------------------- Export Variables --------------------------*/
87
88/*--------------------- Export Functions --------------------------*/
Forest Bond5449c682009-04-25 10:30:44 -040089
Charles Clément830a6192010-05-07 12:30:20 -070090void CARDvSetRSPINF(void *pDeviceHandler, CARD_PHY_TYPE ePHYType);
91void vUpdateIFS(void *pDeviceHandler);
92void CARDvUpdateBasicTopRate(void *pDeviceHandler);
Charles Clément7b6a0012010-08-01 17:15:50 +020093bool CARDbAddBasicRate(void *pDeviceHandler, unsigned short wRateIdx);
94bool CARDbIsOFDMinBasicRate(void *pDeviceHandler);
Charles Clément2986db52010-06-24 11:02:26 -070095void CARDvSetLoopbackMode(unsigned long dwIoBase, unsigned short wLoopbackMode);
Charles Clément7b6a0012010-08-01 17:15:50 +020096bool CARDbSoftwareReset(void *pDeviceHandler);
Charles Clément2986db52010-06-24 11:02:26 -070097void CARDvSetFirstNextTBTT(unsigned long dwIoBase, unsigned short wBeaconInterval);
98void CARDvUpdateNextTBTT(unsigned long dwIoBase, QWORD qwTSF, unsigned short wBeaconInterval);
Charles Clément7b6a0012010-08-01 17:15:50 +020099bool CARDbGetCurrentTSF(unsigned long dwIoBase, PQWORD pqwCurrTSF);
Charles Clément2986db52010-06-24 11:02:26 -0700100QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval);
Charles Clément3fc9b582010-06-24 11:02:27 -0700101QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2);
Charles Clément7b6a0012010-08-01 17:15:50 +0200102bool CARDbSetTxPower(void *pDeviceHandler, unsigned long ulTxPower);
Charles Clément3fc9b582010-06-24 11:02:27 -0700103unsigned char CARDbyGetPktType(void *pDeviceHandler);
Charles Clément830a6192010-05-07 12:30:20 -0700104void CARDvSafeResetTx(void *pDeviceHandler);
105void CARDvSafeResetRx(void *pDeviceHandler);
Forest Bond5449c682009-04-25 10:30:44 -0400106
107//xxx
Charles Clément7b6a0012010-08-01 17:15:50 +0200108bool CARDbRadioPowerOff(void *pDeviceHandler);
109bool CARDbRadioPowerOn(void *pDeviceHandler);
110//bool CARDbSendPacket(void *pDeviceHandler, void *pPacket, CARD_PKT_TYPE ePktType, unsigned int uLength);
111bool CARDbIsShortPreamble(void *pDeviceHandler);
112bool CARDbIsShorSlotTime(void *pDeviceHandler);
113bool CARDbSetPhyParameter(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, unsigned short wCapInfo, unsigned char byERPField, void *pvSupportRateIEs, void *pvExtSupportRateIEs);
114bool CARDbUpdateTSF(void *pDeviceHandler, unsigned char byRxRate, QWORD qwBSSTimestamp, QWORD qwLocalTSF);
115bool CARDbStopTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType);
116bool CARDbStartTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType);
117bool CARDbSetBeaconPeriod(void *pDeviceHandler, unsigned short wBeaconInterval);
118bool CARDbSetBSSID(void *pDeviceHandler, unsigned char *pbyBSSID, CARD_OP_MODE eOPMode);
Forest Bond5449c682009-04-25 10:30:44 -0400119
Charles Clément7b6a0012010-08-01 17:15:50 +0200120bool
Forest Bond5449c682009-04-25 10:30:44 -0400121CARDbPowerDown(
Joe Perchesd4945f02013-03-18 10:44:40 -0700122 void *pDeviceHandler
123);
Forest Bond5449c682009-04-25 10:30:44 -0400124
Charles Clément7b6a0012010-08-01 17:15:50 +0200125bool CARDbSetTxDataRate(
Joe Perchesd4945f02013-03-18 10:44:40 -0700126 void *pDeviceHandler,
127 unsigned short wDataRate
128);
Forest Bond5449c682009-04-25 10:30:44 -0400129
130
Joe Perchesd4945f02013-03-18 10:44:40 -0700131bool CARDbRemoveKey(void *pDeviceHandler, unsigned char *pbyBSSID);
Forest Bond5449c682009-04-25 10:30:44 -0400132
Charles Clément7b6a0012010-08-01 17:15:50 +0200133bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700134CARDbAdd_PMKID_Candidate(
135 void *pDeviceHandler,
136 unsigned char *pbyBSSID,
137 bool bRSNCapExist,
138 unsigned short wRSNCap
139);
Forest Bond5449c682009-04-25 10:30:44 -0400140
Charles Clément830a6192010-05-07 12:30:20 -0700141void *
Joe Perchesd4945f02013-03-18 10:44:40 -0700142CARDpGetCurrentAddress(
143 void *pDeviceHandler
144);
Forest Bond5449c682009-04-25 10:30:44 -0400145
Charles Clément7b6a0012010-08-01 17:15:50 +0200146bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700147CARDbStartMeasure(
148 void *pDeviceHandler,
149 void *pvMeasureEIDs,
150 unsigned int uNumOfMeasureEIDs
151);
Forest Bond5449c682009-04-25 10:30:44 -0400152
Charles Clément7b6a0012010-08-01 17:15:50 +0200153bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700154CARDbChannelSwitch(
155 void *pDeviceHandler,
156 unsigned char byMode,
157 unsigned char byNewChannel,
158 unsigned char byCount
159);
Forest Bond5449c682009-04-25 10:30:44 -0400160
Charles Clément7b6a0012010-08-01 17:15:50 +0200161bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700162CARDbSetQuiet(
163 void *pDeviceHandler,
164 bool bResetQuiet,
165 unsigned char byQuietCount,
166 unsigned char byQuietPeriod,
167 unsigned short wQuietDuration,
168 unsigned short wQuietOffset
169);
Forest Bond5449c682009-04-25 10:30:44 -0400170
Charles Clément7b6a0012010-08-01 17:15:50 +0200171bool
Joe Perchesd4945f02013-03-18 10:44:40 -0700172CARDbStartQuiet(
173 void *pDeviceHandler
174);
Forest Bond5449c682009-04-25 10:30:44 -0400175
Charles Clément6b35b7b2010-05-07 12:30:19 -0700176void
Joe Perchesd4945f02013-03-18 10:44:40 -0700177CARDvSetPowerConstraint(
178 void *pDeviceHandler,
179 unsigned char byChannel,
180 char byPower
181);
Forest Bond5449c682009-04-25 10:30:44 -0400182
Charles Clément6b35b7b2010-05-07 12:30:19 -0700183void
Joe Perchesd4945f02013-03-18 10:44:40 -0700184CARDvGetPowerCapability(
185 void *pDeviceHandler,
186 unsigned char *pbyMinPower,
187 unsigned char *pbyMaxPower
188);
Forest Bond5449c682009-04-25 10:30:44 -0400189
Charles Clémentec28c7f2010-05-28 12:34:18 -0700190char
Joe Perchesd4945f02013-03-18 10:44:40 -0700191CARDbyGetTransmitPower(
192 void *pDeviceHandler
193);
Forest Bond5449c682009-04-25 10:30:44 -0400194
Forest Bond5449c682009-04-25 10:30:44 -0400195#endif // __CARD_H__
196
197
198