📄 dsdef.h
字号:
/******************* (c) Marvell Semiconductor, Inc., 2004 ********************
*
*
* This file contains definitions and data structures that are specific
* to Marvell 802.11 NIC.
*
* $Author: schiu $
*
* $Date: 2004/12/15 $
*
* $Revision: #18 $
*
*****************************************************************************/
#ifndef _DSDEF_H_
#define _DSDEF_H_
// ***************** DO NOT MODIFY *****************
// #define MRVL_AUTOMATED_BUILD_VERSION
// ***************** END DO NOT MODIFY *************
#ifndef MRVL_AUTOMATED_BUILD_VERSION
// This section is used for versioning displayed for
// developer built drivers
#ifdef MRV_CHIP_8305
// Driver Version number
#define MRVDRV_DRIVER_BUILD_VERSION "22.p1"
#endif // #ifdef MRV_CHIP_8305
#ifdef MRV_CHIP_8381PN
// Driver Version number
#define MRVDRV_DRIVER_BUILD_VERSION "27.p11"
#endif
#ifdef MRV_CHIP_8381P
// Driver Version number
#define MRVDRV_DRIVER_BUILD_VERSION "27"
#endif
#ifdef MRV_CHIP_8385PN
// Driver Version number
#define MRVDRV_DRIVER_BUILD_VERSION "27.p11"
#endif
#ifdef MRV_CHIP_8385H
// Driver Version number
#define MRVDRV_DRIVER_BUILD_VERSION "27"
#endif
#else
// This section is used for versioning displayed for
// automated built driver
// ***************** DO NOT MODIFY *****************
#ifdef MRV_CHIP_8305
// Driver Version number
#define MRVDRV_DRIVER_BUILD_VERSION "8305_AUTO_VERSION"
#endif // #ifdef MRV_CHIP_8305
#ifdef MRV_CHIP_8381PN
// Driver Version number
#define MRVDRV_DRIVER_BUILD_VERSION "8381_AUTO_VERSION"
#endif
#ifdef MRV_CHIP_8381P
// Driver Version number
#define MRVDRV_DRIVER_BUILD_VERSION "8381_AUTO_VERSION"
#endif
#ifdef MRV_CHIP_8385PN
// Driver Version number
#define MRVDRV_DRIVER_BUILD_VERSION "8385_AUTO_VERSION"
#endif
#ifdef MRV_CHIP_8385H
// Driver Version number
#define MRVDRV_DRIVER_BUILD_VERSION "8385_AUTO_VERSION"
#endif
// ***************** END DO NOT MODIFY *****************
#endif // #ifndef MRVL_AUTOMATED_BUILD_VERSION
#define MRVDRV_NUM_OF_WEP_INFO 16
// Number of RSSI values to keep for roaming
#define MRVDRV_NUM_RSSI_VALUE 10
// number of packet in RX queue
#define MRVDRV_NUM_RX_PKT_IN_QUEUE 20
#define MRVDRV_MEMORY_TAG 'lvrm'
//
// Ethernet Frame Sizes
//
// Currently, Microsoft passes 802.3/Ethernet packet to the NDIS miniport driver,
// Driver allocates 1536 bytes of host memory to keep Tx/Rx packets.
//
#define MRVDRV_ETH_ADDR_LEN 6
#define MRVDRV_ETH_HEADER_SIZE 14
#define MRVL_DEFAULT_INITIAL_RSSI -200
// Threshold is 500kbps
#define MRVL_SCAN_ALLOW_THRESHOLD 500000/8
// when connected, the driver will try to scan every 60s if there is no traffic
#define MRVL_BACKGOUND_SCAN_TIME 30
#define MRVDRV_MAX_MULTICAST_LIST_SIZE 0x00000020
#define MRVDRV_SIZE_OF_CMD_BUFFER 0x00001000 // 4K
#define MRVDRV_NUM_OF_CMD_BUFFER 0x00000030
// Timer constants
// This section defines time-out intervals for different tasks
#define MRVDRV_TEN_SECS_TIMER_INTERVAL 10000 // 10 sec
#define MRVDRV_DEFAULT_TIMER_INTERVAL 10000 // 10 sec
// most command should finish within 0.5 second
#define MRVDRV_DEFAULT_COMMAND_TIME_OUT 5000
#define MRVDRV_DEFAULT_LONG_COMMAND_TIME_OUT 10000 // 10 sec
#define MRVDRV_ASSOCIATION_TIME_OUT 195
// disconnect if more than one MIC error occurred within the following period (60s)
#define MRVDRV_MIC_ERROR_PERIOD 60000
#if DBG
#define MRVDRV_DEFAULT_TX_PKT_TIME_OUT 5000 // lot's of time for debug dralee
#else
#define MRVDRV_DEFAULT_TX_PKT_TIME_OUT 5000 //300 dralee
#endif
// for Adapter->Initialization Status flags
#define MRVDRV_INIT_STATUS_CMDTIMER_INITALIZED 0x1
#define MRVDRV_INIT_STATUS_MAP_REGISTER_ALLOCATED 0x2
//
// Misc constants
// This section defines 802.11 specific contants
//
#define MRVDRV_DEFAULT_MACHINE_NAME_SIZE 32
#define MRVDRV_MAX_SSID_LENGTH 32
#define MRVDRV_MAX_BSS_DESCRIPTS 16
#define MRVDRV_MAX_REGION_CODE 6
#define MRVDRV_MAX_CHANNEL_NUMBER 14
#define MRVDRV_DEFAULT_LISTEN_INTERVAL 3
// We define 8 levels in TX power command
#define MRVDRV_TX_POWER_LEVEL_TOTAL 0x0008
// definition for power level high, mid, and low
#define MRVDRV_TX_POWER_LEVEL_HIGH 19
#define MRVDRV_TX_POWER_LEVEL_MID 10
#define MRVDRV_TX_POWER_LEVEL_LOW 5
#define MRVDRV_MAX_BSSID_LIST 0x20
// reserve 150 bytes for each AP's variable IE in the scan list
#define MRVDRV_SCAN_LIST_VAR_IE_SPACE 256
// set aside 500 bytes for the association information buffer
#define MRVDRV_ASSOCIATE_INFO_BUFFER_SIZE 500
// max time between awake in ms, used by check for hang
#define MRVL_MAX_TIME_BETWEEN_AWAKE 5000
#ifdef MRV_CHIP_8385H
#define PSCAN_NUM_CH_PER_SCAN 1
#else
#define PSCAN_NUM_CH_PER_SCAN 3
#endif
#define MAX_LIST_BUFFER_SIZE 8192
//
// Resource size
//
// NDIS miniport driver (driver) has 2 ways to get BAR from the bus. The
// driver can either look at the PCI configuration BAR directly or query
// CM_PARTIAL_RESOURCE_DESCRIPTOR to get BAR information, which requires
// a buffer to keep resource list.
//
#define MRVDRV_RESOURCE_BUF_SIZE (sizeof(NDIS_RESOURCE_LIST) + \
(10*sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR)))
//
// Define WCB, PPA, DPA page mask
//
// WCB Status
//
// Station firmware use WCB status field to report final Tx transmit result,
// Bit masks are used to present combined situations.
//
#define MRVDRV_WCB_STATUS_IDLE 0x00000000
#define MRVDRV_WCB_STATUS_USED 0x00000001 // for WCBRefNode
#define MRVDRV_WCB_STATUS_OK 0x00000001
#define MRVDRV_WCB_STATUS_OK_RETRY 0x00000002
#define MRVDRV_WCB_STATUS_OK_MORE_RETRY 0x00000004
#define MRVDRV_WCB_STATUS_MULTICAST_TX 0x00000008
#define MRVDRV_WCB_STATUS_BROADCAST_TX 0x00000010
#define MRVDRV_WCB_STATUS_FAILED_LINK_ERROR 0x00000020
#define MRVDRV_WCB_STATUS_FAILED_EXCEED_LIMIT 0x00000040
#define MRVDRV_WCB_STATUS_FAILED_AGING 0x00000080
//
// in extended scan mode, because there will be
// multiple outstanding scan, this is the way to tell
// whether a command was specific scan or not
//
// in pad[0]
#define MRVDRV_ES_SPECIFICSCAN 0x01
#define MRVDRV_ES_NOTSPECIFICSCAN 0x00
// in pad[1]
#define MRVDRV_ES_ASSOCIATIONBLOCKED 0x01
#define MRVDRV_ES_ASSOCIATIONNOTBLOCKED 0x00
// Tx control node status
// For miniport driver internal use
//
#define MRVDRV_TX_CTRL_NODE_STATUS_IDLE 0x0000
#define MRVDRV_TX_CTRL_NODE_STATUS_USED 0x0001
#define MRVDRV_TX_CTRL_NODE_STATUS_PENDING 0x0002
// RxPD Control
// RxPD control field is used to keep ownership information
//
#define MRVDRV_RXPD_CONTROL_DRIVER_OWNED 0x00
#define MRVDRV_RXPD_CONTROL_OS_OWNED 0x04
#define MRVDRV_RXPD_CONTROL_DMA_OWNED 0x80
// RxPD Status
// Station firmware (FW) use RxPD Status field to report Rx packet type
//
#define MRVDRV_RXPD_STATUS_IDLE 0x0000
#define MRVDRV_RXPD_STATUS_OK 0x0001
#define MRVDRV_RXPD_STATUS_MULTICAST_RX 0x0002
#define MRVDRV_RXPD_STATUS_BROADCAST_RX 0x0004
#define MRVDRV_RXPD_STATUS_FRAGMENT_RX 0x0008
// Command control node status
// Miniport driver use status field to maintian command control nodes
//
#define MRVDRV_CMD_CTRL_NODE_STATUS_IDLE 0x0000
#define MRVDRV_CMD_CTRL_NODE_STATUS_PENDING 0x0001
#define MRVDRV_CMD_CTRL_NODE_STATUS_PROCESSING 0x0002
#define MRVDRV_FW_STATUS_READY 0x5A
#define MRVDRV_FW_DL_RDY_FOR_NEXT_BLOCK 0xAA
// Link spped
// Microsoft defines the unit of link speed measurement to be 100 bps
//
#define MRVDRV_LINK_SPEED_10mbps 100000
#define MRVDRV_LINK_SPEED_B_RATES 1
#define MRVDRV_LINK_SPEED_DEFAULT MRVDRV_LINK_SPEED_11mbps
#define MRVDRV_LINK_SPEED_0mbps 0
#define MRVDRV_LINK_SPEED_1mbps 10000 // in unit of 100bps
#define MRVDRV_LINK_SPEED_2mbps 20000
#define MRVDRV_LINK_SPEED_5dot5mbps 55000
#define MRVDRV_LINK_SPEED_6mbps 60000
#define MRVDRV_LINK_SPEED_9mbps 90000
#define MRVDRV_LINK_SPEED_11mbps 110000
#define MRVDRV_LINK_SPEED_12mbps 120000
#define MRVDRV_LINK_SPEED_18mbps 180000
#define MRVDRV_LINK_SPEED_22mbps 220000
#define MRVDRV_LINK_SPEED_24mbps 240000
#define MRVDRV_LINK_SPEED_33mbps 330000
#define MRVDRV_LINK_SPEED_36mbps 360000
#define MRVDRV_LINK_SPEED_48mbps 480000
#define MRVDRV_LINK_SPEED_54mbps 540000
#define MRVDRV_LINK_SPEED_72mbps 720000
#define MRVDRV_LINK_SPEED_100mbps 1000000
//
// RSSI-related defines
//
// RSSI constants are used to implement NDIS 5.1 802.11 RSSI threshold
// indication. if the Rx packet signal got too weak for 5 consecutive times,
// miniport driver (driver) will report this event to wrapper
//
#define SNR_BEACON 0
#define SNR_RXPD 1
#define NF_BEACON 2
#define NF_RXPD 3
#define MAX_SNR 4
#define CAL_NF(NF) ((LONG)(-(LONG)(NF)))
#define CAL_RSSI(SNR, NF) ((LONG)((UCHAR)(SNR) + CAL_NF(NF)))
#define SCAN_RSSI(RSSI) (0x100 - ((UCHAR)(RSSI)))
#define AVG_SCALE 100
#define CAL_AVG_SNR_NF(AVG, SNRNF) (((AVG) == 0) ? ((USHORT)(SNRNF) * AVG_SCALE) : \
((((int)(AVG) * 7) + ((USHORT)(SNRNF) * \
AVG_SCALE)) >> 3))
// Definitions for SNR and NF
typedef enum _SNRNF_TYPE {
TYPE_BEACON = 0,
TYPE_RXPD,
MAX_TYPE_B
} SNRNF_TYPE;
typedef enum _SNRNF_DATA {
TYPE_NOAVG = 0,
TYPE_AVG,
MAX_TYPE_AVG
} SNRNF_DATA;
#define MRVDRV_RSSI_TRIGGER_DEFAULT (-200)
#define MRVDRV_RSSI_INDICATION_THRESHOLD 5
#define MRVDRV_RSSI_DEFAULT_NOISE_VALUE (-90)
#define MRVL_CHECK_FOR_HANG_TIME 5
//
// Define WCB, PPA, DPA and RxPD
//
#pragma pack(1)
//
// WCB descriptor
//
// Status : Current Tx packet transmit status
// PktPtr : Physical address of the Tx Packet on host PC memory
// PktLen : Tx packet length
// UCHAR DestMACAdrHi[2] : First 2 byte of destination MAC address
// DestMACAdrLow[4] : Last 4 byte of destination MAC address
// DataRate : Driver uses this field to specify data rate for the Tx packet
// NextWCBPtr : Address to next WCB (Used by the driver)
//
typedef struct _WCB
{
ULONG Status;
ULONG TxControl;
ULONG PktPtr;
USHORT PktLen;
UCHAR DestMACAdrHi[2];
UCHAR DestMACAdrLow[4];
struct _WCB *NextWCBPtr;
#ifdef WMM
UCHAR Priority;
UCHAR Reserved[3];
#endif
} WCB, *PWCB;
//
// 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; // RSSI;
UCHAR Control;
USHORT PktLen;
UCHAR NF;
UCHAR RxRate;
ULONG PktPtr;
ULONG NextRxPDPtr;
#ifdef WMM
UCHAR Priority;
UCHAR Reserved[3];
#endif
} RxPD, *PRxPD;
// PJG: get these to match FW and then fix all usage.
#define MRVDRV_MAXIMUM_ETH_PACKET_SIZE 1514 // PJG:
// On CF device we ask upper layer to give us no more data than this.
#define CF_MAX_PACKET_SIZE (MRVDRV_MAXIMUM_ETH_PACKET_SIZE - MRVDRV_ETH_HEADER_SIZE)
// TODO: Check why it is necessary to add extra 38 bytes
#define MRVDRV_ETH_TX_PACKET_BUFFER_SIZE (MRVDRV_MAXIMUM_ETH_PACKET_SIZE + sizeof(WCB))
#define MRVDRV_ETH_RX_PACKET_BUFFER_SIZE (MRVDRV_MAXIMUM_ETH_PACKET_SIZE + sizeof(RxPD) + 38)
//
// 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -