📄 dsdef.h
字号:
//
// RxPD descirptor
//
// Status : Rx packet reception status
// RSSI : Receive RF signal strength for this packet (dbm)
// Control : Not used in CF and SDIO
// PktLen : Number of bytes in the payload
// NF : Noise floor for this packet
// Rate : Rate at which this packet is received
// PktPtr : Offset from the start of the packet to the begining of the payload data
// NextRxPDPtr : Not used in CF and SDIO
//
typedef struct _RxPD
{
USHORT Status;
UCHAR SNR;
UCHAR Control;
USHORT PktLen;
UCHAR NF;
UCHAR RxRate;
ULONG PktPtr;
ULONG NextRxPDPtr;
/*
tt: mark off the following "#ifdef WMM" since our firmware needs them.
*/
//#ifdef WMM
UCHAR Priority;
UCHAR Reserved[3];
//#endif
} RxPD, *PRxPD;
// PJG: get these to match FW and then fix all usage.
#ifndef IF_GSPI
#define MRVDRV_MAXIMUM_ETH_PACKET_SIZE 1514 // PJG:
#else
///crlo: We use this variable to allocate the buffer. For SDIO, we need more buffers to save the SDIO block
/// Because we don't know how much buffers are needed for SPI, just define a big value for safety
#define MRVDRV_MAXIMUM_ETH_PACKET_SIZE 1600 // PJG:
#endif
#define CF_MAX_PACKET_SIZE (MRVDRV_MAXIMUM_ETH_PACKET_SIZE - MRVDRV_ETH_HEADER_SIZE)
///crlo:MTU ++
///crlo: defined MTU to report to the TCP layer
#define MRVDRV_MTU 1500
#define MRVDRV_MTU_TOTAL (MRVDRV_MTU+MRVDRV_ETH_HEADER_SIZE)
///crlo:MTU --
// TODO: Check why it is necessary to add extra 38 bytes
#ifdef IF_GSPI
#define SDIO_EXTENDED_IO_BLOCK_SIZE 1
#endif
//dralee, 072705
//#define MRVDRV_ETH_TX_PACKET_BUFFER_SIZE (MRVDRV_MAXIMUM_ETH_PACKET_SIZE + sizeof(WCB)+)//+SDIO_EXTENDED_IO_BLOCK_SIZE)
#define MRVDRV_ETH_TX_PACKET_BUFFER_SIZE (MRVDRV_MAXIMUM_ETH_PACKET_SIZE + sizeof(WCB)+SDIO_EXTENDED_IO_BLOCK_SIZE*2)
//dralee, 072705, add extra 4 bytes(type+len) in HostCmd_DS_CODE_DNLD
//#define MRVDRV_ETH_RX_PACKET_BUFFER_SIZE (MRVDRV_MAXIMUM_ETH_PACKET_SIZE + sizeof(RxPD) + 38)
#define MRVDRV_ETH_RX_HIDDEN_HEADER_SIZE (sizeof(RxPD)+4)
//dralee 072805
//#define MRVDRV_ETH_RX_PACKET_BUFFER_SIZE (MRVDRV_MAXIMUM_ETH_PACKET_SIZE + MRVDRV_ETH_RX_HIDDEN_HEADER_SIZE + 38)
#define MRVDRV_ETH_RX_PACKET_BUFFER_SIZE (MRVDRV_MAXIMUM_ETH_PACKET_SIZE + MRVDRV_ETH_RX_HIDDEN_HEADER_SIZE + SDIO_EXTENDED_IO_BLOCK_SIZE*2)
//
// Tx control node data structure
//
// Tx control node is used by the driver to keep ready to send Tx packet information.
//
// Status :
// NPTxPacket : NDIS_PACKET reference
// LocalWCB : Local WCB reference
// BufVirtualAddr : Tx staging buffer logical address
// BufPhyAddr : Tx staging buffer physical address
// NextNode : link to next Tx control node
//
typedef struct _TxCtrlNode
{
ULONG Status;
PNDIS_PACKET NPTxPacket;
PWCB LocalWCB;
PUCHAR BufVirtualAddr;
NDIS_PHYSICAL_ADDRESS BufPhyAddr;
struct _TxCtrlNode *NextNode;
} TxCtrlNode, *PTxCtrlNode;
//
// Command control nore data structure, command data structures are defined in
// hostcmd.h
//
// Next : Link to nect command control node
// Status : Current command execution status
// PendingOID : Set or query OID passed from NdisRequest()
// ExpectedRetCode : Result code for the current command
// PendingInfo : Init, Reset, Set OID, Get OID, Host command, etc.
// INTOption : USE_INT or NO_INT
// BatchQNum : Reserved for batch command processing
// IsLastBatchCmd : Reserved for batch command processing
// BytesWritten : For async OID processing
// BytesRead : For async OID processing
// BytesNeeded : For async OID processing
// InformationBuffer : For async OID processing
// BufVirtualAddr : Command buffer logical address
// BufPhyAddr : Command buffer physical address
//
typedef struct _CmdCtrlNode
{
struct _CmdCtrlNode *Next;
ULONG Status;
NDIS_OID PendingOID;
USHORT ExpectedRetCode;
USHORT PendingInfo; // Init, Reset, Set OID, Get OID, Host command, etc.
USHORT INTOption;
USHORT BatchQNum;
BOOLEAN IsLastBatchCmd; // BOOLEAN is defined as unsigned char
UCHAR Pad[3]; // To make it on 4 byte boundary
PULONG BytesWritten; // For async OID processing
PULONG BytesRead; // For async OID processing
PULONG BytesNeeded; // For async OID processing
PVOID InformationBuffer; // For async OID processing
PUCHAR BufVirtualAddr;
NDIS_PHYSICAL_ADDRESS BufPhyAddr;
UCHAR PadExt[4];
} CmdCtrlNode, *PCmdCtrlNode;
// for packet Q
typedef struct _PacketQueueNode
{
struct _PacketQueueNode *Next;
PNDIS_PACKET pPacket;
} PACKET_QUEUE_NODE, *PPACKET_QUEUE_NODE;
typedef enum _GET_PACKET_STATUS
{
GPS_SUCCESS = 0, // get packet was successful
GPS_RESOURCE, // get packet was successful, but number of free packet is low
GPS_FAILED // unable to get packet
} MRVDRV_GET_PACKET_STATUS;
//
// Ethernet Frame Structure
//
// Ethernet MAC address
typedef struct _ETH_ADDRESS_STRUC
{
UCHAR EthNodeAddr[MRVDRV_ETH_ADDR_LEN];
} ETH_ADDR_STRUC, *PETH_ADDR_STRUC;
// Ethernet frame header
typedef struct _ETH_HEADER_STRUC
{
UCHAR DestAddr[MRVDRV_ETH_ADDR_LEN];
UCHAR SrcAddr[MRVDRV_ETH_ADDR_LEN];
USHORT TypeLength;
} ETH_HEADER_STRUC, *PETH_HEADER_STRUC;
typedef struct _REGINFOTAB
{
NDIS_STRING ObjNSName; // Object name (UNICOODE)
char *ObjName; // Object name (ASCII)
UINT Type; // StringData (1), IntegerData (0)
UINT Offset; // Offset to adapter object field
UINT MaxSize; // Maximum Size (in bytes)
} REGINFOTAB;
#ifdef UNDER_CE_XSCALE
#pragma pack()
#endif
// 11/08/02 - Add WEP list data structures
#define MRVL_KEY_BUFFER_SIZE_IN_BYTE 16
// Based on NDIS_802_11_WEP, we extend the WEP buffer length to 128 bits
typedef struct _MRVL_WEP_KEY
{
ULONG Length;
ULONG KeyIndex;
ULONG KeyLength;
UCHAR KeyMaterial[MRVL_KEY_BUFFER_SIZE_IN_BYTE];
} MRVL_WEP_KEY, *PMRVL_WEP_KEY;
typedef struct _MRVL_WEP_INFO
{
ULONG LastKeyIndex;
NDIS_802_11_SSID SSID;
MRVL_WEP_KEY KEY[4];
} MRVL_WEP_INFO, *PMRVL_WEP_INFO;
#ifdef WPA
// support 5 key sets
#define MRVL_NUM_WPA_KEYSET_SUPPORTED 5
// support 4 keys per key set
#define MRVL_NUM_WPA_KEY_PER_SET 4
// max key length is 32 bytes acording to current WPA document
#define MRVL_MAX_WPA_KEY_LENGTH 32
typedef struct _MRVL_WPA_KEY
{
ULONG KeyIndex;
ULONG KeyLength; // length of key in bytes
NDIS_802_11_KEY_RSC KeyRSC;
// variable length depending on above field
UCHAR KeyMaterial[MRVL_MAX_WPA_KEY_LENGTH];
} MRVL_WPA_KEY, *PMRVL_WPA_KEY;
typedef struct _MRVL_WPA_KEY_SET
{
// BSSID is common within the set
NDIS_802_11_MAC_ADDRESS BSSID;
MRVL_WPA_KEY Key[MRVL_NUM_WPA_KEY_PER_SET];
} MRVL_WPA_KEY_SET, *PMRVL_WPA_KEY_SET;
typedef struct _MRVL_NDIS_WPA_KEY
{
UCHAR EncryptionKey[16];
UCHAR MICKey1[8];
UCHAR MICKey2[8];
} MRVL_NDIS_WPA_KEY, *PMRVL_NDIS_WPA_KEY;
// Fixed IE size is 8 bytes time stamp + 2 bytes beacon interval + 2 bytes cap
#define MRVL_FIXED_IE_SIZE 12
#endif // #ifdef WPA
#ifdef WPA2
#define KEY_INFO_ENABLED 0x01
#endif /* WPA2 */
#ifdef WPA2
typedef enum {
KEY_TYPE_ID_WEP = 0,
KEY_TYPE_ID_TKIP,
KEY_TYPE_ID_AES
} KEY_TYPE_ID;
typedef enum {
KEY_INFO_WEP_DEFAULT_KEY = 0x01
} KEY_INFO_WEP;
typedef enum {
KEY_INFO_TKIP_MCAST = 0x01,
KEY_INFO_TKIP_UNICAST = 0x02,
KEY_INFO_TKIP_ENABLED = 0x04
} KEY_INFO_TKIP;
typedef enum {
KEY_INFO_AES_MCAST = 0x01,
KEY_INFO_AES_UNICAST = 0x02,
KEY_INFO_AES_ENABLED = 0x04
} KEY_INFO_AES;
#endif /* WPA2 */
#define WPA_AES_KEY_LEN 16
#define WPA_TKIP_KEY_LEN 32
#ifdef ADHOCAES
typedef struct _MRVL_ADHOC_AES_KEY
{
ULONG Length;
UCHAR KeyBody[32]; //assic form
} MRVL_ADHOC_AES_KEY, *PMRVL_ADHOC_AES_KEY;
#endif
/*
===============================================================================
GLOBAL CONSTANT
===============================================================================
*/
static ULONG DSFeqList[15] = {
0, 2412000, 2417000, 2422000, 2427000, 2432000, 2437000, 2442000,
2447000, 2452000, 2457000, 2462000, 2467000, 2472000, 2484000
};
// region code table
static USHORT RegionCodeToIndex[MRVDRV_MAX_REGION_CODE] = {0x10, 0x20, 0x30, 0x31, 0x32, 0x40};
// for Extended Channel List to work, all INVALID (0) channels must be grouped together
// and store at the end of the list
static UCHAR IEEERegionChannel[MRVDRV_MAX_REGION_CODE][MRVDRV_MAX_CHANNEL_NUMBER] = {
{ 1, 2, 3, 4, 5, 6, 7,8, 9, 10, 11, 0, 0, 0}, //USA FCC
{ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11, 0, 0, 0}, //Canada IC
{ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13, 0}, //Europe ETSI
{10,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //Spain
{10,11,12,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, //France
{ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13, 14} }; //Japan MKK
//BugFix
//Ling++, 012706, Tx DataRate, modify MrvDrvSupportedRates: Add item 4 : 0x00,// reserved
#if (defined(MRV_CHIP_8305) || defined(MRV_CHIP_8381))
///B-rate
static const UCHAR MrvDrvSupportedRates[] = {
0x02, // 1Mbps
0x04, // 2Mbps
0x0b, // 5.5Mbps
0x16 // 11Mbps
};
#else
///BG-rate
static const UCHAR MrvDrvSupportedRates[] = {
0x02, // 1Mbps
0x04, // 2Mbps
0x0b, // 5.5Mbps
0x16, // 11Mbps
0x00, // reserced
0x0c, // 6Mbps
0x12, // 9Mbps
0x18, // 12Mbps
0x24, // 18Mbps
0x30, // 24Mbps
0x48, // 36Mbps
0x60, // 48Mbps
0x6c, // 54Mbps
0x00, //reserved
};
#endif ///MRV_CHIP_8xxxx
/*
#if defined (MRV_CHIP_8385PN) || defined (MRV_CHIP_8388)
static const UCHAR MrvDrvSupportedRates[] = {
0x02, // 1Mbps
0x04, // 2Mbps
0x0b, // 5.5Mbps
0x16, // 11Mbps
0x00, // reserced
0x0c, // 6Mbps
0x12, // 9Mbps
0x18, // 12Mbps
0x24, // 18Mbps
0x30, // 24Mbps
0x48, // 36Mbps
0x60, // 48Mbps
0x6c, // 54Mbps
0x00, //reserved
};
#elif defined(MRV_CHIP_8399)
static const UCHAR MrvDrvSupportedRates[] = {
0x02, // 1Mbps
0x04, // 2Mbps
0x0b, // 5.5Mbps
0x16, // 11Mbps
0x00, //the same as Linux //Ling++, 011106
0x0c, // 6Mbps
0x12, // 9Mbps
0x18, // 12Mbps
0x24, // 18Mbps
0x30, // 24Mbps
0x48, // 36Mbps
0x60, // 48Mbps
0x6c, // 54Mbps
0x00,
};
#elif defined(MRV_CHIP_8686PN)//dralee_1209
static const UCHAR MrvDrvSupportedRates[] = {
0x02, // 1Mbps
0x04, // 2Mbps
0x0b, // 5.5Mbps
0x16, // 11Mbps
0x00, //the same as Linux //Ling++, 011106
0x0c, // 6Mbps
0x12, // 9Mbps
0x18, // 12Mbps
0x24, // 18Mbps
0x30, // 24Mbps
0x48, // 36Mbps
0x60, // 48Mbps
0x6c, // 54Mbps
0x00,
};
#elif defined(MRV_CHIP_8385H)
static const UCHAR MrvDrvSupportedRates[] = {
0x02, // 1Mbps
0x04, // 2Mbps
0x0b, // 5.5Mbps
0x16, // 11Mbps
0x00, //the same as Linux //Ling++, 011106
0x0c, // 6Mbps
0x12, // 9Mbps
0x18, // 12Mbps
0x24, // 18Mbps
0x30, // 24Mbps
0x48, // 36Mbps
0x60, // 48Mbps
0x6c, // 54Mbps
0x00,
};
#else
static const UCHAR MrvDrvSupportedRates[] = {
0x02, // 1Mbps
0x04, // 2Mbps
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -