📄 rt2570sw.h
字号:
/*************************************************************************** * RT2x00 SourceForge Project - http://rt2x00.sourceforge.net * * * * 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. * * * * Licensed under the GNU GPL * * Original code supplied under license from RaLink Inc, 2004. * ***************************************************************************//*************************************************************************** * Module Name: rt2570sw.h * * Abstract: * * Revision History: * Who When What * -------- ---------- ------------------------------------ * Name Date Modification logs * Jan Lee 2005-06-01 Release * Ivo 02-06-2005 Debug flag fix * FelipeaA 02-06-2005 Added Conceptronic C54RU * MathiasK 02-06-2005 Added F5D7050,UB801R * MarkW 02-08-2005 Added MSI 6861 * PeterF 27-06-2005 Added GN-WBKG * zak 03-07-2005 Added second GN-WBKG * PedroP 04-07-2005 Added EMINENT 3035 * MarkW 06-12-2005 Added Linksys@Home ***************************************************************************/#ifndef __vnetsw_h_OK__#define __vnetsw_h_OK__#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)#include <linux/kthread.h>#endif//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_BYTESextern 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 RTUSB_DEVICES { \ { USB_DEVICE(0x0411, 0x0066)}, /* Melco */ \ { USB_DEVICE(0x0411, 0x0067)}, /* Melco */ \ { USB_DEVICE(0x050d, 0x7050)}, /* Belkin */ \ { USB_DEVICE(0x050d, 0x7051)}, /* Belkin */ \ { USB_DEVICE(0x050d, 0x705a)}, /* Belkin */ \ { USB_DEVICE(0x06f8, 0xe000)}, /* GUILLEMOT */ \ { USB_DEVICE(0x0707, 0xee13)}, /* SMC */ \ { USB_DEVICE(0x0b05, 0x1706)}, /* ASUS */ \ { USB_DEVICE(0x0b05, 0x1707)}, /* ASUS */ \ { USB_DEVICE(0x0db0, 0x6861)}, /* MSI */ \ { USB_DEVICE(0x0db0, 0x6865)}, /* MSI */ \ { USB_DEVICE(0x0db0, 0x6869)}, /* MSI */ \ { USB_DEVICE(0x1044, 0x8001)}, /* Gigabyte */ \ { USB_DEVICE(0x1044, 0x8007)}, /* Gigabyte */ \ { USB_DEVICE(0x114b, 0x0110)}, /* Spairon */ \ { USB_DEVICE(0x13b1, 0x000d)}, /* Cisco Systems */ \ { USB_DEVICE(0x13b1, 0x0011)}, /* Cisco Systems */ \ { USB_DEVICE(0x13b1, 0x001a)}, /* Cisco Systems */ \ { USB_DEVICE(0x148f, 0x1706)}, /* Ralink */ \ { USB_DEVICE(0x148f, 0x2570)}, /* Ralink */ \ { USB_DEVICE(0x148f, 0x2573)}, /* CNET CWD-854 */ \ { USB_DEVICE(0x148f, 0x9020)}, /* Ralink */ \ { USB_DEVICE(0x14b2, 0x3c02)}, /* Conceptronic */ \ { USB_DEVICE(0x14f8, 0x2570)}, /* Eminent */ \ { USB_DEVICE(0x2001, 0x3c00)}, /* D-LINK */ \ { USB_DEVICE(0x07d1, 0x3c03)}, /* D-LINK */ \ { USB_DEVICE(0x0411, 0x008b)}, /* Nintendo */ \ { USB_DEVICE(0x5a57, 0x0260)}, /* Zinwell */ \ { USB_DEVICE(0x0eb0, 0x9020)}, /* Novatech */ \ {0,} \}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//#ifdef RT2500_DBGextern ULONG debug;#define DBGPRINT(Level, fmt, args...) \{ \ if (Level <= debug) \ { \ printk(KERN_DEBUG NIC_DBG_STRING fmt, ## args); \ } \}#define DBGPRINT_RAW(Level, fmt, args...) \ { \ if (Level <= debug) \ { \ printk(fmt, ## args); \ } \}#else /* RT2500_DBG */#define DBGPRINT(Level, fmt, args...)#define DBGPRINT_RAW(Level, fmt, args...)#endif /* RT2500_DBG */# 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 0x01typedef 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); \}#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)#define RTUSBUp(pAd, semaphore) \{ \ if(pAd->MLMEThr_pid>0) \ up(semaphore); \}#define RTUSBCMDUp(pAd, semaphore) \{ \ if(pAd->RTUSBCmdThr_pid>0) \ up(semaphore); \}#else#define RTUSBUp(pAd, semaphore) \{ \ if(pAd->MLMEThr_active) \ up(semaphore); \}#define RTUSBCMDUp(pAd, semaphore) \{ \ if(pAd->RTUSBCmdThr_active) \ up(semaphore); \}#endif//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 + -