⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 car6k.hpp

📁 Atheros Communications AR6001 WLAN Driver for SDIO installation Read Me March 26,2007 (based on
💻 HPP
📖 第 1 页 / 共 2 页
字号:
//------------------------------------------------------------------------------
// <copyright file="car6k.hpp" company="Atheros and Microsoft">
//    Copyright (c) 2006 Microsoft Corporation.  All rights reserved.
//    Copyright (c) 2006 Atheros Corporation.  All rights reserved.
//
//    The use and distribution terms for this software are covered by the
//    Microsoft Limited Permissive License (Ms-LPL) 
//    http://www.microsoft.com/resources/sharedsource/licensingbasics/limitedpermissivelicense.mspx 
//    which can be found in the file MS-LPL.txt at the root of this distribution.
//    By using this software in any fashion, you are agreeing to be bound by
//    the terms of this license.
//
//    You must not remove this notice, or any other, from this software.
// </copyright>
// 
// <summary>
//    Windows CE Wifi Driver for AR-6000
// </summary>
//------------------------------------------------------------------------------
//==============================================================================
// AR6000 NDIS Miniport  Class.
//
// Author(s): ="Atheros and Microsoft"
//==============================================================================


#define AR6000_MAX_ENDPOINTS  4
#define AR6000_MAX_RX_BUFFERS 16
#define AR6000_ETH_ADDR_LEN   6

#define AR6K_DEFAULT_MS_TO_WAIT_FOR_TGT_READY 20000
#define AR6K_DEFAULT_MS_TO_WAIT_FOR_WMI_READY 20000
#define AR6K_DEFAULT_MS_TO_WAIT_FOR_TGT_GETSTATS 10000

#define AR6K_DEFAULT_NDIS_INITIALIZATION_THREAD_PRIORITY 200

#define NdisInitializeBuffer(pBuffer, Address, Length) MmInitializeMdl(pBuffer, Address, Length)

/* NDIS wants RSSI indicated relative to -95 dBm */
#define RSSI_TO_NDIS(x) ((x) - 95)

#define WLAN_MAC_ADDR_SIZE 6
#define isGrp(macaddr) \
    ((BOOL)((macaddr)->macAddress[0] & 0x01))
#define isBcast(macaddr) \
    (((macaddr)->macAddress[0] == 0xff))
#define A_MACADDR_COMP(m1, m2)                            \
        (!(NdisEqualMemory((void *)&((m1)->macAddress[0]),    \
        (void *)&((m2)->macAddress[0]),                       \
        WLAN_MAC_ADDR_SIZE) == 1))

 
typedef struct MAC_ADDRESS
{
 	BYTE  macAddress[ETHERNET_MAC_ADDRESS_LENGTH];
} MAC_ADDRESS, *PMAC_ADDRESS;


#pragma pack(1)

typedef struct ETHERNET_MAC_HEADER
{
	BYTE			DestMACAddress[ETHERNET_MAC_ADDRESS_LENGTH];
	BYTE			SrcMACAddress[ETHERNET_MAC_ADDRESS_LENGTH];
	USHORT          Length;
} ETHERNET_MAC_HEADER, *PETHERNET_MAC_HEADER;

typedef struct SNAP_HEADER
{
	BYTE            dsap;
	BYTE            ssap;
	BYTE            cntl;
	BYTE            orgCode[3];
	USHORT          Type;
} SNAP_HEADER, *PSNAP_HEADER;

#define CAP_TYPE_SIZE 6
typedef struct capType {
	A_UINT8		octets[CAP_TYPE_SIZE];
}CAP_CONST;

// Encapsulation header for RFC1042 and Ethernet_tunnel
#define RFC1042SNAP	{{0xAA,0xAA,0x03,0x00,0x00,0x00}}
#define ETHERNET_TUNNEL	{{0xAA,0xAA,0x03,0x00,0x00,0xF8}}

#define APPLE_TALK_ARP	0x80f3
#define NOVELL_IPX		0x8137
#define IPV4			0x8000


#ifdef WMM
/* This stuff is used when we want a simple layer-3 visibility */
struct iphdr {
#ifdef BIG_ENDIAN
    A_UINT32    ip_v:4,                     /* version */
                ip_hl:4,            /* header length */
#else
    A_UINT32    ip_hl:4,                /* header length */
                ip_v:4,                 /* version */
#endif
                ip_tos:8,               /* type of service */
                ip_len:16;              /* total length */
    A_UINT16    ip_id;                  /* identification */
    A_INT16     ip_off;                 /* fragment offset field */
#define IP_DF 0x4000                    /* dont fragment flag */
#define IP_MF 0x2000                    /* more fragments flag */
#define IP_OFFMASK 0x1fff               /* mask for fragmenting bits */
    A_UINT8     ip_ttl;                 /* time to live */
    A_UINT8     ip_p;                   /* protocol */
    A_UINT16    ip_sum;                        /* checksum */
    A_UINT32    ip_src, ip_dst;  /* source and dest address */
};

#endif //WMM

// OIDs specific structures
typedef struct bmi_read_memory_param
{
	DWORD address;
	DWORD length;
	CHAR  buffer;
} BMI_READ_MEMORY_PARAM;

typedef struct bmi_read_soc_reg_param
{
	DWORD address;
	DWORD value;
} BMI_READ_SOC_REG_PARAM;

typedef BMI_READ_MEMORY_PARAM BMI_WRITE_MEMORY_PARAM;

typedef struct bmi_execute_param
{
	DWORD address;
	DWORD param;
} BMI_EXECUTE_PARAM;

typedef struct bmi_set_app_start_param
{
	DWORD address;
} BMI_SET_APP_START_PARAM;

typedef struct bmi_write_soc_reg_param
{
	DWORD address;
	DWORD param;
} BMI_WRITE_SOC_REG_PARAM;

#ifdef HTC_RAW_INTERFACE

typedef struct htc_raw_read_param
{
	DWORD endPointId;
	DWORD length;
	CHAR buffer;
} HTC_RAW_READ_PARAM;

typedef struct htc_raw_write_param
{
	DWORD endPointId;
	DWORD length;
	CHAR buffer;
} HTC_RAW_WRITE_PARAM;

#endif //HTC_RAW_INTERFACE

#pragma pack()

typedef struct AR6K_TRANSMIT_BUFFER
{
	// When the buffer is not in use, the node is used to put the
	// buffer on the free list of transmit buffers.
	LIST_ENTRY      node;

	// When the buffer is in use, having been passed down to HTC
	// for transmission, pTxPacket points to the NDIS_PACKET that
	// it is transmitting.
	PNDIS_PACKET    pNdisPacket;

	// When the buffer is in use, cbCWMIData contains the size of
	// the variable length WMI_DATA (including MAC Header, SNAP Header,
	// and Payload data) which follows.
	ULONG           cbWMIData;

	//
	// Remaining portion of the structure is the WMI_DATA to be transmitted,
	// which begins with a WMI_DATA_HDR but is variable length.
	//
	WMI_DATA_HDR             WMIDataHeader;

	ETHERNET_MAC_HEADER      MACHeader;

	SNAP_HEADER              SNAPHeader;

	// 
	// Variable length payload (e.g. ARP packet, IP packet) follows
	//
	BYTE             PayloadData[1];

} AR6K_TRANSMIT_BUFFER, *PAR6K_TRANSMIT_BUFFER;

typedef struct WlanConfig		// Station Configuration Structure for Reading values from Registry.
{
	
	ULONG 	bkScanEnable;           // Enable(1) or disble(0) Background Scan
	ULONG	bkScanPeriod;           // Background Scan Interval in seconds
	USHORT 	wpaEnabled;             // Enable(1) or disble(0) WPA
	UCHAR 	wpa2Enabled;            // Enable(1) or disble(0) WPA2
	UCHAR	defaultApp;             // Default APP in App (1) or APP loaded using BMI loader
	UCHAR	byPassWmi;              // ByPass(1) or Pass(0) WMI Phase
	UCHAR	discTimeout;            // Disconnect timeout
	ULONG   resetPowerState;        // Power State Upon Reset
    ULONG   ibssChannel;
    ULONG   powerSaveMode;
}WLAN_STA_CONFIG;

class CAR6KMini : public C802_11Miniport
{
private:

	// Number of transmit buffers that will be allocated during initialization
	// and put on the m_TransmitBufferList.
	ULONG      m_MaxTransmitBuffers;
#define DEFAULT_MAX_TRANSMIT_BUFFERS 30

	// Maximum length of data that can be copied into a transmit buffer
	ULONG      m_MaxTransmitBufferPayloadDataLength;
#define DEFAULT_MAX_TRANSMIT_BUFFER_PAYLOAD_DATA_LENGTH 1500

	// Pointer to the block of storage that holds all the transmit buffers:
	PAR6K_TRANSMIT_BUFFER  m_pTransmitBufferArray;
	ULONG                  m_cbTransmitBufferArray;

	// Transmit buffers that are not currently in use are on this list:
	LIST_ENTRY m_TransmitBufferList;

	// NDIS_PACKETS waiting to be transmitted are on this list:
	LIST_ENTRY m_TransmitNdisPacketList;


	// Pool of receive packet headers
	NDIS_HANDLE m_RxPacketPool;
   

	// Set to true when MiniportHalt is called
	boolean     m_Halting;

	// List of NDIS_PACKETs waiting to be passed to NdisMIndicateReceivePacket
	LIST_ENTRY  m_RxPendingPacketList;
	// Event which is signalled when the m_RxPendingPacketList is non empty
	NDIS_EVENT  m_RxPendingEvent;
	// This event is Reset as long as the Rx Work Item handler is running
	NDIS_EVENT  m_RxWorkItemExitedEvent;
	// This event is used to indicate whether the reset power work item has exited
	NDIS_EVENT  m_ResetPowerWorkItemExitedEvent;

	// The address of the NIC encoded in the hardware.
	BYTE  m_PermanentAddress[ETHERNET_MAC_ADDRESS_LENGTH];

	// The address the NIC is currently using
	BYTE  m_CurrentAddress[ETHERNET_MAC_ADDRESS_LENGTH];

	// Infrastructure / ad hoc mode
	NDIS_802_11_NETWORK_INFRASTRUCTURE m_InfrastructureMode;

	ULONG                              m_AuthAlg;

//#ifdef SUPPORT_WPA2
//	NDIS_802_11_AUTHENTICATION_MODE_WPA2    m_AuthenticationMode;
//#else
	NDIS_802_11_AUTHENTICATION_MODE    m_AuthenticationMode;
//#endif

	NDIS_802_11_ENCRYPTION_STATUS      m_EncryptionStatus;

	// HTC Target pointer, sent to us from HTC by an
	// HTC_TARGET_AVAILABLE event indication and passed
	// to HTC on subsequent requests to htc_xxx functions.
	HTC_TARGET                         *m_pHTCTarget;

    // HIF device pointer 
    // Used during BMI
    HIF_DEVICE                          *m_pHIFDevice;

	// Context returned by wmi_init, used for calls into the wmi_xxx
	// library functions.
	PVOID                               m_pWMI;

	// Boolean indicating whether a WMI_READY event has been received.
	// No WMI messages should be issued until a WMI_READY event is
	// received after bootup or a WMI_RESET request.
	boolean                             m_tgtReady;
	boolean                             m_WMIReady;
	boolean                             m_HTCInited;
	boolean                             m_HTCStarted;
	boolean                             m_InitComplete;

	// RSSI is set via a TARGET_STATS event from WMI
	NDIS_802_11_RSSI                    m_RSSI;
	NDIS_802_11_STATISTICS				m_tgtStats;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -