diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-19 17:48:32 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-19 17:48:32 -0700 |
commit | fb20871a54961b82d35303b43452928186c1361d (patch) | |
tree | 1beeb39e45eda1c8b5893090904b583fceeb07ef /drivers/staging/rt2860/rtmp.h | |
parent | bee89ab228e6f51c4ddd3481b9bd491859a8ee7b (diff) | |
parent | c7a5d70796379e3d51d0c652fbe1634b81d3bbd5 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: (342 commits)
Staging: comedi: fix build errors
Staging: udlfb: update to version 0.2.3
Staging: udlfb: fix some sparse warnings.
Staging: udlfb: clean up checkpatch warnings in udlfb.c
Staging: udlfb: clean up checkpatch warnings in udlfb.h
Staging: udlfb: add udlfb driver to build
Staging: add udlfb driver
Staging: pata_rdc: remove pointless comments
Staging: pata_rdc: remove DRIVER macros
Staging: pata_rdc: remove dbgprintf macro
Staging: pata_rdc: remove broken flag
Staging: pata_rdc: fix build warnings
Staging: pata_rdc: use PCI_DEVICE
Staging: pata_rdc: remove function prototypes
Staging: pata_rdc: coding style fixes
Staging: pata_rdc: convert code to work in 2.6.29
Staging: pata_rdc: add driver to the build system
Staging: add pata_rdc driver
Staging: remove obsolete serqt_usb driver
Staging: serqt_usb2 add the driver to the build
...
Diffstat (limited to 'drivers/staging/rt2860/rtmp.h')
-rw-r--r-- | drivers/staging/rt2860/rtmp.h | 1831 |
1 files changed, 894 insertions, 937 deletions
diff --git a/drivers/staging/rt2860/rtmp.h b/drivers/staging/rt2860/rtmp.h index b904b7886c2..25c31998d07 100644 --- a/drivers/staging/rt2860/rtmp.h +++ b/drivers/staging/rt2860/rtmp.h @@ -43,25 +43,112 @@ #include "link_list.h" #include "spectrum_def.h" - -#ifdef CONFIG_STA_SUPPORT #include "aironet.h" -#endif // CONFIG_STA_SUPPORT // //#define DBG_DIAGNOSE 1 -#if defined(CONFIG_AP_SUPPORT) && defined(CONFIG_STA_SUPPORT) -#define IF_DEV_CONFIG_OPMODE_ON_AP(_pAd) if(_pAd->OpMode == OPMODE_AP) -#define IF_DEV_CONFIG_OPMODE_ON_STA(_pAd) if(_pAd->OpMode == OPMODE_STA) -#else -#define IF_DEV_CONFIG_OPMODE_ON_AP(_pAd) -#define IF_DEV_CONFIG_OPMODE_ON_STA(_pAd) -#endif - #define VIRTUAL_IF_INC(__pAd) ((__pAd)->VirtualIfCnt++) #define VIRTUAL_IF_DEC(__pAd) ((__pAd)->VirtualIfCnt--) #define VIRTUAL_IF_NUM(__pAd) ((__pAd)->VirtualIfCnt) +#ifdef RT2870 +//////////////////////////////////////////////////////////////////////////// +// The TX_BUFFER structure forms the transmitted USB packet to the device +//////////////////////////////////////////////////////////////////////////// +typedef struct __TX_BUFFER{ + union { + UCHAR WirelessPacket[TX_BUFFER_NORMSIZE]; + HEADER_802_11 NullFrame; + PSPOLL_FRAME PsPollPacket; + RTS_FRAME RTSFrame; + }field; + UCHAR Aggregation[4]; //Buffer for save Aggregation size. +} TX_BUFFER, *PTX_BUFFER; + +typedef struct __HTTX_BUFFER{ + union { + UCHAR WirelessPacket[MAX_TXBULK_SIZE]; + HEADER_802_11 NullFrame; + PSPOLL_FRAME PsPollPacket; + RTS_FRAME RTSFrame; + }field; + UCHAR Aggregation[4]; //Buffer for save Aggregation size. +} HTTX_BUFFER, *PHTTX_BUFFER; + + +// used to track driver-generated write irps +typedef struct _TX_CONTEXT +{ + PVOID pAd; //Initialized in MiniportInitialize + PURB pUrb; //Initialized in MiniportInitialize + PIRP pIrp; //used to cancel pending bulk out. + //Initialized in MiniportInitialize + PTX_BUFFER TransferBuffer; //Initialized in MiniportInitialize + ULONG BulkOutSize; + UCHAR BulkOutPipeId; + UCHAR SelfIdx; + BOOLEAN InUse; + BOOLEAN bWaitingBulkOut; // at least one packet is in this TxContext, ready for making IRP anytime. + BOOLEAN bFullForBulkOut; // all tx buffer are full , so waiting for tx bulkout. + BOOLEAN IRPPending; + BOOLEAN LastOne; + BOOLEAN bAggregatible; + UCHAR Header_802_3[LENGTH_802_3]; + UCHAR Rsv[2]; + ULONG DataOffset; + UINT TxRate; + dma_addr_t data_dma; // urb dma on linux + +} TX_CONTEXT, *PTX_CONTEXT, **PPTX_CONTEXT; + + +// used to track driver-generated write irps +typedef struct _HT_TX_CONTEXT +{ + PVOID pAd; //Initialized in MiniportInitialize + PURB pUrb; //Initialized in MiniportInitialize + PIRP pIrp; //used to cancel pending bulk out. + //Initialized in MiniportInitialize + PHTTX_BUFFER TransferBuffer; //Initialized in MiniportInitialize + ULONG BulkOutSize; // Indicate the total bulk-out size in bytes in one bulk-transmission + UCHAR BulkOutPipeId; + BOOLEAN IRPPending; + BOOLEAN LastOne; + BOOLEAN bCurWriting; + BOOLEAN bRingEmpty; + BOOLEAN bCopySavePad; + UCHAR SavedPad[8]; + UCHAR Header_802_3[LENGTH_802_3]; + ULONG CurWritePosition; // Indicate the buffer offset which packet will be inserted start from. + ULONG CurWriteRealPos; // Indicate the buffer offset which packet now are writing to. + ULONG NextBulkOutPosition; // Indicate the buffer start offset of a bulk-transmission + ULONG ENextBulkOutPosition; // Indicate the buffer end offset of a bulk-transmission + UINT TxRate; + dma_addr_t data_dma; // urb dma on linux +} HT_TX_CONTEXT, *PHT_TX_CONTEXT, **PPHT_TX_CONTEXT; + + +// +// Structure to keep track of receive packets and buffers to indicate +// receive data to the protocol. +// +typedef struct _RX_CONTEXT +{ + PUCHAR TransferBuffer; + PVOID pAd; + PIRP pIrp;//used to cancel pending bulk in. + PURB pUrb; + //These 2 Boolean shouldn't both be 1 at the same time. + ULONG BulkInOffset; // number of packets waiting for reordering . + BOOLEAN bRxHandling; // Notify this packet is being process now. + BOOLEAN InUse; // USB Hardware Occupied. Wait for USB HW to put packet. + BOOLEAN Readable; // Receive Complete back. OK for driver to indicate receiving packet. + BOOLEAN IRPPending; // TODO: To be removed + atomic_t IrpLock; + NDIS_SPIN_LOCK RxContextLock; + dma_addr_t data_dma; // urb dma on linux +} RX_CONTEXT, *PRX_CONTEXT; +#endif // RT2870 // // @@ -136,14 +223,9 @@ extern UCHAR SsidIe; extern UCHAR SupRateIe; extern UCHAR ExtRateIe; -#ifdef DOT11_N_SUPPORT extern UCHAR HtCapIe; extern UCHAR AddHtInfoIe; extern UCHAR NewExtChanIe; -#ifdef DOT11N_DRAFT3 -extern UCHAR ExtHtCapIe; -#endif // DOT11N_DRAFT3 // -#endif // DOT11_N_SUPPORT // extern UCHAR ErpIe; extern UCHAR DsIe; @@ -152,9 +234,15 @@ extern UCHAR WpaIe; extern UCHAR Wpa2Ie; extern UCHAR IbssIe; extern UCHAR Ccx2Ie; +#ifdef RT30xx +extern UCHAR WapiIe; +#endif extern UCHAR WPA_OUI[]; extern UCHAR RSN_OUI[]; +#ifdef RT30xx +extern UCHAR WAPI_OUI[]; +#endif extern UCHAR WME_INFO_ELEM[]; extern UCHAR WME_PARM_ELEM[]; extern UCHAR Ccx2QosInfo[]; @@ -168,7 +256,6 @@ extern UCHAR RateSwitchTable11B[]; extern UCHAR RateSwitchTable11G[]; extern UCHAR RateSwitchTable11BG[]; -#ifdef DOT11_N_SUPPORT extern UCHAR RateSwitchTable11BGN1S[]; extern UCHAR RateSwitchTable11BGN2S[]; extern UCHAR RateSwitchTable11BGN2SForABand[]; @@ -176,97 +263,10 @@ extern UCHAR RateSwitchTable11N1S[]; extern UCHAR RateSwitchTable11N2S[]; extern UCHAR RateSwitchTable11N2SForABand[]; -#ifdef CONFIG_STA_SUPPORT extern UCHAR PRE_N_HT_OUI[]; -#endif // CONFIG_STA_SUPPORT // -#endif // DOT11_N_SUPPORT // #define MAXSEQ (0xFFF) -#ifdef RALINK_ATE -typedef struct _ATE_INFO { - UCHAR Mode; - CHAR TxPower0; - CHAR TxPower1; - CHAR TxAntennaSel; - CHAR RxAntennaSel; - TXWI_STRUC TxWI; // TXWI - USHORT QID; - UCHAR Addr1[MAC_ADDR_LEN]; - UCHAR Addr2[MAC_ADDR_LEN]; - UCHAR Addr3[MAC_ADDR_LEN]; - UCHAR Channel; - UINT32 TxLength; - UINT32 TxCount; - UINT32 TxDoneCount; // Tx DMA Done - UINT32 RFFreqOffset; - BOOLEAN bRxFer; - BOOLEAN bQATxStart; // Have compiled QA in and use it to ATE tx. - BOOLEAN bQARxStart; // Have compiled QA in and use it to ATE rx. - BOOLEAN bFWLoading; // Reload firmware when ATE is done. - UINT32 RxTotalCnt; - UINT32 RxCntPerSec; - - CHAR LastSNR0; // last received SNR - CHAR LastSNR1; // last received SNR for 2nd antenna - CHAR LastRssi0; // last received RSSI - CHAR LastRssi1; // last received RSSI for 2nd antenna - CHAR LastRssi2; // last received RSSI for 3rd antenna - CHAR AvgRssi0; // last 8 frames' average RSSI - CHAR AvgRssi1; // last 8 frames' average RSSI - CHAR AvgRssi2; // last 8 frames' average RSSI - SHORT AvgRssi0X8; // sum of last 8 frames' RSSI - SHORT AvgRssi1X8; // sum of last 8 frames' RSSI - SHORT AvgRssi2X8; // sum of last 8 frames' RSSI - - UINT32 NumOfAvgRssiSample; - -#ifdef RALINK_28xx_QA - // Tx frame - USHORT HLen; // Header Length - USHORT PLen; // Pattern Length - UCHAR Header[32]; // Header buffer - UCHAR Pattern[32]; // Pattern buffer - USHORT DLen; // Data Length - USHORT seq; - UINT32 CID; - THREAD_PID AtePid; - // counters - UINT32 U2M; - UINT32 OtherData; - UINT32 Beacon; - UINT32 OtherCount; - UINT32 TxAc0; - UINT32 TxAc1; - UINT32 TxAc2; - UINT32 TxAc3; - UINT32 TxHCCA; - UINT32 TxMgmt; - UINT32 RSSI0; - UINT32 RSSI1; - UINT32 RSSI2; - UINT32 SNR0; - UINT32 SNR1; - // control - //UINT32 Repeat; // Tx Cpu count - UCHAR TxStatus; // task Tx status // 0 --> task is idle, 1 --> task is running -#endif // RALINK_28xx_QA // -} ATE_INFO, *PATE_INFO; - -#ifdef RALINK_28xx_QA -struct ate_racfghdr { - UINT32 magic_no; - USHORT command_type; - USHORT command_id; - USHORT length; - USHORT sequence; - USHORT status; - UCHAR data[2046]; -} __attribute__((packed)); -#endif // RALINK_28xx_QA // -#endif // RALINK_ATE // - -#ifdef DOT11_N_SUPPORT struct reordering_mpdu { struct reordering_mpdu *next; @@ -287,7 +287,6 @@ struct reordering_mpdu_pool NDIS_SPIN_LOCK lock; struct reordering_list freelist; }; -#endif // DOT11_N_SUPPORT // typedef struct _RSSI_SAMPLE { CHAR LastRssi0; // last received RSSI @@ -364,12 +363,14 @@ typedef struct _QUEUE_HEADER { #define RTMP_TEST_FLAG(_M, _F) (((_M)->Flags & (_F)) != 0) #define RTMP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F)) +#ifdef RT2860 // Macro for power save flag. #define RTMP_SET_PSFLAG(_M, _F) ((_M)->PSFlags |= (_F)) #define RTMP_CLEAR_PSFLAG(_M, _F) ((_M)->PSFlags &= ~(_F)) #define RTMP_CLEAR_PSFLAGS(_M) ((_M)->PSFlags = 0) #define RTMP_TEST_PSFLAG(_M, _F) (((_M)->PSFlags & (_F)) != 0) #define RTMP_TEST_PSFLAGS(_M, _F) (((_M)->PSFlags & (_F)) == (_F)) +#endif #define OPSTATUS_SET_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags |= (_F)) #define OPSTATUS_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.OpStatusFlags &= ~(_F)) @@ -383,14 +384,12 @@ typedef struct _QUEUE_HEADER { #define RX_FILTER_CLEAR_FLAG(_pAd, _F) ((_pAd)->CommonCfg.PacketFilter &= ~(_F)) #define RX_FILTER_TEST_FLAG(_pAd, _F) (((_pAd)->CommonCfg.PacketFilter & (_F)) != 0) -#ifdef CONFIG_STA_SUPPORT #define STA_NO_SECURITY_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11EncryptionDisabled) #define STA_WEP_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption1Enabled) #define STA_TKIP_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption2Enabled) #define STA_AES_ON(_p) (_p->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) #define STA_TGN_WIFI_ON(_p) (_p->StaCfg.bTGnWifiTest == TRUE) -#endif // CONFIG_STA_SUPPORT // #define CKIP_KP_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x10) && ((_p)->StaCfg.bCkipCmicOn == TRUE)) #define CKIP_CMIC_ON(_p) ((((_p)->StaCfg.CkipFlag) & 0x08) && ((_p)->StaCfg.bCkipCmicOn == TRUE)) @@ -401,7 +400,17 @@ typedef struct _QUEUE_HEADER { (_idx) = (_idx+1) % (_RingSize); \ } +#ifdef RT30xx +// We will have a cost down version which mac version is 0x3090xxxx +#define IS_RT3090(_pAd) ((((_pAd)->MACVersion & 0xffff0000) == 0x30710000) || (((_pAd)->MACVersion & 0xffff0000) == 0x30900000)) +#endif #define IS_RT3070(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x30700000) +#ifdef RT30xx +#define IS_RT3071(_pAd) (((_pAd)->MACVersion & 0xffff0000) == 0x30710000) +#define IS_RT2070(_pAd) (((_pAd)->RfIcType == RFIC_2020) || ((_pAd)->EFuseTag == 0x27)) + +#define IS_RT30xx(_pAd) (((_pAd)->MACVersion & 0xfff00000) == 0x30700000) +#endif #define RING_PACKET_INIT(_TxRing, _idx) \ { \ @@ -437,7 +446,6 @@ typedef struct _QUEUE_HEADER { } \ } -#ifdef DOT11_N_SUPPORT // StaActive.SupportedHtPhy.MCSSet is copied from AP beacon. Don't need to update here. #define COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(_pAd) \ { \ @@ -461,7 +469,6 @@ typedef struct _QUEUE_HEADER { _pAd->MacTab.Content[BSSID_WCID].MmpsMode= (UCHAR)(_pHtCapability->HtCapInfo.MimoPs); \ _pAd->MacTab.Content[BSSID_WCID].MaxRAmpduFactor = (UCHAR)(_pHtCapability->HtCapParm.MaxRAmpduFactor); \ } -#endif // DOT11_N_SUPPORT // // // MACRO for 32-bit PCI register read / write @@ -483,6 +490,7 @@ typedef struct _QUEUE_HEADER { // #define MAX_BUSY_COUNT 100 // Number of retry before failing access BBP & RF indirect register // +#ifdef RT2860 #define RTMP_RF_IO_WRITE32(_A, _V) \ { \ PHY_CSR4_STRUC Value; \ @@ -646,7 +654,20 @@ typedef struct _QUEUE_HEADER { } \ } \ } +#endif /* RT2860 */ +#ifdef RT2870 +#define RTMP_RF_IO_WRITE32(_A, _V) RTUSBWriteRFRegister(_A, _V) +#define RTMP_BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) RTUSBReadBBPRegister(_A, _I, _pV) +#define RTMP_BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) RTUSBWriteBBPRegister(_A, _I, _V) +#define BBP_IO_WRITE8_BY_REG_ID(_A, _I, _V) RTUSBWriteBBPRegister(_A, _I, _V) +#define BBP_IO_READ8_BY_REG_ID(_A, _I, _pV) RTUSBReadBBPRegister(_A, _I, _pV) +#endif // RT2870 // + +#ifdef RT30xx +#define RTMP_RF_IO_READ8_BY_REG_ID(_A, _I, _pV) RT30xxReadRFRegister(_A, _I, _pV) +#define RTMP_RF_IO_WRITE8_BY_REG_ID(_A, _I, _V) RT30xxWriteRFRegister(_A, _I, _V) +#endif // RT30xx // #define MAP_CHANNEL_ID_TO_KHZ(ch, khz) { \ switch (ch) \ @@ -897,6 +918,7 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { // Enqueue this frame to MLME engine // We need to enqueue the whole frame because MLME need to pass data type // information from 802.11 header +#ifdef RT2860 #define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \ { \ UINT32 High32TSF, Low32TSF; \ @@ -904,6 +926,49 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { RTMP_IO_READ32(_pAd, TSF_TIMER_DW0, &Low32TSF); \ MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (UCHAR)_Rssi0, (UCHAR)_Rssi1,(UCHAR)_Rssi2,_FrameSize, _pFrame, (UCHAR)_PlcpSignal); \ } +#endif +#ifdef RT2870 +#define REPORT_MGMT_FRAME_TO_MLME(_pAd, Wcid, _pFrame, _FrameSize, _Rssi0, _Rssi1, _Rssi2, _PlcpSignal) \ +{ \ + UINT32 High32TSF=0, Low32TSF=0; \ + MlmeEnqueueForRecv(_pAd, Wcid, High32TSF, Low32TSF, (UCHAR)_Rssi0, (UCHAR)_Rssi1,(UCHAR)_Rssi2,_FrameSize, _pFrame, (UCHAR)_PlcpSignal); \ +} +#endif // RT2870 // + +#ifdef RT30xx +//Need to collect each ant's rssi concurrently +//rssi1 is report to pair2 Ant and rss2 is reprot to pair1 Ant when 4 Ant +#define COLLECT_RX_ANTENNA_AVERAGE_RSSI(_pAd, _rssi1, _rssi2) \ +{ \ + SHORT AvgRssi; \ + UCHAR UsedAnt; \ + if (_pAd->RxAnt.EvaluatePeriod == 0) \ + { \ + UsedAnt = _pAd->RxAnt.Pair1PrimaryRxAnt; \ + AvgRssi = _pAd->RxAnt.Pair1AvgRssi[UsedAnt]; \ + if (AvgRssi < 0) \ + AvgRssi = AvgRssi - (AvgRssi >> 3) + _rssi1; \ + else \ + AvgRssi = _rssi1 << 3; \ + _pAd->RxAnt.Pair1AvgRssi[UsedAnt] = AvgRssi; \ + } \ + else \ + { \ + UsedAnt = _pAd->RxAnt.Pair1SecondaryRxAnt; \ + AvgRssi = _pAd->RxAnt.Pair1AvgRssi[UsedAnt]; \ + if ((AvgRssi < 0) && (_pAd->RxAnt.FirstPktArrivedWhenEvaluate)) \ + AvgRssi = AvgRssi - (AvgRssi >> 3) + _rssi1; \ + else \ + { \ + _pAd->RxAnt.FirstPktArrivedWhenEvaluate = TRUE; \ + AvgRssi = _rssi1 << 3; \ + } \ + _pAd->RxAnt.Pair1AvgRssi[UsedAnt] = AvgRssi; \ + _pAd->RxAnt.RcvPktNumWhenEvaluate++; \ + } \ +} +#endif // RT30xx // + #define NDIS_QUERY_BUFFER(_NdisBuf, _ppVA, _pBufLen) \ NdisQueryBuffer(_NdisBuf, _ppVA, _pBufLen) @@ -916,7 +981,7 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { // #define JapanChannelCheck(channel) ((channel == 52) || (channel == 56) || (channel == 60) || (channel == 64)) -#ifdef CONFIG_STA_SUPPORT +#ifdef RT2860 #define STA_PORT_SECURED(_pAd) \ { \ _pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; \ @@ -925,8 +990,16 @@ typedef struct _RTMP_SCATTER_GATHER_LIST { _pAd->MacTab.Content[BSSID_WCID].PortSecured = _pAd->StaCfg.PortSecured; \ NdisReleaseSpinLock(&(_pAd)->MacTabLock); \ } -#endif // CONFIG_STA_SUPPORT // - +#endif +#ifdef RT2870 +#define STA_PORT_SECURED(_pAd) \ +{ \ + _pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; \ + NdisAcquireSpinLock(&_pAd->MacTabLock); \ + _pAd->MacTab.Content[BSSID_WCID].PortSecured = _pAd->StaCfg.PortSecured; \ + NdisReleaseSpinLock(&_pAd->MacTabLock); \ +} +#endif // // Register set pair for initialzation register set definition @@ -975,17 +1048,10 @@ typedef struct _RTMP_DMABUF typedef union _HEADER_802_11_SEQ{ -#ifdef RT_BIG_ENDIAN - struct { - USHORT Sequence:12; - USHORT Frag:4; - } field; -#else struct { USHORT Frag:4; USHORT Sequence:12; } field; -#endif USHORT value; } HEADER_802_11_SEQ, *PHEADER_802_11_SEQ; @@ -1002,7 +1068,12 @@ typedef struct _RTMP_REORDERBUF UCHAR DataOffset; USHORT Datasize; ULONG AllocSize; +#ifdef RT2860 NDIS_PHYSICAL_ADDRESS AllocPa; // TxBuf physical address +#endif +#ifdef RT2870 + PUCHAR AllocPa; +#endif // RT2870 // } RTMP_REORDERBUF, *PRTMP_REORDERBUF; // @@ -1101,7 +1172,9 @@ typedef struct _COUNTER_802_11 { typedef struct _COUNTER_RALINK { ULONG TransmittedByteCount; // both successful and failure, used to calculate TX throughput +#ifdef RT2860 ULONG LastReceivedByteCount; +#endif ULONG ReceivedByteCount; // both CRC okay and CRC error, used to calculate RX throughput ULONG BeenDisassociatedCount; ULONG BadCQIAutoRecoveryCount; @@ -1124,6 +1197,9 @@ typedef struct _COUNTER_RALINK { UINT32 OneSecFrameDuplicateCount; +#ifdef RT2870 + ULONG OneSecTransmittedByteCount; // both successful and failure, used to calculate TX throughput +#endif // RT2870 // UINT32 OneSecTxNoRetryOkCount; UINT32 OneSecTxRetryOkCount; @@ -1197,15 +1273,6 @@ typedef struct _ARCFOUR // MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI too. just copy to TXWI. typedef struct _RECEIVE_SETTING { -#ifdef RT_BIG_ENDIAN - USHORT MIMO:1; - USHORT OFDM:1; - USHORT rsv:3; - USHORT STBC:2; //SPACE - USHORT ShortGI:1; - USHORT Mode:2; //channel bandwidth 20MHz or 40 MHz - USHORT NumOfRX:2; // MIMO. WE HAVE 3R -#else USHORT NumOfRX:2; // MIMO. WE HAVE 3R USHORT Mode:2; //channel bandwidth 20MHz or 40 MHz USHORT ShortGI:1; @@ -1213,7 +1280,6 @@ typedef struct _RECEIVE_SETTING { USHORT rsv:3; USHORT OFDM:1; USHORT MIMO:1; -#endif } RECEIVE_SETTING, *PRECEIVE_SETTING; // Shared key data structure @@ -1230,9 +1296,7 @@ typedef struct _CIPHER_KEY { UCHAR RxTsc[6]; // 48bit TSC value UCHAR CipherAlg; // 0-none, 1:WEP64, 2:WEP128, 3:TKIP, 4:AES, 5:CKIP64, 6:CKIP128 UCHAR KeyLen; -#ifdef CONFIG_STA_SUPPORT UCHAR BssId[6]; -#endif // CONFIG_STA_SUPPORT // // Key length for each key, 0: entry is invalid UCHAR Type; // Indicate Pairwise/Group when reporting MIC error } CIPHER_KEY, *PCIPHER_KEY; @@ -1248,6 +1312,9 @@ typedef struct _BBP_TUNING_STRUCT { typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT { UCHAR EvaluatePeriod; // 0:not evalute status, 1: evaluate status, 2: switching status +#ifdef RT30xx + UCHAR EvaluateStableCnt; +#endif UCHAR Pair1PrimaryRxAnt; // 0:Ant-E1, 1:Ant-E2 UCHAR Pair1SecondaryRxAnt; // 0:Ant-E1, 1:Ant-E2 UCHAR Pair2PrimaryRxAnt; // 0:Ant-E3, 1:Ant-E4 @@ -1368,9 +1435,6 @@ typedef struct _BBP_R66_TUNING { typedef struct _CHANNEL_TX_POWER { USHORT RemainingTimeForUse; //unit: sec UCHAR Channel; -#ifdef DOT11N_DRAFT3 - BOOLEAN bEffectedChannel; // For BW 40 operating in 2.4GHz , the "effected channel" is the channel that is covered in 40Mhz. -#endif // DOT11N_DRAFT3 // CHAR Power; CHAR Power2; UCHAR MaxTxPwr; @@ -1393,7 +1457,6 @@ typedef enum _ABGBAND_STATE_ { } ABGBAND_STATE; typedef struct _MLME_STRUCT { -#ifdef CONFIG_STA_SUPPORT // STA state machines STATE_MACHINE CntlMachine; STATE_MACHINE AssocMachine; @@ -1409,20 +1472,10 @@ typedef struct _MLME_STRUCT { STATE_MACHINE_FUNC SyncFunc[SYNC_FUNC_SIZE]; STATE_MACHINE_FUNC WpaPskFunc[WPA_PSK_FUNC_SIZE]; STATE_MACHINE_FUNC AironetFunc[AIRONET_FUNC_SIZE]; -#endif // CONFIG_STA_SUPPORT // STATE_MACHINE_FUNC ActFunc[ACT_FUNC_SIZE]; // Action STATE_MACHINE ActMachine; - -#ifdef QOS_DLS_SUPPORT - STATE_MACHINE DlsMachine; - STATE_MACHINE_FUNC DlsFunc[DLS_FUNC_SIZE]; -#endif // QOS_DLS_SUPPORT // - - - - ULONG ChannelQuality; // 0..100, Channel Quality Indication for Roaming ULONG Now32; // latch the value of NdisGetSystemUpTime() ULONG LastSendNULLpsmTime; @@ -1437,9 +1490,11 @@ typedef struct _MLME_STRUCT { RALINK_TIMER_STRUCT APSDPeriodicTimer; RALINK_TIMER_STRUCT LinkDownTimer; RALINK_TIMER_STRUCT LinkUpTimer; +#ifdef RT2860 UCHAR bPsPollTimerRunning; RALINK_TIMER_STRUCT PsPollTimer; RALINK_TIMER_STRUCT RadioOnOffTimer; +#endif ULONG PeriodicRound; ULONG OneSecPeriodicRound; @@ -1448,7 +1503,10 @@ typedef struct _MLME_STRUCT { BOOLEAN bEnableAutoAntennaCheck; RALINK_TIMER_STRUCT RxAntEvalTimer; - +#ifdef RT2870 + UCHAR CaliBW40RfR24; + UCHAR CaliBW20RfR24; +#endif // RT2870 // } MLME_STRUCT, *PMLME_STRUCT; // structure for radar detection and channel switch @@ -1471,23 +1529,6 @@ typedef struct _RADAR_DETECT_STRUCT { UINT8 LongPulseRadarTh; } RADAR_DETECT_STRUCT, *PRADAR_DETECT_STRUCT; -#ifdef CARRIER_DETECTION_SUPPORT -typedef enum CD_STATE_n -{ - CD_NORMAL, - CD_SILENCE, - CD_MAX_STATE -} CD_STATE; - -typedef struct CARRIER_DETECTION_s -{ - BOOLEAN Enable; - UINT8 CDSessionTime; - UINT8 CDPeriod; - CD_STATE CD_State; -} CARRIER_DETECTION, *PCARRIER_DETECTION; -#endif // CARRIER_DETECTION_SUPPORT // - typedef enum _REC_BLOCKACK_STATUS { Recipient_NONE=0, @@ -1504,7 +1545,6 @@ typedef enum _ORI_BLOCKACK_STATUS Originator_Done } ORI_BLOCKACK_STATUS, *PORI_BLOCKACK_STATUS; -#ifdef DOT11_N_SUPPORT typedef struct _BA_ORI_ENTRY{ UCHAR Wcid; UCHAR TID; @@ -1568,21 +1608,6 @@ typedef struct _QUERYBA_TABLE{ } QUERYBA_TABLE, *PQUERYBA_TABLE; typedef union _BACAP_STRUC { -#ifdef RT_BIG_ENDIAN - struct { - UINT32 :4; - UINT32 b2040CoexistScanSup:1; //As Sta, support do 2040 coexistence scan for AP. As Ap, support monitor trigger event to check if can use BW 40MHz. - UINT32 bHtAdhoc:1; // adhoc can use ht rate. - UINT32 MMPSmode:2; // MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable - UINT32 AmsduSize:1; // 0:3839, 1:7935 bytes. UINT MSDUSizeToBytes[] = { 3839, 7935}; - UINT32 AmsduEnable:1; //Enable AMSDU transmisstion - UINT32 MpduDensity:3; - UINT32 Policy:2; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use - UINT32 AutoBA:1; // automatically BA - UINT32 TxBAWinLimit:8; - UINT32 RxBAWinLimit:8; - } field; -#else struct { UINT32 RxBAWinLimit:8; UINT32 TxBAWinLimit:8; @@ -1596,10 +1621,8 @@ typedef union _BACAP_STRUC { UINT32 b2040CoexistScanSup:1; //As Sta, support do 2040 coexistence scan for AP. As Ap, support monitor trigger event to check if can use BW 40MHz. UINT32 :4; } field; -#endif UINT32 word; } BACAP_STRUC, *PBACAP_STRUC; -#endif // DOT11_N_SUPPORT // //This structure is for all 802.11n card InterOptibilityTest action. Reset all Num every n second. (Details see MLMEPeriodic) typedef struct _IOT_STRUC { @@ -1614,30 +1637,15 @@ typedef struct _IOT_STRUC { UCHAR RTSShortProt; UCHAR RTSLongProt; BOOLEAN bRTSLongProtOn; -#ifdef CONFIG_STA_SUPPORT BOOLEAN bLastAtheros; BOOLEAN bCurrentAtheros; BOOLEAN bNowAtherosBurstOn; BOOLEAN bNextDisableRxBA; BOOLEAN bToggle; -#endif // CONFIG_STA_SUPPORT // } IOT_STRUC, *PIOT_STRUC; // This is the registry setting for 802.11n transmit setting. Used in advanced page. typedef union _REG_TRANSMIT_SETTING { -#ifdef RT_BIG_ENDIAN - struct { - UINT32 rsv:13; - UINT32 EXTCHA:2; - UINT32 HTMODE:1; - UINT32 TRANSNO:2; - UINT32 STBC:1; //SPACE - UINT32 ShortGI:1; - UINT32 BW:1; //channel bandwidth 20MHz or 40 MHz - UINT32 TxBF:1; // 3*3 - UINT32 rsv0:10; - } field; -#else struct { UINT32 rsv0:10; UINT32 TxBF:1; @@ -1649,26 +1657,16 @@ typedef union _REG_TRANSMIT_SETTING { UINT32 EXTCHA:2; UINT32 rsv:13; } field; -#endif UINT32 word; } REG_TRANSMIT_SETTING, *PREG_TRANSMIT_SETTING; typedef union _DESIRED_TRANSMIT_SETTING { -#ifdef RT_BIG_ENDIAN - struct { - USHORT rsv:3; - USHORT FixedTxMode:2; // If MCS isn't AUTO, fix rate in CCK, OFDM or HT mode. - USHORT PhyMode:4; - USHORT MCS:7; // MCS - } field; -#else struct { USHORT MCS:7; // MCS USHORT PhyMode:4; USHORT FixedTxMode:2; // If MCS isn't AUTO, fix rate in CCK, OFDM or HT mode. USHORT rsv:3; } field; -#endif USHORT word; } DESIRED_TRANSMIT_SETTING, *PDESIRED_TRANSMIT_SETTING; @@ -1707,6 +1705,19 @@ typedef struct { UCHAR bit_offset = wcid & 0x7; \ ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] |= BIT8[bit_offset]; } +#ifdef RT2870 +#define BEACON_BITMAP_MASK 0xff +typedef struct _BEACON_SYNC_STRUCT_ +{ + UCHAR BeaconBuf[HW_BEACON_MAX_COUNT][HW_BEACON_OFFSET]; + UCHAR BeaconTxWI[HW_BEACON_MAX_COUNT][TXWI_SIZE]; + ULONG TimIELocationInBeacon[HW_BEACON_MAX_COUNT]; + ULONG CapabilityInfoLocationInBeacon[HW_BEACON_MAX_COUNT]; + BOOLEAN EnableBeacon; // trigger to enable beacon transmission. + UCHAR BeaconBitMap; // NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change. + UCHAR DtimBitOn; // NOTE: If the MAX_MBSSID_NUM is larger than 8, this parameter need to change. +}BEACON_SYNC_STRUCT; +#endif // RT2870 // typedef struct _MULTISSID_STRUCT { UCHAR Bssid[MAC_ADDR_LEN]; @@ -1813,17 +1824,6 @@ typedef struct _MULTISSID_STRUCT { UCHAR BcnBufIdx; } MULTISSID_STRUCT, *PMULTISSID_STRUCT; - - -#ifdef DOT11N_DRAFT3 -typedef enum _BSS2040COEXIST_FLAG{ - BSS_2040_COEXIST_DISABLE = 0, - BSS_2040_COEXIST_TIMER_FIRED = 1, - BSS_2040_COEXIST_INFO_SYNC = 2, - BSS_2040_COEXIST_INFO_NOTIFY = 4, -}BSS2040COEXIST_FLAG; -#endif // DOT11N_DRAFT3 // - // configuration common to OPMODE_AP as well as OPMODE_STA typedef struct _COMMON_CONFIG { @@ -1886,10 +1886,9 @@ typedef struct _COMMON_CONFIG { ULONG TxPowerPercentage; // 0~100 % ULONG TxPowerDefault; // keep for TxPowerPercentage -#ifdef DOT11_N_SUPPORT BACAP_STRUC BACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 BACAP_STRUC REGBACapability; // NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 -#endif // DOT11_N_SUPPORT // + IOT_STRUC IOTestParm; // 802.11n InterOpbility Test Parameter; ULONG TxPreamble; // Rt802_11PreambleLong, Rt802_11PreambleShort, Rt802_11PreambleAuto BOOLEAN bUseZeroToDisableFragment; // Microsoft use 0 as disable @@ -1901,17 +1900,14 @@ typedef struct _COMMON_CONFIG { BOOLEAN bIEEE80211H; // 1: enable IEEE802.11h spec. ULONG DisableOLBCDetect; // 0: enable OLBC detect; 1 disable OLBC detect -#ifdef DOT11_N_SUPPORT BOOLEAN bRdg; -#endif // DOT11_N_SUPPORT // + BOOLEAN bWmmCapable; // 0:disable WMM, 1:enable WMM QOS_CAPABILITY_PARM APQosCapability; // QOS capability of the current associated AP EDCA_PARM APEdcaParm; // EDCA parameters of the current associated AP QBSS_LOAD_PARM APQbssLoad; // QBSS load of the current associated AP UCHAR AckPolicy[4]; // ACK policy of the specified AC. see ACK_xxx -#ifdef CONFIG_STA_SUPPORT BOOLEAN bDLSCapable; // 0:disable DLS, 1:enable DLS -#endif // CONFIG_STA_SUPPORT // // a bitmap of BOOLEAN flags. each bit represent an operation status of a particular // BOOLEAN control, either ON or OFF. These flags should always be accessed via // OPSTATUS_TEST_FLAG(), OPSTATUS_SET_FLAG(), OP_STATUS_CLEAR_FLAG() macros. @@ -1920,15 +1916,13 @@ typedef struct _COMMON_CONFIG { BOOLEAN NdisRadioStateOff; //For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff. ABGBAND_STATE BandState; // For setting BBP used on B/G or A mode. +#ifdef RT30xx + BOOLEAN bRxAntDiversity; // 0:disable, 1:enable Software Rx Antenna Diversity. +#endif // IEEE802.11H--DFS. RADAR_DETECT_STRUCT RadarDetect; -#ifdef CARRIER_DETECTION_SUPPORT - CARRIER_DETECTION CarrierDetect; -#endif // CARRIER_DETECTION_SUPPORT // - -#ifdef DOT11_N_SUPPORT // HT UCHAR BASize; // USer desired BAWindowSize. Should not exceed our max capability //RT_HT_CAPABILITY SupportedHtPhy; @@ -1939,33 +1933,6 @@ typedef struct _COMMON_CONFIG { //This IE is included in channel switch ammouncement frames 7.4.1.5, beacons, probe Rsp. NEW_EXT_CHAN_IE NewExtChanOffset; //7.3.2.20A, 1 if extension channel is above the control channel, 3 if below, 0 if not present -#ifdef DOT11N_DRAFT3 - UCHAR Bss2040CoexistFlag; // bit 0: bBssCoexistTimerRunning, bit 1: NeedSyncAddHtInfo. - RALINK_TIMER_STRUCT Bss2040CoexistTimer; - - //This IE is used for 20/40 BSS Coexistence. - BSS_2040_COEXIST_IE BSS2040CoexistInfo; - // ====== 11n D3.0 =======================> - USHORT Dot11OBssScanPassiveDwell; // Unit : TU. 5~1000 - USHORT Dot11OBssScanActiveDwell; // Unit : TU. 10~1000 - USHORT Dot11BssWidthTriggerScanInt; // Unit : Second - USHORT Dot11OBssScanPassiveTotalPerChannel; // Unit : TU. 200~10000 - USHORT Dot11OBssScanActiveTotalPerChannel; // Unit : TU. 20~10000 - USHORT Dot11BssWidthChanTranDelayFactor; - USHORT Dot11OBssScanActivityThre; // Unit : percentage - - ULONG Dot11BssWidthChanTranDelay; // multiple of (Dot11BssWidthTriggerScanInt * Dot11BssWidthChanTranDelayFactor) - ULONG CountDownCtr; // CountDown Counter from (Dot11BssWidthTriggerScanInt * Dot11BssWidthChanTranDelayFactor) - - NDIS_SPIN_LOCK TriggerEventTabLock; - BSS_2040_COEXIST_IE LastBSSCoexist2040; - BSS_2040_COEXIST_IE BSSCoexist2040; - TRIGGER_EVENT_TAB TriggerEventTab; - UCHAR ChannelListIdx; - // <====== 11n D3.0 ======================= - BOOLEAN bOverlapScanning; -#endif // DOT11N_DRAFT3 // - BOOLEAN bHTProtect; BOOLEAN bMIMOPSEnable; BOOLEAN bBADecline; @@ -1976,7 +1943,6 @@ typedef struct _COMMON_CONFIG { ULONG LastRcvBSSWidthTriggerEventsTime; UCHAR TxBASize; -#endif // DOT11_N_SUPPORT // // Enable wireless event BOOLEAN bWirelessEvent; @@ -1994,6 +1960,20 @@ typedef struct _COMMON_CONFIG { BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled +#ifdef RT2870 + BOOLEAN bMultipleIRP; // Multiple Bulk IN flag + UCHAR NumOfBulkInIRP; // if bMultipleIRP == TRUE, NumOfBulkInIRP will be 4 otherwise be 1 + RT_HT_CAPABILITY SupportedHtPhy; + ULONG MaxPktOneTxBulk; + UCHAR TxBulkFactor; + UCHAR RxBulkFactor; + + BEACON_SYNC_STRUCT *pBeaconSync; + RALINK_TIMER_STRUCT BeaconUpdateTimer; + UINT32 BeaconAdjust; + UINT32 BeaconFactor; + UINT32 BeaconRemain; +#endif // RT2870 // NDIS_SPIN_LOCK MeasureReqTabLock; @@ -2006,16 +1986,8 @@ typedef struct _COMMON_CONFIG { #ifdef MCAST_RATE_SPECIFIC HTTRANSMIT_SETTING MCastPhyMode; #endif // MCAST_RATE_SPECIFIC // - -#ifdef SINGLE_SKU - UINT16 DefineMaxTxPwr; -#endif // SINGLE_SKU // - - } COMMON_CONFIG, *PCOMMON_CONFIG; - -#ifdef CONFIG_STA_SUPPORT /* Modified by Wu Xi-Kun 4/21/2006 */ // STA configuration and status typedef struct _STA_ADMIN_CONFIG { @@ -2103,11 +2075,11 @@ typedef struct _STA_ADMIN_CONFIG { BOOLEAN bRadio; // Radio state, And of Sw & Hw radio state BOOLEAN bHardwareRadio; // Hardware controlled Radio enabled BOOLEAN bShowHiddenSSID; // Show all known SSID in SSID list get operation - +#ifdef RT2860 BOOLEAN AdhocBOnlyJoined; // Indicate Adhoc B Join. BOOLEAN AdhocBGJoined; // Indicate Adhoc B/G Join. BOOLEAN Adhoc20NJoined; // Indicate Adhoc 20MHz N Join. - +#endif // New for WPA, windows want us to to keep association information and // Fixed IEs from last association response NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo; @@ -2189,10 +2161,6 @@ typedef struct _STA_ADMIN_CONFIG { UCHAR DtimCount; // 0.. DtimPeriod-1 UCHAR DtimPeriod; // default = 3 -#ifdef QOS_DLS_SUPPORT - RT_802_11_DLS DLSEntry[MAX_NUM_OF_DLS_ENTRY]; - UCHAR DlsReplayCounter[8]; -#endif // QOS_DLS_SUPPORT // //////////////////////////////////////////////////////////////////////////////////////// // This is only for WHQL test. BOOLEAN WhqlTest; @@ -2203,7 +2171,6 @@ typedef struct _STA_ADMIN_CONFIG { BOOLEAN bFastRoaming; // 0:disable fast roaming, 1:enable fast roaming CHAR dBmToRoam; // the condition to roam when receiving Rssi less than this value. It's negative value. -#ifdef WPA_SUPPLICANT_SUPPORT BOOLEAN IEEE8021X; BOOLEAN IEEE8021x_required_keys; CIPHER_KEY DesireSharedKey[4]; // Record user desired WEP keys @@ -2214,7 +2181,6 @@ typedef struct _STA_ADMIN_CONFIG { // 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters UCHAR WpaSupplicantUP; UCHAR WpaSupplicantScanCount; -#endif // WPA_SUPPLICANT_SUPPORT // CHAR dev_name[16]; USHORT OriDevType; @@ -2227,13 +2193,9 @@ typedef struct _STA_ADMIN_CONFIG { RT_HT_PHY_INFO DesiredHtPhyInfo; BOOLEAN bAutoTxRateSwitch; +#ifdef RT2860 UCHAR BBPR3; - -#ifdef EXT_BUILD_CHANNEL_LIST - UCHAR IEEE80211dClientMode; - UCHAR StaOriCountryCode[3]; - UCHAR StaOriGeography; -#endif // EXT_BUILD_CHANNEL_LIST // +#endif } STA_ADMIN_CONFIG, *PSTA_ADMIN_CONFIG; // This data structure keep the current active BSS/IBSS's configuration that this STA @@ -2259,7 +2221,15 @@ typedef struct _STA_ACTIVE_CONFIG { RT_HT_PHY_INFO SupportedPhyInfo; RT_HT_CAPABILITY SupportedHtPhy; } STA_ACTIVE_CONFIG, *PSTA_ACTIVE_CONFIG; -#endif // CONFIG_STA_SUPPORT // + +#ifdef RT2870 +// for USB interface, avoid in interrupt when write key +typedef struct RT_ADD_PAIRWISE_KEY_ENTRY { + NDIS_802_11_MAC_ADDRESS MacAddr; + USHORT MacTabMatchWCID; // ASIC + CIPHER_KEY CipherKey; +} RT_ADD_PAIRWISE_KEY_ENTRY,*PRT_ADD_PAIRWISE_KEY_ENTRY; +#endif // RT2870 // // ----------- start of AP -------------------------- // AUTH-RSP State Machine Aux data structure @@ -2325,14 +2295,11 @@ typedef struct _MAC_TABLE_ENTRY { UINT32 StaConnectTime; // the live time of this station since associated with AP - -#ifdef DOT11_N_SUPPORT BOOLEAN bSendBAR; USHORT NoBADataCountDown; UINT32 CachedBuf[16]; // UINT (4 bytes) for alignment UINT TxBFCount; // 3*3 -#endif // DOT11_N_SUPPORT // UINT FIFOCount; UINT DebugFIFOCount; UINT DebugTxCount; @@ -2356,14 +2323,6 @@ typedef struct _MAC_TABLE_ENTRY { UCHAR TxRateUpPenalty; // extra # of second penalty due to last unstable condition //==================================================== - - -#ifdef CONFIG_STA_SUPPORT -#ifdef QOS_DLS_SUPPORT - UINT MatchDlsEntryIdx; // indicate the index in pAd->StaCfg.DLSEntry -#endif // QOS_DLS_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - BOOLEAN fNoisyEnvironment; BOOLEAN fLastSecAccordingRSSI; UCHAR LastSecTxRateChangeAction; // 0: no change, 1:rate UP, 2:rate down @@ -2377,10 +2336,8 @@ typedef struct _MAC_TABLE_ENTRY { // see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition. fCLIENT_STATUS_AMSDU_INUSED ULONG ClientStatusFlags; - // TODO: Shall we move that to DOT11_N_SUPPORT??? HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI. -#ifdef DOT11_N_SUPPORT // HT EWC MIMO-N used parameters USHORT RXBAbitmap; // fill to on-chip RXWI_BA_BITMASK in 8.1.3RX attribute entry format USHORT TXBAbitmap; // This bitmap as originator, only keep in software used to mark AMPDU bit in TXWI @@ -2398,11 +2355,6 @@ typedef struct _MAC_TABLE_ENTRY { HT_CAPABILITY_IE HTCapability; -#ifdef DOT11N_DRAFT3 - UCHAR BSS2040CoexistenceMgmtSupport; -#endif // DOT11N_DRAFT3 // -#endif // DOT11_N_SUPPORT // - BOOLEAN bAutoTxRateSwitch; UCHAR RateLen; @@ -2416,6 +2368,9 @@ typedef struct _MAC_TABLE_ENTRY { UINT32 TXMCSSuccessful[16]; UINT32 TXMCSFailed[16]; UINT32 TXMCSAutoFallBack[16][16]; +#ifdef RT2870 + ULONG LastBeaconRxTime; +#endif } MAC_TABLE_ENTRY, *PMAC_TABLE_ENTRY; typedef struct _MAC_TABLE { @@ -2427,16 +2382,16 @@ typedef struct _MAC_TABLE { BOOLEAN fAnyStationInPsm; BOOLEAN fAnyStationBadAtheros; // Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip. BOOLEAN fAnyTxOPForceDisable; // Check if it is necessary to disable BE TxOP -#ifdef DOT11_N_SUPPORT +#ifdef RT2870 + BOOLEAN fAllStationAsRalink; // Check if all stations are ralink-chipset +#endif BOOLEAN fAnyStationIsLegacy; // Check if I use legacy rate to transmit to my BSS Station/ BOOLEAN fAnyStationNonGF; // Check if any Station can't support GF. BOOLEAN fAnyStation20Only; // Check if any Station can't support GF. BOOLEAN fAnyStationMIMOPSDynamic; // Check if any Station is MIMO Dynamic BOOLEAN fAnyBASession; // Check if there is BA session. Force turn on RTS/CTS -#endif // DOT11_N_SUPPORT // } MAC_TABLE, *PMAC_TABLE; -#ifdef DOT11_N_SUPPORT #define IS_HT_STA(_pMacEntry) \ (_pMacEntry->MaxHTPhyMode.field.MODE >= MODE_HTMIX) @@ -2445,7 +2400,6 @@ typedef struct _MAC_TABLE { #define PEER_IS_HT_RATE(_pMacEntry) \ (_pMacEntry->HTPhyMode.field.MODE >= MODE_HTMIX) -#endif // DOT11_N_SUPPORT // typedef struct _WDS_ENTRY { BOOLEAN Valid; @@ -2549,10 +2503,6 @@ typedef struct _APCLI_STRUCT { UCHAR SNonce[32]; // SNonce for WPA-PSK UCHAR GNonce[32]; // GNonce for WPA-PSK from authenticator -#ifdef WSC_AP_SUPPORT - WSC_CTRL WscControl; -#endif // WSC_AP_SUPPORT // - HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode; RT_HT_PHY_INFO DesiredHtPhyInfo; BOOLEAN bAutoTxRateSwitch; @@ -2561,14 +2511,6 @@ typedef struct _APCLI_STRUCT { // ----------- end of AP ---------------------------- -#ifdef BLOCK_NET_IF -typedef struct _BLOCK_QUEUE_ENTRY -{ - BOOLEAN SwTxQueueBlockFlag; - LIST_HEADER NetIfList; -} BLOCK_QUEUE_ENTRY, *PBLOCK_QUEUE_ENTRY; -#endif // BLOCK_NET_IF // - struct wificonf { BOOLEAN bShortGI; @@ -2600,28 +2542,6 @@ typedef struct _INF_USB_CONFIG }; #endif // IKANOS_VX_1X0 // -#ifdef NINTENDO_AP -typedef struct _NINDO_CTRL_BLOCK { - - RT_NINTENDO_TABLE DS_TABLE; - -#ifdef CHIP25XX - spinlock_t NINTENDO_TABLE_Lock; -#else - NDIS_SPIN_LOCK NINTENDO_TABLE_Lock; -#endif // CHIP25XX // - - UCHAR NINTENDO_UP_BUFFER[512]; - UCHAR Local_KeyIdx; - CIPHER_KEY Local_SharedKey; - UCHAR Local_bHideSsid; - UCHAR Local_AuthMode; - UCHAR Local_WepStatus; - USHORT Local_CapabilityInfo; -} NINDO_CTRL_BLOCK; -#endif // NINTENDO_AP // - - #ifdef DBG_DIAGNOSE #define DIAGNOSE_TIME 10 // 10 sec typedef struct _RtmpDiagStrcut_ @@ -2660,6 +2580,7 @@ typedef struct _RTMP_ADAPTER PNET_DEV net_dev; ULONG VirtualIfCnt; +#ifdef RT2860 USHORT LnkCtrlBitMask; USHORT RLnkCtrlConfiguration; USHORT RLnkCtrlOffset; @@ -2686,11 +2607,51 @@ typedef struct _RTMP_ADAPTER RTMP_DMABUF RxDescRing; // Shared memory for RX descriptors RTMP_DMABUF TxDescRing[NUM_OF_TX_RING]; // Shared memory for Tx descriptors RTMP_TX_RING TxRing[NUM_OF_TX_RING]; // AC0~4 + HCCA - +#endif NDIS_SPIN_LOCK irq_lock; UCHAR irq_disabled; +#ifdef RT2870 +/*****************************************************************************************/ +/* USB related parameters */ +/*****************************************************************************************/ + struct usb_config_descriptor *config; + UINT BulkInEpAddr; // bulk-in endpoint address + UINT BulkOutEpAddr[6]; // bulk-out endpoint address + + UINT NumberOfPipes; + USHORT BulkOutMaxPacketSize; + USHORT BulkInMaxPacketSize; + + //======Control Flags + LONG PendingIoCount; + ULONG BulkFlags; + BOOLEAN bUsbTxBulkAggre; // Flags for bulk out data priority + + + //======Timer Thread + RT2870_TIMER_QUEUE TimerQ; + NDIS_SPIN_LOCK TimerQLock; + + + //======Cmd Thread + CmdQ CmdQ; + NDIS_SPIN_LOCK CmdQLock; // CmdQLock spinlock + + BOOLEAN TimerFunc_kill; + BOOLEAN mlme_kill; + + + //======Semaphores (event) + struct semaphore mlme_semaphore; /* to sleep thread on */ + struct semaphore RTUSBCmd_semaphore; /* to sleep thread on */ + struct semaphore RTUSBTimer_semaphore; + struct completion TimerQComplete; + struct completion mlmeComplete; + struct completion CmdQComplete; + wait_queue_head_t *wait; +#endif // RT2870 // /*****************************************************************************************/ @@ -2704,6 +2665,22 @@ typedef struct _RTMP_ADAPTER BOOLEAN DeQueueRunning[NUM_OF_TX_RING]; // for ensuring RTUSBDeQueuePacket get call once NDIS_SPIN_LOCK DeQueueLock[NUM_OF_TX_RING]; +#ifdef RT2870 + // Data related context and AC specified, 4 AC supported + NDIS_SPIN_LOCK BulkOutLock[6]; // BulkOut spinlock for 4 ACs + NDIS_SPIN_LOCK MLMEBulkOutLock; // MLME BulkOut lock + + HT_TX_CONTEXT TxContext[NUM_OF_TX_RING]; + NDIS_SPIN_LOCK TxContextQueueLock[NUM_OF_TX_RING]; // TxContextQueue spinlock + + // 4 sets of Bulk Out index and pending flag + UCHAR NextBulkOutIndex[4]; // only used for 4 EDCA bulkout pipe + + BOOLEAN BulkOutPending[6]; // used for total 6 bulkout pipe + UCHAR bulkResetPipeid; + BOOLEAN MgmtBulkPending; + ULONG bulkResetReq[6]; +#endif // RT2870 // // resource for software backlog queues QUEUE_HEADER TxSwQueue[NUM_OF_TX_RING]; // 4 AC + 1 HCCA @@ -2717,10 +2694,20 @@ typedef struct _RTMP_ADAPTER /*****************************************************************************************/ /* Rx related parameters */ /*****************************************************************************************/ - +#ifdef RT2860 RTMP_RX_RING RxRing; NDIS_SPIN_LOCK RxRingLock; // Rx Ring spinlock - +#endif +#ifdef RT2870 + RX_CONTEXT RxContext[RX_RING_SIZE]; // 1 for redundant multiple IRP bulk in. + NDIS_SPIN_LOCK BulkInLock; // BulkIn spinlock for 4 ACs + UCHAR PendingRx; // The Maxima pending Rx value should be RX_RING_SIZE. + UCHAR NextRxBulkInIndex; // Indicate the current RxContext Index which hold by Host controller. + UCHAR NextRxBulkInReadIndex; // Indicate the current RxContext Index which driver can read & process it. + ULONG NextRxBulkInPosition; // Want to contatenate 2 URB buffer while 1st is bulkin failed URB. This Position is 1st URB TransferLength. + ULONG TransferBufferLength; // current length of the packet buffer + ULONG ReadPosition; // current read position in a packet buffer +#endif // RT2870 // /*****************************************************************************************/ @@ -2734,6 +2721,10 @@ typedef struct _RTMP_ADAPTER ULONG EepromVersion; // byte 0: version, byte 1: revision, byte 2~3: unused UCHAR EEPROMAddressNum; // 93c46=6 93c66=8 USHORT EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS]; +#ifdef RT30xx + BOOLEAN EepromAccess; + UCHAR EFuseTag; +#endif ULONG FirmwareVersion; // byte 0: Minor version, byte 1: Major version, otherwise unused. // --------------------------- @@ -2826,11 +2817,19 @@ typedef struct _RTMP_ADAPTER PSPOLL_FRAME PsPollFrame; HEADER_802_11 NullFrame; +#ifdef RT2870 + TX_CONTEXT BeaconContext[BEACON_RING_SIZE]; + TX_CONTEXT NullContext; + TX_CONTEXT PsPollContext; + TX_CONTEXT RTSContext; +#endif // RT2870 // + + + //=========AP=========== //=======STA=========== -#ifdef CONFIG_STA_SUPPORT /* Modified by Wu Xi-Kun 4/21/2006 */ // ----------------------------------------------- // STA specific configuration & operation status @@ -2840,7 +2839,6 @@ typedef struct _RTMP_ADAPTER STA_ACTIVE_CONFIG StaActive; // valid only when ADHOC_ON(pAd) || INFRA_ON(pAd) CHAR nickname[IW_ESSID_MAX_SIZE+1]; // nickname, only used in the iwconfig i/f NDIS_MEDIA_STATE PreMediaState; -#endif // CONFIG_STA_SUPPORT // //=======Common=========== // OP mode: either AP or STA @@ -2848,7 +2846,6 @@ typedef struct _RTMP_ADAPTER NDIS_MEDIA_STATE IndicateMediaState; // Base on Indication state, default is NdisMediaStateDisConnected - // MAT related parameters // configuration: read from Registry & E2PROM BOOLEAN bLocalAdminMAC; // Use user changed MAC @@ -2869,9 +2866,8 @@ typedef struct _RTMP_ADAPTER MAC_TABLE MacTab; // ASIC on-chip WCID entry table. At TX, ASIC always use key according to this on-chip table. NDIS_SPIN_LOCK MacTabLock; -#ifdef DOT11_N_SUPPORT BA_TABLE BATable; -#endif // DOT11_N_SUPPORT // + NDIS_SPIN_LOCK BATabLock; RALINK_TIMER_STRUCT RECBATimer; @@ -2890,16 +2886,13 @@ typedef struct _RTMP_ADAPTER // flags, see fRTMP_ADAPTER_xxx flags ULONG Flags; // Represent current device status +#ifdef RT2860 ULONG PSFlags; // Power Save operation flag. +#endif // current TX sequence # USHORT Sequence; -#ifdef UNDER_CE - NDIS_HANDLE hGiISR; -#endif - - // Control disconnect / connect event generation //+++Didn't used anymore ULONG LinkDownTime; @@ -2928,6 +2921,14 @@ typedef struct _RTMP_ADAPTER /*****************************************************************************************/ /* Statistic related parameters */ /*****************************************************************************************/ +#ifdef RT2870 + ULONG BulkOutDataOneSecCount; + ULONG BulkInDataOneSecCount; + ULONG BulkLastOneSecCount; // BulkOutDataOneSecCount + BulkInDataOneSecCount + ULONG watchDogRxCnt; + ULONG watchDogRxOverFlowCnt; + ULONG watchDogTxPendingCnt[NUM_OF_TX_RING]; +#endif // RT2870 // BOOLEAN bUpdateBcnCntDone; ULONG watchDogMacDeadlock; // prevent MAC/BBP into deadlock condition @@ -2967,13 +2968,7 @@ typedef struct _RTMP_ADAPTER struct wificonf WIFItestbed; -#ifdef RALINK_ATE - ATE_INFO ate; -#endif // RALINK_ATE // - -#ifdef DOT11_N_SUPPORT struct reordering_mpdu_pool mpdu_blk_pool; -#endif // DOT11_N_SUPPORT // ULONG OneSecondnonBEpackets; // record non BE packets per second @@ -2983,17 +2978,6 @@ typedef struct _RTMP_ADAPTER struct net_device_stats stats; -#ifdef BLOCK_NET_IF - BLOCK_QUEUE_ENTRY blockQueueTab[NUM_OF_TX_RING]; -#endif // BLOCK_NET_IF // - - - -#ifdef MULTIPLE_CARD_SUPPORT - INT32 MC_RowID; - UCHAR MC_FileName[256]; -#endif // MULTIPLE_CARD_SUPPORT // - ULONG TbttTickCount; #ifdef PCI_MSI_SUPPORT BOOLEAN HaveMsi; @@ -3007,11 +2991,6 @@ typedef struct _RTMP_ADAPTER UCHAR flg_be_adjust; ULONG be_adjust_last_time; -#ifdef NINTENDO_AP - NINDO_CTRL_BLOCK nindo_ctrl_block; -#endif // NINTENDO_AP // - - #ifdef IKANOS_VX_1X0 struct IKANOS_TX_INFO IkanosTxInfo; struct IKANOS_TX_INFO IkanosRxInfo[MAX_MBSSID_NUM + MAX_WDS_ENTRY + MAX_APCLI_NUM + MAX_MESH_NUM]; @@ -3024,6 +3003,13 @@ typedef struct _RTMP_ADAPTER UINT8 PM_FlgSuspend; + +#ifdef RT30xx +//======efuse + BOOLEAN bUseEfuse; + BOOLEAN bEEPROMFile; +#endif // RT30xx // + } RTMP_ADAPTER, *PRTMP_ADAPTER; // @@ -3176,7 +3162,7 @@ typedef struct _TX_BLK_ //------------------------------------------------------------------------------------------ - +#ifdef RT2860 // // Enable & Disable NIC interrupt via writing interrupt mask register // Since it use ADAPTER structure, it have to be put after structure definition. @@ -3210,243 +3196,6 @@ __inline VOID NICEnableInterrupt( RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE); } -#ifdef RT_BIG_ENDIAN -static inline VOID WriteBackToDescriptor( - IN PUCHAR Dest, - IN PUCHAR Src, - IN BOOLEAN DoEncrypt, - IN ULONG DescriptorType) -{ - UINT32 *p1, *p2; - - p1 = ((UINT32 *)Dest); - p2 = ((UINT32 *)Src); - - *p1 = *p2; - *(p1+2) = *(p2+2); - *(p1+3) = *(p2+3); - *(p1+1) = *(p2+1); // Word 1; this must be written back last -} - -/* - ======================================================================== - - Routine Description: - Endian conversion of Tx/Rx descriptor . - - Arguments: - pAd Pointer to our adapter - pData Pointer to Tx/Rx descriptor - DescriptorType Direction of the frame - - Return Value: - None - - Note: - Call this function when read or update descriptor - ======================================================================== -*/ -static inline VOID RTMPWIEndianChange( - IN PUCHAR pData, - IN ULONG DescriptorType) -{ - int size; - int i; - - size = ((DescriptorType == TYPE_TXWI) ? TXWI_SIZE : RXWI_SIZE); - - if(DescriptorType == TYPE_TXWI) - { - *((UINT32 *)(pData)) = SWAP32(*((UINT32 *)(pData))); // Byte 0~3 - *((UINT32 *)(pData + 4)) = SWAP32(*((UINT32 *)(pData+4))); // Byte 4~7 - } - else - { - for(i=0; i < size/4 ; i++) - *(((UINT32 *)pData) +i) = SWAP32(*(((UINT32 *)pData)+i)); - } -} - -/* - ======================================================================== - - Routine Description: - Endian conversion of Tx/Rx descriptor . - - Arguments: - pAd Pointer to our adapter - pData Pointer to Tx/Rx descriptor - DescriptorType Direction of the frame - - Return Value: - None - - Note: - Call this function when read or update descriptor - ======================================================================== -*/ -static inline VOID RTMPDescriptorEndianChange( - IN PUCHAR pData, - IN ULONG DescriptorType) -{ - *((UINT32 *)(pData)) = SWAP32(*((UINT32 *)(pData))); // Byte 0~3 - *((UINT32 *)(pData + 8)) = SWAP32(*((UINT32 *)(pData+8))); // Byte 8~11 - *((UINT32 *)(pData +12)) = SWAP32(*((UINT32 *)(pData + 12))); // Byte 12~15 - *((UINT32 *)(pData + 4)) = SWAP32(*((UINT32 *)(pData + 4))); // Byte 4~7, this must be swapped last -} - -/* - ======================================================================== - - Routine Description: - Endian conversion of all kinds of 802.11 frames . - - Arguments: - pAd Pointer to our adapter - pData Pointer to the 802.11 frame structure - Dir Direction of the frame - FromRxDoneInt Caller is from RxDone interrupt - - Return Value: - None - - Note: - Call this function when read or update buffer data - ======================================================================== -*/ -static inline VOID RTMPFrameEndianChange( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pData, - IN ULONG Dir, - IN BOOLEAN FromRxDoneInt) -{ - PHEADER_802_11 pFrame; - PUCHAR pMacHdr; - - // swab 16 bit fields - Frame Control field - if(Dir == DIR_READ) - { - *(USHORT *)pData = SWAP16(*(USHORT *)pData); - } - - pFrame = (PHEADER_802_11) pData; - pMacHdr = (PUCHAR) pFrame; - - // swab 16 bit fields - Duration/ID field - *(USHORT *)(pMacHdr + 2) = SWAP16(*(USHORT *)(pMacHdr + 2)); - - // swab 16 bit fields - Sequence Control field - *(USHORT *)(pMacHdr + 22) = SWAP16(*(USHORT *)(pMacHdr + 22)); - - if(pFrame->FC.Type == BTYPE_MGMT) - { - switch(pFrame->FC.SubType) - { - case SUBTYPE_ASSOC_REQ: - case SUBTYPE_REASSOC_REQ: - // swab 16 bit fields - CapabilityInfo field - pMacHdr += sizeof(HEADER_802_11); - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - - // swab 16 bit fields - Listen Interval field - pMacHdr += 2; - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - break; - - case SUBTYPE_ASSOC_RSP: - case SUBTYPE_REASSOC_RSP: - // swab 16 bit fields - CapabilityInfo field - pMacHdr += sizeof(HEADER_802_11); - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - - // swab 16 bit fields - Status Code field - pMacHdr += 2; - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - - // swab 16 bit fields - AID field - pMacHdr += 2; - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - break; - - case SUBTYPE_AUTH: - // If from APHandleRxDoneInterrupt routine, it is still a encrypt format. - // The convertion is delayed to RTMPHandleDecryptionDoneInterrupt. - if(!FromRxDoneInt && pFrame->FC.Wep == 1) - break; - else - { - // swab 16 bit fields - Auth Alg No. field - pMacHdr += sizeof(HEADER_802_11); - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - - // swab 16 bit fields - Auth Seq No. field - pMacHdr += 2; - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - - // swab 16 bit fields - Status Code field - pMacHdr += 2; - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - } - break; - - case SUBTYPE_BEACON: - case SUBTYPE_PROBE_RSP: - // swab 16 bit fields - BeaconInterval field - pMacHdr += (sizeof(HEADER_802_11) + TIMESTAMP_LEN); - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - - // swab 16 bit fields - CapabilityInfo field - pMacHdr += sizeof(USHORT); - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - break; - - case SUBTYPE_DEAUTH: - case SUBTYPE_DISASSOC: - // swab 16 bit fields - Reason code field - pMacHdr += sizeof(HEADER_802_11); - *(USHORT *)pMacHdr = SWAP16(*(USHORT *)pMacHdr); - break; - } - } - else if( pFrame->FC.Type == BTYPE_DATA ) - { - } - else if(pFrame->FC.Type == BTYPE_CNTL) - { - switch(pFrame->FC.SubType) - { - case SUBTYPE_BLOCK_ACK_REQ: - { - PFRAME_BA_REQ pBAReq = (PFRAME_BA_REQ)pFrame; - *(USHORT *)(&pBAReq->BARControl) = SWAP16(*(USHORT *)(&pBAReq->BARControl)); - pBAReq->BAStartingSeq.word = SWAP16(pBAReq->BAStartingSeq.word); - } - break; - case SUBTYPE_BLOCK_ACK: - // For Block Ack packet, the HT_CONTROL field is in the same offset with Addr3 - *(UINT32 *)(&pFrame->Addr3[0]) = SWAP32(*(UINT32 *)(&pFrame->Addr3[0])); - break; - - case SUBTYPE_ACK: - //For ACK packet, the HT_CONTROL field is in the same offset with Addr2 - *(UINT32 *)(&pFrame->Addr2[0])= SWAP32(*(UINT32 *)(&pFrame->Addr2[0])); - break; - } - } - else - { - DBGPRINT(RT_DEBUG_ERROR,("Invalid Frame Type!!!\n")); - } - - // swab 16 bit fields - Frame Control - if(Dir == DIR_WRITE) - { - *(USHORT *)pData = SWAP16(*(USHORT *)pData); - } -} -#endif // RT_BIG_ENDIAN // - - static inline VOID ConvertMulticastIP2MAC( IN PUCHAR pIpAddr, IN PUCHAR *ppMacAddr, @@ -3484,6 +3233,7 @@ static inline VOID ConvertMulticastIP2MAC( return; } +#endif /* RT2860 */ BOOLEAN RTMPCheckForHang( IN NDIS_HANDLE MiniportAdapterContext @@ -3523,6 +3273,10 @@ NDIS_STATUS NICReadRegParameters( IN NDIS_HANDLE WrapperConfigurationContext ); +#ifdef RT2870 +VOID NICInitRT30xxRFRegisters( + IN PRTMP_ADAPTER pAd); +#endif // RT2870 // VOID NICReadEEPROMParameters( IN PRTMP_ADAPTER pAd, @@ -3541,10 +3295,10 @@ NDIS_STATUS NICInitializeAdapter( NDIS_STATUS NICInitializeAsic( IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset); - +#ifdef RT2860 VOID NICRestoreBBPValue( IN PRTMP_ADAPTER pAd); - +#endif VOID NICIssueReset( IN PRTMP_ADAPTER pAd); @@ -3691,7 +3445,6 @@ VOID MlmeQOSAction( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem); -#ifdef DOT11_N_SUPPORT VOID PeerAddBAReqAction( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem); @@ -3707,53 +3460,12 @@ VOID PeerDelBAAction( VOID PeerBAAction( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem); -#endif // DOT11_N_SUPPORT // VOID SendPSMPAction( IN PRTMP_ADAPTER pAd, IN UCHAR Wcid, IN UCHAR Psmp); - -#ifdef DOT11N_DRAFT3 -VOID SendBSS2040CoexistMgmtAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR apidx, - IN UCHAR InfoReq); - -VOID SendNotifyBWActionFrame( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR apidx); - -BOOLEAN ChannelSwitchSanityCheck( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR NewChannel, - IN UCHAR Secondary); - -VOID ChannelSwitchAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN UCHAR Channel, - IN UCHAR Secondary); - -ULONG BuildIntolerantChannelRep( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDest); - -VOID Update2040CoexistFrameAndNotify( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN BOOLEAN bAddIntolerantCha); - -VOID Send2040CoexistAction( - IN PRTMP_ADAPTER pAd, - IN UCHAR Wcid, - IN BOOLEAN bAddIntolerantCha); -#endif // DOT11N_DRAFT3 // - VOID PeerRMAction( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem); @@ -3762,44 +3474,22 @@ VOID PeerPublicAction( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem); -#ifdef CONFIG_STA_SUPPORT VOID StaPublicAction( IN PRTMP_ADAPTER pAd, IN UCHAR Bss2040Coexist); -#endif // CONFIG_STA_SUPPORT // - VOID PeerBSSTranAction( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem); -#ifdef DOT11_N_SUPPORT VOID PeerHTAction( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem); -#endif // DOT11_N_SUPPORT // VOID PeerQOSAction( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem); -#ifdef QOS_DLS_SUPPORT -VOID PeerDLSAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); -#endif // QOS_DLS_SUPPORT // - -#ifdef CONFIG_STA_SUPPORT -#ifdef QOS_DLS_SUPPORT -VOID DlsParmFill( - IN PRTMP_ADAPTER pAd, - IN OUT MLME_DLS_REQ_STRUCT *pDlsReq, - IN PRT_802_11_DLS pDls, - IN USHORT reason); -#endif // QOS_DLS_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - -#ifdef DOT11_N_SUPPORT VOID RECBATimerTimeout( IN PVOID SystemSpecific1, IN PVOID FunctionContext, @@ -3812,7 +3502,6 @@ VOID ORIBATimerTimeout( VOID SendRefreshBAR( IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY *pEntry); -#endif // DOT11_N_SUPPORT // VOID ActHeaderInit( IN PRTMP_ADAPTER pAd, @@ -3845,7 +3534,6 @@ BOOLEAN QosBADataParse( IN USHORT Datasize, IN UINT CurRxIndex); -#ifdef DOT11_N_SUPPORT BOOLEAN CntlEnqueueForRecv( IN PRTMP_ADAPTER pAd, IN ULONG Wcid, @@ -3854,7 +3542,6 @@ BOOLEAN CntlEnqueueForRecv( VOID BaAutoManSwitch( IN PRTMP_ADAPTER pAd); -#endif // DOT11_N_SUPPORT // VOID HTIOTCheck( IN PRTMP_ADAPTER pAd, @@ -4010,7 +3697,13 @@ NDIS_STATUS MiniportMMRequest( IN UCHAR QueIdx, IN PUCHAR pData, IN UINT Length); - +#ifdef RT2870 +NDIS_STATUS MiniportDataMMRequest( + IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, + IN PUCHAR pData, + IN UINT Length); +#endif VOID RTMPSendNullFrame( IN PRTMP_ADAPTER pAd, IN UCHAR TxRate, @@ -4039,7 +3732,6 @@ PQUEUE_HEADER RTMPCheckTxSwQueue( IN PRTMP_ADAPTER pAd, OUT UCHAR *QueIdx); -#ifdef CONFIG_STA_SUPPORT VOID RTMPReportMicError( IN PRTMP_ADAPTER pAd, IN PCIPHER_KEY pWpaKey); @@ -4053,7 +3745,6 @@ VOID WpaDisassocApAndBlockAssoc( IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); -#endif // CONFIG_STA_SUPPORT // NDIS_STATUS RTMPCloneNdisPacket( IN PRTMP_ADAPTER pAd, @@ -4193,7 +3884,6 @@ VOID AsicRfTuningExec( IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); -#ifdef CONFIG_STA_SUPPORT VOID AsicSleepThenAutoWakeup( IN PRTMP_ADAPTER pAd, IN USHORT TbttNumToNextWakeUp); @@ -4203,8 +3893,12 @@ VOID AsicForceSleep( VOID AsicForceWakeup( IN PRTMP_ADAPTER pAd, +#ifdef RT2860 IN UCHAR Level); -#endif // CONFIG_STA_SUPPORT // +#endif +#ifdef RT2870 + IN BOOLEAN bFromTx); +#endif VOID AsicSetBssid( IN PRTMP_ADAPTER pAd, @@ -4298,11 +3992,11 @@ BOOLEAN AsicSendCommandToMcu( IN UCHAR Token, IN UCHAR Arg0, IN UCHAR Arg1); - +#ifdef RT2860 BOOLEAN AsicCheckCommanOk( IN PRTMP_ADAPTER pAd, IN UCHAR Command); - +#endif VOID MacAddrRandomBssid( IN PRTMP_ADAPTER pAd, OUT PUCHAR pAddr); @@ -4325,11 +4019,9 @@ VOID MlmeRadioOn( VOID BssTableInit( IN BSS_TABLE *Tab); -#ifdef DOT11_N_SUPPORT VOID BATableInit( IN PRTMP_ADAPTER pAd, IN BA_TABLE *Tab); -#endif // DOT11_N_SUPPORT // ULONG BssTableSearch( IN BSS_TABLE *Tab, @@ -4355,7 +4047,6 @@ VOID BssTableDeleteEntry( IN PUCHAR pBssid, IN UCHAR Channel); -#ifdef DOT11_N_SUPPORT VOID BATableDeleteORIEntry( IN OUT PRTMP_ADAPTER pAd, IN BA_ORI_ENTRY *pBAORIEntry); @@ -4376,7 +4067,6 @@ VOID BATableTearRECEntry( IN UCHAR TID, IN UCHAR WCID, IN BOOLEAN ALL); -#endif // DOT11_N_SUPPORT // VOID BssEntrySet( IN PRTMP_ADAPTER pAd, @@ -4438,7 +4128,6 @@ ULONG BssTableSetEntry( IN USHORT LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE); -#ifdef DOT11_N_SUPPORT VOID BATableInsertEntry( IN PRTMP_ADAPTER pAd, IN USHORT Aid, @@ -4449,31 +4138,6 @@ VOID BATableInsertEntry( IN UCHAR OriginatorStatus, IN BOOLEAN IsRecipient); -#ifdef DOT11N_DRAFT3 -VOID Bss2040CoexistTimeOut( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - - -VOID TriEventInit( - IN PRTMP_ADAPTER pAd); - -ULONG TriEventTableSetEntry( - IN PRTMP_ADAPTER pAd, - OUT TRIGGER_EVENT_TAB *Tab, - IN PUCHAR pBssid, - IN HT_CAPABILITY_IE *pHtCapability, - IN UCHAR HtCapabilityLen, - IN UCHAR RegClass, - IN UCHAR ChannelNo); - -VOID TriEventCounterMaintenance( - IN PRTMP_ADAPTER pAd); -#endif // DOT11N_DRAFT3 // -#endif // DOT11_N_SUPPORT // - VOID BssTableSsidSort( IN PRTMP_ADAPTER pAd, OUT BSS_TABLE *OutTab, @@ -4638,6 +4302,12 @@ VOID InvalidStateWhenDisassociate( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem); +#ifdef RT2870 +VOID MlmeCntlConfirm( + IN PRTMP_ADAPTER pAd, + IN ULONG MsgType, + IN USHORT Msg); +#endif // RT2870 // VOID ComposePsPoll( IN PRTMP_ADAPTER pAd); @@ -4721,142 +4391,6 @@ VOID PeerAuthSimpleRspGenAndSend( // Private routines in dls.c // -#ifdef CONFIG_STA_SUPPORT -#ifdef QOS_DLS_SUPPORT -void DlsStateMachineInit( - IN PRTMP_ADAPTER pAd, - IN STATE_MACHINE *Sm, - OUT STATE_MACHINE_FUNC Trans[]); - -VOID MlmeDlsReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerDlsReqAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerDlsRspAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID MlmeDlsTearDownAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID PeerDlsTearDownAction( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); - -VOID RTMPCheckDLSTimeOut( - IN PRTMP_ADAPTER pAd); - -BOOLEAN RTMPRcvFrameDLSCheck( - IN PRTMP_ADAPTER pAd, - IN PHEADER_802_11 pHeader, - IN ULONG Len, - IN PRT28XX_RXD_STRUC pRxD); - -INT RTMPCheckDLSFrame( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA); - -VOID RTMPSendDLSTearDownFrame( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA); - -NDIS_STATUS RTMPSendSTAKeyRequest( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA); - -NDIS_STATUS RTMPSendSTAKeyHandShake( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pDA); - -VOID DlsTimeoutAction( - IN PVOID SystemSpecific1, - IN PVOID FunctionContext, - IN PVOID SystemSpecific2, - IN PVOID SystemSpecific3); - -BOOLEAN MlmeDlsReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PRT_802_11_DLS *pDLS, - OUT PUSHORT pReason); - -INT Set_DlsEntryInfo_Display_Proc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); - -MAC_TABLE_ENTRY *MacTableInsertDlsEntry( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN UINT DlsEntryIdx); - -BOOLEAN MacTableDeleteDlsEntry( - IN PRTMP_ADAPTER pAd, - IN USHORT wcid, - IN PUCHAR pAddr); - -MAC_TABLE_ENTRY *DlsEntryTableLookup( - IN PRTMP_ADAPTER pAd, - IN PUCHAR pAddr, - IN BOOLEAN bResetIdelCount); - -MAC_TABLE_ENTRY *DlsEntryTableLookupByWcid( - IN PRTMP_ADAPTER pAd, - IN UCHAR wcid, - IN PUCHAR pAddr, - IN BOOLEAN bResetIdelCount); - -INT Set_DlsAddEntry_Proc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); - -INT Set_DlsTearDownEntry_Proc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); -#endif // QOS_DLS_SUPPORT // -#endif // CONFIG_STA_SUPPORT // - -#ifdef QOS_DLS_SUPPORT -BOOLEAN PeerDlsReqSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pDA, - OUT PUCHAR pSA, - OUT USHORT *pCapabilityInfo, - OUT USHORT *pDlsTimeout, - OUT UCHAR *pRatesLen, - OUT UCHAR Rates[], - OUT UCHAR *pHtCapabilityLen, - OUT HT_CAPABILITY_IE *pHtCapability); - -BOOLEAN PeerDlsRspSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pDA, - OUT PUCHAR pSA, - OUT USHORT *pCapabilityInfo, - OUT USHORT *pStatus, - OUT UCHAR *pRatesLen, - OUT UCHAR Rates[], - OUT UCHAR *pHtCapabilityLen, - OUT HT_CAPABILITY_IE *pHtCapability); - -BOOLEAN PeerDlsTearDownSanity( - IN PRTMP_ADAPTER pAd, - IN VOID *Msg, - IN ULONG MsgLen, - OUT PUCHAR pDA, - OUT PUCHAR pSA, - OUT USHORT *pReason); -#endif // QOS_DLS_SUPPORT // - //======================================== VOID SyncStateMachineInit( @@ -4961,12 +4495,6 @@ VOID CntlWaitAssocProc( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem); -#ifdef QOS_DLS_SUPPORT -VOID CntlOidDLSSetupProc( - IN PRTMP_ADAPTER pAd, - IN MLME_QUEUE_ELEM *Elem); -#endif // QOS_DLS_SUPPORT // - VOID LinkUp( IN PRTMP_ADAPTER pAd, IN UCHAR BssType); @@ -5113,9 +4641,7 @@ BOOLEAN PeerBeaconAndProbeRspSanity( OUT PQOS_CAPABILITY_PARM pQosCapability, OUT ULONG *pRalinkIe, OUT UCHAR *pHtCapabilityLen, -#ifdef CONFIG_STA_SUPPORT OUT UCHAR *pPreNHtCapabilityLen, -#endif // CONFIG_STA_SUPPORT // OUT HT_CAPABILITY_IE *pHtCapability, OUT UCHAR *AddHtInfoLen, OUT ADD_HT_INFO_IE *AddHtInfo, @@ -5343,23 +4869,19 @@ VOID MlmeUpdateTxRates( IN BOOLEAN bLinkUp, IN UCHAR apidx); -#ifdef DOT11_N_SUPPORT VOID MlmeUpdateHtTxRates( IN PRTMP_ADAPTER pAd, IN UCHAR apidx); -#endif // DOT11_N_SUPPORT // VOID RTMPCheckRates( IN PRTMP_ADAPTER pAd, IN OUT UCHAR SupRate[], IN OUT UCHAR *SupRateLen); -#ifdef CONFIG_STA_SUPPORT BOOLEAN RTMPCheckChannel( IN PRTMP_ADAPTER pAd, IN UCHAR CentralChannel, IN UCHAR Channel); -#endif // CONFIG_STA_SUPPORT // BOOLEAN RTMPCheckHt( IN PRTMP_ADAPTER pAd, @@ -5388,6 +4910,12 @@ CHAR RTMPMaxRssi( IN CHAR Rssi1, IN CHAR Rssi2); +#ifdef RT30xx +VOID AsicSetRxAnt( + IN PRTMP_ADAPTER pAd, + IN UCHAR Ant); +#endif + VOID AsicEvaluateRxAnt( IN PRTMP_ADAPTER pAd); @@ -5600,15 +5128,12 @@ VOID RTMPIndicateWPA2Status( VOID RTMPOPModeSwitching( IN PRTMP_ADAPTER pAd); -#ifdef CONFIG_STA_SUPPORT VOID RTMPAddBSSIDCipher( IN PRTMP_ADAPTER pAd, IN UCHAR Aid, IN PNDIS_802_11_KEY pKey, IN UCHAR CipherAlg); -#endif // CONFIG_STA_SUPPORT // -#ifdef DOT11_N_SUPPORT VOID RTMPSetHT( IN PRTMP_ADAPTER pAd, IN OID_SET_HT_PHYMODE *pHTPhyMode); @@ -5616,7 +5141,6 @@ VOID RTMPSetHT( VOID RTMPSetIndividualHT( IN PRTMP_ADAPTER pAd, IN UCHAR apidx); -#endif // DOT11_N_SUPPORT // VOID RTMPSendWirelessEvent( IN PRTMP_ADAPTER pAd, @@ -5793,13 +5317,6 @@ CHAR ConvertToRssi( IN CHAR Rssi, IN UCHAR RssiNumber); - -#ifdef DOT11N_DRAFT3 -VOID BuildEffectedChannelList( - IN PRTMP_ADAPTER pAd); -#endif // DOT11N_DRAFT3 // - - VOID APAsicEvaluateRxAnt( IN PRTMP_ADAPTER pAd); @@ -6072,6 +5589,10 @@ VOID RTMPSendTriggerFrame( IN UCHAR TxRate, IN BOOLEAN bQosNull); +#ifdef RT30xx +VOID RTMPFilterCalibration( + IN PRTMP_ADAPTER pAd); +#endif // RT30xx // /* timeout -- ms */ VOID RTMP_SetPeriodicTimer( @@ -6263,7 +5784,6 @@ UCHAR VLAN_8023_Header_Copy( OUT PUCHAR pData, IN UCHAR FromWhichBSSID); -#ifdef DOT11_N_SUPPORT void ba_flush_reordering_timeout_mpdus( IN PRTMP_ADAPTER pAd, IN PBA_REC_ENTRY pBAEntry, @@ -6281,7 +5801,6 @@ VOID BAOriSessionSetUp( VOID BASessionTearDownALL( IN OUT PRTMP_ADAPTER pAd, IN UCHAR Wcid); -#endif // DOT11_N_SUPPORT // BOOLEAN OS_Need_Clone_Packet(void); @@ -6429,7 +5948,6 @@ INT Set_ResetStatCounter_Proc( IN PRTMP_ADAPTER pAd, IN PUCHAR arg); -#ifdef DOT11_N_SUPPORT INT Set_BASetup_Proc( IN PRTMP_ADAPTER pAd, IN PUCHAR arg); @@ -6530,24 +6048,17 @@ INT Set_HtMIMOPSmode_Proc( INT Set_HtTxBASize_Proc( IN PRTMP_ADAPTER pAd, IN PUCHAR arg); -#endif // DOT11_N_SUPPORT // - - -#ifdef CONFIG_STA_SUPPORT //Dls , kathy VOID RTMPSendDLSTearDownFrame( IN PRTMP_ADAPTER pAd, IN PUCHAR pDA); -#ifdef DOT11_N_SUPPORT //Block ACK VOID QueryBATABLE( IN PRTMP_ADAPTER pAd, OUT PQUERYBA_TABLE pBAT); -#endif // DOT11_N_SUPPORT // -#ifdef WPA_SUPPLICANT_SUPPORT INT WpaCheckEapCode( IN PRTMP_ADAPTER pAd, IN PUCHAR pFrame, @@ -6560,26 +6071,16 @@ VOID WpaSendMicFailureToWpaSupplicant( VOID SendAssocIEsToWpaSupplicant( IN PRTMP_ADAPTER pAd); -#endif // WPA_SUPPLICANT_SUPPORT // -#ifdef NATIVE_WPA_SUPPLICANT_SUPPORT int wext_notify_event_assoc( IN RTMP_ADAPTER *pAd); -#endif // NATIVE_WPA_SUPPLICANT_SUPPORT // - -#endif // CONFIG_STA_SUPPORT // - - -#ifdef DOT11_N_SUPPORT VOID Handle_BSS_Width_Trigger_Events( IN PRTMP_ADAPTER pAd); void build_ext_channel_switch_ie( IN PRTMP_ADAPTER pAd, IN HT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE *pIE); -#endif // DOT11_N_SUPPORT // - BOOLEAN APRxDoneInterruptHandle( IN PRTMP_ADAPTER pAd); @@ -6588,7 +6089,6 @@ BOOLEAN STARxDoneInterruptHandle( IN PRTMP_ADAPTER pAd, IN BOOLEAN argc); -#ifdef DOT11_N_SUPPORT // AMPDU packet indication VOID Indicate_AMPDU_Packet( IN PRTMP_ADAPTER pAd, @@ -6600,7 +6100,6 @@ VOID Indicate_AMSDU_Packet( IN PRTMP_ADAPTER pAd, IN RX_BLK *pRxBlk, IN UCHAR FromWhichBSSID); -#endif // DOT11_N_SUPPORT // // Normal legacy Rx packet indication VOID Indicate_Legacy_Packet( @@ -6630,8 +6129,6 @@ UINT deaggregate_AMSDU_announce( IN PUCHAR pData, IN ULONG DataSize); - -#ifdef CONFIG_STA_SUPPORT // remove LLC and get 802_3 Header #define RTMP_802_11_REMOVE_LLC_AND_CONVERT_TO_802_3(_pRxBlk, _pHeader802_3) \ { \ @@ -6662,8 +6159,6 @@ UINT deaggregate_AMSDU_announce( CONVERT_TO_802_3(_pHeader802_3, _pDA, _pSA, _pRxBlk->pData, \ _pRxBlk->DataSize, _pRemovedLLCSNAP); \ } -#endif // CONFIG_STA_SUPPORT // - BOOLEAN APFowardWirelessStaToWirelessSta( IN PRTMP_ADAPTER pAd, @@ -6680,13 +6175,9 @@ VOID Sta_Announce_or_Forward_802_3_Packet( IN PNDIS_PACKET pPacket, IN UCHAR FromWhichBSSID); - -#ifdef CONFIG_STA_SUPPORT #define ANNOUNCE_OR_FORWARD_802_3_PACKET(_pAd, _pPacket, _FromWhichBSS)\ Sta_Announce_or_Forward_802_3_Packet(_pAd, _pPacket, _FromWhichBSS); //announce_802_3_packet(_pAd, _pPacket); -#endif // CONFIG_STA_SUPPORT // - PNDIS_PACKET DuplicatePacket( IN PRTMP_ADAPTER pAd, @@ -6729,22 +6220,6 @@ PNDIS_PACKET RTMPDeFragmentDataFrame( IN RX_BLK *pRxBlk); //////////////////////////////////////// - - - - - -#ifdef SNMP_SUPPORT -//for snmp , kathy -typedef struct _DefaultKeyIdxValue -{ - UCHAR KeyIdx; - UCHAR Value[16]; -} DefaultKeyIdxValue, *PDefaultKeyIdxValue; -#endif - - -#ifdef CONFIG_STA_SUPPORT enum { DIDmsg_lnxind_wlansniffrm = 0x00000044, DIDmsg_lnxind_wlansniffrm_hosttime = 0x00010044, @@ -6857,18 +6332,11 @@ struct iw_statistics *rt28xx_get_wireless_stats( VOID RTMPSetDesiredRates( IN PRTMP_ADAPTER pAdapter, IN LONG Rates); -#endif // CONFIG_STA_SUPPORT // INT Set_FixedTxMode_Proc( IN PRTMP_ADAPTER pAd, IN PUCHAR arg); -#ifdef CONFIG_APSTA_MIXED_SUPPORT -INT Set_OpMode_Proc( - IN PRTMP_ADAPTER pAd, - IN PUCHAR arg); -#endif // CONFIG_APSTA_MIXED_SUPPORT // - static inline char* GetPhyMode( int Mode) { @@ -6879,13 +6347,11 @@ static inline char* GetPhyMode( case MODE_OFDM: return "OFDM"; -#ifdef DOT11_N_SUPPORT case MODE_HTMIX: return "HTMIX"; case MODE_HTGREENFIELD: return "GREEN"; -#endif // DOT11_N_SUPPORT // default: return "N/A"; } @@ -6902,10 +6368,8 @@ static inline char* GetBW( case BW_20: return "20M"; -#ifdef DOT11_N_SUPPORT case BW_40: return "40M"; -#endif // DOT11_N_SUPPORT // default: return "N/A"; } @@ -6945,13 +6409,10 @@ INT rt28xx_ioctl( IN OUT struct ifreq *rq, IN INT cmd); - -#ifdef CONFIG_STA_SUPPORT INT rt28xx_sta_ioctl( IN struct net_device *net_dev, IN OUT struct ifreq *rq, IN INT cmd); -#endif // CONFIG_STA_SUPPORT // BOOLEAN RT28XXSecurityKeyAdd( IN PRTMP_ADAPTER pAd, @@ -6971,6 +6432,7 @@ void kill_thread_task(PRTMP_ADAPTER pAd); void tbtt_tasklet(unsigned long data); +#ifdef RT2860 // // Function Prototype in cmm_data_2860.c // @@ -7035,7 +6497,6 @@ NDIS_STATUS RTMPCheckRxError( IN PRXWI_STRUC pRxWI, IN PRT28XX_RXD_STRUC pRxD); -#ifdef CONFIG_STA_SUPPORT VOID RTMPInitPCIeLinkCtrlValue( IN PRTMP_ADAPTER pAd); @@ -7078,13 +6539,13 @@ VOID RadioOnExec( IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3); -#endif // CONFIG_STA_SUPPORT // VOID RT28xxPciMlmeRadioOn( IN PRTMP_ADAPTER pAd); VOID RT28xxPciMlmeRadioOFF( IN PRTMP_ADAPTER pAd); +#endif /* RT2860 */ VOID AsicTurnOffRFClk( IN PRTMP_ADAPTER pAd, @@ -7094,6 +6555,493 @@ VOID AsicTurnOnRFClk( IN PRTMP_ADAPTER pAd, IN UCHAR Channel); +#ifdef RT30xx +NTSTATUS RT30xxWriteRFRegister( + IN PRTMP_ADAPTER pAd, + IN UCHAR RegID, + IN UCHAR Value); + +NTSTATUS RT30xxReadRFRegister( + IN PRTMP_ADAPTER pAd, + IN UCHAR RegID, + IN PUCHAR pValue); + +//2008/09/11:KH add to support efuse<-- +UCHAR eFuseReadRegisters( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN USHORT Length, + OUT USHORT* pData); + +VOID eFuseReadPhysical( + IN PRTMP_ADAPTER pAd, + IN PUSHORT lpInBuffer, + IN ULONG nInBufferSize, + OUT PUSHORT lpOutBuffer, + IN ULONG nOutBufferSize +); + +NTSTATUS eFuseRead( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + OUT PUCHAR pData, + IN USHORT Length); + +VOID eFusePhysicalWriteRegisters( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN USHORT Length, + OUT USHORT* pData); + +NTSTATUS eFuseWriteRegisters( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN USHORT Length, + IN USHORT* pData); + +VOID eFuseWritePhysical( + IN PRTMP_ADAPTER pAd, + PUSHORT lpInBuffer, + ULONG nInBufferSize, + PUCHAR lpOutBuffer, + ULONG nOutBufferSize +); + +NTSTATUS eFuseWrite( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN PUCHAR pData, + IN USHORT length); + +INT set_eFuseGetFreeBlockCount_Proc( + IN PRTMP_ADAPTER pAd, + IN PUCHAR arg); + +INT set_eFusedump_Proc( + IN PRTMP_ADAPTER pAd, + IN PUCHAR arg); + +INT set_eFuseLoadFromBin_Proc( + IN PRTMP_ADAPTER pAd, + IN PUCHAR arg); + +NTSTATUS eFuseWriteRegistersFromBin( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN USHORT Length, + IN USHORT* pData); + +VOID eFusePhysicalReadRegisters( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN USHORT Length, + OUT USHORT* pData); + +NDIS_STATUS NICLoadEEPROM( + IN PRTMP_ADAPTER pAd); + +BOOLEAN bNeedLoadEEPROM( + IN PRTMP_ADAPTER pAd); +//2008/09/11:KH add to support efuse--> +#endif // RT30xx // + +#ifdef RT30xx +// add by johnli, RF power sequence setup +VOID RT30xxLoadRFNormalModeSetup( + IN PRTMP_ADAPTER pAd); + +VOID RT30xxLoadRFSleepModeSetup( + IN PRTMP_ADAPTER pAd); + +VOID RT30xxReverseRFSleepModeSetup( + IN PRTMP_ADAPTER pAd); +// end johnli +#endif // RT30xx // + +#ifdef RT2870 +// +// Function Prototype in rtusb_bulk.c +// +VOID RTUSBInitTxDesc( + IN PRTMP_ADAPTER pAd, + IN PTX_CONTEXT pTxContext, + IN UCHAR BulkOutPipeId, + IN usb_complete_t Func); + +VOID RTUSBInitHTTxDesc( + IN PRTMP_ADAPTER pAd, + IN PHT_TX_CONTEXT pTxContext, + IN UCHAR BulkOutPipeId, + IN ULONG BulkOutSize, + IN usb_complete_t Func); + +VOID RTUSBInitRxDesc( + IN PRTMP_ADAPTER pAd, + IN PRX_CONTEXT pRxContext); + +VOID RTUSBCleanUpDataBulkOutQueue( + IN PRTMP_ADAPTER pAd); + +VOID RTUSBCancelPendingBulkOutIRP( + IN PRTMP_ADAPTER pAd); + +VOID RTUSBBulkOutDataPacket( + IN PRTMP_ADAPTER pAd, + IN UCHAR BulkOutPipeId, + IN UCHAR Index); + +VOID RTUSBBulkOutNullFrame( + IN PRTMP_ADAPTER pAd); + +VOID RTUSBBulkOutRTSFrame( + IN PRTMP_ADAPTER pAd); + +VOID RTUSBCancelPendingBulkInIRP( + IN PRTMP_ADAPTER pAd); + +VOID RTUSBCancelPendingIRPs( + IN PRTMP_ADAPTER pAd); + +VOID RTUSBBulkOutMLMEPacket( + IN PRTMP_ADAPTER pAd, + IN UCHAR Index); + +VOID RTUSBBulkOutPsPoll( + IN PRTMP_ADAPTER pAd); + +VOID RTUSBCleanUpMLMEBulkOutQueue( + IN PRTMP_ADAPTER pAd); + +VOID RTUSBKickBulkOut( + IN PRTMP_ADAPTER pAd); + +VOID RTUSBBulkReceive( + IN PRTMP_ADAPTER pAd); + +VOID DoBulkIn( + IN RTMP_ADAPTER *pAd); + +VOID RTUSBInitRxDesc( + IN PRTMP_ADAPTER pAd, + IN PRX_CONTEXT pRxContext); + +VOID RTUSBBulkRxHandle( + IN unsigned long data); + +// +// Function Prototype in rtusb_io.c +// +NTSTATUS RTUSBMultiRead( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + OUT PUCHAR pData, + IN USHORT length); + +NTSTATUS RTUSBMultiWrite( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN PUCHAR pData, + IN USHORT length); + +NTSTATUS RTUSBMultiWrite_OneByte( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN PUCHAR pData); + +NTSTATUS RTUSBReadBBPRegister( + IN PRTMP_ADAPTER pAd, + IN UCHAR Id, + IN PUCHAR pValue); + +NTSTATUS RTUSBWriteBBPRegister( + IN PRTMP_ADAPTER pAd, + IN UCHAR Id, + IN UCHAR Value); + +NTSTATUS RTUSBWriteRFRegister( + IN PRTMP_ADAPTER pAd, + IN UINT32 Value); + +#ifndef RT30xx +NTSTATUS RT30xxWriteRFRegister( + IN PRTMP_ADAPTER pAd, + IN UCHAR RegID, + IN UCHAR Value); + +NTSTATUS RT30xxReadRFRegister( + IN PRTMP_ADAPTER pAd, + IN UCHAR RegID, + IN PUCHAR pValue); +#endif + +NTSTATUS RTUSB_VendorRequest( + IN PRTMP_ADAPTER pAd, + IN UINT32 TransferFlags, + IN UCHAR ReservedBits, + IN UCHAR Request, + IN USHORT Value, + IN USHORT Index, + IN PVOID TransferBuffer, + IN UINT32 TransferBufferLength); + +NTSTATUS RTUSBReadEEPROM( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + OUT PUCHAR pData, + IN USHORT length); + +NTSTATUS RTUSBWriteEEPROM( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN PUCHAR pData, + IN USHORT length); + +VOID RTUSBPutToSleep( + IN PRTMP_ADAPTER pAd); + +NTSTATUS RTUSBWakeUp( + IN PRTMP_ADAPTER pAd); + +VOID RTUSBInitializeCmdQ( + IN PCmdQ cmdq); + +NDIS_STATUS RTUSBEnqueueCmdFromNdis( + IN PRTMP_ADAPTER pAd, + IN NDIS_OID Oid, + IN BOOLEAN SetInformation, + IN PVOID pInformationBuffer, + IN UINT32 InformationBufferLength); + +NDIS_STATUS RTUSBEnqueueInternalCmd( + IN PRTMP_ADAPTER pAd, + IN NDIS_OID Oid, + IN PVOID pInformationBuffer, + IN UINT32 InformationBufferLength); + +VOID RTUSBDequeueCmd( + IN PCmdQ cmdq, + OUT PCmdQElmt *pcmdqelmt); + +INT RTUSBCmdThread( + IN OUT PVOID Context); + +INT TimerQThread( + IN OUT PVOID Context); + +RT2870_TIMER_ENTRY *RT2870_TimerQ_Insert( + IN RTMP_ADAPTER *pAd, + IN RALINK_TIMER_STRUCT *pTimer); + +BOOLEAN RT2870_TimerQ_Remove( + IN RTMP_ADAPTER *pAd, + IN RALINK_TIMER_STRUCT *pTimer); + +void RT2870_TimerQ_Exit( + IN RTMP_ADAPTER *pAd); + +void RT2870_TimerQ_Init( + IN RTMP_ADAPTER *pAd); + +VOID RT2870_BssBeaconExit( + IN RTMP_ADAPTER *pAd); + +VOID RT2870_BssBeaconStop( + IN RTMP_ADAPTER *pAd); + +VOID RT2870_BssBeaconStart( + IN RTMP_ADAPTER * pAd); + +VOID RT2870_BssBeaconInit( + IN RTMP_ADAPTER *pAd); + +VOID RT2870_WatchDog( + IN RTMP_ADAPTER *pAd); + +NTSTATUS RTUSBWriteMACRegister( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + IN UINT32 Value); + +NTSTATUS RTUSBReadMACRegister( + IN PRTMP_ADAPTER pAd, + IN USHORT Offset, + OUT PUINT32 pValue); + +NTSTATUS RTUSBSingleWrite( + IN RTMP_ADAPTER *pAd, + IN USHORT Offset, + IN USHORT Value); + +NTSTATUS RTUSBFirmwareRun( + IN PRTMP_ADAPTER pAd); + +NTSTATUS RTUSBFirmwareWrite( + IN PRTMP_ADAPTER pAd, + IN PUCHAR pFwImage, + IN ULONG FwLen); + +NTSTATUS RTUSBFirmwareOpmode( + IN PRTMP_ADAPTER pAd, + OUT PUINT32 pValue); + +NTSTATUS RTUSBVenderReset( + IN PRTMP_ADAPTER pAd); + +NDIS_STATUS RTUSBSetHardWareRegister( + IN PRTMP_ADAPTER pAdapter, + IN PVOID pBuf); + +NDIS_STATUS RTUSBQueryHardWareRegister( + IN PRTMP_ADAPTER pAdapter, + IN PVOID pBuf); + +VOID CMDHandler( + IN PRTMP_ADAPTER pAd); + + +NDIS_STATUS CreateThreads( + IN struct net_device *net_dev ); + + +VOID MacTableInitialize( + IN PRTMP_ADAPTER pAd); + +VOID MlmeSetPsm( + IN PRTMP_ADAPTER pAd, + IN USHORT psm); + +NDIS_STATUS RTMPWPAAddKeyProc( + IN PRTMP_ADAPTER pAd, + IN PVOID pBuf); + +VOID AsicRxAntEvalAction( + IN PRTMP_ADAPTER pAd); + +void append_pkt( + IN PRTMP_ADAPTER pAd, + IN PUCHAR pHeader802_3, + IN UINT HdrLen, + IN PUCHAR pData, + IN ULONG DataSize, + OUT PNDIS_PACKET *ppPacket); + +UINT deaggregate_AMSDU_announce( + IN PRTMP_ADAPTER pAd, + PNDIS_PACKET pPacket, + IN PUCHAR pData, + IN ULONG DataSize); + +NDIS_STATUS RTMPCheckRxError( + IN PRTMP_ADAPTER pAd, + IN PHEADER_802_11 pHeader, + IN PRXWI_STRUC pRxWI, + IN PRT28XX_RXD_STRUC pRxINFO); + + +VOID RTUSBMlmeHardTransmit( + IN PRTMP_ADAPTER pAd, + IN PMGMT_STRUC pMgmt); + +INT MlmeThread( + IN PVOID Context); + +// +// Function Prototype in rtusb_data.c +// +NDIS_STATUS RTUSBFreeDescriptorRequest( + IN PRTMP_ADAPTER pAd, + IN UCHAR BulkOutPipeId, + IN UINT32 NumberRequired); + + +BOOLEAN RTUSBNeedQueueBackForAgg( + IN RTMP_ADAPTER *pAd, + IN UCHAR BulkOutPipeId); + + +VOID RTMPWriteTxInfo( + IN PRTMP_ADAPTER pAd, + IN PTXINFO_STRUC pTxInfo, + IN USHORT USBDMApktLen, + IN BOOLEAN bWiv, + IN UCHAR QueueSel, + IN UCHAR NextValid, + IN UCHAR TxBurst); + +// +// Function Prototype in cmm_data_2870.c +// +USHORT RtmpUSB_WriteSubTxResource( + IN PRTMP_ADAPTER pAd, + IN TX_BLK *pTxBlk, + IN BOOLEAN bIsLast, + OUT USHORT *FreeNumber); + +USHORT RtmpUSB_WriteSingleTxResource( + IN PRTMP_ADAPTER pAd, + IN TX_BLK *pTxBlk, + IN BOOLEAN bIsLast, + OUT USHORT *FreeNumber); + +USHORT RtmpUSB_WriteFragTxResource( + IN PRTMP_ADAPTER pAd, + IN TX_BLK *pTxBlk, + IN UCHAR fragNum, + OUT USHORT *FreeNumber); + +USHORT RtmpUSB_WriteMultiTxResource( + IN PRTMP_ADAPTER pAd, + IN TX_BLK *pTxBlk, + IN UCHAR frameNum, + OUT USHORT *FreeNumber); + +VOID RtmpUSB_FinalWriteTxResource( + IN PRTMP_ADAPTER pAd, + IN TX_BLK *pTxBlk, + IN USHORT totalMPDUSize, +#ifdef RT2860 + IN USHORT FirstTxIdx); +#endif + IN USHORT TxIdx); + +VOID RtmpUSBDataLastTxIdx( + IN PRTMP_ADAPTER pAd, + IN UCHAR QueIdx, + IN USHORT TxIdx); + +VOID RtmpUSBDataKickOut( + IN PRTMP_ADAPTER pAd, + IN TX_BLK *pTxBlk, + IN UCHAR QueIdx); + + +int RtmpUSBMgmtKickOut( + IN RTMP_ADAPTER *pAd, + IN UCHAR QueIdx, + IN PNDIS_PACKET pPacket, + IN PUCHAR pSrcBufVA, + IN UINT SrcBufLen); + +VOID RtmpUSBNullFrameKickOut( + IN RTMP_ADAPTER *pAd, + IN UCHAR QueIdx, + IN UCHAR *pNullFrame, + IN UINT32 frameLen); + +VOID RT28xxUsbStaAsicForceWakeup( + IN PRTMP_ADAPTER pAd, + IN BOOLEAN bFromTx); + +VOID RT28xxUsbStaAsicSleepThenAutoWakeup( + IN PRTMP_ADAPTER pAd, + IN USHORT TbttNumToNextWakeUp); + +VOID RT28xxUsbMlmeRadioOn( + IN PRTMP_ADAPTER pAd); + +VOID RT28xxUsbMlmeRadioOFF( + IN PRTMP_ADAPTER pAd); +#endif // RT2870 // //////////////////////////////////////// @@ -7120,10 +7068,10 @@ PCHAR RTMPGetRalinkEncryModeStr( IN USHORT encryMode); ////////////////////////////////////// -#ifdef CONFIG_STA_SUPPORT VOID AsicStaBbpTuning( IN PRTMP_ADAPTER pAd); +#ifdef RT2860 VOID AsicResetFromDMABusy( IN PRTMP_ADAPTER pAd); @@ -7135,7 +7083,16 @@ VOID AsicResetMAC( VOID AsicResetPBF( IN PRTMP_ADAPTER pAd); -#endif // CONFIG_STA_SUPPORT // +#endif +#ifdef RT2870 +BOOLEAN StaAddMacTableEntry( + IN PRTMP_ADAPTER pAd, + IN PMAC_TABLE_ENTRY pEntry, + IN UCHAR MaxSupportedRateIn500Kbps, + IN HT_CAPABILITY_IE *pHtCapability, + IN UCHAR HtCapabilityLen, + IN USHORT CapabilityInfo); +#endif void RTMP_IndicateMediaState( IN PRTMP_ADAPTER pAd); |