提交 36c7928c 编写于 作者: B Bartlomiej Zolnierkiewicz 提交者: Greg Kroah-Hartman

Staging: add rt3090 wireless driver

This is the vendor driver for the Ralink RT3090 chipset.

It should be later cleaned and ported to use the existing rt2x00
infrastructure or just replaced by the proper version.

[ Unfortunately since it follows the same design/implementation like
  rt{286,287,307}0 drivers (already present in the staging tree)
  it is highly unlikely that it will see much love from the wireless
  development community.. ]

However since the development of the cleaner/proper version can take
significant time lets give distros (i.e. openSUSE seems to already
have the package with the original vendor driver) and users "something"
to use in the meantime.

I forward ported it to 2.6.31-rc1, ported to the Linux build system
and did some initial cleanups.  More fixes/cleanups to come later
(it seems that the driver can be made to share most of its code with
the other Ralink drivers already present in the staging tree).
Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 fd882783
...@@ -75,6 +75,8 @@ source "drivers/staging/rt2870/Kconfig" ...@@ -75,6 +75,8 @@ source "drivers/staging/rt2870/Kconfig"
source "drivers/staging/rt3070/Kconfig" source "drivers/staging/rt3070/Kconfig"
source "drivers/staging/rt3090/Kconfig"
source "drivers/staging/comedi/Kconfig" source "drivers/staging/comedi/Kconfig"
source "drivers/staging/asus_oled/Kconfig" source "drivers/staging/asus_oled/Kconfig"
......
...@@ -20,6 +20,7 @@ obj-$(CONFIG_OTUS) += otus/ ...@@ -20,6 +20,7 @@ obj-$(CONFIG_OTUS) += otus/
obj-$(CONFIG_RT2860) += rt2860/ obj-$(CONFIG_RT2860) += rt2860/
obj-$(CONFIG_RT2870) += rt2870/ obj-$(CONFIG_RT2870) += rt2870/
obj-$(CONFIG_RT3070) += rt3070/ obj-$(CONFIG_RT3070) += rt3070/
obj-$(CONFIG_RT3090) += rt3090/
obj-$(CONFIG_COMEDI) += comedi/ obj-$(CONFIG_COMEDI) += comedi/
obj-$(CONFIG_ASUS_OLED) += asus_oled/ obj-$(CONFIG_ASUS_OLED) += asus_oled/
obj-$(CONFIG_PANEL) += panel/ obj-$(CONFIG_PANEL) += panel/
......
config RT3090
tristate "Ralink 3090 wireless support"
depends on PCI && X86 && WLAN_80211
---help---
This is an experimental driver for the Ralink 3090 wireless chip.
obj-$(CONFIG_RT3090) += rt3090sta.o
include drivers/staging/rt3090/config.mk
rt3090sta-objs := \
common/crypt_md5.o \
common/crypt_sha2.o \
common/crypt_hmac.o \
common/mlme.o \
common/cmm_wep.o \
common/action.o \
common/cmm_data.o \
common/rtmp_init.o \
common/cmm_tkip.o \
common/cmm_aes.o \
common/cmm_sync.o \
common/eeprom.o \
common/cmm_sanity.o \
common/cmm_info.o \
common/cmm_cfg.o \
common/cmm_wpa.o \
common/dfs.o \
common/spectrum.o \
common/rtmp_timer.o \
common/rt_channel.o \
common/cmm_profile.o \
common/cmm_asic.o \
sta/assoc.o \
sta/auth.o \
sta/auth_rsp.o \
sta/sync.o \
sta/sanity.o \
sta/rtmp_data.o \
sta/connect.o \
sta/wpa.o \
rt_linux.o \
rt_profile.o \
rt_main_dev.o \
sta_ioctl.o
#ifdef DOT11_N_SUPPORT
ifeq ($(HAS_DOT11_N_SUPPORT),y)
rt3090sta-objs += \
common/ba_action.o
endif
#endif // DOT11_N_SUPPORT //
#ifdef ETH_CONVERT
ifeq ($(HAS_ETH_CONVERT_SUPPORT), y)
rt3090sta-objs += \
common/cmm_mat.o \
common/cmm_mat_iparp.o \
common/cmm_mat_pppoe.o \
common/cmm_mat_ipv6.o
endif
#endif // ETH_CONVERT //
ifeq ($(HAS_BLOCK_NET_IF),y)
rt3090sta-objs += common/netif_block.o
endif
ifeq ($(HAS_QOS_DLS_SUPPORT),y)
rt3090sta-objs += sta/dls.o
endif
rt3090sta-objs += \
pci_main_dev.o \
rt_pci_rbus.o \
common/cmm_mac_pci.o \
common/cmm_data_pci.o \
common/ee_prom.o \
common/ee_efuse.o \
common/rtmp_mcu.o \
chips/rt30xx.o \
common/rt_rf.o \
chips/rt3090.o
ifeq ($(HAS_ATE),y)
rt3090sta-objs += rt_ate.o
endif
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
aironet.h
Abstract:
Revision History:
Who When What
-------- ---------- ----------------------------------------------
Name Date Modification logs
Paul Lin 04-06-15 Initial
*/
#ifndef __ACTION_H__
#define __ACTION_H__
typedef struct PACKED __HT_INFO_OCTET
{
#ifdef RT_BIG_ENDIAN
UCHAR Reserved:5;
UCHAR STA_Channel_Width:1;
UCHAR Forty_MHz_Intolerant:1;
UCHAR Request:1;
#else
UCHAR Request:1;
UCHAR Forty_MHz_Intolerant:1;
UCHAR STA_Channel_Width:1;
UCHAR Reserved:5;
#endif
} HT_INFORMATION_OCTET;
typedef struct PACKED __FRAME_HT_INFO
{
HEADER_802_11 Hdr;
UCHAR Category;
UCHAR Action;
HT_INFORMATION_OCTET HT_Info;
} FRAME_HT_INFO, *PFRAME_HT_INFO;
#endif /* __ACTION_H__ */
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
ap.h
Abstract:
Miniport generic portion header file
Revision History:
Who When What
-------- ---------- ----------------------------------------------
Paul Lin 08-01-2002 created
James Tan 09-06-2002 modified (Revise NTCRegTable)
John Chang 12-22-2004 modified for RT2561/2661. merge with STA driver
*/
#ifndef __AP_H__
#define __AP_H__
// =============================================================
// Function Prototypes
// =============================================================
// ap_data.c
BOOLEAN APBridgeToWirelessSta(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pHeader,
IN UINT HdrLen,
IN PUCHAR pData,
IN UINT DataLen,
IN ULONG fromwdsidx);
VOID APSendPackets(
IN NDIS_HANDLE MiniportAdapterContext,
IN PPNDIS_PACKET ppPacketArray,
IN UINT NumberOfPackets);
NDIS_STATUS APSendPacket(
IN PRTMP_ADAPTER pAd,
IN PNDIS_PACKET pPacket);
NDIS_STATUS APHardTransmit(
IN PRTMP_ADAPTER pAd,
IN TX_BLK *pTxBlk,
IN UCHAR QueIdx);
VOID APRxEAPOLFrameIndicate(
IN PRTMP_ADAPTER pAd,
IN MAC_TABLE_ENTRY *pEntry,
IN RX_BLK *pRxBlk,
IN UCHAR FromWhichBSSID);
NDIS_STATUS APCheckRxError(
IN PRTMP_ADAPTER pAd,
IN PRT28XX_RXD_STRUC pRxD,
IN UCHAR Wcid);
BOOLEAN APCheckClass2Class3Error(
IN PRTMP_ADAPTER pAd,
IN ULONG Wcid,
IN PHEADER_802_11 pHeader);
VOID APHandleRxPsPoll(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pAddr,
IN USHORT Aid,
IN BOOLEAN isActive);
VOID RTMPDescriptorEndianChange(
IN PUCHAR pData,
IN ULONG DescriptorType);
VOID RTMPFrameEndianChange(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pData,
IN ULONG Dir,
IN BOOLEAN FromRxDoneInt);
// ap_assoc.c
VOID APAssocStateMachineInit(
IN PRTMP_ADAPTER pAd,
IN STATE_MACHINE *S,
OUT STATE_MACHINE_FUNC Trans[]);
VOID APPeerAssocReqAction(
IN PRTMP_ADAPTER pAd,
IN MLME_QUEUE_ELEM *Elem);
VOID APPeerReassocReqAction(
IN PRTMP_ADAPTER pAd,
IN MLME_QUEUE_ELEM *Elem);
VOID APPeerDisassocReqAction(
IN PRTMP_ADAPTER pAd,
IN MLME_QUEUE_ELEM *Elem);
VOID MbssKickOutStas(
IN PRTMP_ADAPTER pAd,
IN INT apidx,
IN USHORT Reason);
VOID APMlmeKickOutSta(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pStaAddr,
IN UCHAR Wcid,
IN USHORT Reason);
VOID APMlmeDisassocReqAction(
IN PRTMP_ADAPTER pAd,
IN MLME_QUEUE_ELEM *Elem);
VOID APCls3errAction(
IN PRTMP_ADAPTER pAd,
IN ULONG Wcid,
IN PHEADER_802_11 pHeader);
USHORT APBuildAssociation(
IN PRTMP_ADAPTER pAd,
IN MAC_TABLE_ENTRY *pEntry,
IN USHORT CapabilityInfo,
IN UCHAR MaxSupportedRateIn500Kbps,
IN UCHAR *RSN,
IN UCHAR *pRSNLen,
IN BOOLEAN bWmmCapable,
IN ULONG RalinkIe,
#ifdef DOT11N_DRAFT3
IN EXT_CAP_INFO_ELEMENT ExtCapInfo,
#endif // DOT11N_DRAFT3 //
IN HT_CAPABILITY_IE *pHtCapability,
IN UCHAR HtCapabilityLen,
OUT USHORT *pAid);
/*
VOID RTMPAddClientSec(
IN PRTMP_ADAPTER pAd,
IN UCHAR BssIdx,
IN UCHAR KeyIdx,
IN UCHAR CipherAlg,
IN PUCHAR pKey,
IN PUCHAR pTxMic,
IN PUCHAR pRxMic,
IN MAC_TABLE_ENTRY *pEntry);
*/
// ap_auth.c
void APAuthStateMachineInit(
IN PRTMP_ADAPTER pAd,
IN STATE_MACHINE *Sm,
OUT STATE_MACHINE_FUNC Trans[]);
VOID APCls2errAction(
IN PRTMP_ADAPTER pAd,
IN ULONG Wcid,
IN PHEADER_802_11 pHeader);
// ap_connect.c
VOID APMakeBssBeacon(
IN PRTMP_ADAPTER pAd,
IN INT apidx);
VOID APUpdateBeaconFrame(
IN PRTMP_ADAPTER pAd,
IN INT apidx);
VOID APMakeAllBssBeacon(
IN PRTMP_ADAPTER pAd);
VOID APUpdateAllBeaconFrame(
IN PRTMP_ADAPTER pAd);
// ap_sync.c
VOID APSyncStateMachineInit(
IN PRTMP_ADAPTER pAd,
IN STATE_MACHINE *Sm,
OUT STATE_MACHINE_FUNC Trans[]);
VOID APScanTimeout(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3);
VOID APInvalidStateWhenScan(
IN PRTMP_ADAPTER pAd,
IN MLME_QUEUE_ELEM *Elem);
VOID APScanTimeoutAction(
IN PRTMP_ADAPTER pAd,
IN MLME_QUEUE_ELEM *Elem);
VOID APPeerProbeReqAction(
IN PRTMP_ADAPTER pAd,
IN MLME_QUEUE_ELEM *Elem);
VOID APPeerBeaconAction(
IN PRTMP_ADAPTER pAd,
IN MLME_QUEUE_ELEM *Elem);
VOID APMlmeScanReqAction(
IN PRTMP_ADAPTER pAd,
IN MLME_QUEUE_ELEM *Elem);
VOID APPeerBeaconAtScanAction(
IN PRTMP_ADAPTER pAd,
IN MLME_QUEUE_ELEM *Elem);
VOID APScanCnclAction(
IN PRTMP_ADAPTER pAd,
IN MLME_QUEUE_ELEM *Elem);
VOID ApSiteSurvey(
IN PRTMP_ADAPTER pAd,
IN PNDIS_802_11_SSID pSsid,
IN UCHAR ScanType);
VOID SupportRate(
IN PUCHAR SupRate,
IN UCHAR SupRateLen,
IN PUCHAR ExtRate,
IN UCHAR ExtRateLen,
OUT PUCHAR *Rates,
OUT PUCHAR RatesLen,
OUT PUCHAR pMaxSupportRate);
BOOLEAN ApScanRunning(
IN PRTMP_ADAPTER pAd);
#ifdef DOT11N_DRAFT3
VOID APOverlappingBSSScan(
IN RTMP_ADAPTER *pAd);
#endif // DOT11N_DRAFT3 //
// ap_wpa.c
VOID WpaStateMachineInit(
IN PRTMP_ADAPTER pAd,
IN STATE_MACHINE *Sm,
OUT STATE_MACHINE_FUNC Trans[]);
// ap_mlme.c
VOID APMlmePeriodicExec(
IN PRTMP_ADAPTER pAd);
VOID APMlmeSelectTxRateTable(
IN PRTMP_ADAPTER pAd,
IN PMAC_TABLE_ENTRY pEntry,
IN PUCHAR *ppTable,
IN PUCHAR pTableSize,
IN PUCHAR pInitTxRateIdx);
VOID APMlmeSetTxRate(
IN PRTMP_ADAPTER pAd,
IN PMAC_TABLE_ENTRY pEntry,
IN PRTMP_TX_RATE_SWITCH pTxRate);
VOID APMlmeDynamicTxRateSwitching(
IN PRTMP_ADAPTER pAd);
VOID APQuickResponeForRateUpExec(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3);
BOOLEAN APMsgTypeSubst(
IN PRTMP_ADAPTER pAd,
IN PFRAME_802_11 pFrame,
OUT INT *Machine,
OUT INT *MsgType);
VOID APQuickResponeForRateUpExec(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3);
VOID RTMPSetPiggyBack(
IN PRTMP_ADAPTER pAd,
IN BOOLEAN bPiggyBack);
VOID APAsicEvaluateRxAnt(
IN PRTMP_ADAPTER pAd);
VOID APAsicRxAntEvalTimeout(
IN PRTMP_ADAPTER pAd);
// ap.c
VOID APSwitchChannel(
IN PRTMP_ADAPTER pAd,
IN INT Channel);
NDIS_STATUS APInitialize(
IN PRTMP_ADAPTER pAd);
VOID APShutdown(
IN PRTMP_ADAPTER pAd);
VOID APStartUp(
IN PRTMP_ADAPTER pAd);
VOID APStop(
IN PRTMP_ADAPTER pAd);
VOID APCleanupPsQueue(
IN PRTMP_ADAPTER pAd,
IN PQUEUE_HEADER pQueue);
VOID MacTableReset(
IN PRTMP_ADAPTER pAd);
MAC_TABLE_ENTRY *MacTableInsertEntry(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pAddr,
IN UCHAR apidx,
IN BOOLEAN CleanAll);
BOOLEAN MacTableDeleteEntry(
IN PRTMP_ADAPTER pAd,
IN USHORT wcid,
IN PUCHAR pAddr);
MAC_TABLE_ENTRY *MacTableLookup(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pAddr);
VOID MacTableMaintenance(
IN PRTMP_ADAPTER pAd);
UINT32 MacTableAssocStaNumGet(
IN PRTMP_ADAPTER pAd);
MAC_TABLE_ENTRY *APSsPsInquiry(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pAddr,
OUT SST *Sst,
OUT USHORT *Aid,
OUT UCHAR *PsMode,
OUT UCHAR *Rate);
BOOLEAN APPsIndicate(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pAddr,
IN ULONG Wcid,
IN UCHAR Psm);
VOID ApLogEvent(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pAddr,
IN USHORT Event);
#ifdef DOT11_N_SUPPORT
VOID APUpdateOperationMode(
IN PRTMP_ADAPTER pAd);
#endif // DOT11_N_SUPPORT //
VOID APUpdateCapabilityAndErpIe(
IN PRTMP_ADAPTER pAd);
BOOLEAN ApCheckAccessControlList(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pAddr,
IN UCHAR Apidx);
VOID ApUpdateAccessControlList(
IN PRTMP_ADAPTER pAd,
IN UCHAR Apidx);
VOID ApEnqueueNullFrame(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pAddr,
IN UCHAR TxRate,
IN UCHAR PID,
IN UCHAR apidx,
IN BOOLEAN bQosNull,
IN BOOLEAN bEOSP,
IN UCHAR OldUP);
VOID ApSendFrame(
IN PRTMP_ADAPTER pAd,
IN PVOID pBuffer,
IN ULONG Length,
IN UCHAR TxRate,
IN UCHAR PID);
VOID ApEnqueueAckFrame(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pAddr,
IN UCHAR TxRate,
IN UCHAR apidx);
// ap_sanity.c
BOOLEAN PeerAssocReqCmmSanity(
IN PRTMP_ADAPTER pAd,
IN BOOLEAN isRessoc,
IN VOID *Msg,
IN ULONG MsgLen,
OUT PUCHAR pAddr2,
OUT USHORT *pCapabilityInfo,
OUT USHORT *pListenInterval,
OUT PUCHAR pApAddr,
OUT UCHAR *pSsidLen,
OUT char *Ssid,
OUT UCHAR *pRatesLen,
OUT UCHAR Rates[],
OUT UCHAR *RSN,
OUT UCHAR *pRSNLen,
OUT BOOLEAN *pbWmmCapable,
OUT ULONG *pRalinkIe,
#ifdef DOT11N_DRAFT3
OUT EXT_CAP_INFO_ELEMENT *pExtCapInfo,
#endif // DOT11N_DRAFT3 //
OUT UCHAR *pHtCapabilityLen,
OUT HT_CAPABILITY_IE *pHtCapability);
BOOLEAN PeerDisassocReqSanity(
IN PRTMP_ADAPTER pAd,
IN VOID *Msg,
IN ULONG MsgLen,
OUT PUCHAR pAddr2,
OUT USHORT *Reason);
BOOLEAN PeerDeauthReqSanity(
IN PRTMP_ADAPTER pAd,
IN VOID *Msg,
IN ULONG MsgLen,
OUT PUCHAR pAddr2,
OUT USHORT *Reason);
BOOLEAN APPeerAuthSanity(
IN PRTMP_ADAPTER pAd,
IN VOID *Msg,
IN ULONG MsgLen,
OUT PUCHAR pAddr1,
OUT PUCHAR pAddr2,
OUT USHORT *Alg,
OUT USHORT *Seq,
OUT USHORT *Status,
OUT CHAR *ChlgText
);
BOOLEAN APPeerProbeReqSanity(
IN PRTMP_ADAPTER pAd,
IN VOID *Msg,
IN ULONG MsgLen,
OUT PUCHAR pAddr2,
OUT CHAR Ssid[],
OUT UCHAR *SsidLen);
BOOLEAN APPeerBeaconAndProbeRspSanity(
IN PRTMP_ADAPTER pAd,
IN VOID *Msg,
IN ULONG MsgLen,
OUT PUCHAR pAddr2,
OUT PUCHAR pBssid,
OUT CHAR Ssid[],
OUT UCHAR *SsidLen,
OUT UCHAR *BssType,
OUT USHORT *BeaconPeriod,
OUT UCHAR *Channel,
OUT LARGE_INTEGER *Timestamp,
OUT USHORT *CapabilityInfo,
OUT UCHAR Rate[],
OUT UCHAR *RateLen,
OUT BOOLEAN *ExtendedRateIeExist,
OUT UCHAR *Erp);
#if defined(RT30xx) || defined(RT305x)
VOID EnableAPMIMOPS(
IN PRTMP_ADAPTER pAd);
VOID DisableAPMIMOPS(
IN PRTMP_ADAPTER pAd);
#endif
#endif // __AP_H__
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
ap_apcli.h
Abstract:
Miniport generic portion header file
Revision History:
Who When What
-------- ---------- ----------------------------------------------
Shiang, Fonchi 02-13-2007 created
*/
#ifndef _AP_APCLI_H_
#define _AP_APCLI_H_
#ifdef APCLI_SUPPORT
#include "rtmp.h"
#define AUTH_TIMEOUT 300 // unit: msec
#define ASSOC_TIMEOUT 300 // unit: msec
//#define JOIN_TIMEOUT 2000 // unit: msec // not used in Ap-client mode, remove it
#define PROBE_TIMEOUT 1000 // unit: msec
#define APCLI_ROOT_BSSID_GET(pAd, wcid) ((pAd)->MacTab.Content[(wcid)].Addr)
#define APCLI_IF_UP_CHECK(pAd, ifidx) ((pAd)->ApCfg.ApCliTab[(ifidx)].dev->flags & IFF_UP)
/* sanity check for apidx */
#define APCLI_MR_APIDX_SANITY_CHECK(idx) \
{ \
if ((idx) >= MAX_APCLI_NUM) \
{ \
(idx) = 0; \
DBGPRINT(RT_DEBUG_ERROR, ("%s> Error! apcli-idx > MAX_APCLI_NUM!\n", __FUNCTION__)); \
} \
}
typedef struct _APCLI_MLME_JOIN_REQ_STRUCT {
UCHAR Bssid[MAC_ADDR_LEN];
UCHAR SsidLen;
UCHAR Ssid[MAX_LEN_OF_SSID];
} APCLI_MLME_JOIN_REQ_STRUCT;
typedef struct _STA_CTRL_JOIN_REQ_STRUCT {
USHORT Status;
} APCLI_CTRL_MSG_STRUCT, *PSTA_CTRL_MSG_STRUCT;
BOOLEAN isValidApCliIf(
SHORT ifIndex);
//
// Private routines in apcli_ctrl.c
//
VOID ApCliCtrlStateMachineInit(
IN PRTMP_ADAPTER pAd,
IN STATE_MACHINE_EX *Sm,
OUT STATE_MACHINE_FUNC_EX Trans[]);
//
// Private routines in apcli_sync.c
//
VOID ApCliSyncStateMachineInit(
IN PRTMP_ADAPTER pAd,
IN STATE_MACHINE_EX *Sm,
OUT STATE_MACHINE_FUNC_EX Trans[]);
//
// Private routines in apcli_auth.c
//
VOID ApCliAuthStateMachineInit(
IN PRTMP_ADAPTER pAd,
IN STATE_MACHINE_EX *Sm,
OUT STATE_MACHINE_FUNC_EX Trans[]);
//
// Private routines in apcli_assoc.c
//
VOID ApCliAssocStateMachineInit(
IN PRTMP_ADAPTER pAd,
IN STATE_MACHINE_EX *Sm,
OUT STATE_MACHINE_FUNC_EX Trans[]);
MAC_TABLE_ENTRY *ApCliTableLookUpByWcid(
IN PRTMP_ADAPTER pAd,
IN UCHAR wcid,
IN PUCHAR pAddrs);
BOOLEAN ApCliAllowToSendPacket(
IN RTMP_ADAPTER *pAd,
IN PNDIS_PACKET pPacket,
OUT UCHAR *pWcid);
BOOLEAN ApCliValidateRSNIE(
IN PRTMP_ADAPTER pAd,
IN PEID_STRUCT pEid_ptr,
IN USHORT eid_len,
IN USHORT idx);
VOID RT28xx_ApCli_Init(
IN PRTMP_ADAPTER pAd,
IN PNET_DEV pPhyNetDev);
VOID RT28xx_ApCli_Close(
IN PRTMP_ADAPTER pAd);
VOID RT28xx_ApCli_Remove(
IN PRTMP_ADAPTER pAd);
VOID RT28xx_ApCli_Remove(
IN PRTMP_ADAPTER ad_p);
INT ApCliIfLookUp(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pAddr);
INT ApCli_VirtualIF_Open(
IN PNET_DEV dev_p);
INT ApCli_VirtualIF_Close(
IN PNET_DEV dev_p);
INT ApCli_VirtualIF_PacketSend(
IN PNDIS_PACKET skb_p,
IN PNET_DEV dev_p);
INT ApCli_VirtualIF_Ioctl(
IN PNET_DEV dev_p,
IN OUT struct ifreq *rq_p,
IN INT cmd);
VOID ApCliMgtMacHeaderInit(
IN PRTMP_ADAPTER pAd,
IN OUT PHEADER_802_11 pHdr80211,
IN UCHAR SubType,
IN UCHAR ToDs,
IN PUCHAR pDA,
IN PUCHAR pBssid,
IN USHORT ifIndex);
#ifdef DOT11_N_SUPPORT
BOOLEAN ApCliCheckHt(
IN PRTMP_ADAPTER pAd,
IN USHORT IfIndex,
IN OUT HT_CAPABILITY_IE *pHtCapability,
IN OUT ADD_HT_INFO_IE *pAddHtInfo);
#endif // DOT11_N_SUPPORT //
BOOLEAN ApCliLinkUp(
IN PRTMP_ADAPTER pAd,
IN UCHAR ifIndex);
VOID ApCliLinkDown(
IN PRTMP_ADAPTER pAd,
IN UCHAR ifIndex);
VOID ApCliIfUp(
IN PRTMP_ADAPTER pAd);
VOID ApCliIfDown(
IN PRTMP_ADAPTER pAd);
VOID ApCliIfMonitor(
IN PRTMP_ADAPTER pAd);
BOOLEAN ApCliMsgTypeSubst(
IN PRTMP_ADAPTER pAd,
IN PFRAME_802_11 pFrame,
OUT INT *Machine,
OUT INT *MsgType);
BOOLEAN preCheckMsgTypeSubset(
IN PRTMP_ADAPTER pAd,
IN PFRAME_802_11 pFrame,
OUT INT *Machine,
OUT INT *MsgType);
BOOLEAN ApCliPeerAssocRspSanity(
IN PRTMP_ADAPTER pAd,
IN VOID *pMsg,
IN ULONG MsgLen,
OUT PUCHAR pAddr2,
OUT USHORT *pCapabilityInfo,
OUT USHORT *pStatus,
OUT USHORT *pAid,
OUT UCHAR SupRate[],
OUT UCHAR *pSupRateLen,
OUT UCHAR ExtRate[],
OUT UCHAR *pExtRateLen,
OUT HT_CAPABILITY_IE *pHtCapability,
OUT ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE
OUT UCHAR *pHtCapabilityLen,
OUT UCHAR *pAddHtInfoLen,
OUT UCHAR *pNewExtChannelOffset,
OUT PEDCA_PARM pEdcaParm,
OUT UCHAR *pCkipFlag);
VOID ApCliPeerPairMsg1Action(
IN PRTMP_ADAPTER pAd,
IN MAC_TABLE_ENTRY *pEntry,
IN MLME_QUEUE_ELEM *Elem);
VOID ApCliPeerPairMsg3Action(
IN PRTMP_ADAPTER pAd,
IN MAC_TABLE_ENTRY *pEntry,
IN MLME_QUEUE_ELEM *Elem);
VOID ApCliPeerGroupMsg1Action(
IN PRTMP_ADAPTER pAd,
IN MAC_TABLE_ENTRY *pEntry,
IN MLME_QUEUE_ELEM *Elem);
BOOLEAN ApCliCheckRSNIE(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pData,
IN UCHAR DataLen,
IN MAC_TABLE_ENTRY *pEntry,
OUT UCHAR *Offset);
BOOLEAN ApCliParseKeyData(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pKeyData,
IN UCHAR KeyDataLen,
IN MAC_TABLE_ENTRY *pEntry,
IN UCHAR IfIdx,
IN UCHAR bPairewise);
BOOLEAN ApCliHandleRxBroadcastFrame(
IN PRTMP_ADAPTER pAd,
IN RX_BLK *pRxBlk,
IN MAC_TABLE_ENTRY *pEntry,
IN UCHAR FromWhichBSSID);
VOID APCliUpdatePairwiseKeyTable(
IN PRTMP_ADAPTER pAd,
IN UCHAR *KeyRsc,
IN MAC_TABLE_ENTRY *pEntry);
BOOLEAN APCliUpdateSharedKeyTable(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pKey,
IN UCHAR KeyLen,
IN UCHAR DefaultKeyIdx,
IN MAC_TABLE_ENTRY *pEntry);
#endif // APCLI_SUPPORT //
#endif /* _AP_APCLI_H_ */
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
ap_autoChSel.h
Abstract:
Miniport generic portion header file
Revision History:
Who When What
-------- ---------- ----------------------------------------------
*/
#include "ap_autoChSel_cmm.h"
#ifndef __AUTOCHSELECT_H__
#define __AUTOCHSELECT_H__
#ifdef AUTO_CH_SELECT_ENHANCE
#define AP_AUTO_CH_SEL(__P, __O) New_APAutoSelectChannel((__P), (__O))
#else
#define AP_AUTO_CH_SEL(__P, __O) APAutoSelectChannel((__P), (__O))
#endif
ULONG AutoChBssInsertEntry(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pBssid,
IN CHAR Ssid[],
IN UCHAR SsidLen,
IN UCHAR ChannelNo,
IN UCHAR ExtChOffset,
IN CHAR Rssi);
void AutoChBssTableInit(
IN PRTMP_ADAPTER pAd);
void ChannelInfoInit(
IN PRTMP_ADAPTER pAd);
void AutoChBssTableDestroy(
IN PRTMP_ADAPTER pAd);
void ChannelInfoDestroy(
IN PRTMP_ADAPTER pAd);
UCHAR New_APAutoSelectChannel(
IN PRTMP_ADAPTER pAd,
IN BOOLEAN Optimal);
UCHAR APAutoSelectChannel(
IN PRTMP_ADAPTER pAd,
IN BOOLEAN Optimal);
#endif // __AUTOCHSELECT_H__ //
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
ap_autoChSel_cmm.h
Abstract:
Miniport generic portion header file
Revision History:
Who When What
-------- ---------- ----------------------------------------------
*/
#ifndef __AUTOCHSELECT_CMM_H__
#define __AUTOCHSELECT_CMM_H__
#define RSSI_TO_DBM_OFFSET 120 // RSSI-115 = dBm
typedef struct {
ULONG dirtyness[MAX_NUM_OF_CHANNELS+1];
ULONG max_rssi[MAX_NUM_OF_CHANNELS+1];
ULONG total_rssi[MAX_NUM_OF_CHANNELS+1];
UINT32 FalseCCA[MAX_NUM_OF_CHANNELS+1];
} CHANNELINFO, *PCHANNELINFO;
typedef struct {
UCHAR Bssid[MAC_ADDR_LEN];
UCHAR SsidLen;
CHAR Ssid[MAX_LEN_OF_SSID];
UCHAR Channel;
UCHAR ExtChOffset;
UCHAR Rssi;
} BSSENTRY, *PBSSENTRY;
typedef struct {
UCHAR BssNr;
BSSENTRY BssEntry[MAX_LEN_OF_BSS_TABLE];
} BSSINFO, *PBSSINFO;
#endif // __AUTOCHSELECT_CMM_H__ //
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
ap_cfg.h
Abstract:
Miniport generic portion header file
Revision History:
Who When What
-------- ---------- ----------------------------------------------
*/
#ifndef __AP_CFG_H__
#define __AP_CFG_H__
#include "rt_config.h"
INT RTMPAPPrivIoctlSet(
IN RTMP_ADAPTER *pAd,
IN struct iwreq *pIoctlCmdStr);
INT RTMPAPPrivIoctlShow(
IN RTMP_ADAPTER *pAd,
IN struct iwreq *pIoctlCmdStr);
INT RTMPAPSetInformation(
IN PRTMP_ADAPTER pAd,
IN OUT struct iwreq *rq,
IN INT cmd);
INT RTMPAPQueryInformation(
IN PRTMP_ADAPTER pAd,
IN OUT struct iwreq *rq,
IN INT cmd);
VOID RTMPIoctlStatistics(
IN PRTMP_ADAPTER pAd,
IN struct iwreq *wrq);
VOID RTMPIoctlGetMacTable(
IN PRTMP_ADAPTER pAd,
IN struct iwreq *wrq);
#ifdef DBG
VOID RTMPAPIoctlBBP(
IN PRTMP_ADAPTER pAdapter,
IN struct iwreq *wrq);
VOID RTMPAPIoctlMAC(
IN PRTMP_ADAPTER pAdapter,
IN struct iwreq *wrq);
VOID RTMPAPIoctlE2PROM(
IN PRTMP_ADAPTER pAdapter,
IN struct iwreq *wrq);
#ifdef RTMP_RF_RW_SUPPORT
VOID RTMPAPIoctlRF(
IN PRTMP_ADAPTER pAdapter,
IN struct iwreq *wrq);
#endif // RTMP_RF_RW_SUPPORT //
#endif // DBG //
VOID RT28XX_IOCTL_MaxRateGet(
IN RTMP_ADAPTER *pAd,
IN PHTTRANSMIT_SETTING pHtPhyMode,
OUT UINT32 *pRate);
#ifdef DOT11_N_SUPPORT
VOID RTMPIoctlQueryBaTable(
IN PRTMP_ADAPTER pAd,
IN struct iwreq *wrq);
#endif // DOT11_N_SUPPORT //
VOID RTMPIoctlStaticWepCopy(
IN PRTMP_ADAPTER pAd,
IN struct iwreq *wrq);
VOID RTMPIoctlRadiusData(
IN PRTMP_ADAPTER pAd,
IN struct iwreq *wrq);
VOID RTMPIoctlAddWPAKey(
IN PRTMP_ADAPTER pAd,
IN struct iwreq *wrq);
VOID RTMPIoctlAddPMKIDCache(
IN PRTMP_ADAPTER pAd,
IN struct iwreq *wrq);
#endif // __AP_CFG_H__ //
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
ap_ids.h
Abstract:
Miniport generic portion header file
Revision History:
Who When What
-------- ---------- ----------------------------------------------
*/
VOID RTMPIdsPeriodicExec(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3);
BOOLEAN RTMPSpoofedMgmtDetection(
IN PRTMP_ADAPTER pAd,
IN PHEADER_802_11 pHeader,
IN CHAR Rssi0,
IN CHAR Rssi1,
IN CHAR Rssi2);
VOID RTMPConflictSsidDetection(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pSsid,
IN UCHAR SsidLen,
IN CHAR Rssi0,
IN CHAR Rssi1,
IN CHAR Rssi2);
BOOLEAN RTMPReplayAttackDetection(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pAddr2,
IN CHAR Rssi0,
IN CHAR Rssi1,
IN CHAR Rssi2);
VOID RTMPUpdateStaMgmtCounter(
IN PRTMP_ADAPTER pAd,
IN USHORT type);
VOID RTMPClearAllIdsCounter(
IN PRTMP_ADAPTER pAd);
VOID RTMPIdsStart(
IN PRTMP_ADAPTER pAd);
VOID RTMPIdsStop(
IN PRTMP_ADAPTER pAd);
VOID rtmp_read_ids_from_file(
IN PRTMP_ADAPTER pAd,
char *tmpbuf,
char *buffer);
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
ap_mbss.h
Abstract:
Miniport generic portion header file
Revision History:
Who When What
-------- ---------- ----------------------------------------------
*/
#ifndef MODULE_MBSS
#define MBSS_EXTERN extern
#else
#define MBSS_EXTERN
#endif // MODULE_MBSS //
/* Public function list */
MBSS_EXTERN VOID RT28xx_MBSS_Init(
IN PRTMP_ADAPTER ad_p,
IN PNET_DEV main_dev_p);
MBSS_EXTERN VOID RT28xx_MBSS_Close(
IN PRTMP_ADAPTER ad_p);
MBSS_EXTERN VOID RT28xx_MBSS_Remove(
IN PRTMP_ADAPTER ad_p);
INT MBSS_VirtualIF_Open(
IN PNET_DEV dev_p);
INT MBSS_VirtualIF_Close(
IN PNET_DEV dev_p);
INT MBSS_VirtualIF_PacketSend(
IN PNDIS_PACKET skb_p,
IN PNET_DEV dev_p);
INT MBSS_VirtualIF_Ioctl(
IN PNET_DEV dev_p,
IN OUT struct ifreq *rq_p,
IN INT cmd);
/* End of ap_mbss.h */
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
ap_uapsd.h
Abstract:
Miniport generic portion header file
Revision History:
Who When What
-------- ---------- ----------------------------------------------
*/
/* only for UAPSD_TIMING_RECORD */
//#define UAPSD_TIMING_RECORD_FUNC
#define UAPSD_TIMING_RECORD_MAX 1000
#define UAPSD_TIMING_RECORD_DISPLAY_TIMES 10
#define UAPSD_TIMING_RECORD_ISR 1
#define UAPSD_TIMING_RECORD_TASKLET 2
#define UAPSD_TIMING_RECORD_TRG_RCV 3
#define UAPSD_TIMING_RECORD_MOVE2TX 4
#define UAPSD_TIMING_RECORD_TX2AIR 5
#define UAPSD_TIMING_CTRL_STOP 0
#define UAPSD_TIMING_CTRL_START 1
#define UAPSD_TIMING_CTRL_SUSPEND 2
#define UAPSD_TIMESTAMP_GET(__pAd, __TimeStamp) \
{ \
UINT32 __CSR=0; UINT64 __Value64; \
RTMP_IO_READ32((__pAd), TSF_TIMER_DW0, &__CSR); \
__TimeStamp = (UINT64)__CSR; \
RTMP_IO_READ32((__pAd), TSF_TIMER_DW1, &__CSR); \
__Value64 = (UINT64)__CSR; \
__TimeStamp |= (__Value64 << 32); \
}
#ifdef LINUX
#define UAPSD_TIME_GET(__pAd, __Time) \
__Time = jiffies
#endif // LINUX //
#ifdef UAPSD_TIMING_RECORD_FUNC
#define UAPSD_TIMING_RECORD_START() \
UAPSD_TimingRecordCtrl(UAPSD_TIMING_CTRL_START);
#define UAPSD_TIMING_RECORD_STOP() \
UAPSD_TimingRecordCtrl(UAPSD_TIMING_CTRL_STOP);
#define UAPSD_TIMING_RECORD(__pAd, __Type) \
UAPSD_TimingRecord(__pAd, __Type);
#define UAPSD_TIMING_RECORD_INDEX(__LoopIndex) \
UAPSD_TimeingRecordLoopIndex(__LoopIndex);
#else
#define UAPSD_TIMING_RECORD_START()
#define UAPSD_TIMING_RECORD_STOP()
#define UAPSD_TIMING_RECORD(__pAd, __type)
#define UAPSD_TIMING_RECORD_INDEX(__LoopIndex)
#endif // UAPSD_TIMING_RECORD_FUNC //
#ifndef MODULE_WMM_UAPSD
#define UAPSD_EXTERN extern
/* Public Marco list */
/*
Init some parameters in packet structure for QoS Null frame;
purpose: is for management frame tx done use
*/
#define UAPSD_MR_QOS_NULL_HANDLE(__pAd, __pData, __pPacket) \
{ \
PHEADER_802_11 __pHeader = (PHEADER_802_11)(__pData); \
MAC_TABLE_ENTRY *__pEntry; \
if (__pHeader->FC.SubType == SUBTYPE_QOS_NULL) \
{ \
RTMP_SET_PACKET_QOS_NULL((__pPacket)); \
__pEntry = MacTableLookup((__pAd), __pHeader->Addr1); \
if (__pEntry != NULL) \
{ \
RTMP_SET_PACKET_WCID((__pPacket), __pEntry->Aid); \
} \
} \
else \
{ \
RTMP_SET_PACKET_NON_QOS_NULL((__pPacket)); \
} \
}
/*
Init MAC entry UAPSD parameters;
purpose: initialize UAPSD PS queue and control parameters
*/
#define UAPSD_MR_ENTRY_INIT(__pEntry) \
{ \
UINT16 __IdAc; \
for(__IdAc=0; __IdAc<WMM_NUM_OF_AC; __IdAc++) \
InitializeQueueHeader(&(__pEntry)->UAPSDQueue[__IdAc]); \
(__pEntry)->UAPSDTxNum = 0; \
(__pEntry)->pUAPSDEOSPFrame = NULL; \
(__pEntry)->bAPSDFlagSPStart = 0; \
(__pEntry)->bAPSDFlagEOSPOK = 0; \
(__pEntry)->MaxSPLength = 0; \
}
/*
Reset MAC entry UAPSD parameters;
purpose: clean all UAPSD PS queue; release the EOSP frame if exists;
reset control parameters
*/
#define UAPSD_MR_ENTRY_RESET(__pAd, __pEntry) \
{ \
MAC_TABLE_ENTRY *__pSta; \
UINT32 __IdAc; \
__pSta = (__pEntry); \
/* clear all U-APSD queues */ \
for(__IdAc=0; __IdAc<WMM_NUM_OF_AC; __IdAc++) \
APCleanupPsQueue((__pAd), &__pSta->UAPSDQueue[__IdAc]); \
/* clear EOSP frame */ \
__pSta->UAPSDTxNum = 0; \
if (__pSta->pUAPSDEOSPFrame != NULL) { \
RELEASE_NDIS_PACKET((__pAd), \
QUEUE_ENTRY_TO_PACKET(__pSta->pUAPSDEOSPFrame), \
NDIS_STATUS_FAILURE); \
__pSta->pUAPSDEOSPFrame = NULL; } \
__pSta->bAPSDFlagSPStart = 0; \
__pSta->bAPSDFlagEOSPOK = 0; }
/*
Enable or disable UAPSD flag in WMM element in beacon frame;
purpose: set UAPSD enable/disable bit
*/
#define UAPSD_MR_IE_FILL(__QosCtrlField, __pAd) \
(__QosCtrlField) |= ((__pAd)->CommonCfg.bAPSDCapable) ? 0x80 : 0x00;
/*
Check if we do NOT need to control TIM bit for the station;
note: we control TIM bit only when all AC are UAPSD AC
*/
#define UAPSD_MR_IS_NOT_TIM_BIT_NEEDED_HANDLED(__pMacEntry, __QueIdx) \
(CLIENT_STATUS_TEST_FLAG((__pMacEntry), fCLIENT_STATUS_APSD_CAPABLE) && \
(!(__pMacEntry)->bAPSDDeliverEnabledPerAC[QID_AC_VO] || \
!(__pMacEntry)->bAPSDDeliverEnabledPerAC[QID_AC_VI] || \
!(__pMacEntry)->bAPSDDeliverEnabledPerAC[QID_AC_BE] || \
!(__pMacEntry)->bAPSDDeliverEnabledPerAC[QID_AC_BK]) && \
(__pMacEntry)->bAPSDDeliverEnabledPerAC[__QueIdx])
/* check if the AC is UAPSD delivery-enabled AC */
#define UAPSD_MR_IS_UAPSD_AC(__pMacEntry, __AcId) \
(CLIENT_STATUS_TEST_FLAG((__pMacEntry), fCLIENT_STATUS_APSD_CAPABLE) && \
((0 <= (__AcId)) && ((__AcId) < WMM_NUM_OF_AC)) && /* 0 ~ 3 */ \
(__pMacEntry)->bAPSDDeliverEnabledPerAC[(__AcId)])
/* check if all AC are UAPSD delivery-enabled AC */
#define UAPSD_MR_IS_ALL_AC_UAPSD(__FlgIsActive, __pMacEntry) \
(((__FlgIsActive) == FALSE) && ((__pMacEntry)->bAPSDAllAC == 1))
/* suspend SP */
#define UAPSD_MR_SP_SUSPEND(__pAd) \
(__pAd)->bAPSDFlagSPSuspend = 1;
/* resume SP */
#define UAPSD_MR_SP_RESUME(__pAd) \
(__pAd)->bAPSDFlagSPSuspend = 0;
/* mark PS poll frame sent in mix mode */
#ifdef RTMP_MAC_PCI
/*
Note:
(1) When SP is not started, try to mark a flag to record if the legacy ps
packet is handled in statistics handler;
(2) When SP is started, increase the UAPSD count number for the legacy PS.
*/
#define UAPSD_MR_MIX_PS_POLL_RCV(__pAd, __pMacEntry) \
if ((__pMacEntry)->bAPSDFlagSpRoughUse == 0) \
{ \
if ((__pMacEntry)->bAPSDFlagSPStart == 0) \
{ \
if ((__pMacEntry)->bAPSDFlagLegacySent == 1) \
NICUpdateFifoStaCounters((__pAd)); \
(__pMacEntry)->bAPSDFlagLegacySent = 1; \
} \
else \
{ \
(__pMacEntry)->UAPSDTxNum ++; \
} \
}
#endif // RTMP_MAC_PCI //
#else
#define UAPSD_EXTERN
#define UAPSD_QOS_NULL_QUE_ID 0x7f
#ifdef RTMP_MAC_PCI
/*
In RT2870, FIFO counter is for all stations, not for per-entry,
so we can not use accurate method in RT2870
*/
/*
Note for SP ACCURATE Mechanism:
1. When traffic is busy for the PS station
Statistics FIFO counter maybe overflow before we read it, so UAPSD
counting mechanism will not accurately.
Solution:
We need to avoid the worse case so we suggest a maximum interval for
a SP that the interval between last frame from QAP and data frame from
QSTA is larger than UAPSD_EPT_SP_INT.
2. When traffic use CCK/1Mbps from QAP
Statistics FIFO will not count the packet. There are 2 cases:
(1) We force to downgrage ARP response & DHCP packet to 1Mbps;
(2) After rate switch mechanism, tx rate is fixed to 1Mbps.
Solution:
Use old DMA UAPSD mechanism.
3. When part of AC uses legacy PS mode
Statistics count will inclue packet statistics for legacy PS packets
so we can not know which one is UAPSD, which one is legacy.
Solution:
Cound the legacy PS packet.
4. Check FIFO statistics count in Rx Done function
We can not to check TX FIFO statistics count in Rx Done function or
the real packet tx/rx sequence will be disarranged.
Solution:
Suspend SP handle before rx done and resume SP handle after rx done.
*/
#define UAPSD_SP_ACCURATE /* use more accurate method to send EOSP */
#endif // RTMP_MAC_PCI //
#define UAPSD_EPT_SP_INT (100000/(1000000/OS_HZ)) /* 100ms */
#endif // MODULE_WMM_UAPSD //
/* max UAPSD buffer queue size */
#define MAX_PACKETS_IN_UAPSD_QUEUE 16 /* for each AC = 16*4 = 64 */
/* Public function list */
/*
========================================================================
Routine Description:
UAPSD Module Init.
Arguments:
pAd Pointer to our adapter
Return Value:
None
Note:
========================================================================
*/
UAPSD_EXTERN VOID UAPSD_Init(
IN PRTMP_ADAPTER pAd);
/*
========================================================================
Routine Description:
UAPSD Module Release.
Arguments:
pAd Pointer to our adapter
Return Value:
None
Note:
========================================================================
*/
UAPSD_EXTERN VOID UAPSD_Release(
IN PRTMP_ADAPTER pAd);
/*
========================================================================
Routine Description:
Free all EOSP frames and close all SP.
Arguments:
pAd Pointer to our adapter
Return Value:
None
Note:
========================================================================
*/
UAPSD_EXTERN VOID UAPSD_FreeAll(
IN PRTMP_ADAPTER pAd);
/*
========================================================================
Routine Description:
Close current Service Period.
Arguments:
pAd Pointer to our adapter
pEntry Close the SP of the entry
Return Value:
None
Note:
========================================================================
*/
UAPSD_EXTERN VOID UAPSD_SP_Close(
IN PRTMP_ADAPTER pAd,
IN MAC_TABLE_ENTRY *pEntry);
/*
========================================================================
Routine Description:
Deliver all queued packets.
Arguments:
pAd Pointer to our adapter
*pEntry STATION
Return Value:
None
Note:
SMP protection by caller for packet enqueue.
========================================================================
*/
UAPSD_EXTERN VOID UAPSD_AllPacketDeliver(
IN PRTMP_ADAPTER pAd,
IN MAC_TABLE_ENTRY *pEntry);
/*
========================================================================
Routine Description:
Parse the UAPSD field in WMM element in (re)association request frame.
Arguments:
pAd Pointer to our adapter
*pEntry STATION
*pElm QoS information field
Return Value:
None
Note:
No protection is needed.
1. Association -> TSPEC:
use static UAPSD settings in Association
update UAPSD settings in TSPEC
2. Association -> TSPEC(11r) -> Reassociation:
update UAPSD settings in TSPEC
backup static UAPSD settings in Reassociation
3. Association -> Reassociation:
update UAPSD settings in TSPEC
backup static UAPSD settings in Reassociation
========================================================================
*/
UAPSD_EXTERN VOID UAPSD_AssocParse(
IN PRTMP_ADAPTER pAd,
IN MAC_TABLE_ENTRY *pEntry,
IN UCHAR *pElm);
/*
========================================================================
Routine Description:
Enqueue a UAPSD packet.
Arguments:
pAd Pointer to our adapter
*pEntry STATION
pPacket UAPSD dnlink packet
IdAc UAPSD AC ID (0 ~ 3)
Return Value:
None
Note:
========================================================================
*/
UAPSD_EXTERN VOID UAPSD_PacketEnqueue(
IN PRTMP_ADAPTER pAd,
IN MAC_TABLE_ENTRY *pEntry,
IN PNDIS_PACKET pPacket,
IN UINT32 IdAc);
/*
========================================================================
Routine Description:
Handle QoS Null Frame Tx Done or Management Tx Done interrupt.
Arguments:
pAd Pointer to our adapter
pPacket Completed TX packet
pDstMac Destinated MAC address
Return Value:
None
Note:
========================================================================
*/
UAPSD_EXTERN VOID UAPSD_QoSNullTxMgmtTxDoneHandle(
IN PRTMP_ADAPTER pAd,
IN PNDIS_PACKET pPacket,
IN UCHAR *pDstMac);
/*
========================================================================
Routine Description:
Maintenance our UAPSD PS queue. Release all queued packet if timeout.
Arguments:
pAd Pointer to our adapter
*pEntry STATION
Return Value:
None
Note:
If in RT2870, pEntry can not be removed during UAPSD_QueueMaintenance()
========================================================================
*/
UAPSD_EXTERN VOID UAPSD_QueueMaintenance(
IN PRTMP_ADAPTER pAd,
IN MAC_TABLE_ENTRY *pEntry);
/*
========================================================================
Routine Description:
Close SP in Tx Done, not Tx DMA Done.
Arguments:
pAd Pointer to our adapter
pEntry destination entry
FlgSuccess 0:tx success, 1:tx fail
Return Value:
None
Note:
For RT28xx series, for packetID=0 or multicast frame, no statistics
count can be got, ex: ARP response or DHCP packets, we will use
low rate to set (CCK, MCS=0=packetID).
So SP will not be close until UAPSD_EPT_SP_INT timeout.
So if the tx rate is 1Mbps for a entry, we will use DMA done, not
use UAPSD_SP_AUE_Handle().
========================================================================
*/
UAPSD_EXTERN VOID UAPSD_SP_AUE_Handle(
IN RTMP_ADAPTER *pAd,
IN MAC_TABLE_ENTRY *pEntry,
IN UCHAR FlgSuccess);
/*
========================================================================
Routine Description:
Close current Service Period.
Arguments:
pAd Pointer to our adapter
Return Value:
None
Note:
When we receive EOSP frame tx done interrupt and a uplink packet
from the station simultaneously, we will regard it as a new trigger
frame because the packet is received when EOSP frame tx done interrupt.
We can not sure the uplink packet is sent after old SP or in the old SP.
So we must close the old SP in receive done ISR to avoid the problem.
========================================================================
*/
UAPSD_EXTERN VOID UAPSD_SP_CloseInRVDone(
IN PRTMP_ADAPTER pAd);
/*
========================================================================
Routine Description:
Check if we need to close current SP.
Arguments:
pAd Pointer to our adapter
pPacket Completed TX packet
pDstMac Destinated MAC address
Return Value:
None
Note:
1. We need to call the function in TxDone ISR.
2. SMP protection by caller for packet enqueue.
========================================================================
*/
UAPSD_EXTERN VOID UAPSD_SP_PacketCheck(
IN PRTMP_ADAPTER pAd,
IN PNDIS_PACKET pPacket,
IN UCHAR *pDstMac);
#ifdef UAPSD_TIMING_RECORD_FUNC
/*
========================================================================
Routine Description:
Enable/Disable Timing Record Function.
Arguments:
pAd Pointer to our adapter
Flag 1 (Enable) or 0 (Disable)
Return Value:
None
Note:
========================================================================
*/
UAPSD_EXTERN VOID UAPSD_TimingRecordCtrl(
IN UINT32 Flag);
/*
========================================================================
Routine Description:
Record some timings.
Arguments:
pAd Pointer to our adapter
Type The timing is for what type
Return Value:
None
Note:
UAPSD_TIMING_RECORD_ISR
UAPSD_TIMING_RECORD_TASKLET
UAPSD_TIMING_RECORD_TRG_RCV
UAPSD_TIMING_RECORD_MOVE2TX
UAPSD_TIMING_RECORD_TX2AIR
========================================================================
*/
UAPSD_EXTERN VOID UAPSD_TimingRecord(
IN PRTMP_ADAPTER pAd,
IN UINT32 Type);
/*
========================================================================
Routine Description:
Record the loop index for received packet handle.
Arguments:
pAd Pointer to our adapter
LoopIndex The RxProcessed in APRxDoneInterruptHandle()
Return Value:
None
Note:
========================================================================
*/
UAPSD_EXTERN VOID UAPSD_TimeingRecordLoopIndex(
IN UINT32 LoopIndex);
#endif // UAPSD_TIMING_RECORD_FUNC //
/*
========================================================================
Routine Description:
Handle UAPSD Trigger Frame.
Arguments:
pAd Pointer to our adapter
*pEntry the source STATION
UpOfFrame the UP of the trigger frame
Return Value:
None
Note:
========================================================================
*/
UAPSD_EXTERN VOID UAPSD_TriggerFrameHandle(
IN PRTMP_ADAPTER pAd,
IN MAC_TABLE_ENTRY *pEntry,
IN UCHAR UpOfFrame);
/* End of ap_uapsd.h */
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
ap_cfg.h
Abstract:
Miniport generic portion header file
Revision History:
Who When What
-------- ---------- ----------------------------------------------
Fonchi 02-13-2007 created
*/
#ifndef _AP_WDS_H_
#define _AP_WDS_H_
#define WDS_ENTRY_RETRY_INTERVAL (100 * OS_HZ / 1000)
static inline BOOLEAN WDS_IF_UP_CHECK(
IN PRTMP_ADAPTER pAd,
IN ULONG ifidx)
{
if ((pAd->flg_wds_init != TRUE) ||
(ifidx >= MAX_WDS_ENTRY))
return FALSE;
// if (pAd->WdsTab.WdsEntry[ifidx].dev->flags & IFF_UP)
// Patch for wds ,when dirver call apmlmeperiod => APMlmeDynamicTxRateSwitching check if wds device ready
if ((pAd->WdsTab.WdsEntry[ifidx].dev != NULL) && (pAd->WdsTab.WdsEntry[ifidx].dev->flags & IFF_UP))
return TRUE;
return FALSE;
}
LONG WdsEntryAlloc(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pAddr);
VOID WdsEntryDel(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pAddr);
MAC_TABLE_ENTRY *MacTableInsertWDSEntry(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pAddr,
UINT WdsTabIdx);
BOOLEAN MacTableDeleteWDSEntry(
IN PRTMP_ADAPTER pAd,
IN USHORT wcid,
IN PUCHAR pAddr);
BOOLEAN ApWdsAllowToSendPacket(
IN RTMP_ADAPTER *pAd,
IN PNDIS_PACKET pPacket,
OUT UCHAR *pWcid);
MAC_TABLE_ENTRY *WdsTableLookupByWcid(
IN PRTMP_ADAPTER pAd,
IN UCHAR wcid,
IN PUCHAR pAddr,
IN BOOLEAN bResetIdelCount);
MAC_TABLE_ENTRY *WdsTableLookup(
IN PRTMP_ADAPTER pAd,
IN PUCHAR pAddr,
IN BOOLEAN bResetIdelCount);
MAC_TABLE_ENTRY *FindWdsEntry(
IN PRTMP_ADAPTER pAd,
IN UCHAR Wcid,
IN PUCHAR pAddr,
IN UINT32 PhyMode);
VOID WdsTableMaintenance(
IN PRTMP_ADAPTER pAd);
VOID RT28xx_WDS_Init(
IN PRTMP_ADAPTER pAd,
IN PNET_DEV net_dev);
VOID RT28xx_WDS_Close(
IN PRTMP_ADAPTER pAd);
VOID RT28xx_WDS_Remove(
IN PRTMP_ADAPTER pAd);
VOID WdsDown(
IN PRTMP_ADAPTER pAd);
VOID AsicUpdateWdsRxWCIDTable(
IN PRTMP_ADAPTER pAd);
VOID AsicUpdateWdsEncryption(
IN PRTMP_ADAPTER pAd,
IN UCHAR wcid);
VOID WdsPeerBeaconProc(
IN PRTMP_ADAPTER pAd,
IN PMAC_TABLE_ENTRY pEntry,
IN USHORT CapabilityInfo,
IN UCHAR MaxSupportedRateIn500Kbps,
IN UCHAR MaxSupportedRateLen,
IN BOOLEAN bWmmCapable,
IN ULONG ClientRalinkIe,
IN HT_CAPABILITY_IE *pHtCapability,
IN UCHAR HtCapabilityLen);
VOID APWdsInitialize(
IN PRTMP_ADAPTER pAd);
INT Show_WdsTable_Proc(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg);
VOID rtmp_read_wds_from_file(
IN PRTMP_ADAPTER pAd,
PSTRING tmpbuf,
PSTRING buffer);
VOID WdsPrepareWepKeyFromMainBss(
IN PRTMP_ADAPTER pAd);
INT WdsVirtualIFSendPackets(
IN PNDIS_PACKET pSkb,
IN PNET_DEV dev);
INT WdsVirtualIF_open(
IN PNET_DEV dev);
INT WdsVirtualIF_close(
IN PNET_DEV dev);
INT WdsVirtualIF_ioctl(
IN PNET_DEV net_dev,
IN OUT struct ifreq *rq,
IN INT cmd);
/*
==========================================================================
Description:
Check the WDS Entry is valid or not.
==========================================================================
*/
static inline BOOLEAN ValidWdsEntry(
IN PRTMP_ADAPTER pAd,
IN UCHAR WdsIndex)
{
BOOLEAN result;
PMAC_TABLE_ENTRY pMacEntry;
do
{
if (WdsIndex >= MAX_WDS_ENTRY)
{
result = FALSE;
break;
}
if (pAd->WdsTab.WdsEntry[WdsIndex].Valid != TRUE)
{
result = FALSE;
break;
}
if ((pAd->WdsTab.WdsEntry[WdsIndex].MacTabMatchWCID==0)
|| (pAd->WdsTab.WdsEntry[WdsIndex].MacTabMatchWCID >= MAX_LEN_OF_MAC_TABLE))
{
result = FALSE;
break;
}
pMacEntry = &pAd->MacTab.Content[pAd->WdsTab.WdsEntry[WdsIndex].MacTabMatchWCID];
if (pMacEntry->ValidAsWDS != TRUE)
{
result = FALSE;
break;
}
result = TRUE;
} while(FALSE);
return result;
}
#endif // _AP_WDS_H_ //
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
rt3090.c
Abstract:
Specific funcitons and variables for RT3070
Revision History:
Who When What
-------- ---------- ----------------------------------------------
*/
#ifdef RT3090
#include "../rt_config.h"
#ifndef RTMP_RF_RW_SUPPORT
#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip"
#endif // RTMP_RF_RW_SUPPORT //
VOID NICInitRT3090RFRegisters(IN PRTMP_ADAPTER pAd)
{
INT i;
// Driver must read EEPROM to get RfIcType before initial RF registers
// Initialize RF register to default value
if (IS_RT3090(pAd))
{
// Init RF calibration
// Driver should toggle RF R30 bit7 before init RF registers
UINT32 RfReg = 0, data;
RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg);
RfReg |= 0x80;
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
RTMPusecDelay(1000);
RfReg &= 0x7F;
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
// init R24, R31
RT30xxWriteRFRegister(pAd, RF_R24, 0x0F);
RT30xxWriteRFRegister(pAd, RF_R31, 0x0F);
// RT309x version E has fixed this issue
if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211))
{
// patch tx EVM issue temporarily
RTMP_IO_READ32(pAd, LDO_CFG0, &data);
data = ((data & 0xE0FFFFFF) | 0x0D000000);
RTMP_IO_WRITE32(pAd, LDO_CFG0, data);
}
else
{
RTMP_IO_READ32(pAd, LDO_CFG0, &data);
data = ((data & 0xE0FFFFFF) | 0x01000000);
RTMP_IO_WRITE32(pAd, LDO_CFG0, data);
}
// patch LNA_PE_G1 failed issue
RTMP_IO_READ32(pAd, GPIO_SWITCH, &data);
data &= ~(0x20);
RTMP_IO_WRITE32(pAd, GPIO_SWITCH, data);
// Initialize RF register to default value
for (i = 0; i < NUM_RF_REG_PARMS; i++)
{
RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value);
}
// Driver should set RF R6 bit6 on before calibration
RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RfReg);
RfReg |= 0x40;
RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg);
//For RF filter Calibration
RTMPFilterCalibration(pAd);
// Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration()
if ((pAd->MACVersion & 0xffff) < 0x0211)
RT30xxWriteRFRegister(pAd, RF_R27, 0x3);
// set led open drain enable
RTMP_IO_READ32(pAd, OPT_14, &data);
data |= 0x01;
RTMP_IO_WRITE32(pAd, OPT_14, data);
// set default antenna as main
if (pAd->RfIcType == RFIC_3020)
AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt);
// add by johnli, RF power sequence setup, load RF normal operation-mode setup
RT30xxLoadRFNormalModeSetup(pAd);
}
}
#endif // RT3090 //
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
rt30xx.c
Abstract:
Specific funcitons and variables for RT30xx.
Revision History:
Who When What
-------- ---------- ----------------------------------------------
*/
#ifdef RT30xx
#ifndef RTMP_RF_RW_SUPPORT
#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip"
#endif // RTMP_RF_RW_SUPPORT //
#include "../rt_config.h"
//
// RF register initialization set
//
REG_PAIR RT30xx_RFRegTable[] = {
{RF_R04, 0x40},
{RF_R05, 0x03},
{RF_R06, 0x02},
{RF_R07, 0x70},
{RF_R09, 0x0F},
{RF_R10, 0x41},
{RF_R11, 0x21},
{RF_R12, 0x7B},
{RF_R14, 0x90},
{RF_R15, 0x58},
{RF_R16, 0xB3},
{RF_R17, 0x92},
{RF_R18, 0x2C},
{RF_R19, 0x02},
{RF_R20, 0xBA},
{RF_R21, 0xDB},
{RF_R24, 0x16},
{RF_R25, 0x01},
{RF_R29, 0x1F},
};
UCHAR NUM_RF_REG_PARMS = (sizeof(RT30xx_RFRegTable) / sizeof(REG_PAIR));
// Antenna divesity use GPIO3 and EESK pin for control
// Antenna and EEPROM access are both using EESK pin,
// Therefor we should avoid accessing EESK at the same time
// Then restore antenna after EEPROM access
// The original name of this function is AsicSetRxAnt(), now change to
//VOID AsicSetRxAnt(
VOID RT30xxSetRxAnt(
IN PRTMP_ADAPTER pAd,
IN UCHAR Ant)
{
UINT32 Value;
UINT32 x;
if ((pAd->EepromAccess) ||
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) ||
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) ||
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) ||
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)))
{
return;
}
// the antenna selection is through firmware and MAC register(GPIO3)
if (Ant == 0)
{
// Main antenna
#ifdef RTMP_MAC_PCI
RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
x |= (EESK);
RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);
#else
AsicSendCommandToMcu(pAd, 0x73, 0xFF, 0x1, 0x0);
#endif // RTMP_MAC_PCI //
RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value);
Value &= ~(0x0808);
RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value);
DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to main antenna\n"));
}
else
{
// Aux antenna
#ifdef RTMP_MAC_PCI
RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
x &= ~(EESK);
RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);
#else
AsicSendCommandToMcu(pAd, 0x73, 0xFF, 0x0, 0x0);
#endif // RTMP_MAC_PCI //
RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value);
Value &= ~(0x0808);
Value |= 0x08;
RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value);
DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to aux antenna\n"));
}
}
/*
========================================================================
Routine Description:
For RF filter calibration purpose
Arguments:
pAd Pointer to our adapter
Return Value:
None
IRQL = PASSIVE_LEVEL
========================================================================
*/
VOID RTMPFilterCalibration(
IN PRTMP_ADAPTER pAd)
{
UCHAR R55x = 0, value, FilterTarget = 0x1E, BBPValue=0;
UINT loop = 0, count = 0, loopcnt = 0, ReTry = 0;
UCHAR RF_R24_Value = 0;
// Give bbp filter initial value
pAd->Mlme.CaliBW20RfR24 = 0x1F;
pAd->Mlme.CaliBW40RfR24 = 0x2F; //Bit[5] must be 1 for BW 40
do
{
if (loop == 1) //BandWidth = 40 MHz
{
// Write 0x27 to RF_R24 to program filter
RF_R24_Value = 0x27;
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
if (IS_RT3090(pAd) || IS_RT3572(pAd)|| IS_RT3390(pAd))
FilterTarget = 0x15;
else
FilterTarget = 0x19;
// when calibrate BW40, BBP mask must set to BW40.
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
BBPValue&= (~0x18);
BBPValue|= (0x10);
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
// set to BW40
RT30xxReadRFRegister(pAd, RF_R31, &value);
value |= 0x20;
RT30xxWriteRFRegister(pAd, RF_R31, value);
}
else //BandWidth = 20 MHz
{
// Write 0x07 to RF_R24 to program filter
RF_R24_Value = 0x07;
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
if (IS_RT3090(pAd) || IS_RT3572(pAd)|| IS_RT3390(pAd))
FilterTarget = 0x13;
else
FilterTarget = 0x16;
// set to BW20
RT30xxReadRFRegister(pAd, RF_R31, &value);
value &= (~0x20);
RT30xxWriteRFRegister(pAd, RF_R31, value);
}
// Write 0x01 to RF_R22 to enable baseband loopback mode
RT30xxReadRFRegister(pAd, RF_R22, &value);
value |= 0x01;
RT30xxWriteRFRegister(pAd, RF_R22, value);
// Write 0x00 to BBP_R24 to set power & frequency of passband test tone
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0);
do
{
// Write 0x90 to BBP_R25 to transmit test tone
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90);
RTMPusecDelay(1000);
// Read BBP_R55[6:0] for received power, set R55x = BBP_R55[6:0]
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value);
R55x = value & 0xFF;
} while ((ReTry++ < 100) && (R55x == 0));
// Write 0x06 to BBP_R24 to set power & frequency of stopband test tone
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0x06);
while(TRUE)
{
// Write 0x90 to BBP_R25 to transmit test tone
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90);
//We need to wait for calibration
RTMPusecDelay(1000);
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value);
value &= 0xFF;
if ((R55x - value) < FilterTarget)
{
RF_R24_Value ++;
}
else if ((R55x - value) == FilterTarget)
{
RF_R24_Value ++;
count ++;
}
else
{
break;
}
// prevent infinite loop cause driver hang.
if (loopcnt++ > 100)
{
DBGPRINT(RT_DEBUG_ERROR, ("RTMPFilterCalibration - can't find a valid value, loopcnt=%d stop calibrating", loopcnt));
break;
}
// Write RF_R24 to program filter
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
}
if (count > 0)
{
RF_R24_Value = RF_R24_Value - ((count) ? (1) : (0));
}
// Store for future usage
if (loopcnt < 100)
{
if (loop++ == 0)
{
//BandWidth = 20 MHz
pAd->Mlme.CaliBW20RfR24 = (UCHAR)RF_R24_Value;
}
else
{
//BandWidth = 40 MHz
pAd->Mlme.CaliBW40RfR24 = (UCHAR)RF_R24_Value;
break;
}
}
else
break;
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
// reset count
count = 0;
} while(TRUE);
//
// Set back to initial state
//
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0);
RT30xxReadRFRegister(pAd, RF_R22, &value);
value &= ~(0x01);
RT30xxWriteRFRegister(pAd, RF_R22, value);
// set BBP back to BW20
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
BBPValue&= (~0x18);
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
DBGPRINT(RT_DEBUG_TRACE, ("RTMPFilterCalibration - CaliBW20RfR24=0x%x, CaliBW40RfR24=0x%x\n", pAd->Mlme.CaliBW20RfR24, pAd->Mlme.CaliBW40RfR24));
}
// add by johnli, RF power sequence setup
/*
==========================================================================
Description:
Load RF normal operation-mode setup
==========================================================================
*/
VOID RT30xxLoadRFNormalModeSetup(
IN PRTMP_ADAPTER pAd)
{
UCHAR RFValue;
// RX0_PD & TX0_PD, RF R1 register Bit 2 & Bit 3 to 0 and RF_BLOCK_en,RX1_PD & TX1_PD, Bit0, Bit 4 & Bit5 to 1
RT30xxReadRFRegister(pAd, RF_R01, &RFValue);
RFValue = (RFValue & (~0x0C)) | 0x31;
RT30xxWriteRFRegister(pAd, RF_R01, RFValue);
// TX_LO2_en, RF R15 register Bit 3 to 0
RT30xxReadRFRegister(pAd, RF_R15, &RFValue);
RFValue &= (~0x08);
RT30xxWriteRFRegister(pAd, RF_R15, RFValue);
/* move to NICInitRT30xxRFRegisters
// TX_LO1_en, RF R17 register Bit 3 to 0
RT30xxReadRFRegister(pAd, RF_R17, &RFValue);
RFValue &= (~0x08);
// to fix rx long range issue
if (((pAd->MACVersion & 0xffff) >= 0x0211) && (pAd->NicConfig2.field.ExternalLNAForG == 0))
{
RFValue |= 0x20;
}
// set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h
if (pAd->TxMixerGain24G >= 2)
{
RFValue &= (~0x7); // clean bit [2:0]
RFValue |= pAd->TxMixerGain24G;
}
RT30xxWriteRFRegister(pAd, RF_R17, RFValue);
*/
// RX_LO1_en, RF R20 register Bit 3 to 0
RT30xxReadRFRegister(pAd, RF_R20, &RFValue);
RFValue &= (~0x08);
RT30xxWriteRFRegister(pAd, RF_R20, RFValue);
// RX_LO2_en, RF R21 register Bit 3 to 0
RT30xxReadRFRegister(pAd, RF_R21, &RFValue);
RFValue &= (~0x08);
RT30xxWriteRFRegister(pAd, RF_R21, RFValue);
/* add by johnli, reset RF_R27 when interface down & up to fix throughput problem*/
// LDORF_VC, RF R27 register Bit 2 to 0
RT30xxReadRFRegister(pAd, RF_R27, &RFValue);
// TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F).
// Raising RF voltage is no longer needed for RT3070(F)
if (IS_RT3090(pAd)) // RT309x and RT3071/72
{
if ((pAd->MACVersion & 0xffff) < 0x0211)
RFValue = (RFValue & (~0x77)) | 0x3;
else
RFValue = (RFValue & (~0x77));
RT30xxWriteRFRegister(pAd, RF_R27, RFValue);
}
/* end johnli */
}
/*
==========================================================================
Description:
Load RF sleep-mode setup
==========================================================================
*/
VOID RT30xxLoadRFSleepModeSetup(
IN PRTMP_ADAPTER pAd)
{
UCHAR RFValue;
UINT32 MACValue;
{
// RF_BLOCK_en. RF R1 register Bit 0 to 0
RT30xxReadRFRegister(pAd, RF_R01, &RFValue);
RFValue &= (~0x01);
RT30xxWriteRFRegister(pAd, RF_R01, RFValue);
// VCO_IC, RF R7 register Bit 4 & Bit 5 to 0
RT30xxReadRFRegister(pAd, RF_R07, &RFValue);
RFValue &= (~0x30);
RT30xxWriteRFRegister(pAd, RF_R07, RFValue);
// Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 0
RT30xxReadRFRegister(pAd, RF_R09, &RFValue);
RFValue &= (~0x0E);
RT30xxWriteRFRegister(pAd, RF_R09, RFValue);
// RX_CTB_en, RF R21 register Bit 7 to 0
RT30xxReadRFRegister(pAd, RF_R21, &RFValue);
RFValue &= (~0x80);
RT30xxWriteRFRegister(pAd, RF_R21, RFValue);
}
if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72
IS_RT3572(pAd) ||
(IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201)))
{
{
RT30xxReadRFRegister(pAd, RF_R27, &RFValue);
RFValue |= 0x77;
RT30xxWriteRFRegister(pAd, RF_R27, RFValue);
}
RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue);
MACValue |= 0x1D000000;
RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue);
}
}
/*
==========================================================================
Description:
Reverse RF sleep-mode setup
==========================================================================
*/
VOID RT30xxReverseRFSleepModeSetup(
IN PRTMP_ADAPTER pAd)
{
UCHAR RFValue;
UINT32 MACValue;
{
// RF_BLOCK_en, RF R1 register Bit 0 to 1
RT30xxReadRFRegister(pAd, RF_R01, &RFValue);
RFValue |= 0x01;
RT30xxWriteRFRegister(pAd, RF_R01, RFValue);
// VCO_IC, RF R7 register Bit 4 & Bit 5 to 1
RT30xxReadRFRegister(pAd, RF_R07, &RFValue);
RFValue |= 0x30;
RT30xxWriteRFRegister(pAd, RF_R07, RFValue);
// Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 1
RT30xxReadRFRegister(pAd, RF_R09, &RFValue);
RFValue |= 0x0E;
RT30xxWriteRFRegister(pAd, RF_R09, RFValue);
// RX_CTB_en, RF R21 register Bit 7 to 1
RT30xxReadRFRegister(pAd, RF_R21, &RFValue);
RFValue |= 0x80;
RT30xxWriteRFRegister(pAd, RF_R21, RFValue);
}
if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72
IS_RT3572(pAd) ||
IS_RT3390(pAd) ||
(IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201)))
{
{
RT30xxReadRFRegister(pAd, RF_R27, &RFValue);
if ((pAd->MACVersion & 0xffff) < 0x0211)
RFValue = (RFValue & (~0x77)) | 0x3;
else
RFValue = (RFValue & (~0x77));
RT30xxWriteRFRegister(pAd, RF_R27, RFValue);
}
// RT3071 version E has fixed this issue
if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211))
{
// patch tx EVM issue temporarily
RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue);
MACValue = ((MACValue & 0xE0FFFFFF) | 0x0D000000);
RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue);
}
else
{
RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue);
MACValue = ((MACValue & 0xE0FFFFFF) | 0x01000000);
RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue);
}
}
if(IS_RT3572(pAd))
RT30xxWriteRFRegister(pAd, RF_R08, 0x80);
}
// end johnli
VOID RT30xxHaltAction(
IN PRTMP_ADAPTER pAd)
{
UINT32 TxPinCfg = 0x00050F0F;
//
// Turn off LNA_PE or TRSW_POL
//
if (IS_RT3070(pAd) || IS_RT3071(pAd) || IS_RT3572(pAd))
{
if ((IS_RT3071(pAd) || IS_RT3572(pAd))
#ifdef RTMP_EFUSE_SUPPORT
&& (pAd->bUseEfuse)
#endif // RTMP_EFUSE_SUPPORT //
)
{
TxPinCfg &= 0xFFFBF0F0; // bit18 off
}
else
{
TxPinCfg &= 0xFFFFF0F0;
}
RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg);
}
}
#endif // RT30xx //
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
rt3370.c
Abstract:
Specific funcitons and variables for RT30xx.
Revision History:
Who When What
-------- ---------- ----------------------------------------------
*/
#ifdef RT3370
#include "../rt_config.h"
#ifndef RTMP_RF_RW_SUPPORT
#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip"
#endif // RTMP_RF_RW_SUPPORT //
VOID NICInitRT3370RFRegisters(IN PRTMP_ADAPTER pAd)
{
INT i;
// Driver must read EEPROM to get RfIcType before initial RF registers
// Initialize RF register to default value
if (IS_RT3090(pAd)||IS_RT3390(pAd)||IS_RT3572(pAd))
{
// Init RF calibration
// Driver should toggle RF R30 bit7 before init RF registers
UINT32 RfReg = 0, data;
RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg);
RfReg |= 0x80;
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
RTMPusecDelay(1000);
RfReg &= 0x7F;
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
// init R24, R31
RT30xxWriteRFRegister(pAd, RF_R24, 0x0F);
RT30xxWriteRFRegister(pAd, RF_R31, 0x0F);
if (IS_RT3390(pAd))
{
// patch LNA_PE_G1 failed issue
RTMP_IO_READ32(pAd, GPIO_SWITCH, &data);
data &= ~(0x20);
RTMP_IO_WRITE32(pAd, GPIO_SWITCH, data);
// RF registers initialization
for (i = 0; i < NUM_RF_REG_PARMS_OVER_RT3390; i++)
{
RT30xxWriteRFRegister(pAd, RFRegTableOverRT3390[i].Register, RFRegTableOverRT3390[i].Value);
}
}
// patch LNA_PE_G1 failed issue
RTMP_IO_READ32(pAd, GPIO_SWITCH, &data);
data &= ~(0x20);
RTMP_IO_WRITE32(pAd, GPIO_SWITCH, data);
// Initialize RF register to default value
for (i = 0; i < NUM_RF_REG_PARMS_OVER_RT3390; i++)
{
RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value);
}
// Driver should set RF R6 bit6 on before calibration
RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RfReg);
RfReg |= 0x40;
RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg);
//For RF filter Calibration
RTMPFilterCalibration(pAd);
// Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration()
if ((pAd->MACVersion & 0xffff) < 0x0211)
RT30xxWriteRFRegister(pAd, RF_R27, 0x3);
// set led open drain enable
RTMP_IO_READ32(pAd, OPT_14, &data);
data |= 0x01;
RTMP_IO_WRITE32(pAd, OPT_14, data);
// set default antenna as main
if (pAd->RfIcType == RFIC_3020)
AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt);
// add by johnli, RF power sequence setup, load RF normal operation-mode setup
RT30xxLoadRFNormalModeSetup(pAd);
}
}
#endif // RT3070 //
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
rt3390.c
Abstract:
Specific funcitons and variables for RT30xx.
Revision History:
Who When What
-------- ---------- ----------------------------------------------
*/
#ifdef RT3390
#include "../rt_config.h"
#ifndef RTMP_RF_RW_SUPPORT
#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip"
#endif // RTMP_RF_RW_SUPPORT //
VOID NICInitRT3390RFRegisters(IN PRTMP_ADAPTER pAd)
{
INT i;
// Driver must read EEPROM to get RfIcType before initial RF registers
// Initialize RF register to default value
if (IS_RT3090(pAd)||IS_RT3390(pAd)||IS_RT3572(pAd))
{
// Init RF calibration
// Driver should toggle RF R30 bit7 before init RF registers
UINT32 RfReg = 0, data;
RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg);
RfReg |= 0x80;
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
RTMPusecDelay(1000);
RfReg &= 0x7F;
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
// init R24, R31
RT30xxWriteRFRegister(pAd, RF_R24, 0x0F);
RT30xxWriteRFRegister(pAd, RF_R31, 0x0F);
if (IS_RT3390(pAd))
{
// patch LNA_PE_G1 failed issue
RTMP_IO_READ32(pAd, GPIO_SWITCH, &data);
data &= ~(0x20);
RTMP_IO_WRITE32(pAd, GPIO_SWITCH, data);
// RF registers initialization
for (i = 0; i < NUM_RF_REG_PARMS_OVER_RT3390; i++)
{
RT30xxWriteRFRegister(pAd, RFRegTableOverRT3390[i].Register, RFRegTableOverRT3390[i].Value);
}
}
// patch LNA_PE_G1 failed issue
RTMP_IO_READ32(pAd, GPIO_SWITCH, &data);
data &= ~(0x20);
RTMP_IO_WRITE32(pAd, GPIO_SWITCH, data);
// Initialize RF register to default value
for (i = 0; i < NUM_RF_REG_PARMS_OVER_RT3390; i++)
{
RT30xxWriteRFRegister(pAd, RFRegTableOverRT3390[i].Register, RFRegTableOverRT3390[i].Value);
}
// Driver should set RF R6 bit6 on before calibration
RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RfReg);
RfReg |= 0x40;
RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg);
//For RF filter Calibration
RTMPFilterCalibration(pAd);
// Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration()
if ((pAd->MACVersion & 0xffff) < 0x0211)
RT30xxWriteRFRegister(pAd, RF_R27, 0x3);
// set led open drain enable
RTMP_IO_READ32(pAd, OPT_14, &data);
data |= 0x01;
RTMP_IO_WRITE32(pAd, OPT_14, data);
// set default antenna as main
if (pAd->RfIcType == RFIC_3020)
AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt);
// add by johnli, RF power sequence setup, load RF normal operation-mode setup
RT33xxLoadRFNormalModeSetup(pAd);
}
}
#endif // RT3390 //
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
rt33xx.c
Abstract:
Specific funcitons and variables for RT30xx.
Revision History:
Who When What
-------- ---------- ----------------------------------------------
*/
#ifdef RT33xx
#ifndef RTMP_RF_RW_SUPPORT
#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip"
#endif // RTMP_RF_RW_SUPPORT //
#include "../rt_config.h"
//
// RF register initialization set
//
REG_PAIR RFRegTableOverRT3390[] = {
{RF_R00, 0xA0},
{RF_R01, 0xE1},
{RF_R02, 0xF1},
{RF_R03, 0x62},
{RF_R04, 0x40},
{RF_R05, 0x8B},
{RF_R06, 0x42},
{RF_R07, 0x34},
{RF_R08, 0x00}, // Read only
{RF_R09, 0xC0},
{RF_R10, 0x61},
{RF_R11, 0x21},
{RF_R12, 0x3B},
{RF_R13, 0xE0},
{RF_R14, 0x90},
{RF_R15, 0x53},
{RF_R16, 0x0E},
{RF_R17, 0x94},
{RF_R18, 0x5C},
{RF_R19, 0x4A},
{RF_R20, 0xB2},
{RF_R21, 0xF6},
{RF_R22, 0x00},
{RF_R23, 0x14},
{RF_R24, 0x08},
{RF_R25, 0x3D},
{RF_R26, 0x85},
{RF_R27, 0x00},
{RF_R28, 0x41},
{RF_R29, 0x8F},
{RF_R30, 0x20},
{RF_R31, 0x0F},
};
UCHAR NUM_RF_REG_PARMS_OVER_RT3390=(sizeof(RFRegTableOverRT3390) / sizeof(REG_PAIR));
// Antenna divesity use GPIO3 and EESK pin for control
// Antenna and EEPROM access are both using EESK pin,
// Therefor we should avoid accessing EESK at the same time
// Then restore antenna after EEPROM access
// The original name of this function is AsicSetRxAnt(), now change to
//VOID AsicSetRxAnt(
VOID RT33xxSetRxAnt(
IN PRTMP_ADAPTER pAd,
IN UCHAR Ant)
{
UINT32 Value;
UINT32 x;
if ((pAd->EepromAccess) ||
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS)) ||
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS)) ||
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF)) ||
(RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)))
{
return;
}
// the antenna selection is through firmware and MAC register(GPIO3)
if (Ant == 0)
{
// Main antenna
RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
x |= (EESK);
RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);
RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value);
Value &= ~(0x0808);
RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value);
DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to main antenna\n"));
}
else
{
// Aux antenna
RTMP_IO_READ32(pAd, E2PROM_CSR, &x);
x &= ~(EESK);
RTMP_IO_WRITE32(pAd, E2PROM_CSR, x);
RTMP_IO_READ32(pAd, GPIO_CTRL_CFG, &Value);
Value &= ~(0x0808);
Value |= 0x08;
RTMP_IO_WRITE32(pAd, GPIO_CTRL_CFG, Value);
DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to aux antenna\n"));
}
}
/*
========================================================================
Routine Description:
For RF filter calibration purpose
Arguments:
pAd Pointer to our adapter
Return Value:
None
IRQL = PASSIVE_LEVEL
========================================================================
*/
VOID RTMPFilterCalibration(
IN PRTMP_ADAPTER pAd)
{
UCHAR R55x = 0, value, FilterTarget = 0x1E, BBPValue=0;
UINT loop = 0, count = 0, loopcnt = 0, ReTry = 0;
UCHAR RF_R24_Value = 0;
// Give bbp filter initial value
pAd->Mlme.CaliBW20RfR24 = 0x1F;
pAd->Mlme.CaliBW40RfR24 = 0x2F; //Bit[5] must be 1 for BW 40
do
{
if (loop == 1) //BandWidth = 40 MHz
{
// Write 0x27 to RF_R24 to program filter
RF_R24_Value = 0x27;
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
if (IS_RT3090(pAd) || IS_RT3572(pAd)|| IS_RT3390(pAd))
FilterTarget = 0x15;
else
FilterTarget = 0x19;
// when calibrate BW40, BBP mask must set to BW40.
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
BBPValue&= (~0x18);
BBPValue|= (0x10);
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
// set to BW40
RT30xxReadRFRegister(pAd, RF_R31, &value);
value |= 0x20;
RT30xxWriteRFRegister(pAd, RF_R31, value);
}
else //BandWidth = 20 MHz
{
// Write 0x07 to RF_R24 to program filter
RF_R24_Value = 0x07;
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
if (IS_RT3090(pAd) || IS_RT3572(pAd)|| IS_RT3390(pAd))
FilterTarget = 0x13;
else
FilterTarget = 0x16;
// set to BW20
RT30xxReadRFRegister(pAd, RF_R31, &value);
value &= (~0x20);
RT30xxWriteRFRegister(pAd, RF_R31, value);
}
// Write 0x01 to RF_R22 to enable baseband loopback mode
RT30xxReadRFRegister(pAd, RF_R22, &value);
value |= 0x01;
RT30xxWriteRFRegister(pAd, RF_R22, value);
// Write 0x00 to BBP_R24 to set power & frequency of passband test tone
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0);
do
{
// Write 0x90 to BBP_R25 to transmit test tone
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90);
RTMPusecDelay(1000);
// Read BBP_R55[6:0] for received power, set R55x = BBP_R55[6:0]
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value);
R55x = value & 0xFF;
} while ((ReTry++ < 100) && (R55x == 0));
// Write 0x06 to BBP_R24 to set power & frequency of stopband test tone
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0x06);
while(TRUE)
{
// Write 0x90 to BBP_R25 to transmit test tone
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90);
//We need to wait for calibration
RTMPusecDelay(1000);
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value);
value &= 0xFF;
if ((R55x - value) < FilterTarget)
{
RF_R24_Value ++;
}
else if ((R55x - value) == FilterTarget)
{
RF_R24_Value ++;
count ++;
}
else
{
break;
}
// prevent infinite loop cause driver hang.
if (loopcnt++ > 100)
{
DBGPRINT(RT_DEBUG_ERROR, ("RTMPFilterCalibration - can't find a valid value, loopcnt=%d stop calibrating", loopcnt));
break;
}
// Write RF_R24 to program filter
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
}
if (count > 0)
{
RF_R24_Value = RF_R24_Value - ((count) ? (1) : (0));
}
// Store for future usage
if (loopcnt < 100)
{
if (loop++ == 0)
{
//BandWidth = 20 MHz
pAd->Mlme.CaliBW20RfR24 = (UCHAR)RF_R24_Value;
}
else
{
//BandWidth = 40 MHz
pAd->Mlme.CaliBW40RfR24 = (UCHAR)RF_R24_Value;
break;
}
}
else
break;
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
// reset count
count = 0;
} while(TRUE);
//
// Set back to initial state
//
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0);
RT30xxReadRFRegister(pAd, RF_R22, &value);
value &= ~(0x01);
RT30xxWriteRFRegister(pAd, RF_R22, value);
// set BBP back to BW20
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
BBPValue&= (~0x18);
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
DBGPRINT(RT_DEBUG_TRACE, ("RTMPFilterCalibration - CaliBW20RfR24=0x%x, CaliBW40RfR24=0x%x\n", pAd->Mlme.CaliBW20RfR24, pAd->Mlme.CaliBW40RfR24));
}
// add by johnli, RF power sequence setup
/*
==========================================================================
Description:
Load RF normal operation-mode setup
==========================================================================
*/
VOID RT33xxLoadRFNormalModeSetup(
IN PRTMP_ADAPTER pAd)
{
UCHAR RFValue;
// RX0_PD & TX0_PD, RF R1 register Bit 2 & Bit 3 to 0 and RF_BLOCK_en,RX1_PD & TX1_PD, Bit0, Bit 4 & Bit5 to 1
RT30xxReadRFRegister(pAd, RF_R01, &RFValue);
RFValue = (RFValue & (~0x0C)) | 0x31;
RT30xxWriteRFRegister(pAd, RF_R01, RFValue);
// TX_LO2_en, RF R15 register Bit 3 to 0
RT30xxReadRFRegister(pAd, RF_R15, &RFValue);
RFValue &= (~0x08);
RT30xxWriteRFRegister(pAd, RF_R15, RFValue);
/* move to NICInitRT30xxRFRegisters
// TX_LO1_en, RF R17 register Bit 3 to 0
RT30xxReadRFRegister(pAd, RF_R17, &RFValue);
RFValue &= (~0x08);
// to fix rx long range issue
if (((pAd->MACVersion & 0xffff) >= 0x0211) && (pAd->NicConfig2.field.ExternalLNAForG == 0))
{
RFValue |= 0x20;
}
// set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h
if (pAd->TxMixerGain24G >= 2)
{
RFValue &= (~0x7); // clean bit [2:0]
RFValue |= pAd->TxMixerGain24G;
}
RT30xxWriteRFRegister(pAd, RF_R17, RFValue);
*/
// RX_LO1_en, RF R20 register Bit 3 to 0
RT30xxReadRFRegister(pAd, RF_R20, &RFValue);
RFValue &= (~0x08);
RT30xxWriteRFRegister(pAd, RF_R20, RFValue);
// RX_LO2_en, RF R21 register Bit 3 to 0
RT30xxReadRFRegister(pAd, RF_R21, &RFValue);
RFValue &= (~0x08);
RT30xxWriteRFRegister(pAd, RF_R21, RFValue);
/* add by johnli, reset RF_R27 when interface down & up to fix throughput problem*/
// LDORF_VC, RF R27 register Bit 2 to 0
RT30xxReadRFRegister(pAd, RF_R27, &RFValue);
// TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F).
// Raising RF voltage is no longer needed for RT3070(F)
if (IS_RT3090(pAd)) // RT309x and RT3071/72
{
if ((pAd->MACVersion & 0xffff) < 0x0211)
RFValue = (RFValue & (~0x77)) | 0x3;
else
RFValue = (RFValue & (~0x77));
RT30xxWriteRFRegister(pAd, RF_R27, RFValue);
}
/* end johnli */
}
/*
==========================================================================
Description:
Load RF sleep-mode setup
==========================================================================
*/
VOID RT33xxLoadRFSleepModeSetup(
IN PRTMP_ADAPTER pAd)
{
UCHAR RFValue;
UINT32 MACValue;
{
// RF_BLOCK_en. RF R1 register Bit 0 to 0
RT30xxReadRFRegister(pAd, RF_R01, &RFValue);
RFValue &= (~0x01);
RT30xxWriteRFRegister(pAd, RF_R01, RFValue);
// VCO_IC, RF R7 register Bit 4 & Bit 5 to 0
RT30xxReadRFRegister(pAd, RF_R07, &RFValue);
RFValue &= (~0x30);
RT30xxWriteRFRegister(pAd, RF_R07, RFValue);
// Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 0
RT30xxReadRFRegister(pAd, RF_R09, &RFValue);
RFValue &= (~0x0E);
RT30xxWriteRFRegister(pAd, RF_R09, RFValue);
// RX_CTB_en, RF R21 register Bit 7 to 0
RT30xxReadRFRegister(pAd, RF_R21, &RFValue);
RFValue &= (~0x80);
RT30xxWriteRFRegister(pAd, RF_R21, RFValue);
}
if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72
IS_RT3572(pAd) ||
IS_RT3390(pAd) ||
(IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201)))
{
{
RT30xxReadRFRegister(pAd, RF_R27, &RFValue);
RFValue |= 0x77;
RT30xxWriteRFRegister(pAd, RF_R27, RFValue);
}
RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue);
MACValue |= 0x1D000000;
RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue);
}
}
/*
==========================================================================
Description:
Reverse RF sleep-mode setup
==========================================================================
*/
VOID RT33xxReverseRFSleepModeSetup(
IN PRTMP_ADAPTER pAd)
{
UCHAR RFValue;
UINT32 MACValue;
{
// RF_BLOCK_en, RF R1 register Bit 0 to 1
RT30xxReadRFRegister(pAd, RF_R01, &RFValue);
RFValue |= 0x01;
RT30xxWriteRFRegister(pAd, RF_R01, RFValue);
// VCO_IC, RF R7 register Bit 4 & Bit 5 to 1
RT30xxReadRFRegister(pAd, RF_R07, &RFValue);
RFValue |= 0x30;
RT30xxWriteRFRegister(pAd, RF_R07, RFValue);
// Idoh, RF R9 register Bit 1, Bit 2 & Bit 3 to 1
RT30xxReadRFRegister(pAd, RF_R09, &RFValue);
RFValue |= 0x0E;
RT30xxWriteRFRegister(pAd, RF_R09, RFValue);
// RX_CTB_en, RF R21 register Bit 7 to 1
RT30xxReadRFRegister(pAd, RF_R21, &RFValue);
RFValue |= 0x80;
RT30xxWriteRFRegister(pAd, RF_R21, RFValue);
}
if (IS_RT3090(pAd) || // IS_RT3090 including RT309x and RT3071/72
IS_RT3572(pAd) ||
IS_RT3390(pAd) ||
(IS_RT3070(pAd) && ((pAd->MACVersion & 0xffff) < 0x0201)))
{
{
RT30xxReadRFRegister(pAd, RF_R27, &RFValue);
if ((pAd->MACVersion & 0xffff) < 0x0211)
RFValue = (RFValue & (~0x77)) | 0x3;
else
RFValue = (RFValue & (~0x77));
RT30xxWriteRFRegister(pAd, RF_R27, RFValue);
}
// RT3071 version E has fixed this issue
if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211))
{
// patch tx EVM issue temporarily
RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue);
MACValue = ((MACValue & 0xE0FFFFFF) | 0x0D000000);
RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue);
}
else
{
RTMP_IO_READ32(pAd, LDO_CFG0, &MACValue);
MACValue = ((MACValue & 0xE0FFFFFF) | 0x01000000);
RTMP_IO_WRITE32(pAd, LDO_CFG0, MACValue);
}
}
if(IS_RT3572(pAd))
RT30xxWriteRFRegister(pAd, RF_R08, 0x80);
}
// end johnli
VOID RT33xxHaltAction(
IN PRTMP_ADAPTER pAd)
{
UINT32 TxPinCfg = 0x00050F0F;
//
// Turn off LNA_PE or TRSW_POL
//
if (IS_RT3070(pAd) || IS_RT3071(pAd) || IS_RT3390(pAd)||IS_RT3572(pAd))
{
//KH? Both support 3390 usb and PCI
if ((IS_RT3071(pAd) || IS_RT3572(pAd)||IS_RT3390(pAd))
#ifdef RTMP_EFUSE_SUPPORT
&& (pAd->bUseEfuse)
#endif // RTMP_EFUSE_SUPPORT //
)
{
TxPinCfg &= 0xFFFBF0F0; // bit18 off
}
else
{
TxPinCfg &= 0xFFFFF0F0;
}
RTMP_IO_WRITE32(pAd, TX_PIN_CFG, TxPinCfg);
}
}
#endif // RT30xx //
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
chlist.h
Abstract:
Miniport generic portion header file
Revision History:
Who When What
-------- ---------- ----------------------------------------------
Fonchi Wu 2007-12-19 created
*/
#ifndef __CHLIST_H__
#define __CHLIST_H__
#include "rtmp_type.h"
#include "rtmp_def.h"
#define ODOR 0
#define IDOR 1
#define BOTH 2
#define BAND_5G 0
#define BAND_24G 1
#define BAND_BOTH 2
typedef struct _CH_DESP {
UCHAR FirstChannel;
UCHAR NumOfCh;
CHAR MaxTxPwr; // dBm
UCHAR Geography; // 0:out door, 1:in door, 2:both
BOOLEAN DfsReq; // Dfs require, 0: No, 1: yes.
} CH_DESP, *PCH_DESP;
typedef struct _CH_REGION {
UCHAR CountReg[3];
UCHAR DfsType; // 0: CE, 1: FCC, 2: JAP, 3:JAP_W53, JAP_W56
CH_DESP ChDesp[10];
} CH_REGION, *PCH_REGION;
extern CH_REGION ChRegion[];
typedef struct _CH_FREQ_MAP_{
UINT16 channel;
UINT16 freqKHz;
}CH_FREQ_MAP;
extern CH_FREQ_MAP CH_HZ_ID_MAP[];
extern int CH_HZ_ID_MAP_NUM;
#define MAP_CHANNEL_ID_TO_KHZ(_ch, _khz) \
do{ \
int _chIdx; \
for (_chIdx = 0; _chIdx < CH_HZ_ID_MAP_NUM; _chIdx++)\
{ \
if ((_ch) == CH_HZ_ID_MAP[_chIdx].channel) \
{ \
(_khz) = CH_HZ_ID_MAP[_chIdx].freqKHz * 1000; \
break; \
} \
} \
if (_chIdx == CH_HZ_ID_MAP_NUM) \
(_khz) = 2412000; \
}while(0)
#define MAP_KHZ_TO_CHANNEL_ID(_khz, _ch) \
do{ \
int _chIdx; \
for (_chIdx = 0; _chIdx < CH_HZ_ID_MAP_NUM; _chIdx++)\
{ \
if ((_khz) == CH_HZ_ID_MAP[_chIdx].freqKHz) \
{ \
(_ch) = CH_HZ_ID_MAP[_chIdx].channel; \
break; \
} \
} \
if (_chIdx == CH_HZ_ID_MAP_NUM) \
(_ch) = 1; \
}while(0)
VOID BuildChannelListEx(
IN PRTMP_ADAPTER pAd);
VOID BuildBeaconChList(
IN PRTMP_ADAPTER pAd,
OUT PUCHAR pBuf,
OUT PULONG pBufLen);
#ifdef DOT11_N_SUPPORT
VOID N_ChannelCheck(
IN PRTMP_ADAPTER pAd);
VOID N_SetCenCh(
IN PRTMP_ADAPTER pAd);
#endif // DOT11_N_SUPPORT //
UINT8 GetCuntryMaxTxPwr(
IN PRTMP_ADAPTER pAd,
IN UINT8 channel);
#endif // __CHLIST_H__
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
eeprom.c
Abstract:
Revision History:
Who When What
-------- ---------- ----------------------------------------------
Name Date Modification logs
*/
#include "../rt_config.h"
INT RtmpChipOpsEepromHook(
IN RTMP_ADAPTER *pAd,
IN INT infType)
{
RTMP_CHIP_OP *pChipOps = &pAd->chipOps;
#ifdef RT30xx
#ifdef RTMP_EFUSE_SUPPORT
UINT32 eFuseCtrl, MacCsr0;
int index;
index = 0;
do
{
RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0);
pAd->MACVersion = MacCsr0;
if ((pAd->MACVersion != 0x00) && (pAd->MACVersion != 0xFFFFFFFF))
break;
RTMPusecDelay(10);
} while (index++ < 100);
pAd->bUseEfuse=FALSE;
RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrl);
pAd->bUseEfuse = ( (eFuseCtrl & 0x80000000) == 0x80000000) ? 1 : 0;
if(pAd->bUseEfuse)
{
pChipOps->eeinit = eFuse_init;
pChipOps->eeread = rtmp_ee_efuse_read16;
pChipOps->eewrite = rtmp_ee_efuse_write16;
return 0 ;
}
else
{
pAd->bFroceEEPROMBuffer = FALSE;
DBGPRINT(RT_DEBUG_TRACE, ("NVM is EEPROM\n"));
}
#endif // RTMP_EFUSE_SUPPORT //
#endif // RT30xx //
switch(infType)
{
#ifdef RTMP_PCI_SUPPORT
case RTMP_DEV_INF_PCI:
pChipOps->eeinit = NULL;
pChipOps->eeread = rtmp_ee_prom_read16;
pChipOps->eewrite = rtmp_ee_prom_write16;
break;
#endif // RTMP_PCI_SUPPORT //
default:
DBGPRINT(RT_DEBUG_ERROR, ("RtmpChipOpsEepromHook() failed!\n"));
break;
}
return 0;
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
mlme_ex_def.h
Abstract:
Miniport generic portion header file
Revision History:
Who When What
-------- ---------- ----------------------------------------------
Fonchi 2007-06-25 Extend original mlme APIs to support multi-entries
*/
#ifndef __MLME_EX_DEF_H__
#define __MLME_EX_DEF_H__
typedef VOID (*STATE_MACHINE_FUNC_EX)(VOID *Adaptor, MLME_QUEUE_ELEM *Elem, PULONG pCurrState, USHORT Idx);
typedef struct _STA_STATE_MACHINE_EX
{
ULONG Base;
ULONG NrState;
ULONG NrMsg;
ULONG CurrState;
STATE_MACHINE_FUNC_EX *TransFunc;
} STATE_MACHINE_EX, *PSTA_STATE_MACHINE_EX;
#endif // __MLME_EX_DEF_H__ //
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册