提交 5449c685 编写于 作者: F Forest Bond 提交者: Greg Kroah-Hartman

Staging: Add pristine upstream vt6655 driver sources

Add pristine upstream vt6655 driver sources to drivers/staging/vt6655.  These
files were literally copied from the driver directory in the upstream source
archive, available here:

  http://www.viaarena.com/Driver/vt6655_linux_src_v1.19.12_x86.zipSigned-off-by: NForest Bond <forest@alittletooquiet.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 be2e1071
/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* File: 80211hdr.h
*
* Purpose: Defines the macros, types, and functions for dealing
* with 802.11 MAC headers.
*
* Author: Lyndon Chen
*
* Date: Apr 8, 2002
*
*/
#ifndef __80211HDR_H__
#define __80211HDR_H__
#if !defined(__TTYPE_H__)
#include "ttype.h"
#endif
/*--------------------- Export Definitions -------------------------*/
// bit type
#define BIT0 0x00000001
#define BIT1 0x00000002
#define BIT2 0x00000004
#define BIT3 0x00000008
#define BIT4 0x00000010
#define BIT5 0x00000020
#define BIT6 0x00000040
#define BIT7 0x00000080
#define BIT8 0x00000100
#define BIT9 0x00000200
#define BIT10 0x00000400
#define BIT11 0x00000800
#define BIT12 0x00001000
#define BIT13 0x00002000
#define BIT14 0x00004000
#define BIT15 0x00008000
#define BIT16 0x00010000
#define BIT17 0x00020000
#define BIT18 0x00040000
#define BIT19 0x00080000
#define BIT20 0x00100000
#define BIT21 0x00200000
#define BIT22 0x00400000
#define BIT23 0x00800000
#define BIT24 0x01000000
#define BIT25 0x02000000
#define BIT26 0x04000000
#define BIT27 0x08000000
#define BIT28 0x10000000
#define BIT29 0x20000000
#define BIT30 0x40000000
#define BIT31 0x80000000
// 802.11 frame related, defined as 802.11 spec
#define WLAN_ADDR_LEN 6
#define WLAN_CRC_LEN 4
#define WLAN_CRC32_LEN 4
#define WLAN_FCS_LEN 4
#define WLAN_BSSID_LEN 6
#define WLAN_BSS_TS_LEN 8
#define WLAN_HDR_ADDR2_LEN 16
#define WLAN_HDR_ADDR3_LEN 24
#define WLAN_HDR_ADDR4_LEN 30
#define WLAN_IEHDR_LEN 2
#define WLAN_SSID_MAXLEN 32
//#define WLAN_RATES_MAXLEN 255
#define WLAN_RATES_MAXLEN 16
#define WLAN_RATES_MAXLEN_11B 4
#define WLAN_RSN_MAXLEN 32
#define WLAN_DATA_MAXLEN 2312
#define WLAN_A3FR_MAXLEN (WLAN_HDR_ADDR3_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN)
#define WLAN_BEACON_FR_MAXLEN WLAN_A3FR_MAXLEN
#define WLAN_ATIM_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 0)
#define WLAN_NULLDATA_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 0)
#define WLAN_DISASSOC_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 2)
#define WLAN_ASSOCREQ_FR_MAXLEN WLAN_A3FR_MAXLEN
#define WLAN_ASSOCRESP_FR_MAXLEN WLAN_A3FR_MAXLEN
#define WLAN_REASSOCREQ_FR_MAXLEN WLAN_A3FR_MAXLEN
#define WLAN_REASSOCRESP_FR_MAXLEN WLAN_A3FR_MAXLEN
#define WLAN_PROBEREQ_FR_MAXLEN WLAN_A3FR_MAXLEN
#define WLAN_PROBERESP_FR_MAXLEN WLAN_A3FR_MAXLEN
#define WLAN_AUTHEN_FR_MAXLEN WLAN_A3FR_MAXLEN
#define WLAN_DEAUTHEN_FR_MAXLEN (WLAN_HDR_ADDR3_LEN + 2)
#define WLAN_WEP_NKEYS 4
#define WLAN_WEP40_KEYLEN 5
#define WLAN_WEP104_KEYLEN 13
#define WLAN_WEP232_KEYLEN 29
//#define WLAN_WEPMAX_KEYLEN 29
#define WLAN_WEPMAX_KEYLEN 32
#define WLAN_CHALLENGE_IE_MAXLEN 255
#define WLAN_CHALLENGE_IE_LEN 130
#define WLAN_CHALLENGE_LEN 128
#define WLAN_WEP_IV_LEN 4
#define WLAN_WEP_ICV_LEN 4
#define WLAN_FRAGS_MAX 16
// Frame Type
#define WLAN_TYPE_MGR 0x00
#define WLAN_TYPE_CTL 0x01
#define WLAN_TYPE_DATA 0x02
#define WLAN_FTYPE_MGMT 0x00
#define WLAN_FTYPE_CTL 0x01
#define WLAN_FTYPE_DATA 0x02
// Frame Subtypes
#define WLAN_FSTYPE_ASSOCREQ 0x00
#define WLAN_FSTYPE_ASSOCRESP 0x01
#define WLAN_FSTYPE_REASSOCREQ 0x02
#define WLAN_FSTYPE_REASSOCRESP 0x03
#define WLAN_FSTYPE_PROBEREQ 0x04
#define WLAN_FSTYPE_PROBERESP 0x05
#define WLAN_FSTYPE_BEACON 0x08
#define WLAN_FSTYPE_ATIM 0x09
#define WLAN_FSTYPE_DISASSOC 0x0a
#define WLAN_FSTYPE_AUTHEN 0x0b
#define WLAN_FSTYPE_DEAUTHEN 0x0c
#define WLAN_FSTYPE_ACTION 0x0d
// Control
#define WLAN_FSTYPE_PSPOLL 0x0a
#define WLAN_FSTYPE_RTS 0x0b
#define WLAN_FSTYPE_CTS 0x0c
#define WLAN_FSTYPE_ACK 0x0d
#define WLAN_FSTYPE_CFEND 0x0e
#define WLAN_FSTYPE_CFENDCFACK 0x0f
// Data
#define WLAN_FSTYPE_DATAONLY 0x00
#define WLAN_FSTYPE_DATA_CFACK 0x01
#define WLAN_FSTYPE_DATA_CFPOLL 0x02
#define WLAN_FSTYPE_DATA_CFACK_CFPOLL 0x03
#define WLAN_FSTYPE_NULL 0x04
#define WLAN_FSTYPE_CFACK 0x05
#define WLAN_FSTYPE_CFPOLL 0x06
#define WLAN_FSTYPE_CFACK_CFPOLL 0x07
#ifdef __BIG_ENDIAN
// GET & SET Frame Control bit
#define WLAN_GET_FC_PRVER(n) ((((WORD)(n) >> 8) & (BIT0 | BIT1))
#define WLAN_GET_FC_FTYPE(n) ((((WORD)(n) >> 8) & (BIT2 | BIT3)) >> 2)
#define WLAN_GET_FC_FSTYPE(n) ((((WORD)(n) >> 8) & (BIT4|BIT5|BIT6|BIT7)) >> 4)
#define WLAN_GET_FC_TODS(n) ((((WORD)(n) << 8) & (BIT8)) >> 8)
#define WLAN_GET_FC_FROMDS(n) ((((WORD)(n) << 8) & (BIT9)) >> 9)
#define WLAN_GET_FC_MOREFRAG(n) ((((WORD)(n) << 8) & (BIT10)) >> 10)
#define WLAN_GET_FC_RETRY(n) ((((WORD)(n) << 8) & (BIT11)) >> 11)
#define WLAN_GET_FC_PWRMGT(n) ((((WORD)(n) << 8) & (BIT12)) >> 12)
#define WLAN_GET_FC_MOREDATA(n) ((((WORD)(n) << 8) & (BIT13)) >> 13)
#define WLAN_GET_FC_ISWEP(n) ((((WORD)(n) << 8) & (BIT14)) >> 14)
#define WLAN_GET_FC_ORDER(n) ((((WORD)(n) << 8) & (BIT15)) >> 15)
// Sequence Field bit
#define WLAN_GET_SEQ_FRGNUM(n) (((WORD)(n) >> 8) & (BIT0|BIT1|BIT2|BIT3))
#define WLAN_GET_SEQ_SEQNUM(n) ((((WORD)(n) >> 8) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4)
// Capability Field bit
#define WLAN_GET_CAP_INFO_ESS(n) (((n) >> 8) & BIT0)
#define WLAN_GET_CAP_INFO_IBSS(n) ((((n) >> 8) & BIT1) >> 1)
#define WLAN_GET_CAP_INFO_CFPOLLABLE(n) ((((n) >> 8) & BIT2) >> 2)
#define WLAN_GET_CAP_INFO_CFPOLLREQ(n) ((((n) >> 8) & BIT3) >> 3)
#define WLAN_GET_CAP_INFO_PRIVACY(n) ((((n) >> 8) & BIT4) >> 4)
#define WLAN_GET_CAP_INFO_SHORTPREAMBLE(n) ((((n) >> 8) & BIT5) >> 5)
#define WLAN_GET_CAP_INFO_PBCC(n) ((((n) >> 8) & BIT6) >> 6)
#define WLAN_GET_CAP_INFO_AGILITY(n) ((((n) >> 8) & BIT7) >> 7)
#define WLAN_GET_CAP_INFO_SPECTRUMMNG(n) ((((n)) & BIT8) >> 10)
#define WLAN_GET_CAP_INFO_SHORTSLOTTIME(n) ((((n)) & BIT10) >> 10)
#define WLAN_GET_CAP_INFO_DSSSOFDM(n) ((((n)) & BIT13) >> 13)
#define WLAN_GET_CAP_INFO_GRPACK(n) ((((n)) & BIT14) >> 14)
#else
// GET & SET Frame Control bit
#define WLAN_GET_FC_PRVER(n) (((WORD)(n)) & (BIT0 | BIT1))
#define WLAN_GET_FC_FTYPE(n) ((((WORD)(n)) & (BIT2 | BIT3)) >> 2)
#define WLAN_GET_FC_FSTYPE(n) ((((WORD)(n)) & (BIT4|BIT5|BIT6|BIT7)) >> 4)
#define WLAN_GET_FC_TODS(n) ((((WORD)(n)) & (BIT8)) >> 8)
#define WLAN_GET_FC_FROMDS(n) ((((WORD)(n)) & (BIT9)) >> 9)
#define WLAN_GET_FC_MOREFRAG(n) ((((WORD)(n)) & (BIT10)) >> 10)
#define WLAN_GET_FC_RETRY(n) ((((WORD)(n)) & (BIT11)) >> 11)
#define WLAN_GET_FC_PWRMGT(n) ((((WORD)(n)) & (BIT12)) >> 12)
#define WLAN_GET_FC_MOREDATA(n) ((((WORD)(n)) & (BIT13)) >> 13)
#define WLAN_GET_FC_ISWEP(n) ((((WORD)(n)) & (BIT14)) >> 14)
#define WLAN_GET_FC_ORDER(n) ((((WORD)(n)) & (BIT15)) >> 15)
// Sequence Field bit
#define WLAN_GET_SEQ_FRGNUM(n) (((WORD)(n)) & (BIT0|BIT1|BIT2|BIT3))
#define WLAN_GET_SEQ_SEQNUM(n) ((((WORD)(n)) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4)
// Capability Field bit
#define WLAN_GET_CAP_INFO_ESS(n) ((n) & BIT0)
#define WLAN_GET_CAP_INFO_IBSS(n) (((n) & BIT1) >> 1)
#define WLAN_GET_CAP_INFO_CFPOLLABLE(n) (((n) & BIT2) >> 2)
#define WLAN_GET_CAP_INFO_CFPOLLREQ(n) (((n) & BIT3) >> 3)
#define WLAN_GET_CAP_INFO_PRIVACY(n) (((n) & BIT4) >> 4)
#define WLAN_GET_CAP_INFO_SHORTPREAMBLE(n) (((n) & BIT5) >> 5)
#define WLAN_GET_CAP_INFO_PBCC(n) (((n) & BIT6) >> 6)
#define WLAN_GET_CAP_INFO_AGILITY(n) (((n) & BIT7) >> 7)
#define WLAN_GET_CAP_INFO_SPECTRUMMNG(n) (((n) & BIT8) >> 10)
#define WLAN_GET_CAP_INFO_SHORTSLOTTIME(n) (((n) & BIT10) >> 10)
#define WLAN_GET_CAP_INFO_DSSSOFDM(n) (((n) & BIT13) >> 13)
#define WLAN_GET_CAP_INFO_GRPACK(n) (((n) & BIT14) >> 14)
#endif //#ifdef __BIG_ENDIAN
#define WLAN_SET_CAP_INFO_ESS(n) (n)
#define WLAN_SET_CAP_INFO_IBSS(n) ((n) << 1)
#define WLAN_SET_CAP_INFO_CFPOLLABLE(n) ((n) << 2)
#define WLAN_SET_CAP_INFO_CFPOLLREQ(n) ((n) << 3)
#define WLAN_SET_CAP_INFO_PRIVACY(n) ((n) << 4)
#define WLAN_SET_CAP_INFO_SHORTPREAMBLE(n) ((n) << 5)
#define WLAN_SET_CAP_INFO_SPECTRUMMNG(n) ((n) << 8)
#define WLAN_SET_CAP_INFO_PBCC(n) ((n) << 6)
#define WLAN_SET_CAP_INFO_AGILITY(n) ((n) << 7)
#define WLAN_SET_CAP_INFO_SHORTSLOTTIME(n) ((n) << 10)
#define WLAN_SET_CAP_INFO_DSSSOFDM(n) ((n) << 13)
#define WLAN_SET_CAP_INFO_GRPACK(n) ((n) << 14)
#define WLAN_SET_FC_PRVER(n) ((WORD)(n))
#define WLAN_SET_FC_FTYPE(n) (((WORD)(n)) << 2)
#define WLAN_SET_FC_FSTYPE(n) (((WORD)(n)) << 4)
#define WLAN_SET_FC_TODS(n) (((WORD)(n)) << 8)
#define WLAN_SET_FC_FROMDS(n) (((WORD)(n)) << 9)
#define WLAN_SET_FC_MOREFRAG(n) (((WORD)(n)) << 10)
#define WLAN_SET_FC_RETRY(n) (((WORD)(n)) << 11)
#define WLAN_SET_FC_PWRMGT(n) (((WORD)(n)) << 12)
#define WLAN_SET_FC_MOREDATA(n) (((WORD)(n)) << 13)
#define WLAN_SET_FC_ISWEP(n) (((WORD)(n)) << 14)
#define WLAN_SET_FC_ORDER(n) (((WORD)(n)) << 15)
#define WLAN_SET_SEQ_FRGNUM(n) ((WORD)(n))
#define WLAN_SET_SEQ_SEQNUM(n) (((WORD)(n)) << 4)
// ERP Field bit
#define WLAN_GET_ERP_NONERP_PRESENT(n) ((n) & BIT0)
#define WLAN_GET_ERP_USE_PROTECTION(n) (((n) & BIT1) >> 1)
#define WLAN_GET_ERP_BARKER_MODE(n) (((n) & BIT2) >> 2)
#define WLAN_SET_ERP_NONERP_PRESENT(n) (n)
#define WLAN_SET_ERP_USE_PROTECTION(n) ((n) << 1)
#define WLAN_SET_ERP_BARKER_MODE(n) ((n) << 2)
// Support & Basic Rates field
#define WLAN_MGMT_IS_BASICRATE(b) ((b) & BIT7)
#define WLAN_MGMT_GET_RATE(b) ((b) & ~BIT7)
// TIM field
#define WLAN_MGMT_IS_MULTICAST_TIM(b) ((b) & BIT0)
#define WLAN_MGMT_GET_TIM_OFFSET(b) (((b) & ~BIT0) >> 1)
// 3-Addr & 4-Addr
#define WLAN_HDR_A3_DATA_PTR(p) (((PBYTE)(p)) + WLAN_HDR_ADDR3_LEN)
#define WLAN_HDR_A4_DATA_PTR(p) (((PBYTE)(p)) + WLAN_HDR_ADDR4_LEN)
// IEEE ADDR
#define IEEE_ADDR_UNIVERSAL 0x02
#define IEEE_ADDR_GROUP 0x01
typedef struct {
BYTE abyAddr[6];
} IEEE_ADDR, *PIEEE_ADDR;
// 802.11 Header Format
typedef struct tagWLAN_80211HDR_A2 {
WORD wFrameCtl;
WORD wDurationID;
BYTE abyAddr1[WLAN_ADDR_LEN];
BYTE abyAddr2[WLAN_ADDR_LEN];
}__attribute__ ((__packed__))
WLAN_80211HDR_A2, *PWLAN_80211HDR_A2;
typedef struct tagWLAN_80211HDR_A3 {
WORD wFrameCtl;
WORD wDurationID;
BYTE abyAddr1[WLAN_ADDR_LEN];
BYTE abyAddr2[WLAN_ADDR_LEN];
BYTE abyAddr3[WLAN_ADDR_LEN];
WORD wSeqCtl;
}__attribute__ ((__packed__))
WLAN_80211HDR_A3, *PWLAN_80211HDR_A3;
typedef struct tagWLAN_80211HDR_A4 {
WORD wFrameCtl;
WORD wDurationID;
BYTE abyAddr1[WLAN_ADDR_LEN];
BYTE abyAddr2[WLAN_ADDR_LEN];
BYTE abyAddr3[WLAN_ADDR_LEN];
WORD wSeqCtl;
BYTE abyAddr4[WLAN_ADDR_LEN];
}__attribute__ ((__packed__))
WLAN_80211HDR_A4, *PWLAN_80211HDR_A4;
typedef union tagUWLAN_80211HDR {
WLAN_80211HDR_A2 sA2;
WLAN_80211HDR_A3 sA3;
WLAN_80211HDR_A4 sA4;
} UWLAN_80211HDR, *PUWLAN_80211HDR;
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
#endif // __80211HDR_H__
此差异已折叠。
此差异已折叠。
/*
* Copyright (c) 1996, 2005 VIA Networking Technologies, Inc.
* All rights reserved.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*
* File: IEEE11h.c
*
* Purpose:
*
* Functions:
*
* Revision History:
*
* Author: Yiching Chen
*
* Date: Mar. 31, 2005
*
*/
#if !defined(__TTYPE_H__)
#include "ttype.h"
#endif
#if !defined(__UMEM_H__)
#include "umem.h"
#endif
#if !defined(__TMACRO_H__)
#include "tmacro.h"
#endif
#if !defined(__TETHER_H__)
#include "tether.h"
#endif
#if !defined(__IEEE11h_H__)
#include "IEEE11h.h"
#endif
#if !defined(__DEVICE_H__)
#include "device.h"
#endif
#if !defined(__WMGR_H__)
#include "wmgr.h"
#endif
#if !defined(__RXTX_H__)
#include "rxtx.h"
#endif
/*--------------------- Static Definitions -------------------------*/
static int msglevel =MSG_LEVEL_INFO;
#pragma pack(1)
typedef struct _WLAN_FRAME_ACTION {
WLAN_80211HDR_A3 Header;
BYTE byCategory;
BYTE byAction;
BYTE abyVars[1];
} WLAN_FRAME_ACTION, *PWLAN_FRAME_ACTION;
typedef struct _WLAN_FRAME_MSRREQ {
WLAN_80211HDR_A3 Header;
BYTE byCategory;
BYTE byAction;
BYTE byDialogToken;
WLAN_IE_MEASURE_REQ sMSRReqEIDs[1];
} WLAN_FRAME_MSRREQ, *PWLAN_FRAME_MSRREQ;
typedef struct _WLAN_FRAME_MSRREP {
WLAN_80211HDR_A3 Header;
BYTE byCategory;
BYTE byAction;
BYTE byDialogToken;
WLAN_IE_MEASURE_REP sMSRRepEIDs[1];
} WLAN_FRAME_MSRREP, *PWLAN_FRAME_MSRREP;
typedef struct _WLAN_FRAME_TPCREQ {
WLAN_80211HDR_A3 Header;
BYTE byCategory;
BYTE byAction;
BYTE byDialogToken;
WLAN_IE_TPC_REQ sTPCReqEIDs;
} WLAN_FRAME_TPCREQ, *PWLAN_FRAME_TPCREQ;
typedef struct _WLAN_FRAME_TPCREP {
WLAN_80211HDR_A3 Header;
BYTE byCategory;
BYTE byAction;
BYTE byDialogToken;
WLAN_IE_TPC_REP sTPCRepEIDs;
} WLAN_FRAME_TPCREP, *PWLAN_FRAME_TPCREP;
#pragma pack()
// action field reference ieee 802.11h Table 20e
#define ACTION_MSRREQ 0
#define ACTION_MSRREP 1
#define ACTION_TPCREQ 2
#define ACTION_TPCREP 3
#define ACTION_CHSW 4
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
/*--------------------- Static Functions --------------------------*/
static BOOL s_bRxMSRReq(PSMgmtObject pMgmt, PWLAN_FRAME_MSRREQ pMSRReq, UINT uLength)
{
UINT uNumOfEIDs = 0;
BOOL bResult = TRUE;
if (uLength <= WLAN_A3FR_MAXLEN) {
MEMvCopy(pMgmt->abyCurrentMSRReq, pMSRReq, uLength);
}
uNumOfEIDs = ((uLength - OFFSET(WLAN_FRAME_MSRREQ, sMSRReqEIDs))/ (sizeof(WLAN_IE_MEASURE_REQ)));
pMgmt->pCurrMeasureEIDRep = &(((PWLAN_FRAME_MSRREP) (pMgmt->abyCurrentMSRRep))->sMSRRepEIDs[0]);
pMgmt->uLengthOfRepEIDs = 0;
bResult = CARDbStartMeasure(pMgmt->pAdapter,
((PWLAN_FRAME_MSRREQ) (pMgmt->abyCurrentMSRReq))->sMSRReqEIDs,
uNumOfEIDs
);
return (bResult);
}
static BOOL s_bRxTPCReq(PSMgmtObject pMgmt, PWLAN_FRAME_TPCREQ pTPCReq, BYTE byRate, BYTE byRSSI)
{
PWLAN_FRAME_TPCREP pFrame;
PSTxMgmtPacket pTxPacket = NULL;
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN);
pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket));
pFrame = (PWLAN_FRAME_TPCREP)((PBYTE)pTxPacket + sizeof(STxMgmtPacket));
pFrame->Header.wFrameCtl = ( WLAN_SET_FC_FTYPE(WLAN_FTYPE_MGMT) |
WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ACTION)
);
MEMvCopy( pFrame->Header.abyAddr1, pTPCReq->Header.abyAddr2, WLAN_ADDR_LEN);
MEMvCopy( pFrame->Header.abyAddr2, CARDpGetCurrentAddress(pMgmt->pAdapter), WLAN_ADDR_LEN);
MEMvCopy( pFrame->Header.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
pFrame->byCategory = 0;
pFrame->byAction = 3;
pFrame->byDialogToken = ((PWLAN_FRAME_MSRREQ) (pMgmt->abyCurrentMSRReq))->byDialogToken;
pFrame->sTPCRepEIDs.byElementID = WLAN_EID_TPC_REP;
pFrame->sTPCRepEIDs.len = 2;
pFrame->sTPCRepEIDs.byTxPower = CARDbyGetTransmitPower(pMgmt->pAdapter);
switch (byRate) {
case RATE_54M:
pFrame->sTPCRepEIDs.byLinkMargin = 65 - byRSSI;
break;
case RATE_48M:
pFrame->sTPCRepEIDs.byLinkMargin = 66 - byRSSI;
break;
case RATE_36M:
pFrame->sTPCRepEIDs.byLinkMargin = 70 - byRSSI;
break;
case RATE_24M:
pFrame->sTPCRepEIDs.byLinkMargin = 74 - byRSSI;
break;
case RATE_18M:
pFrame->sTPCRepEIDs.byLinkMargin = 77 - byRSSI;
break;
case RATE_12M:
pFrame->sTPCRepEIDs.byLinkMargin = 79 - byRSSI;
break;
case RATE_9M:
pFrame->sTPCRepEIDs.byLinkMargin = 81 - byRSSI;
break;
case RATE_6M:
default:
pFrame->sTPCRepEIDs.byLinkMargin = 82 - byRSSI;
break;
}
pTxPacket->cbMPDULen = sizeof(WLAN_FRAME_TPCREP);
pTxPacket->cbPayloadLen = sizeof(WLAN_FRAME_TPCREP) - WLAN_HDR_ADDR3_LEN;
if (csMgmt_xmit(pMgmt->pAdapter, pTxPacket) != CMD_STATUS_PENDING)
return (FALSE);
return (TRUE);
// return (CARDbSendPacket(pMgmt->pAdapter, pFrame, PKT_TYPE_802_11_MNG, sizeof(WLAN_FRAME_TPCREP)));
}
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
/*+
*
* Description:
* Handles action management frames.
*
* Parameters:
* In:
* pMgmt - Management Object structure
* pRxPacket - Received packet
* Out:
* none
*
* Return Value: None.
*
-*/
BOOL
IEEE11hbMgrRxAction (
IN PVOID pMgmtHandle,
IN PVOID pRxPacket
)
{
PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle;
PWLAN_FRAME_ACTION pAction = NULL;
UINT uLength = 0;
PWLAN_IE_CH_SW pChannelSwitch = NULL;
// decode the frame
uLength = ((PSRxMgmtPacket)pRxPacket)->cbMPDULen;
if (uLength > WLAN_A3FR_MAXLEN) {
return (FALSE);
}
pAction = (PWLAN_FRAME_ACTION) (((PSRxMgmtPacket)pRxPacket)->p80211Header);
if (pAction->byCategory == 0) {
switch (pAction->byAction) {
case ACTION_MSRREQ:
return (s_bRxMSRReq(pMgmt, (PWLAN_FRAME_MSRREQ) pAction, uLength));
break;
case ACTION_MSRREP:
break;
case ACTION_TPCREQ:
return (s_bRxTPCReq(pMgmt,
(PWLAN_FRAME_TPCREQ) pAction,
((PSRxMgmtPacket)pRxPacket)->byRxRate,
(BYTE) ((PSRxMgmtPacket)pRxPacket)->uRSSI));
break;
case ACTION_TPCREP:
break;
case ACTION_CHSW:
pChannelSwitch = (PWLAN_IE_CH_SW) (pAction->abyVars);
if ((pChannelSwitch->byElementID == WLAN_EID_CH_SWITCH) &&
(pChannelSwitch->len == 3)) {
// valid element id
CARDbChannelSwitch( pMgmt->pAdapter,
pChannelSwitch->byMode,
CARDbyGetChannelMapping(pMgmt->pAdapter, pChannelSwitch->byChannel, pMgmt->eCurrentPHYMode),
pChannelSwitch->byCount
);
}
break;
default:
DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown Action = %d\n", pAction->byAction);
break;
}
} else {
DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown Category = %d\n", pAction->byCategory);
pAction->byCategory |= 0x80;
//return (CARDbSendPacket(pMgmt->pAdapter, pAction, PKT_TYPE_802_11_MNG, uLength));
return (TRUE);
}
return (TRUE);
}
BOOL IEEE11hbMSRRepTx (
IN PVOID pMgmtHandle
)
{
PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle;
PWLAN_FRAME_MSRREP pMSRRep = (PWLAN_FRAME_MSRREP) (pMgmt->abyCurrentMSRRep + sizeof(STxMgmtPacket));
UINT uLength = 0;
PSTxMgmtPacket pTxPacket = NULL;
pTxPacket = (PSTxMgmtPacket)pMgmt->abyCurrentMSRRep;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN);
pTxPacket->p80211Header = (PUWLAN_80211HDR)((PBYTE)pTxPacket + sizeof(STxMgmtPacket));
pMSRRep->Header.wFrameCtl = ( WLAN_SET_FC_FTYPE(WLAN_FTYPE_MGMT) |
WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ACTION)
);
MEMvCopy( pMSRRep->Header.abyAddr1, ((PWLAN_FRAME_MSRREQ) (pMgmt->abyCurrentMSRReq))->Header.abyAddr2, WLAN_ADDR_LEN);
MEMvCopy( pMSRRep->Header.abyAddr2, CARDpGetCurrentAddress(pMgmt->pAdapter), WLAN_ADDR_LEN);
MEMvCopy( pMSRRep->Header.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
pMSRRep->byCategory = 0;
pMSRRep->byAction = 1;
pMSRRep->byDialogToken = ((PWLAN_FRAME_MSRREQ) (pMgmt->abyCurrentMSRReq))->byDialogToken;
uLength = pMgmt->uLengthOfRepEIDs + OFFSET(WLAN_FRAME_MSRREP, sMSRRepEIDs);
pTxPacket->cbMPDULen = uLength;
pTxPacket->cbPayloadLen = uLength - WLAN_HDR_ADDR3_LEN;
if (csMgmt_xmit(pMgmt->pAdapter, pTxPacket) != CMD_STATUS_PENDING)
return (FALSE);
return (TRUE);
// return (CARDbSendPacket(pMgmt->pAdapter, pMSRRep, PKT_TYPE_802_11_MNG, uLength));
}
/*
* Copyright (c) 1996, 2005 VIA Networking Technologies, Inc.
* All rights reserved.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*
* File: IEEE11h.h
*
* Purpose: Defines the macros, types, and functions for dealing
* with IEEE 802.11h.
*
* Author: Yiching Chen
*
* Date: Mar. 31, 2005
*
*/
#ifndef __IEEE11h_H__
#define __IEEE11h_H__
#if !defined(__TTYPE_H__)
#include "ttype.h"
#endif
#if !defined(__80211HDR_H__)
#include "80211hdr.h"
#endif
#if !defined(__80211MGR_H__)
#include "80211mgr.h"
#endif
/*--------------------- Export Definitions -------------------------*/
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Types ------------------------------*/
/*--------------------- Export Functions --------------------------*/
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
BOOL IEEE11hbMSRRepTx (
IN PVOID pMgmtHandle
);
#ifdef __cplusplus
} /* End of extern "C" { */
#endif /* __cplusplus */
#endif // __IEEE11h_H__
#
# Build options:
# PRIV_OBJ := 1 for object version
#
IO_MAP := 0
HOSTAP := 1
PRIV_OBJ := 0
#KSP : = 0
KSP := /lib/modules/$(shell uname -r)/build \
# /usr/src/linux-$(shell uname -r) \
# /usr/src/linux-$(shell uname -r | sed 's/-.*//') \
# /usr/src/kernel-headers-$(shell uname -r) \
# /usr/src/kernel-source-$(shell uname -r) \
# /usr/src/linux-$(shell uname -r | sed 's/\([0-9]*\.[0-9]*\)\..*/\1/') \
# /usr/src/linux /home/plice
#test_dir = $(shell [ -e $(dir)/include/linux ] && echo $(dir))
#KSP := $(foreach dir, $(KSP), $(test_dir))
KSRC := $(firstword $(KSP))
#ifeq (,$(KSRC))
# $( error Linux kernel source not found)
#endif
# check kernel version
KVER := $(shell uname -r | cut -c1-3 | sed 's/2\.[56]/2\.6/')
KERVER2=$(shell uname -r | cut -d. -f2)
ifeq ($(KVER), 2.6)
# 2.6 kernel
TARGET = viawget.ko
else
TARGET = viawget.o
endif
INSTDIR := $(shell find /lib/modules/$(shell uname -r) -name $(TARGET) -printf "%h\n" | sort | head -1)
ifeq (,$(INSTDIR))
ifeq (,$(KERVER2))
ifneq (,$(wildcard /lib/modules/$(shell uname -r)/kernel))
INSTDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net
else
INSTDIR := /lib/modules/$(shell uname -r)/net
endif
else
ifneq ($(KERVER2),2)
INSTDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net
else
INSTDIR := /lib/modules/$(shell uname -r)/net
endif
endif
endif
SRC = device_main.c card.c mac.c baseband.c wctl.c 80211mgr.c \
wcmd.c wmgr.c bssdb.c wpa2.c rxtx.c dpc.c power.c datarate.c \
srom.c mib.c rc4.c tether.c tcrc.c ioctl.c hostap.c wpa.c key.c \
tkip.c michael.c wroute.c rf.c iwctl.c wpactl.c aes_ccmp.c \
vntwifi.c IEEE11h.c
ifeq ($(IO_MAP), 1)
EXTRA_CFLAGS += -DIO_MAP
endif
ifeq ($(HOSTAP), 1)
EXTRA_CFLAGS += -DHOSTAP
endif
ifeq ($(PRIV_OBJ), 1)
EXTRA_CFLAGS += -DPRIVATE_OBJ
endif
EXTRA_CFLAGS += -I$(PWD) -I$(PWD)/../include -I$(PWD)/../solomon
EXTRA_CFLAGS += -I$(PWD)/include -I$(PWD)/solomon
# build rule
ifeq ($(KVER), 2.6)
# 2.6 kernel
ifndef KERNEL_CONF
KERNEL_CONF= $(KSRC)/.config
endif
include ${KERNEL_CONF}
obj-m += viawget.o
viawget-objs := device_main.o card.o mac.o baseband.o wctl.o 80211mgr.o \
wcmd.o wmgr.o bssdb.o rxtx.o dpc.o power.o datarate.o srom.o \
mib.o rc4.o tether.o tcrc.o ioctl.o hostap.o wpa.o key.o tkip.o \
michael.o wroute.o rf.o iwctl.o wpactl.o wpa2.o aes_ccmp.o \
vntwifi.o IEEE11h.o
.c.o:
$(CC) $(CFLAGS) -o $@ $<
default:
make -C $(KSRC) SUBDIRS=$(shell pwd) modules
else
# 2.2/2.4 kernel
OBJS := device_main.o card.o mac.o baseband.o wctl.o 80211mgr.o \
wcmd.o wmgr.o bssdb.o rxtx.o dpc.o power.o datarate.o srom.o \
mib.o rc4.o tether.o tcrc.o ioctl.o hostap.o wpa.o key.o tkip.o \
michael.o wroute.o rf.o iwctl.o wpactl.o wpa2.o aes_ccmp.o \
vntwifi.o IEEE11h.o
VERSION_FILE := $(KSRC)/include/linux/version.h
CONFIG_FILE := $(KSRC)/include/linux/config.h
ifeq (,$(wildcard $(VERSION_FILE)))
$(error Linux kernel source not configured - missing version.h)
endif
ifeq (,$(wildcard $(CONFIG_FILE)))
$(error Linux kernel source not configured - missing config.h)
endif
ifneq (,$(findstring egcs-2.91.66, $(shell cat /proc/version)))
CC := kgcc gcc cc
else
CC := gcc cc
endif
test_cc = $(shell which $(cc) > /dev/null 2>&1 && echo $(cc))
CC := $(foreach cc, $(CC), $(test_cc))
CC := $(firstword $(CC))
EXTRA_CFLAGS += -Wall -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -D__NO_VERSION__ -O2 -pipe
EXTRA_CFLAGS += -I$(KSRC)/include -Wstrict-prototypes -fomit-frame-pointer -fno-strict-aliasing
EXTRA_CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \
echo "-DMODVERSIONS -include $(KSRC)/include/linux/modversions.h")
.SILENT: $(TARGET) clean
# look for SMP in config.h
SMP := $(shell $(CC) $(CFLAGS) -E -dM $(CONFIG_FILE) | \
grep CONFIG_SMP | awk '{ print $$3 }')
ifneq ($(SMP),1)
SMP := 0
endif
ifeq ($(SMP), 1)
EXTRA_CFLAGS += -D__SMP__
endif
ifeq ($(PRIV_OBJ), 1)
EXTRA_CFLAGS += -DPRIVATE_OBJ
TARGET = x86g_up.o
ifeq ($(SMP), 1)
TARGET = x86g_smp.o
endif
endif
# check x86_64
SUBARCH := $(shell uname -m)
ifeq ($(SUBARCH),x86_64)
EXTRA_CFLAGS += -mcmodel=kernel -mno-red-zone
endif
$(TARGET): $(filter-out $(TARGET), $(SRC:.c=.o))
$(LD) -r $^ -o $@
echo; echo
echo "**************************************************"
echo "Build options:"
echo " VERSION $(KVER)"
echo -n " SMP "
if [ "$(SMP)" = "1" ]; \
then echo "Enabled"; else echo "Disabled"; fi
endif # ifeq ($(KVER),2.6)
ifeq ($(KVER), 2.6)
install: default
else
install: clean $(TARGET)
endif
mkdir -p $(MOD_ROOT)$(INSTDIR)
install -m 644 -o root $(TARGET) $(MOD_ROOT)$(INSTDIR)
ifeq (,$(MOD_ROOT))
/sbin/depmod -a || true
else
/sbin/depmod -b $(MOD_ROOT) -a || true
endif
uninstall:
rm -f $(INSTDIR)/$(TARGET)
/sbin/depmod -a
clean:
rm -f $(TARGET) $(SRC:.c=.o) *.o *~
rm -f .*.o.d .*.o.cmd .*.ko.cmd *.mod.c *.mod.o
-include .depend.mak
#
#
# Build options:
# PRIV_OBJ := 1 for object version
# BIG_ENDIAN := 1 for big-endian mode
#
# arm-linux-tools chain are located at:
# /usr/local/bin/arm-linux-gcc
# /usr/local/bin/arm-linux-ld
#
IO_MAP := 0
HOSTAP := 1
PRIV_OBJ := 1
BIG_ENDIAN := 1
test_dir = $(shell [ -e $(dir)/include/linux ] && echo $(dir))
KSP := $(foreach dir, $(KSP), $(test_dir))
KSRC := $(firstword $(KSP))
#ifeq (,$(KSRC))
# $(error Linux kernel source not found)
#endif
# check kernel version
KVER := $(shell uname -r | cut -c1-3 | sed 's/2\.[56]/2\.6/')
KERVER2=$(shell uname -r | cut -d. -f2)
ifeq ($(KVER), 2.6)
# 2.6 kernel
TARGET = viawget.ko
else
TARGET = viawget.o
endif
INSTDIR := $(shell find /lib/modules/$(shell uname -r) -name $(TARGET) -printf "%h\n" | sort | head -1)
ifeq (,$(INSTDIR))
ifeq (,$(KERVER2))
ifneq (,$(wildcard /lib/modules/$(shell uname -r)/kernel))
INSTDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net
else
INSTDIR := /lib/modules/$(shell uname -r)/net
endif
else
ifneq ($(KERVER2),2)
INSTDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net
else
INSTDIR := /lib/modules/$(shell uname -r)/net
endif
endif
endif
SRC = device_main.c card.c mac.c baseband.c wctl.c 80211mgr.c \
wcmd.c wmgr.c bssdb.c rxtx.c dpc.c power.c datarate.c srom.c \
mib.c rc4.c tether.c tcrc.c ioctl.c hostap.c wpa.c key.c tkip.c \
michael.c wroute.c rf.c iwctl.c wpactl.c wpa2.c aes_ccmp.c
ifeq ($(IO_MAP), 1)
CFLAGS += -DIO_MAP
endif
ifeq ($(HOSTAP), 1)
CFLAGS += -DHOSTAP
endif
ifeq ($(PRIV_OBJ), 1)
CFLAGS += -DPRIVATE_OBJ
endif
ifeq ($(BIG_ENDIAN), 1)
CFLAGS += -D__BIG_ENDIAN
CFLAGS += -mbig-endian
LDOPTS += -EB
else
CFLAGS += -mlittle-endian
LDOPTS += -EL
endif
CFLAGS += -I$(PWD) -I$(PWD)/../include -I$(PWD)/../solomon
# build rule
ifeq ($(KVER), 2.6)
# 2.6 kernel
ifndef KERNEL_CONF
KERNEL_CONF= $(KSRC)/.config
endif
include ${KERNEL_CONF}
obj-m += viawget.o
viawget-objs := device_main.o card.o mac.o baseband.o wctl.o 80211mgr.o \
wcmd.o wmgr.o bssdb.o rxtx.o dpc.o power.o datarate.o srom.o \
mib.o rc4.o tether.o tcrc.o ioctl.o hostap.o wpa.o key.o tkip.o \
michael.o wroute.o rf.o iwctl.o wpactl.o wpa2.o aes_ccmp.o
.c.o:
$(CC) $(CFLAGS) -o $@ $<
default:
make -C $(KSRC) SUBDIRS=$(shell pwd) modules
else
# 2.2/2.4 kernel
OBJS := device_main.o card.o mac.o baseband.o wctl.o 80211mgr.o \
wcmd.o wmgr.o bssdb.o rxtx.o dpc.o power.o datarate.o srom.o \
mib.o rc4.o tether.o tcrc.o ioctl.o hostap.o wpa.o key.o tkip.o \
michael.o wroute.o rf.o iwctl.o wpactl.o wpa2.o
CC := /usr/local/bin/arm-linux-gcc
LD := /usr/local/bin/arm-linux-ld
CFLAGS += -Wall -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -D__NO_VERSION__ -O2 -pipe
#CFLAGS += -Wstrict-prototypes -fomit-frame-pointer
COPTS+= -march=armv4 -fno-strict-aliasing -fno-common
#COPTS+= -mapcs-32 -mtune=xscale -mshort-load-bytes -msoft-float -mfp=2
#COPTS+= -mthumb -mcpu=arm9 -ffunction-sections -fdata-sections
.SILENT: $(TARGET) clean
ifeq ($(PRIV_OBJ), 1)
ifeq ($(BIG_ENDIAN), 1)
TARGET = arm_be_g.o
else
TARGET = arm_le_g.o
endif
endif
$(TARGET): $(filter-out $(TARGET), $(SRC:.c=.o))
$(LD) $(LDOPTS) -r $^ -o $@
echo
echo "***********************************"
echo "Build options:"
echo " VERSION $(KVER)"
echo -n " SMP "
if [ "$(SMP)" = "1" ]; \
then echo "Enabled"; else echo "Disabled"; fi
endif # ifeq ($(KVER),2.6)
ifeq ($(KVER), 2.6)
install: default
else
install: clean $(TARGET)
endif
mkdir -p $(MOD_ROOT)$(INSTDIR)
install -m 644 -o root $(TARGET) $(MOD_ROOT)$(INSTDIR)
ifeq (,$(MOD_ROOT))
/sbin/depmod -a || true
else
/sbin/depmod -b $(MOD_ROOT) -a || true
endif
uninstall:
rm -f $(INSTDIR)/$(TARGET)
/sbin/depmod -a
clean:
rm -f $(TARGET) $(SRC:.c=.o) *~
rm -f .*.o.d .*.o.cmd .*.ko.cmd *.mod.c *.mod.o
-include .depend.mak
#
# Build options:
# PRIV_OBJ := 1 for object version
#
IO_MAP := 0
HOSTAP := 1
PRIV_OBJ := 1
KSP := /lib/modules/$(shell uname -r)/build \
/usr/src/linux-$(shell uname -r) \
/usr/src/linux-$(shell uname -r | sed 's/-.*//') \
/usr/src/kernel-headers-$(shell uname -r) \
/usr/src/kernel-source-$(shell uname -r) \
/usr/src/linux-$(shell uname -r | sed 's/\([0-9]*\.[0-9]*\)\..*/\1/') \
/usr/src/linux
test_dir = $(shell [ -e $(dir)/include/linux ] && echo $(dir))
KSP := $(foreach dir, $(KSP), $(test_dir))
KSRC := $(firstword $(KSP))
ifeq (,$(KSRC))
$(error Linux kernel source not found)
endif
# check kernel version
KVER := $(shell uname -r | cut -c1-3 | sed 's/2\.[56]/2\.6/')
KERVER2=$(shell uname -r | cut -d. -f2)
ifeq ($(KVER), 2.6)
# 2.6 kernel
TARGET = viawget.ko
else
TARGET = viawget.o
endif
INSTDIR := $(shell find /lib/modules/$(shell uname -r) -name $(TARGET) -printf "%h\n" | sort | head -1)
ifeq (,$(INSTDIR))
ifeq (,$(KERVER2))
ifneq (,$(wildcard /lib/modules/$(shell uname -r)/kernel))
INSTDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net
else
INSTDIR := /lib/modules/$(shell uname -r)/net
endif
else
ifneq ($(KERVER2),2)
INSTDIR := /lib/modules/$(shell uname -r)/kernel/drivers/net
else
INSTDIR := /lib/modules/$(shell uname -r)/net
endif
endif
endif
SRC = device_main.c card.c mac.c baseband.c wctl.c 80211mgr.c \
wcmd.c wmgr.c bssdb.c wpa2.c rxtx.c dpc.c power.c datarate.c \
srom.c mib.c rc4.c tether.c tcrc.c ioctl.c hostap.c wpa.c key.c \
tkip.c michael.c wroute.c rf.c iwctl.c wpactl.c aes_ccmp.c
ifeq ($(IO_MAP), 1)
CFLAGS += -DIO_MAP
endif
ifeq ($(HOSTAP), 1)
CFLAGS += -DHOSTAP
endif
ifeq ($(PRIV_OBJ), 1)
CFLAGS += -DPRIVATE_OBJ
endif
CFLAGS += -I$(PWD) -I$(PWD)/../include -I$(PWD)/../solomon
# build rule
ifeq ($(KVER), 2.6)
# 2.6 kernel
ifndef KERNEL_CONF
KERNEL_CONF= $(KSRC)/.config
endif
include ${KERNEL_CONF}
obj-m += viawget.o
viawget-objs := device_main.o card.o mac.o baseband.o wctl.o 80211mgr.o \
wcmd.o wmgr.o bssdb.o rxtx.o dpc.o power.o datarate.o srom.o \
mib.o rc4.o tether.o tcrc.o ioctl.o hostap.o wpa.o key.o tkip.o \
michael.o wroute.o rf.o iwctl.o wpactl.o wpa2.o aes_ccmp.o
.c.o:
$(CC) $(CFLAGS) -o $@ $<
default:
make -C $(KSRC) SUBDIRS=$(shell pwd) modules
else
# 2.2/2.4 kernel
OBJS := device_main.o card.o mac.o baseband.o wctl.o 80211mgr.o \
wcmd.o wmgr.o bssdb.o rxtx.o dpc.o power.o datarate.o srom.o \
mib.o rc4.o tether.o tcrc.o ioctl.o hostap.o wpa.o key.o tkip.o \
michael.o wroute.o rf.o iwctl.o wpactl.o wpa2.o aes_ccmp.o
VERSION_FILE := $(KSRC)/include/linux/version.h
CONFIG_FILE := $(KSRC)/include/linux/config.h
ifeq (,$(wildcard $(VERSION_FILE)))
$(error Linux kernel source not configured - missing version.h)
endif
ifeq (,$(wildcard $(CONFIG_FILE)))
$(error Linux kernel source not configured - missing config.h)
endif
ifneq (,$(findstring egcs-2.91.66, $(shell cat /proc/version)))
CC := kgcc gcc cc
else
CC := gcc cc
endif
test_cc = $(shell which $(cc) > /dev/null 2>&1 && echo $(cc))
CC := $(foreach cc, $(CC), $(test_cc))
CC := $(firstword $(CC))
CFLAGS += -Wall -DLINUX -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -D__NO_VERSION__ -O2 -pipe
CFLAGS += -I$(KSRC)/include -Wstrict-prototypes -fomit-frame-pointer
CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \
echo "-DMODVERSIONS -include $(KSRC)/include/linux/modversions.h")
.SILENT: $(TARGET) clean
# look for SMP in config.h
SMP := $(shell $(CC) $(CFLAGS) -E -dM $(CONFIG_FILE) | \
grep CONFIG_SMP | awk '{ print $$3 }')
ifneq ($(SMP),1)
SMP := 0
endif
ifeq ($(SMP), 1)
CFLAGS += -D__SMP__
endif
ifeq ($(PRIV_OBJ), 1)
CFLAGS += -DPRIVATE_OBJ
TARGET = x86g_up.o
ifeq ($(SMP), 1)
TARGET = x86g_smp.o
endif
endif
# check x86_64
SUBARCH := $(shell uname -m)
ifeq ($(SUBARCH),x86_64)
CFLAGS += -mcmodel=kernel -mno-red-zone
endif
$(TARGET): $(filter-out $(TARGET), $(SRC:.c=.o))
$(LD) -r $^ -o $@
echo; echo
echo "**************************************************"
echo "Build options:"
echo " VERSION $(KVER)"
echo -n " SMP "
if [ "$(SMP)" = "1" ]; \
then echo "Enabled"; else echo "Disabled"; fi
endif # ifeq ($(KVER),2.6)
ifeq ($(KVER), 2.6)
install: default
else
install: clean $(TARGET)
endif
mkdir -p $(MOD_ROOT)$(INSTDIR)
install -m 644 -o root $(TARGET) $(MOD_ROOT)$(INSTDIR)
ifeq (,$(MOD_ROOT))
/sbin/depmod -a || true
else
/sbin/depmod -b $(MOD_ROOT) -a || true
endif
uninstall:
rm -f $(INSTDIR)/$(TARGET)
/sbin/depmod -a
clean:
rm -f $(TARGET) $(SRC:.c=.o) *~
rm -f .*.o.d .*.o.cmd .*.ko.cmd *.mod.c *.mod.o
-include .depend.mak
/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*
* File: aes_ccmp.c
*
* Purpose: AES_CCMP decryption
*
* Author: Warren Hsu
*
* Date: Feb 15, 2005
*
* Functions:
* AESbGenCCMP - Parsing RX-packet
*
*
* Revision History:
*
*/
#if !defined(__UMEM_H__)
#include "umem.h"
#endif
#if !defined(__DEVICE_H__)
#include "device.h"
#endif
#if !defined(__80211HDR_H__)
#include "80211hdr.h"
#endif
/*--------------------- Static Definitions -------------------------*/
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
/*
* SBOX Table
*/
BYTE sbox_table[256] =
{
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
};
BYTE dot2_table[256] = {
0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e,
0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e,
0x40, 0x42, 0x44, 0x46, 0x48, 0x4a, 0x4c, 0x4e, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e,
0x60, 0x62, 0x64, 0x66, 0x68, 0x6a, 0x6c, 0x6e, 0x70, 0x72, 0x74, 0x76, 0x78, 0x7a, 0x7c, 0x7e,
0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9c, 0x9e,
0xa0, 0xa2, 0xa4, 0xa6, 0xa8, 0xaa, 0xac, 0xae, 0xb0, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe,
0xc0, 0xc2, 0xc4, 0xc6, 0xc8, 0xca, 0xcc, 0xce, 0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde,
0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee, 0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0xfe,
0x1b, 0x19, 0x1f, 0x1d, 0x13, 0x11, 0x17, 0x15, 0x0b, 0x09, 0x0f, 0x0d, 0x03, 0x01, 0x07, 0x05,
0x3b, 0x39, 0x3f, 0x3d, 0x33, 0x31, 0x37, 0x35, 0x2b, 0x29, 0x2f, 0x2d, 0x23, 0x21, 0x27, 0x25,
0x5b, 0x59, 0x5f, 0x5d, 0x53, 0x51, 0x57, 0x55, 0x4b, 0x49, 0x4f, 0x4d, 0x43, 0x41, 0x47, 0x45,
0x7b, 0x79, 0x7f, 0x7d, 0x73, 0x71, 0x77, 0x75, 0x6b, 0x69, 0x6f, 0x6d, 0x63, 0x61, 0x67, 0x65,
0x9b, 0x99, 0x9f, 0x9d, 0x93, 0x91, 0x97, 0x95, 0x8b, 0x89, 0x8f, 0x8d, 0x83, 0x81, 0x87, 0x85,
0xbb, 0xb9, 0xbf, 0xbd, 0xb3, 0xb1, 0xb7, 0xb5, 0xab, 0xa9, 0xaf, 0xad, 0xa3, 0xa1, 0xa7, 0xa5,
0xdb, 0xd9, 0xdf, 0xdd, 0xd3, 0xd1, 0xd7, 0xd5, 0xcb, 0xc9, 0xcf, 0xcd, 0xc3, 0xc1, 0xc7, 0xc5,
0xfb, 0xf9, 0xff, 0xfd, 0xf3, 0xf1, 0xf7, 0xf5, 0xeb, 0xe9, 0xef, 0xed, 0xe3, 0xe1, 0xe7, 0xe5
};
BYTE dot3_table[256] = {
0x00, 0x03, 0x06, 0x05, 0x0c, 0x0f, 0x0a, 0x09, 0x18, 0x1b, 0x1e, 0x1d, 0x14, 0x17, 0x12, 0x11,
0x30, 0x33, 0x36, 0x35, 0x3c, 0x3f, 0x3a, 0x39, 0x28, 0x2b, 0x2e, 0x2d, 0x24, 0x27, 0x22, 0x21,
0x60, 0x63, 0x66, 0x65, 0x6c, 0x6f, 0x6a, 0x69, 0x78, 0x7b, 0x7e, 0x7d, 0x74, 0x77, 0x72, 0x71,
0x50, 0x53, 0x56, 0x55, 0x5c, 0x5f, 0x5a, 0x59, 0x48, 0x4b, 0x4e, 0x4d, 0x44, 0x47, 0x42, 0x41,
0xc0, 0xc3, 0xc6, 0xc5, 0xcc, 0xcf, 0xca, 0xc9, 0xd8, 0xdb, 0xde, 0xdd, 0xd4, 0xd7, 0xd2, 0xd1,
0xf0, 0xf3, 0xf6, 0xf5, 0xfc, 0xff, 0xfa, 0xf9, 0xe8, 0xeb, 0xee, 0xed, 0xe4, 0xe7, 0xe2, 0xe1,
0xa0, 0xa3, 0xa6, 0xa5, 0xac, 0xaf, 0xaa, 0xa9, 0xb8, 0xbb, 0xbe, 0xbd, 0xb4, 0xb7, 0xb2, 0xb1,
0x90, 0x93, 0x96, 0x95, 0x9c, 0x9f, 0x9a, 0x99, 0x88, 0x8b, 0x8e, 0x8d, 0x84, 0x87, 0x82, 0x81,
0x9b, 0x98, 0x9d, 0x9e, 0x97, 0x94, 0x91, 0x92, 0x83, 0x80, 0x85, 0x86, 0x8f, 0x8c, 0x89, 0x8a,
0xab, 0xa8, 0xad, 0xae, 0xa7, 0xa4, 0xa1, 0xa2, 0xb3, 0xb0, 0xb5, 0xb6, 0xbf, 0xbc, 0xb9, 0xba,
0xfb, 0xf8, 0xfd, 0xfe, 0xf7, 0xf4, 0xf1, 0xf2, 0xe3, 0xe0, 0xe5, 0xe6, 0xef, 0xec, 0xe9, 0xea,
0xcb, 0xc8, 0xcd, 0xce, 0xc7, 0xc4, 0xc1, 0xc2, 0xd3, 0xd0, 0xd5, 0xd6, 0xdf, 0xdc, 0xd9, 0xda,
0x5b, 0x58, 0x5d, 0x5e, 0x57, 0x54, 0x51, 0x52, 0x43, 0x40, 0x45, 0x46, 0x4f, 0x4c, 0x49, 0x4a,
0x6b, 0x68, 0x6d, 0x6e, 0x67, 0x64, 0x61, 0x62, 0x73, 0x70, 0x75, 0x76, 0x7f, 0x7c, 0x79, 0x7a,
0x3b, 0x38, 0x3d, 0x3e, 0x37, 0x34, 0x31, 0x32, 0x23, 0x20, 0x25, 0x26, 0x2f, 0x2c, 0x29, 0x2a,
0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1f, 0x1c, 0x19, 0x1a
};
/*--------------------- Static Functions --------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
void xor_128(BYTE *a, BYTE *b, BYTE *out)
{
PDWORD dwPtrA = (PDWORD) a;
PDWORD dwPtrB = (PDWORD) b;
PDWORD dwPtrOut =(PDWORD) out;
(*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++);
(*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++);
(*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++);
(*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++);
}
void xor_32(BYTE *a, BYTE *b, BYTE *out)
{
PDWORD dwPtrA = (PDWORD) a;
PDWORD dwPtrB = (PDWORD) b;
PDWORD dwPtrOut =(PDWORD) out;
(*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++);
}
void AddRoundKey(BYTE *key, int round)
{
BYTE sbox_key[4];
BYTE rcon_table[10] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36};
sbox_key[0] = sbox_table[key[13]];
sbox_key[1] = sbox_table[key[14]];
sbox_key[2] = sbox_table[key[15]];
sbox_key[3] = sbox_table[key[12]];
key[0] = key[0] ^ rcon_table[round];
xor_32(&key[0], sbox_key, &key[0]);
xor_32(&key[4], &key[0], &key[4]);
xor_32(&key[8], &key[4], &key[8]);
xor_32(&key[12], &key[8], &key[12]);
}
void SubBytes(BYTE *in, BYTE *out)
{
int i;
for (i=0; i< 16; i++)
{
out[i] = sbox_table[in[i]];
}
}
void ShiftRows(BYTE *in, BYTE *out)
{
out[0] = in[0];
out[1] = in[5];
out[2] = in[10];
out[3] = in[15];
out[4] = in[4];
out[5] = in[9];
out[6] = in[14];
out[7] = in[3];
out[8] = in[8];
out[9] = in[13];
out[10] = in[2];
out[11] = in[7];
out[12] = in[12];
out[13] = in[1];
out[14] = in[6];
out[15] = in[11];
}
void MixColumns(BYTE *in, BYTE *out)
{
out[0] = dot2_table[in[0]] ^ dot3_table[in[1]] ^ in[2] ^ in[3];
out[1] = in[0] ^ dot2_table[in[1]] ^ dot3_table[in[2]] ^ in[3];
out[2] = in[0] ^ in[1] ^ dot2_table[in[2]] ^ dot3_table[in[3]];
out[3] = dot3_table[in[0]] ^ in[1] ^ in[2] ^ dot2_table[in[3]];
}
void AESv128(BYTE *key, BYTE *data, BYTE *ciphertext)
{
int i;
int round;
BYTE TmpdataA[16];
BYTE TmpdataB[16];
BYTE abyRoundKey[16];
for(i=0; i<16; i++)
abyRoundKey[i] = key[i];
for (round = 0; round < 11; round++)
{
if (round == 0)
{
xor_128(abyRoundKey, data, ciphertext);
AddRoundKey(abyRoundKey, round);
}
else if (round == 10)
{
SubBytes(ciphertext, TmpdataA);
ShiftRows(TmpdataA, TmpdataB);
xor_128(TmpdataB, abyRoundKey, ciphertext);
}
else // round 1 ~ 9
{
SubBytes(ciphertext, TmpdataA);
ShiftRows(TmpdataA, TmpdataB);
MixColumns(&TmpdataB[0], &TmpdataA[0]);
MixColumns(&TmpdataB[4], &TmpdataA[4]);
MixColumns(&TmpdataB[8], &TmpdataA[8]);
MixColumns(&TmpdataB[12], &TmpdataA[12]);
xor_128(TmpdataA, abyRoundKey, ciphertext);
AddRoundKey(abyRoundKey, round);
}
}
}
/*
* Description: AES decryption
*
* Parameters:
* In:
* pbyRxKey - The key used to decrypt
* pbyFrame - Starting address of packet header
* wFrameSize - Total packet size including CRC
* Out:
* none
*
* Return Value: MIC compare result
*
*/
BOOL AESbGenCCMP(PBYTE pbyRxKey, PBYTE pbyFrame, WORD wFrameSize)
{
BYTE abyNonce[13];
BYTE MIC_IV[16];
BYTE MIC_HDR1[16];
BYTE MIC_HDR2[16];
BYTE abyMIC[16];
BYTE abyCTRPLD[16];
BYTE abyTmp[16];
BYTE abyPlainText[16];
BYTE abyLastCipher[16];
PS802_11Header pMACHeader = (PS802_11Header) pbyFrame;
PBYTE pbyIV;
PBYTE pbyPayload;
WORD wHLen = 22;
WORD wPayloadSize = wFrameSize - 8 - 8 - 4 - WLAN_HDR_ADDR3_LEN;//8 is IV, 8 is MIC, 4 is CRC
BOOL bA4 = FALSE;
BYTE byTmp;
WORD wCnt;
int ii,jj,kk;
pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN;
if ( WLAN_GET_FC_TODS(*(PWORD)pbyFrame) &&
WLAN_GET_FC_FROMDS(*(PWORD)pbyFrame) ) {
bA4 = TRUE;
pbyIV += 6; // 6 is 802.11 address4
wHLen += 6;
wPayloadSize -= 6;
}
pbyPayload = pbyIV + 8; //IV-length
abyNonce[0] = 0x00; //now is 0, if Qos here will be priority
MEMvCopy(&(abyNonce[1]), pMACHeader->abyAddr2, U_ETHER_ADDR_LEN);
abyNonce[7] = pbyIV[7];
abyNonce[8] = pbyIV[6];
abyNonce[9] = pbyIV[5];
abyNonce[10] = pbyIV[4];
abyNonce[11] = pbyIV[1];
abyNonce[12] = pbyIV[0];
//MIC_IV
MIC_IV[0] = 0x59;
MEMvCopy(&(MIC_IV[1]), &(abyNonce[0]), 13);
MIC_IV[14] = (BYTE)(wPayloadSize >> 8);
MIC_IV[15] = (BYTE)(wPayloadSize & 0xff);
//MIC_HDR1
MIC_HDR1[0] = (BYTE)(wHLen >> 8);
MIC_HDR1[1] = (BYTE)(wHLen & 0xff);
byTmp = (BYTE)(pMACHeader->wFrameCtl & 0xff);
MIC_HDR1[2] = byTmp & 0x8f;
byTmp = (BYTE)(pMACHeader->wFrameCtl >> 8);
byTmp &= 0x87;
MIC_HDR1[3] = byTmp | 0x40;
MEMvCopy(&(MIC_HDR1[4]), pMACHeader->abyAddr1, U_ETHER_ADDR_LEN);
MEMvCopy(&(MIC_HDR1[10]), pMACHeader->abyAddr2, U_ETHER_ADDR_LEN);
//MIC_HDR2
MEMvCopy(&(MIC_HDR2[0]), pMACHeader->abyAddr3, U_ETHER_ADDR_LEN);
byTmp = (BYTE)(pMACHeader->wSeqCtl & 0xff);
MIC_HDR2[6] = byTmp & 0x0f;
MIC_HDR2[7] = 0;
if ( bA4 ) {
MEMvCopy(&(MIC_HDR2[8]), pMACHeader->abyAddr4, U_ETHER_ADDR_LEN);
} else {
MIC_HDR2[8] = 0x00;
MIC_HDR2[9] = 0x00;
MIC_HDR2[10] = 0x00;
MIC_HDR2[11] = 0x00;
MIC_HDR2[12] = 0x00;
MIC_HDR2[13] = 0x00;
}
MIC_HDR2[14] = 0x00;
MIC_HDR2[15] = 0x00;
//CCMP
AESv128(pbyRxKey,MIC_IV,abyMIC);
for ( kk=0; kk<16; kk++ ) {
abyTmp[kk] = MIC_HDR1[kk] ^ abyMIC[kk];
}
AESv128(pbyRxKey,abyTmp,abyMIC);
for ( kk=0; kk<16; kk++ ) {
abyTmp[kk] = MIC_HDR2[kk] ^ abyMIC[kk];
}
AESv128(pbyRxKey,abyTmp,abyMIC);
wCnt = 1;
abyCTRPLD[0] = 0x01;
MEMvCopy(&(abyCTRPLD[1]), &(abyNonce[0]), 13);
for(jj=wPayloadSize; jj>16; jj=jj-16) {
abyCTRPLD[14] = (BYTE) (wCnt >> 8);
abyCTRPLD[15] = (BYTE) (wCnt & 0xff);
AESv128(pbyRxKey,abyCTRPLD,abyTmp);
for ( kk=0; kk<16; kk++ ) {
abyPlainText[kk] = abyTmp[kk] ^ pbyPayload[kk];
}
for ( kk=0; kk<16; kk++ ) {
abyTmp[kk] = abyMIC[kk] ^ abyPlainText[kk];
}
AESv128(pbyRxKey,abyTmp,abyMIC);
MEMvCopy(pbyPayload, abyPlainText, 16);
wCnt++;
pbyPayload += 16;
} //for wPayloadSize
//last payload
MEMvCopy(&(abyLastCipher[0]), pbyPayload, jj);
for ( ii=jj; ii<16; ii++ ) {
abyLastCipher[ii] = 0x00;
}
abyCTRPLD[14] = (BYTE) (wCnt >> 8);
abyCTRPLD[15] = (BYTE) (wCnt & 0xff);
AESv128(pbyRxKey,abyCTRPLD,abyTmp);
for ( kk=0; kk<16; kk++ ) {
abyPlainText[kk] = abyTmp[kk] ^ abyLastCipher[kk];
}
MEMvCopy(pbyPayload, abyPlainText, jj);
pbyPayload += jj;
//for MIC calculation
for ( ii=jj; ii<16; ii++ ) {
abyPlainText[ii] = 0x00;
}
for ( kk=0; kk<16; kk++ ) {
abyTmp[kk] = abyMIC[kk] ^ abyPlainText[kk];
}
AESv128(pbyRxKey,abyTmp,abyMIC);
//=>above is the calculate MIC
//--------------------------------------------
wCnt = 0;
abyCTRPLD[14] = (BYTE) (wCnt >> 8);
abyCTRPLD[15] = (BYTE) (wCnt & 0xff);
AESv128(pbyRxKey,abyCTRPLD,abyTmp);
for ( kk=0; kk<8; kk++ ) {
abyTmp[kk] = abyTmp[kk] ^ pbyPayload[kk];
}
//=>above is the dec-MIC from packet
//--------------------------------------------
if ( MEMEqualMemory(abyMIC,abyTmp,8) ) {
return TRUE;
} else {
return FALSE;
}
}
/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*
* File: aes_ccmp.h
*
* Purpose: AES_CCMP Decryption
*
* Author: Warren Hsu
*
* Date: Feb 15, 2005
*
*/
#ifndef __AES_H__
#define __AES_H__
#if !defined(__TTYPE_H__)
#include "ttype.h"
#endif
/*--------------------- Export Definitions -------------------------*/
/*--------------------- Export Types ------------------------------*/
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
BOOL AESbGenCCMP(PBYTE pbyRxKey, PBYTE pbyFrame, WORD wFrameSize);
#endif //__AES_H__
此差异已折叠。
/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* File: baseband.h
*
* Purpose: Implement functions to access baseband
*
* Author: Jerry Chen
*
* Date: Jun. 5, 2002
*
*/
#ifndef __BASEBAND_H__
#define __BASEBAND_H__
#if !defined(__TTYPE_H__)
#include "ttype.h"
#endif
#if !defined(__TETHER_H__)
#include "tether.h"
#endif
#if !defined(__DEVICE_H__)
#include "device.h"
#endif
/*--------------------- Export Definitions -------------------------*/
//
// Registers in the BASEBAND
//
#define BB_MAX_CONTEXT_SIZE 256
//
// Baseband RF pair definition in eeprom (Bits 6..0)
//
/*
#define RATE_1M 0
#define RATE_2M 1
#define RATE_5M 2
#define RATE_11M 3
#define RATE_6M 4
#define RATE_9M 5
#define RATE_12M 6
#define RATE_18M 7
#define RATE_24M 8
#define RATE_36M 9
#define RATE_48M 10
#define RATE_54M 11
#define RATE_AUTO 12
#define MAX_RATE 12
//0:11A 1:11B 2:11G
#define BB_TYPE_11A 0
#define BB_TYPE_11B 1
#define BB_TYPE_11G 2
//0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate)
#define PK_TYPE_11A 0
#define PK_TYPE_11B 1
#define PK_TYPE_11GB 2
#define PK_TYPE_11GA 3
*/
#define PREAMBLE_LONG 0
#define PREAMBLE_SHORT 1
#define F5G 0
#define F2_4G 1
#define TOP_RATE_54M 0x80000000
#define TOP_RATE_48M 0x40000000
#define TOP_RATE_36M 0x20000000
#define TOP_RATE_24M 0x10000000
#define TOP_RATE_18M 0x08000000
#define TOP_RATE_12M 0x04000000
#define TOP_RATE_11M 0x02000000
#define TOP_RATE_9M 0x01000000
#define TOP_RATE_6M 0x00800000
#define TOP_RATE_55M 0x00400000
#define TOP_RATE_2M 0x00200000
#define TOP_RATE_1M 0x00100000
/*--------------------- Export Types ------------------------------*/
/*--------------------- Export Macros ------------------------------*/
#define BBvClearFOE(dwIoBase) \
{ \
BBbWriteEmbeded(dwIoBase, 0xB1, 0); \
}
#define BBvSetFOE(dwIoBase) \
{ \
BBbWriteEmbeded(dwIoBase, 0xB1, 0x0C); \
}
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
UINT
BBuGetFrameTime(
IN BYTE byPreambleType,
IN BYTE byPktType,
IN UINT cbFrameLength,
IN WORD wRate
);
VOID
BBvCaculateParameter (
IN PSDevice pDevice,
IN UINT cbFrameLength,
IN WORD wRate,
IN BYTE byPacketType,
OUT PWORD pwPhyLen,
OUT PBYTE pbyPhySrv,
OUT PBYTE pbyPhySgn
);
BOOL BBbReadEmbeded(DWORD_PTR dwIoBase, BYTE byBBAddr, PBYTE pbyData);
BOOL BBbWriteEmbeded(DWORD_PTR dwIoBase, BYTE byBBAddr, BYTE byData);
VOID BBvReadAllRegs(DWORD_PTR dwIoBase, PBYTE pbyBBRegs);
void BBvLoopbackOn(PSDevice pDevice);
void BBvLoopbackOff(PSDevice pDevice);
void BBvSetShortSlotTime(PSDevice pDevice);
BOOL BBbIsRegBitsOn(DWORD_PTR dwIoBase, BYTE byBBAddr, BYTE byTestBits);
BOOL BBbIsRegBitsOff(DWORD_PTR dwIoBase, BYTE byBBAddr, BYTE byTestBits);
VOID BBvSetVGAGainOffset(PSDevice pDevice, BYTE byData);
// VT3253 Baseband
BOOL BBbVT3253Init(PSDevice pDevice);
VOID BBvSoftwareReset(DWORD_PTR dwIoBase);
VOID BBvPowerSaveModeON(DWORD_PTR dwIoBase);
VOID BBvPowerSaveModeOFF(DWORD_PTR dwIoBase);
VOID BBvSetTxAntennaMode(DWORD_PTR dwIoBase, BYTE byAntennaMode);
VOID BBvSetRxAntennaMode(DWORD_PTR dwIoBase, BYTE byAntennaMode);
VOID BBvSetDeepSleep(DWORD_PTR dwIoBase, BYTE byLocalID);
VOID BBvExitDeepSleep(DWORD_PTR dwIoBase, BYTE byLocalID);
// timer for antenna diversity
VOID
TimerSQ3CallBack(
IN HANDLE hDeviceContext
);
VOID
TimerState1CallBack(
IN HANDLE hDeviceContext
);
void BBvAntennaDiversity(PSDevice pDevice, BYTE byRxRate, BYTE bySQ3);
VOID
BBvClearAntDivSQ3Value (PSDevice pDevice);
#ifdef __cplusplus
} /* End of extern "C" { */
#endif /* __cplusplus */
#endif // __BASEBAND_H__
此差异已折叠。
/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*
* File: bssdb.h
*
* Purpose: Handles the Basic Service Set & Node Database functions
*
* Author: Lyndon Chen
*
* Date: July 16, 2002
*
*/
#ifndef __BSSDB_H__
#define __BSSDB_H__
//#if !defined(__DEVICE_H__)
//#include "device.h"
//#endif
#include <linux/skbuff.h>
#if !defined(__80211HDR_H__)
#include "80211hdr.h"
#endif
#if !defined(__80211MGR_H__)
#include "80211mgr.h"
#endif
#if !defined(__CARD_H__)
#include "card.h"
#endif
/*--------------------- Export Definitions -------------------------*/
#define MAX_NODE_NUM 64
#define MAX_BSS_NUM 42
#define LOST_BEACON_COUNT 10 // 10 sec, XP defined
#define MAX_PS_TX_BUF 32 // sta max power saving tx buf
#define ADHOC_LOST_BEACON_COUNT 30 // 30 sec, beacon lost for adhoc only
#define MAX_INACTIVE_COUNT 300 // 300 sec, inactive STA node refresh
#define USE_PROTECT_PERIOD 10 // 10 sec, Use protect mode check period
#define ERP_RECOVER_COUNT 30 // 30 sec, ERP support callback check
#define BSS_CLEAR_COUNT 1
#define RSSI_STAT_COUNT 10
#define MAX_CHECK_RSSI_COUNT 8
// STA dwflags
#define WLAN_STA_AUTH BIT0
#define WLAN_STA_ASSOC BIT1
#define WLAN_STA_PS BIT2
#define WLAN_STA_TIM BIT3
// permanent; do not remove entry on expiration
#define WLAN_STA_PERM BIT4
// If 802.1X is used, this flag is
// controlling whether STA is authorized to
// send and receive non-IEEE 802.1X frames
#define WLAN_STA_AUTHORIZED BIT5
#define MAX_RATE 12
#define MAX_WPA_IE_LEN 64
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Types ------------------------------*/
//
// IEEE 802.11 Structures and definitions
//
typedef enum _NDIS_802_11_NETWORK_TYPE
{
Ndis802_11FH,
Ndis802_11DS,
Ndis802_11OFDM5,
Ndis802_11OFDM24,
Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound
} NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
typedef struct tagSERPObject {
BOOL bERPExist;
BYTE byERP;
} ERPObject, DEF* PERPObject;
typedef struct tagSRSNCapObject {
BOOL bRSNCapExist;
WORD wRSNCap;
} SRSNCapObject, DEF* PSRSNCapObject;
// BSS info(AP)
#pragma pack(1)
typedef struct tagKnownBSS {
// BSS info
BOOL bActive;
BYTE abyBSSID[WLAN_BSSID_LEN];
UINT uChannel;
BYTE abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
BYTE abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
UINT uRSSI;
BYTE bySQ;
WORD wBeaconInterval;
WORD wCapInfo;
BYTE abySSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
BYTE byRxRate;
// WORD wATIMWindow;
BYTE byRSSIStatCnt;
LONG ldBmMAX;
LONG ldBmAverage[RSSI_STAT_COUNT];
LONG ldBmAverRange;
//For any BSSID selection improvment
BOOL bSelected;
//++ WPA informations
BOOL bWPAValid;
BYTE byGKType;
BYTE abyPKType[4];
WORD wPKCount;
BYTE abyAuthType[4];
WORD wAuthCount;
BYTE byDefaultK_as_PK;
BYTE byReplayIdx;
//--
//++ WPA2 informations
BOOL bWPA2Valid;
BYTE byCSSGK;
WORD wCSSPKCount;
BYTE abyCSSPK[4];
WORD wAKMSSAuthCount;
BYTE abyAKMSSAuthType[4];
//++ wpactl
BYTE byWPAIE[MAX_WPA_IE_LEN];
BYTE byRSNIE[MAX_WPA_IE_LEN];
WORD wWPALen;
WORD wRSNLen;
// Clear count
UINT uClearCount;
// BYTE abyIEs[WLAN_BEACON_FR_MAXLEN];
UINT uIELength;
QWORD qwBSSTimestamp;
QWORD qwLocalTSF; // local TSF timer
// NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
CARD_PHY_TYPE eNetworkTypeInUse;
ERPObject sERP;
SRSNCapObject sRSNCapObj;
BYTE abyIEs[1024]; // don't move this field !!
}__attribute__ ((__packed__))
KnownBSS , DEF* PKnownBSS;
//2006-1116-01,<Add> by NomadZhao
#pragma pack()
typedef enum tagNODE_STATE {
NODE_FREE,
NODE_AGED,
NODE_KNOWN,
NODE_AUTH,
NODE_ASSOC
} NODE_STATE, *PNODE_STATE;
// STA node info
typedef struct tagKnownNodeDB {
// STA info
BOOL bActive;
BYTE abyMACAddr[WLAN_ADDR_LEN];
BYTE abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
BYTE abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
WORD wTxDataRate;
BOOL bShortPreamble;
BOOL bERPExist;
BOOL bShortSlotTime;
UINT uInActiveCount;
WORD wMaxBasicRate; //Get from byTopOFDMBasicRate or byTopCCKBasicRate which depends on packetTyp.
WORD wMaxSuppRate; //Records the highest supported rate getting from SuppRates IE and ExtSuppRates IE in Beacon.
WORD wSuppRate;
BYTE byTopOFDMBasicRate;//Records the highest basic rate in OFDM mode
BYTE byTopCCKBasicRate; //Records the highest basic rate in CCK mode
// For AP mode
struct sk_buff_head sTxPSQueue;
WORD wCapInfo;
WORD wListenInterval;
WORD wAID;
NODE_STATE eNodeState;
BOOL bPSEnable;
BOOL bRxPSPoll;
BYTE byAuthSequence;
ULONG ulLastRxJiffer;
BYTE bySuppRate;
DWORD dwFlags;
WORD wEnQueueCnt;
BOOL bOnFly;
ULONGLONG KeyRSC;
BYTE byKeyIndex;
DWORD dwKeyIndex;
BYTE byCipherSuite;
DWORD dwTSC47_16;
WORD wTSC15_0;
UINT uWepKeyLength;
BYTE abyWepKey[WLAN_WEPMAX_KEYLEN];
//
// Auto rate fallback vars
BOOL bIsInFallback;
UINT uAverageRSSI;
UINT uRateRecoveryTimeout;
UINT uRatePollTimeout;
UINT uTxFailures;
UINT uTxAttempts;
UINT uTxRetry;
UINT uFailureRatio;
UINT uRetryRatio;
UINT uTxOk[MAX_RATE+1];
UINT uTxFail[MAX_RATE+1];
UINT uTimeCount;
} KnownNodeDB, DEF* PKnownNodeDB;
/*--------------------- Export Functions --------------------------*/
PKnownBSS
BSSpSearchBSSList(
IN HANDLE hDeviceContext,
IN PBYTE pbyDesireBSSID,
IN PBYTE pbyDesireSSID,
IN CARD_PHY_TYPE ePhyType
);
PKnownBSS
BSSpAddrIsInBSSList(
IN HANDLE hDeviceContext,
IN PBYTE abyBSSID,
IN PWLAN_IE_SSID pSSID
);
VOID
BSSvClearBSSList(
IN HANDLE hDeviceContext,
IN BOOL bKeepCurrBSSID
);
BOOL
BSSbInsertToBSSList(
IN HANDLE hDeviceContext,
IN PBYTE abyBSSIDAddr,
IN QWORD qwTimestamp,
IN WORD wBeaconInterval,
IN WORD wCapInfo,
IN BYTE byCurrChannel,
IN PWLAN_IE_SSID pSSID,
IN PWLAN_IE_SUPP_RATES pSuppRates,
IN PWLAN_IE_SUPP_RATES pExtSuppRates,
IN PERPObject psERP,
IN PWLAN_IE_RSN pRSN,
IN PWLAN_IE_RSN_EXT pRSNWPA,
IN PWLAN_IE_COUNTRY pIE_Country,
IN PWLAN_IE_QUIET pIE_Quiet,
IN UINT uIELength,
IN PBYTE pbyIEs,
IN HANDLE pRxPacketContext
);
BOOL
BSSbUpdateToBSSList(
IN HANDLE hDeviceContext,
IN QWORD qwTimestamp,
IN WORD wBeaconInterval,
IN WORD wCapInfo,
IN BYTE byCurrChannel,
IN BOOL bChannelHit,
IN PWLAN_IE_SSID pSSID,
IN PWLAN_IE_SUPP_RATES pSuppRates,
IN PWLAN_IE_SUPP_RATES pExtSuppRates,
IN PERPObject psERP,
IN PWLAN_IE_RSN pRSN,
IN PWLAN_IE_RSN_EXT pRSNWPA,
IN PWLAN_IE_COUNTRY pIE_Country,
IN PWLAN_IE_QUIET pIE_Quiet,
IN PKnownBSS pBSSList,
IN UINT uIELength,
IN PBYTE pbyIEs,
IN HANDLE pRxPacketContext
);
BOOL
BSSDBbIsSTAInNodeDB(
IN HANDLE hDeviceContext,
IN PBYTE abyDstAddr,
OUT PUINT puNodeIndex
);
VOID
BSSvCreateOneNode(
IN HANDLE hDeviceContext,
OUT PUINT puNodeIndex
);
VOID
BSSvUpdateAPNode(
IN HANDLE hDeviceContext,
IN PWORD pwCapInfo,
IN PWLAN_IE_SUPP_RATES pItemRates,
IN PWLAN_IE_SUPP_RATES pExtSuppRates
);
VOID
BSSvSecondCallBack(
IN HANDLE hDeviceContext
);
VOID
BSSvUpdateNodeTxCounter(
IN HANDLE hDeviceContext,
IN BYTE byTsr0,
IN BYTE byTsr1,
IN PBYTE pbyBuffer,
IN UINT uFIFOHeaderSize
);
VOID
BSSvRemoveOneNode(
IN HANDLE hDeviceContext,
IN UINT uNodeIndex
);
VOID
BSSvAddMulticastNode(
IN HANDLE hDeviceContext
);
VOID
BSSvClearNodeDBTable(
IN HANDLE hDeviceContext,
IN UINT uStartIndex
);
VOID
BSSvClearAnyBSSJoinRecord(
IN HANDLE hDeviceContext
);
#endif //__BSSDB_H__
此差异已折叠。
/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* File: card.h
*
* Purpose: Provide functions to setup NIC operation mode
*
* Author: Tevin Chen
*
* Date: May 21, 1996
*
*/
#ifndef __CARD_H__
#define __CARD_H__
//#if !defined(__DEVICE_H__)
//#include "device.h"
//#endif
#if !defined(__TTYPE_H__)
#include "ttype.h"
#endif
/*--------------------- Export Definitions -------------------------*/
//
// Loopback mode
//
// LOBYTE is MAC LB mode, HIBYTE is MII LB mode
#define CARD_LB_NONE MAKEWORD(MAC_LB_NONE, 0)
#define CARD_LB_MAC MAKEWORD(MAC_LB_INTERNAL, 0) // PHY must ISO, avoid MAC loopback packet go out
#define CARD_LB_PHY MAKEWORD(MAC_LB_EXT, 0)
#define DEFAULT_MSDU_LIFETIME 512 // ms
#define DEFAULT_MSDU_LIFETIME_RES_64us 8000 // 64us
#define DEFAULT_MGN_LIFETIME 8 // ms
#define DEFAULT_MGN_LIFETIME_RES_64us 125 // 64us
#define CB_MAX_CHANNEL_24G 14
#define CB_MAX_CHANNEL_5G 42 //[20050104] add channel9(5045MHz), 41==>42
#define CB_MAX_CHANNEL (CB_MAX_CHANNEL_24G+CB_MAX_CHANNEL_5G)
typedef enum _CARD_PHY_TYPE {
PHY_TYPE_AUTO,
PHY_TYPE_11B,
PHY_TYPE_11G,
PHY_TYPE_11A
} CARD_PHY_TYPE, *PCARD_PHY_TYPE;
typedef enum _CARD_PKT_TYPE {
PKT_TYPE_802_11_BCN,
PKT_TYPE_802_11_MNG,
PKT_TYPE_802_11_DATA,
PKT_TYPE_802_11_ALL
} CARD_PKT_TYPE, *PCARD_PKT_TYPE;
typedef enum _CARD_STATUS_TYPE {
CARD_STATUS_MEDIA_CONNECT,
CARD_STATUS_MEDIA_DISCONNECT,
CARD_STATUS_PMKID
} CARD_STATUS_TYPE, *PCARD_STATUS_TYPE;
typedef enum _CARD_OP_MODE {
OP_MODE_INFRASTRUCTURE,
OP_MODE_ADHOC,
OP_MODE_AP,
OP_MODE_UNKNOWN
} CARD_OP_MODE, *PCARD_OP_MODE;
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
BOOL ChannelValid(UINT CountryCode, UINT ChannelIndex);
void CARDvSetRSPINF(PVOID pDeviceHandler, CARD_PHY_TYPE ePHYType);
void vUpdateIFS(PVOID pDeviceHandler);
void CARDvUpdateBasicTopRate(PVOID pDeviceHandler);
BOOL CARDbAddBasicRate(PVOID pDeviceHandler, WORD wRateIdx);
BOOL CARDbIsOFDMinBasicRate(PVOID pDeviceHandler);
void CARDvSetLoopbackMode(DWORD_PTR dwIoBase, WORD wLoopbackMode);
BOOL CARDbSoftwareReset(PVOID pDeviceHandler);
void CARDvSetFirstNextTBTT(DWORD_PTR dwIoBase, WORD wBeaconInterval);
void CARDvUpdateNextTBTT(DWORD_PTR dwIoBase, QWORD qwTSF, WORD wBeaconInterval);
BOOL CARDbGetCurrentTSF(DWORD_PTR dwIoBase, PQWORD pqwCurrTSF);
QWORD CARDqGetNextTBTT(QWORD qwTSF, WORD wBeaconInterval);
QWORD CARDqGetTSFOffset(BYTE byRxRate, QWORD qwTSF1, QWORD qwTSF2);
BOOL CARDbSetTxPower(PVOID pDeviceHandler, ULONG ulTxPower);
BYTE CARDbyGetPktType(PVOID pDeviceHandler);
VOID CARDvSafeResetTx(PVOID pDeviceHandler);
VOID CARDvSafeResetRx(PVOID pDeviceHandler);
//xxx
BOOL CARDbRadioPowerOff(PVOID pDeviceHandler);
BOOL CARDbRadioPowerOn(PVOID pDeviceHandler);
BOOL CARDbSetChannel(PVOID pDeviceHandler, UINT uConnectionChannel);
//BOOL CARDbSendPacket(PVOID pDeviceHandler, PVOID pPacket, CARD_PKT_TYPE ePktType, UINT uLength);
BOOL CARDbIsShortPreamble(PVOID pDeviceHandler);
BOOL CARDbIsShorSlotTime(PVOID pDeviceHandler);
BOOL CARDbSetPhyParameter(PVOID pDeviceHandler, CARD_PHY_TYPE ePHYType, WORD wCapInfo, BYTE byERPField, PVOID pvSupportRateIEs, PVOID pvExtSupportRateIEs);
BOOL CARDbUpdateTSF(PVOID pDeviceHandler, BYTE byRxRate, QWORD qwBSSTimestamp, QWORD qwLocalTSF);
BOOL CARDbStopTxPacket(PVOID pDeviceHandler, CARD_PKT_TYPE ePktType);
BOOL CARDbStartTxPacket(PVOID pDeviceHandler, CARD_PKT_TYPE ePktType);
BOOL CARDbSetBeaconPeriod(PVOID pDeviceHandler, WORD wBeaconInterval);
BOOL CARDbSetBSSID(PVOID pDeviceHandler, PBYTE pbyBSSID, CARD_OP_MODE eOPMode);
BOOL
CARDbPowerDown(
PVOID pDeviceHandler
);
BOOL CARDbSetTxDataRate(
PVOID pDeviceHandler,
WORD wDataRate
);
BOOL CARDbRemoveKey (PVOID pDeviceHandler, PBYTE pbyBSSID);
BOOL
CARDbAdd_PMKID_Candidate (
IN PVOID pDeviceHandler,
IN PBYTE pbyBSSID,
IN BOOL bRSNCapExist,
IN WORD wRSNCap
);
PVOID
CARDpGetCurrentAddress (
IN PVOID pDeviceHandler
);
VOID CARDvInitChannelTable(PVOID pDeviceHandler);
BYTE CARDbyGetChannelMapping(PVOID pDeviceHandler, BYTE byChannelNumber, CARD_PHY_TYPE ePhyType);
BOOL
CARDbStartMeasure (
IN PVOID pDeviceHandler,
IN PVOID pvMeasureEIDs,
IN UINT uNumOfMeasureEIDs
);
BOOL
CARDbChannelSwitch (
IN PVOID pDeviceHandler,
IN BYTE byMode,
IN BYTE byNewChannel,
IN BYTE byCount
);
BOOL
CARDbSetQuiet (
IN PVOID pDeviceHandler,
IN BOOL bResetQuiet,
IN BYTE byQuietCount,
IN BYTE byQuietPeriod,
IN WORD wQuietDuration,
IN WORD wQuietOffset
);
BOOL
CARDbStartQuiet (
IN PVOID pDeviceHandler
);
VOID
CARDvSetCountryInfo (
IN PVOID pDeviceHandler,
IN CARD_PHY_TYPE ePHYType,
IN PVOID pIE
);
VOID
CARDvSetPowerConstraint (
IN PVOID pDeviceHandler,
IN BYTE byChannel,
IN I8 byPower
);
VOID
CARDvGetPowerCapability (
IN PVOID pDeviceHandler,
OUT PBYTE pbyMinPower,
OUT PBYTE pbyMaxPower
);
BYTE
CARDbySetSupportChannels (
IN PVOID pDeviceHandler,
IN OUT PBYTE pbyIEs
);
I8
CARDbyGetTransmitPower (
IN PVOID pDeviceHandler
);
BOOL
CARDbChannelGetList (
IN UINT uCountryCodeIdx,
OUT PBYTE pbyChannelTable
);
VOID
CARDvSetCountryIE(
IN PVOID pDeviceHandler,
IN PVOID pIE
);
BOOL
CARDbGetChannelMapInfo(
IN PVOID pDeviceHandler,
IN UINT uChannelIndex,
OUT PBYTE pbyChannelNumber,
OUT PBYTE pbyMap
);
VOID
CARDvSetChannelMapInfo(
IN PVOID pDeviceHandler,
IN UINT uChannelIndex,
IN BYTE byMap
);
VOID
CARDvClearChannelMapInfo(
IN PVOID pDeviceHandler
);
BYTE
CARDbyAutoChannelSelect(
IN PVOID pDeviceHandler,
CARD_PHY_TYPE ePHYType
);
BYTE CARDbyGetChannelNumber(PVOID pDeviceHandler, BYTE byChannelIndex);
#ifdef __cplusplus
} /* End of extern "C" { */
#endif /* __cplusplus */
#endif // __CARD_H__
/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*
* File: country.h
*
* Purpose: Country Code information
*
* Author: Lucas Lin
*
* Date: Dec 23, 2004
*
*/
#ifndef __COUNTRY_H__
#define __COUNTRY_H__
#if !defined(__TTYPE_H__)
#include "ttype.h"
#endif
/*--------------------- Export Definitions -------------------------*/
/************************************************************************
* The definition here should be complied with the INF country order
* Please check with VNWL.inf/VNWL64.inf/VNWL*.inf
************************************************************************/
typedef enum _COUNTRY_CODE {
CCODE_FCC = 0,
CCODE_TELEC,
CCODE_ETSI,
CCODE_RESV3,
CCODE_RESV4,
CCODE_RESV5,
CCODE_RESV6,
CCODE_RESV7,
CCODE_RESV8,
CCODE_RESV9,
CCODE_RESVa,
CCODE_RESVb,
CCODE_RESVc,
CCODE_RESVd,
CCODE_RESVe,
CCODE_ALLBAND,
CCODE_ALBANIA,
CCODE_ALGERIA,
CCODE_ARGENTINA,
CCODE_ARMENIA,
CCODE_AUSTRALIA,
CCODE_AUSTRIA,
CCODE_AZERBAIJAN,
CCODE_BAHRAIN,
CCODE_BELARUS,
CCODE_BELGIUM,
CCODE_BELIZE,
CCODE_BOLIVIA,
CCODE_BRAZIL,
CCODE_BRUNEI_DARUSSALAM,
CCODE_BULGARIA,
CCODE_CANADA,
CCODE_CHILE,
CCODE_CHINA,
CCODE_COLOMBIA,
CCODE_COSTA_RICA,
CCODE_CROATIA,
CCODE_CYPRUS,
CCODE_CZECH,
CCODE_DENMARK,
CCODE_DOMINICAN_REPUBLIC,
CCODE_ECUADOR,
CCODE_EGYPT,
CCODE_EL_SALVADOR,
CCODE_ESTONIA,
CCODE_FINLAND,
CCODE_FRANCE,
CCODE_GERMANY,
CCODE_GREECE,
CCODE_GEORGIA,
CCODE_GUATEMALA,
CCODE_HONDURAS,
CCODE_HONG_KONG,
CCODE_HUNGARY,
CCODE_ICELAND,
CCODE_INDIA,
CCODE_INDONESIA,
CCODE_IRAN,
CCODE_IRELAND,
CCODE_ITALY,
CCODE_ISRAEL,
CCODE_JAPAN,
CCODE_JORDAN,
CCODE_KAZAKHSTAN,
CCODE_KUWAIT,
CCODE_LATVIA,
CCODE_LEBANON,
CCODE_LEICHTENSTEIN,
CCODE_LITHUANIA,
CCODE_LUXEMBURG,
CCODE_MACAU,
CCODE_MACEDONIA,
CCODE_MALTA,
CCODE_MALAYSIA,
CCODE_MEXICO,
CCODE_MONACO,
CCODE_MOROCCO,
CCODE_NETHERLANDS,
CCODE_NEW_ZEALAND,
CCODE_NORTH_KOREA,
CCODE_NORWAY,
CCODE_OMAN,
CCODE_PAKISTAN,
CCODE_PANAMA,
CCODE_PERU,
CCODE_PHILIPPINES,
CCODE_POLAND,
CCODE_PORTUGAL,
CCODE_PUERTO_RICO,
CCODE_QATAR,
CCODE_ROMANIA,
CCODE_RUSSIA,
CCODE_SAUDI_ARABIA,
CCODE_SINGAPORE,
CCODE_SLOVAKIA,
CCODE_SLOVENIA,
CCODE_SOUTH_AFRICA,
CCODE_SOUTH_KOREA,
CCODE_SPAIN,
CCODE_SWEDEN,
CCODE_SWITZERLAND,
CCODE_SYRIA,
CCODE_TAIWAN,
CCODE_THAILAND,
CCODE_TRINIDAD_TOBAGO,
CCODE_TUNISIA,
CCODE_TURKEY,
CCODE_UK,
CCODE_UKRAINE,
CCODE_UNITED_ARAB_EMIRATES,
CCODE_UNITED_STATES,
CCODE_URUGUAY,
CCODE_UZBEKISTAN,
CCODE_VENEZUELA,
CCODE_VIETNAM,
CCODE_YEMEN,
CCODE_ZIMBABWE,
CCODE_JAPAN_W52_W53,
CCODE_MAX
} COUNTRY_CODE;
typedef struct tagSCountryTable
{
BYTE byChannelCountryCode; /* The country code */
CHAR chCountryCode[2];
BYTE bChannelIdxList[CB_MAX_CHANNEL]; /* Available channels Index */
BYTE byPower[CB_MAX_CHANNEL];
} SCountryTable, DEF* PSCountryTable;
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
extern SCountryTable ChannelRuleTab[CCODE_MAX+1];
/*--------------------- Export Functions --------------------------*/
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
#ifdef __cplusplus
} /* End of extern "C" { */
#endif /* __cplusplus */
/************************************************************************
* Function prototype
************************************************************************/
#endif /* __COUNTRY_H__ */
此差异已折叠。
/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*
* File: datarate.h
*
* Purpose: Handles the auto fallback & data rates functions
*
* Author: Lyndon Chen
*
* Date: July 16, 2002
*
*/
#ifndef __DATARATE_H__
#define __DATARATE_H__
/*--------------------- Export Definitions -------------------------*/
#define FALLBACK_PKT_COLLECT_TR_H 50 // pkts
#define FALLBACK_PKT_COLLECT_TR_L 10 // pkts
#define FALLBACK_POLL_SECOND 5 // 5 sec
#define FALLBACK_RECOVER_SECOND 30 // 30 sec
#define FALLBACK_THRESHOLD 15 // percent
#define UPGRADE_THRESHOLD 5 // percent
#define UPGRADE_CNT_THRD 3 // times
#define RETRY_TIMES_THRD_H 2 // times
#define RETRY_TIMES_THRD_L 1 // times
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Types ------------------------------*/
/*--------------------- Export Functions --------------------------*/
VOID
RATEvParseMaxRate(
IN PVOID pDeviceHandler,
IN PWLAN_IE_SUPP_RATES pItemRates,
IN PWLAN_IE_SUPP_RATES pItemExtRates,
IN BOOL bUpdateBasicRate,
OUT PWORD pwMaxBasicRate,
OUT PWORD pwMaxSuppRate,
OUT PWORD pwSuppRate,
OUT PBYTE pbyTopCCKRate,
OUT PBYTE pbyTopOFDMRate
);
VOID
RATEvTxRateFallBack(
IN PVOID pDeviceHandler,
IN PKnownNodeDB psNodeDBTable
);
BYTE
RATEuSetIE(
IN PWLAN_IE_SUPP_RATES pSrcRates,
IN PWLAN_IE_SUPP_RATES pDstRates,
IN UINT uRateLen
);
WORD
wGetRateIdx(
IN BYTE byRate
);
BYTE
DATARATEbyGetRateIdx(
IN BYTE byRate
);
#endif //__DATARATE_H__
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* File: whdr.h
*
* Purpose:
*
* Author: Jerry Chen
*
* Date: Jun. 27, 2002
*
*/
#ifndef __DPC_H__
#define __DPC_H__
#if !defined(__TTYPE_H__)
#include "ttype.h"
#endif
#if !defined(__DEVICE_H__)
#include "device.h"
#endif
#if !defined(__WCMD_H__)
#include "wcmd.h"
#endif
/*--------------------- Export Definitions -------------------------*/
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
BOOL
device_receive_frame (
IN PSDevice pDevice,
IN PSRxDesc pCurrRD
);
#ifdef __cplusplus
} /* End of extern "C" { */
#endif /* __cplusplus */
VOID MngWorkItem(PVOID Context);
#endif // __RXTX_H__
此差异已折叠。
此差异已折叠。
此差异已折叠。
/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* File: hostap.h
*
* Purpose:
*
* Author: Lyndon Chen
*
* Date: May 21, 2003
*
*/
#ifndef __IOCTL_H__
#define __IOCTL_H__
#if !defined(__DEVICE_H__)
#include "device.h"
#endif
/*--------------------- Export Definitions -------------------------*/
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
int private_ioctl(PSDevice pDevice, struct ifreq *rq);
/*
VOID vConfigWEPKey (
IN PSDevice pDevice,
IN DWORD dwKeyIndex,
IN PBYTE pbyKey,
IN ULONG uKeyLength
);
*/
#ifdef __cplusplus
} /* End of extern "C" { */
#endif /* __cplusplus */
#endif // __IOCTL_H__
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
KSP := /lib/modules/$(shell uname -r)/build \
/usr/src/linux-$(shell uname -r) \
/usr/src/linux-$(shell uname -r | sed 's/-.*//') \
# /usr/src/kernel-headers-$(shell uname -r) \
# /usr/src/kernel-source-$(shell uname -r) \
# /usr/src/linux-$(shell uname -r | sed 's/\([0-9]*\.[0-9]*\)\..*/\1/') \
# /usr/src/linux /home/plice
test_dir = $(shell [ -e $(dir)/include/linux ] && echo $(dir))
KSP := $(foreach dir, $(KSP), $(test_dir))
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
ZONETYPE=EUROPE
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册