?? rt2570sw.h
字號:
/*
***************************************************************************
* Ralink Tech Inc.
* 4F, No. 2 Technology 5th Rd.
* Science-based Industrial Park
* Hsin-chu, Taiwan, R.O.C.
*
* (c) Copyright 2002-2004, Ralink Technology, Inc.
*
* 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., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
************************************************************************
Module Name:
rt2570sw.h
Abstract:
Revision History:
Who When What
-------- ---------- ----------------------------------------------
Name Date Modification logs
Jan Lee 2005-06-01 Release
*/
#ifndef __vnetsw_h_OK__
#define __vnetsw_h_OK__
//red,extern unsigned long NIC_VENDOR_DRIVER_VERSION;//blue
////////////////////////////////////////////////////////////////////////////
// Frame Sizes
////////////////////////////////////////////////////////////////////////////
#define MAC_ADDRESS_LENGTH 6
#define HEADER_SIZE 14
#define MAXIMUM_PACKET_SIZE 1500
#define MAX_QUEUE_SIZE 100
#define USB_TX_HEADER_SIZE 8//WLength+TxRate+PaddingBytes+Reserved
#define USB_RX_HEADER_SIZE 12
#define WIRELESS_HEADER_OVERHEAD 18
#define MAX_TX_PADDING_BYTES 50
#define MAX_RX_PADDING_BYTES 66
#define CRC32_BYTES 4
#define MAX_WIRELESS_SIZE WIRELESS_HEADER_OVERHEAD + HEADER_SIZE + MAXIMUM_PACKET_SIZE + CRC32_BYTES
extern unsigned long flagg;
typedef UCHAR ADDRESS[MAC_ADDRESS_LENGTH];
////////////////////////////////////////////////////////////////////////////
// NDIS related definitions
////////////////////////////////////////////////////////////////////////////
#define MAX_MULTICAST_ADDRESSES 32
#define MAX_LOOKAHEAD_SIZE MAXIMUM_PACKET_SIZE + HEADER_SIZE
#define TRANSMIT_BUFFER_SPACE 0x3000
#define RECEIVE_BUFFER_SPACE 0x4000
#define MAXIMUM_SEND_PACKETS 8
#define OPER_RATE_SIZE 4
#define SUPPORTED_RATES_SET_1 0
#define SUPPORTED_RATES_SET_2 1
////////////////////////////////////////////////////////////////////////////
// Memory Macros
////////////////////////////////////////////////////////////////////////////
#define FreeMemory(_buffer) kfree(_buffer)
////////////////////////////////////////////////////////////////////////////
// 802,11 related definitions
////////////////////////////////////////////////////////////////////////////
#define ESS_ID_SIZE 32
#define AD_HOC_MODE 1
#define INFRASTRUCTURE_MODE 2
#define WEP_KEY_SIZE 13 //128-bit encryption
#define PREAMBLE_TYPE_LONG 0
#define PREAMBLE_TYPE_SHORT 1
////////////////////////////////////////////////////////////////////////////
// used to track information on usb pipes in use
////////////////////////////////////////////////////////////////////////////
typedef struct __BULKUSB_PIPEINFO {
BOOLEAN fPipeOpened;
} BULKUSB_PIPEINFO, *PBULKUSB_PIPEINFO;
//#pragma pack (push, 1)
#define RTVID1 0x148f //ralink
#define RTPID1 0x2570
#define RTVID2 0xb05 //Asus
#define RTPID2 0x1706
#define RTVID3 0x2001 //alpha
#define RTPID3 0x3c00
#define RTVID4 0x0B05 //MSI
#define RTPID4 0x1706
#define RTVID5 0x0B05 //MSI
#define RTPID5 0x1707
#define RTVID6 0x0707 //smc
#define RTPID6 0xEE13
#define GEMTEKVID 0x13B1 //gemtek
#define GEMTEKPID1 0x000D
#define GEMTEKPID2 0x0011
#define RTUSB_DEVICES { \
{USB_DEVICE(RTVID1,RTPID1)}, \
{USB_DEVICE(RTVID2,RTPID2)}, \
{USB_DEVICE(RTVID3,RTPID3)}, \
{USB_DEVICE(RTVID4,RTPID4)}, \
{USB_DEVICE(RTVID5,RTPID5)}, \
{USB_DEVICE(RTVID6,RTPID6)}, \
{USB_DEVICE(GEMTEKVID,GEMTEKPID1)}, \
{USB_DEVICE(GEMTEKVID,GEMTEKPID2)}, \
{USB_DEVICE(0,0)}} /* end marker */
typedef struct urb *purbb_t;
typedef struct usb_ctrlrequest devctrlrequest;
// for vendor-specific control operations
#define CONTROL_TIMEOUT_MS (500) /* msec */
#define CONTROL_TIMEOUT_JIFFIES ((CONTROL_TIMEOUT_MS * HZ)/1000)
/* map devrequest fields onto usb_ctrlrequest's */
#define DEVREQ_REQUEST(x) ((x)->bRequest)
#define DEVREQ_REQUESTTYPE(x) ((x)->bRequestType)
#define DEVREQ_VALUE(x) ((x)->wValue)
#define DEVREQ_INDEX(x) ((x)->wIndex)
#define DEVREQ_LENGTH(x) ((x)->wLength)
#define PURB purbb_t
#define PIRP PVOID
#define PMDL PVOID
#define NDIS_OID UINT
//
// MACRO for debugging information
//
#if 1
extern ULONG RTDebugLevel;
#define DBGPRINT(Level, fmt, args...) \
{ \
if (Level <= RTDebugLevel) \
{ \
printk(NIC_DBG_STRING); \
printk(KERN_DEBUG fmt, ## args); \
} \
}
#define DBGPRINT_RAW(Level, fmt, args...) \
{ \
if (Level <= RTDebugLevel) \
{ \
printk(" "); \
printk(KERN_DEBUG fmt, ## args); \
} \
}
#else
#define DBGPRINT(Level, fmt, args...)
#define DBGPRINT_RAW(Level, fmt, args...)
#endif
# define assert(expr) \
if(unlikely(!(expr))) { \
printk(KERN_ERR "Assertion failed! %s,%s,%s,line=%d\n", \
#expr,__FILE__,__FUNCTION__,__LINE__); \
}
//
// Defines the state of the LAN media
//
typedef enum _NDIS_MEDIA_STATE
{
NdisMediaStateConnected,
NdisMediaStateDisconnected
} NDIS_MEDIA_STATE, *PNDIS_MEDIA_STATE;
#define NdisMSetInformationComplete(handle, status) \
{ \
}
#define NdisMIndicateStatusComplete(handle) \
{ \
}
#define NdisMIndicateStatus(_M, _G, _SB, _BS) \
{ \
}
//
// The following structure defines the device power states.
//
typedef enum _NDIS_DEVICE_POWER_STATE
{
NdisDeviceStateUnspecified = 0,
NdisDeviceStateD0,
NdisDeviceStateD1,
NdisDeviceStateD2,
NdisDeviceStateD3,
NdisDeviceStateMaximum
} NDIS_DEVICE_POWER_STATE, *PNDIS_DEVICE_POWER_STATE;
#define ETH_LENGTH_OF_ADDRESS 6
#define STATUS_SUCCESS 0x00
#define STATUS_UNSUCCESSFUL 0x01
typedef LONG NTSTATUS;
typedef NTSTATUS *PNTSTATUS;
//
// spin_lock enhanced for Nested spin lock
//
#define NdisAllocateSpinLock(lock) \
{ \
spin_lock_init(lock); \
}
#define NdisReleaseSpinLock(lock) \
{ \
if (in_interrupt()) \
{ \
spin_unlock_irqrestore(lock, flagg); \
} \
else \
{ \
spin_unlock(lock); \
} \
}
#define NdisAcquireSpinLock(lock) \
{ \
if (in_interrupt()) \
spin_lock_irqsave(lock, flagg); \
else \
spin_lock(lock); \
}
#define RTUSBFreeSkbBuffer(skb) \
{ \
dev_kfree_skb_any(skb); \
}
#define RTUSBUp(pAd, semaphore) \
{ \
if(pAd->MLMEThr_pid>0) \
up(semaphore); \
}
#define RTUSBCMDUp(pAd, semaphore) \
{ \
if(pAd->RTUSBCmdThr_pid>0) \
up(semaphore); \
}
//Setup Packet used in Ctrl urb's filler....
#define FILL_REQUEST(a,aa,ab,ac,ad,ae)\
do {\
(a)->devreq->request = aa;\
(a)->devreq->requesttype = ab;\
(a)->devreq->value = cpu_to_le16(ac);\
(a)->devreq->index = cpu_to_le16(ad);\
(a)->devreq->length = cpu_to_le16(ae);\
}while(0);
// direction is specified in TransferFlags
#define URB_FUNCTION_RESERVED0 0x0016
//
// These are for sending vendor and class commands
// on the default pipe
//
// direction is specified in TransferFlags
//
#define URB_FUNCTION_VENDOR_DEVICE 0x0017
#define URB_FUNCTION_VENDOR_INTERFACE 0x0018
#define URB_FUNCTION_VENDOR_ENDPOINT 0x0019
#define URB_FUNCTION_VENDOR_OTHER 0x0020
#define URB_FUNCTION_CLASS_DEVICE 0x001A
#define URB_FUNCTION_CLASS_INTERFACE 0x001B
#define URB_FUNCTION_CLASS_ENDPOINT 0x001C
#define URB_FUNCTION_CLASS_OTHER 0x001F
//
// Reserved function codes
//
#define URB_FUNCTION_RESERVED 0x001D
#define URB_FUNCTION_GET_CONFIGURATION 0x0026
#define URB_FUNCTION_GET_INTERFACE 0x0027
#define URB_FUNCTION_LAST 0x0029
//define Vendor Command Constant
#define CMD_VendorReset 0x01
#define CMD_Disconnect 0x02
#define CMD_FunctionSwitch 0x03
#define CMD_SetTestMode 0x04
#define CMD_ClearTestMode 0x05
#define CMD_WriteMacRegister 0x06
#define CMD_ReadMacRegister 0x07
#define CMD_EEPROMWrite 0x08
#define CMD_EEPROMRead 0x09
#define CMD_MultipleRead 0x0A
#define CMD_MultipleWrite 0x0B
#define CMD_SingleRead 0x0C
#define CMD_SingleWrite 0x0D
#define NdisMSleep mdelay
// Assert MACRO to make sure program running
//
#undef ASSERT
#define ASSERT(x) \
{ \
if (!(x)) \
{ \
printk(KERN_WARNING __FILE__ ":%d assert " #x "failed\n", __LINE__); \
} \
}
#if 0
#undef MOD_INC_USE_COUNT
#define MOD_INC_USE_COUNT do { } while (0)
#undef MOD_DEC_USE_COUNT
#define MOD_DEC_USE_COUNT do { } while (0)
#endif
//add by james
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -