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

📄 rt2570sw.h

📁 台湾RALink公司的 rt2570无线 802.11g 网卡的 驱动的源代码 ,支持linux2.4以上的 内河
💻 H
📖 第 1 页 / 共 5 页
字号:

////////////////////////////////////////////////////////////////////////////
// VERSION_INFO exchanged between driver/application
////////////////////////////////////////////////////////////////////////////
typedef struct __VERSION_INFO{
    UCHAR   DriverMajorVersion;
    UCHAR   DriverMinorVersion;
    UCHAR   DriverSubVersion;
    USHORT  DriverBuild;

    USHORT  FwMajorVersion;
    USHORT  FwMinorVersion;
    USHORT  FwSubVersion;
    USHORT  FwBuild;
}VERSION_INFO, *PVERSION_INFO;

#if 0
////////////////////////////////////////////////////////////////////////////
// The RX_BUFFER structure forms the Received USB packet from the device
////////////////////////////////////////////////////////////////////////////
typedef struct __RX_BUFFER{
    USHORT      WLength;
    UCHAR       RxRate;       //This field is not used in this version of Drv/FW
    UCHAR       ChangeBSSID;
    UCHAR       Fragmentation;//This field is not used in this version of Drv/FW
    UCHAR       RSSI;
    UCHAR       LinkQuality;
    UCHAR       NoiseLevel;   //This field is not used in this version of Drv/FW
    UCHAR       RxTime[4];    //This field is not used in this version of Drv/FW
    UCHAR       WirelessPacket[MAX_WIRELESS_SIZE];
} RX_BUFFER, *PRX_BUFFER;
#endif


////////////////////////////////////////////////////////////////////////////
// The TX_BUFFER structure forms the transmitted USB packet to the device
////////////////////////////////////////////////////////////////////////////
typedef struct _TX_BUFFER{
//	UINT			BulkOutSize;
    TXD_STRUC		TxDesc;
    UCHAR			WirelessPacket[2342];
} TX_BUFFER, *PTX_BUFFER;


////////////////////////////////////////////////////////////////////////////
// The RTS_BUFFER structure forms the transmitted USB packet to the device
////////////////////////////////////////////////////////////////////////////
typedef struct __RTS_BUFFER{
    TXD_STRUC      TxDesc;
    UCHAR	       RTSPacket[16];
} RTS_BUFFER, *PRTS_BUFFER;

////////////////////////////////////////////////////////////////////////////
// The USB_CARD_CONFIG structure is used only during device initialization
// to pass the initial operationg parameters to device
////////////////////////////////////////////////////////////////////////////
typedef struct __USB_CARD_CONFIG{
    UCHAR       ExcludeUnencrypted;
    UCHAR       PromiscuousMode;
    UCHAR       ShortRetryLimit;
    UCHAR       EncryptionType;
    USHORT      RtsThreshold;
    USHORT      FragmentationThreshold;     // 256..2346
    UCHAR       BasicRateSet[4];
    BOOLEAN     AutoRateFallBack;           //0,1
    UCHAR       Channel;
    BOOLEAN     PrivacyInvoked;
    UCHAR       WEPDefaultKeyID;            // 0..3
    UCHAR       CurrentSSID[32];
    UCHAR       WEPDefaultKeyValue[4][WEP_KEY_SIZE];
    UCHAR       SSIDLen;
    UCHAR       ShortPreamble;
    USHORT      BeaconPeriod;
} USB_CARD_CONFIG, *PUSB_CARD_CONFIG;


////////////////////////////////////////////////////////////////////////////
// In WEP_INFO are kept all the WEP related parameters. This structure is
// also exchanged between driver and application.
////////////////////////////////////////////////////////////////////////////
typedef struct __WEP_INFO{
    UCHAR                       WepKeyToUse;
    UCHAR                       WepMode;
    USHORT                      AuthenticationType;
    UCHAR                       EncryptionLevel;
    UCHAR                       WepKey1[WEP_KEY_SIZE];
    UCHAR                       WepKey2[WEP_KEY_SIZE];
    UCHAR                       WepKey3[WEP_KEY_SIZE];
    UCHAR                       WepKey4[WEP_KEY_SIZE];
} WEP_INFO, *PWEP_INFO;


////////////////////////////////////////////////////////////////////////////
// In the STATISTICS structure are kept all the device's statitrics.
// This structure is also exchanged between driver and application.
////////////////////////////////////////////////////////////////////////////
typedef struct __STATISTICS{
    ULONG   TxDataPacketsOk;
    ULONG   TxDataPacketsError;
    ULONG   TxMgmtPacketsOk;
    ULONG   TxMgmtPacketsError;

    ULONG   RxDataPacketsOk;
    ULONG   RxDataPacketsError;
    ULONG   RxMgmtPacketsOk;
    ULONG   RxMgmtPacketsError;

    ULONG   RxLost;
    ULONG   TxPacketsRejectedNotReady;
    ULONG   TxPacketsRejectedResources;
    ULONG   MatchingBeacons;
}STATISTICS, *PSTATISTICS;

////////////////////////////////////////////////////////////////////////////
// The BSS_INFO and SITE_SURVEY_INFO structures are used to form a custom
// list of 12 maximum BSSs and keet there characteristics.
// This list is the one that application displays in Site Survey Tab.
////////////////////////////////////////////////////////////////////////////
typedef struct __BSS_INFO{
    UCHAR   Channel;
    UCHAR   SSID[ESS_ID_SIZE];
    UCHAR   SSIDsize;
    UCHAR   BSSID[6];
    UCHAR   RSSI;
    UCHAR   UsingWEP;
    UCHAR   PreambleType;
    USHORT  BeaconPeriod;
    UCHAR   BSSType;  //11->Ad-Hoc, 2->Infrastructure
}BSS_INFO, *PBSS_INFO;

#define MAX_AP_ENTRIES  30

typedef struct __SITE_SURVEY_INFO{
    BSS_INFO        BSSinfo[MAX_AP_ENTRIES];
    UCHAR           BSSsInList;
    UCHAR           UserSelectedIndex;
    UCHAR           SiteSurveyState;
}SITE_SURVEY_INFO, *PSITE_SURVEY_INFO;

#ifdef WINXP
typedef struct __XP_BSSID_LIST{
    ULONG                   NumberOfEntries;
    NDIS_WLAN_BSSID         NdisBSSIDEntry[MAX_AP_ENTRIES];
}XP_BSSID_LIST;
#endif

//#pragma pack(pop)



////////////////////////////////////////////////////////////////////////////
// The FRAGMENTED_PACKET structure is used for the reassembly of the
// fragmented 802.11 packets in the driver
////////////////////////////////////////////////////////////////////////////
typedef struct __FRAGMENTED_PACKET{
    USHORT  Sequence;
    USHORT  CurrentLen;
    UCHAR   SourceAddress[6];
    UCHAR   FragmentNumber;//next fragment expected
    UCHAR   WirelessPacket[MAX_WIRELESS_SIZE];
}FRAGMENTED_PACKET, *PFRAGMENTED_PACKET;

////////////////////////////////////////////////////////////////////////////
// The ASYNC_OID structure is used for holding the context of an OID call
// that the driver will complete asynchronously
////////////////////////////////////////////////////////////////////////////
typedef struct __ASYNC_OID{
    PVOID   InformationBuffer;
    ULONG   InformationBufferLength;
    PULONG  Bytes;
    PULONG  BytesNeeded;
}ASYNC_OID, *PASYNC_OID;

#if 1//RT2460
//
//  Some utility macros
//
#ifndef min
#define min(_a, _b)     (((_a) < (_b)) ? (_a) : (_b))
#endif

#ifndef max
#define max(_a, _b)     (((_a) > (_b)) ? (_a) : (_b))
#endif

#define INC_COUNTER(Val)    (Val.QuadPart++)

#define	INFRA_ON(_p)		        (((_p)->PortCfg.Massoc) == TRUE)	// Check Massoc
#define ADHOC_ON(_p)                (((_p)->PortCfg.Mibss) == TRUE)    // check Mibss

#define	RTMP_SET_PACKET_FRAGMENTS(_p, number)	((_p)->cb[10] = number)
#define RTMP_GET_PACKET_FRAGMENTS(_p)			((_p)->cb[10])
#define	RTMP_SET_PACKET_RTS(_p, number)			((_p)->cb[11] = number)
#define RTMP_GET_PACKET_RTS(_p)					((_p)->cb[11])
#define	RTMP_SET_PACKET_FIRST_CONTEXT(_p, number)	((_p)->cb[12] = number)
#define RTMP_GET_PACKET_FIRST_CONTEXT(_p)			((_p)->cb[12])
//blue,#define	RTMP_SET_PACKET_CONTEXTS_REQUIRED(_p, number)	((_p)->cb[13] = number)
//blue,#define RTMP_GET_PACKET_CONTEXTS_REQUIRED(_p)			((_p)->cb[13])
#define GET_NEXT_PACKET_IN_BULKOUT_QUEUE(_p)			((struct sk_buff **)&((_p)->cb[14]))


#define	MAKE_802_3_HEADER(_p, _pMac1, _pMac2, _pType)								\
{																					\
	NdisMoveMemory(_p, _pMac1, ETH_LENGTH_OF_ADDRESS);								\
	NdisMoveMemory((_p + ETH_LENGTH_OF_ADDRESS), _pMac2, ETH_LENGTH_OF_ADDRESS);	\
	NdisMoveMemory((_p + ETH_LENGTH_OF_ADDRESS * 2), _pType, LENGTH_802_3_TYPE);	\
}

//
// Register set pair for initialzation register set definition
//
typedef	struct	_RTMP_REG_PAIR
{
	ULONG	Register;
	ULONG	Value;
}	RTMP_REG_PAIR, *PRTMP_REG_PAIR;

//
// Register set pair for initialzation register set definition
//
typedef	struct	_RTMP_RF_REGS
{
	UCHAR   Channel;
	ULONG	R1;
	ULONG   R2;
	ULONG   R3;
	ULONG   R4;
}	RTMP_RF_REGS, *PRTMP_RF_REGS;

typedef	struct	_RTMP_RF_REGS_1
{
	UCHAR   Channel;
	ULONG	TempR2;
	ULONG	R1;
	ULONG   R2;
	ULONG   R3;
	ULONG   R4;
}	RTMP_RF_REGS_1, *PRTMP_RF_REGS_1;
//
//  Queue structure and macros
//
typedef struct  _QUEUE_ENTRY    {
    struct _QUEUE_ENTRY     *Next;
}   QUEUE_ENTRY, *PQUEUE_ENTRY;

// Queue structure
typedef struct  _QUEUE_HEADER   {
    PQUEUE_ENTRY    Head;
    PQUEUE_ENTRY    Tail;
    ULONG			Number;
}   QUEUE_HEADER, *PQUEUE_HEADER;

#define InitializeQueueHeader(QueueHeader)              \
{                                                       \
    (QueueHeader)->Head = (QueueHeader)->Tail = NULL;   \
    (QueueHeader)->Number = 0;							\
}

#define RemoveHeadQueue(QueueHeader)                \
(QueueHeader)->Head;                                \
{                                                   \
    PQUEUE_ENTRY pNext;                             \
    ASSERT((QueueHeader)->Head);                    \
    pNext = (QueueHeader)->Head->Next;              \
    (QueueHeader)->Head = pNext;                    \
    if (pNext == NULL)                              \
        (QueueHeader)->Tail = NULL;                 \
    (QueueHeader)->Number--;						\
}

#define InsertHeadQueue(QueueHeader, QueueEntry)            \
{                                                           \
    ((PQUEUE_ENTRY)QueueEntry)->Next = (QueueHeader)->Head; \
    (QueueHeader)->Head = (PQUEUE_ENTRY)(QueueEntry);       \
    if ((QueueHeader)->Tail == NULL)                        \
        (QueueHeader)->Tail = (PQUEUE_ENTRY)(QueueEntry);   \
    (QueueHeader)->Number++;								\
}

#define InsertTailQueue(QueueHeader, QueueEntry)                \
{                                                               \
    ((PQUEUE_ENTRY)QueueEntry)->Next = NULL;                    \
    if ((QueueHeader)->Tail)                                    \
        (QueueHeader)->Tail->Next = (PQUEUE_ENTRY)(QueueEntry); \
    else                                                        \
        (QueueHeader)->Head = (PQUEUE_ENTRY)(QueueEntry);       \
    (QueueHeader)->Tail = (PQUEUE_ENTRY)(QueueEntry);           \
    (QueueHeader)->Number++;									\
}

//
//  Macros for flag and ref count operations
//
#define RTMP_SET_FLAG(_M, _F)       ((_M)->Flags |= (_F))
#define RTMP_CLEAR_FLAG(_M, _F)     ((_M)->Flags &= ~(_F))
#define RTMP_CLEAR_FLAGS(_M)        ((_M)->Flags = 0)
#define RTMP_TEST_FLAG(_M, _F)      (((_M)->Flags & (_F)) != 0)
#define RTMP_TEST_FLAGS(_M, _F)     (((_M)->Flags & (_F)) == (_F))

#define RTMP_INC_REF(_A)            NdisInterlockedIncrement(&(_A)->RefCount)
#define RTMP_DEC_REF(_A)            NdisInterlockedDecrement(&(_A)->RefCount); ASSERT(_A->RefCount >= 0)
#define RTMP_GET_REF(_A)            ((_A)->RefCount)

#define RTMP_INC_RCV_REF(_A)        ((_A)->RcvRefCount++)
#define RTMP_DEC_RCV_REF(_A)        ((_A)->RcvRefCount--)
#define RTMP_GET_RCV_REF(_A)        ((_A)->RcvRefCount)

#define RTMP_INC_SEND_REF(_A)       ((_A)->SendRefCount++)
#define RTMP_DEC_SEND_REF(_A)       ((_A)->SendRefCount--)
#define RTMP_GET_SEND_REF(_A)       ((_A)->SendRefCount)

#define RTMP_OFFSET(field)          ((UINT)FIELD_OFFSET(RTMP_ADAPTER, field))
#define RTMP_SIZE(field)            sizeof(((PRT2570ADAPTER)0)->field)
#define PORT_OFFSET(field)          ((UINT)FIELD_OFFSET(PORT_CONFIG, field))
#define PORT_SIZE(field)            sizeof(((PPORT_CONFIG)0)->field)

#undef	NdisMoveMemory
#undef	NdisZeroMemory
#undef	NdisFillMemory
#undef	NdisEqualMemory

#define	NdisMoveMemory(Destination, Source, Length)	RTMPMoveMemory(Destination, Source, Length)
#define	NdisZeroMemory(Destination, Length)			RTMPZeroMemory(Destination, Length)
#define	NdisFillMemory(Destination, Length, Fill)	RTMPFillMemory(Destination, Length, Fill)
#define	NdisEqualMemory(Source1, Source2, Length)	RTMPEqualMemory(Source1, Source2, Length)

//blue,#define RTMP_IO_READ32(_A, _R, _pV) RTUSBReadMACRegister((_A), (_R), (_pV))
//blue,#define RTMP_IO_WRITE32(_A, _R, _V) RTUSBReadMACRegister((_A), (_R), (_V))
//
//  Statistic counter structure
//
//mandatory counters from general and Ethernet statistics objects
typedef struct _COUNTER_802_3
{
    // General Stats
	ULONG		GoodTransmits;
	ULONG		GoodReceives;
	ULONG		TxErrors;
	ULONG		RxErrors;
	ULONG		RxNoBuffer;

    // Ethernet Stats
	ULONG		RcvAlignmentErrors;
	ULONG		OneCollision;
	ULONG		MoreCollisions;

}   COUNTER_802_3, *PCOUNTER_802_3;
//OID_802_11_STATISTICS
typedef struct _COUNTER_802_11 {
    ULONG           Length;
    LARGE_INTEGER   TransmittedFragmentCount;
    LARGE_INTEGER   MulticastTransmittedFrameCount;
    LARGE_INTEGER   FailedCount;
    LARGE_INTEGER   NoRetryCount;
    LARGE_INTEGER   RetryCount;
    LARGE_INTEGER   MultipleRetryCount;
    LARGE_INTEGER   RTSSuccessCount;
    LARGE_INTEGER   RTSFailureCount;
    LARGE_INTEGER   ACKFailureCount;
    LARGE_INTEGER   FrameDuplicateCount;
    LARGE_INTEGER   ReceivedFragmentCount;
    LARGE_INTEGER   MulticastReceivedFrameCount;
    LARGE_INTEGER   FCSErrorCount;
} COUNTER_802_11, *PCOUNTER_802_11;
//proprietary counters
typedef struct _COUNTER_RALINK {
    ULONG           TransmittedByteCount;   // both successful and failure, used to calculate TX throughput
    ULONG           ReceivedByteCount;      // both CRC okay and CRC error, used to calculate RX throughput
    ULONG           BeenDisassociatedCount;
    ULONG           BadCQIAutoRecoveryCount;
    ULONG           PoorCQIRoamingCount;
    ULONG           MgmtRingFullCount;
    ULONG           RxCount;
    ULONG           DecryptCount;
    ULONG           RxRingErrCount;

⌨️ 快捷键说明

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