/*
* This is part of rtl8187 OpenSource driver.
* Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com>
* Released under the terms of GPL (General Public Licence)
*
* Parts of this driver are based on the GPL part of the
* official realtek driver
*
* Parts of this driver are based on the rtl8192 driver skeleton
* from Patric Schenke & Andres Salomon
*
* Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
*
* We want to thank the Authors of those projects and the Ndiswrapper
* project Authors.
*/
#ifndef R819xU_H
#define R819xU_H
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/netdevice.h>
#include <linux/usb.h>
#include <linux/etherdevice.h>
#include <linux/delay.h>
#include <linux/rtnetlink.h>
#include <linux/wireless.h>
#include <linux/timer.h>
#include <linux/proc_fs.h>
#include <linux/if_arp.h>
#include <linux/random.h>
#include <asm/io.h>
#include "ieee80211/ieee80211.h"
#define RTL8192U
#define RTL819xU_MODULE_NAME "rtl819xU"
/* HW security */
#define FALSE 0
#define TRUE 1
#define MAX_KEY_LEN 61
#define KEY_BUF_SIZE 5
#define BIT0 0x00000001
#define BIT1 0x00000002
#define BIT2 0x00000004
#define BIT3 0x00000008
#define BIT4 0x00000010
#define BIT5 0x00000020
#define BIT6 0x00000040
#define BIT7 0x00000080
#define BIT8 0x00000100
#define BIT9 0x00000200
#define BIT10 0x00000400
#define BIT11 0x00000800
#define BIT12 0x00001000
#define BIT13 0x00002000
#define BIT14 0x00004000
#define BIT15 0x00008000
#define BIT16 0x00010000
#define BIT17 0x00020000
#define BIT18 0x00040000
#define BIT19 0x00080000
#define BIT20 0x00100000
#define BIT21 0x00200000
#define BIT22 0x00400000
#define BIT23 0x00800000
#define BIT24 0x01000000
#define BIT25 0x02000000
#define BIT26 0x04000000
#define BIT27 0x08000000
#define BIT28 0x10000000
#define BIT29 0x20000000
#define BIT30 0x40000000
#define BIT31 0x80000000
#define Rx_Smooth_Factor 20
#define DMESG(x, a...)
#define DMESGW(x, a...)
#define DMESGE(x, a...)
extern u32 rt_global_debug_component;
#define RT_TRACE(component, x, args...) \
do { \
if (rt_global_debug_component & component) \
pr_debug("RTL8192U: " x "\n", ##args); \
} while (0)
#define COMP_TRACE BIT0 /* Function call tracing. */
#define COMP_DBG BIT1
#define COMP_INIT BIT2 /* Driver initialization/halt/reset. */
#define COMP_RECV BIT3 /* Receive data path. */
#define COMP_SEND BIT4 /* Send data path. */
#define COMP_IO BIT5
/* 802.11 Power Save mode or System/Device Power state. */
#define COMP_POWER BIT6
/* 802.11 link related: join/start BSS, leave BSS. */
#define COMP_EPROM BIT7
#define COMP_SWBW BIT8 /* Bandwidth switch. */
#define COMP_POWER_TRACKING BIT9 /* 8190 TX Power Tracking */
#define COMP_TURBO BIT10 /* Turbo Mode */
#define COMP_QOS BIT11
#define COMP_RATE BIT12 /* Rate Adaptive mechanism */
#define COMP_RM BIT13 /* Radio Measurement */
#define COMP_DIG BIT14
#define COMP_PHY BIT15
#define COMP_CH BIT16 /* Channel setting debug */
#define COMP_TXAGC BIT17 /* Tx power */
#define COMP_HIPWR BIT18 /* High Power Mechanism */
#define COMP_HALDM BIT19 /* HW Dynamic Mechanism */
#define COMP_SEC BIT20 /* Event handling */
#define COMP_LED BIT21
#define COMP_RF BIT22
#define COMP_RXDESC BIT23 /* Rx desc information for SD3 debug */
/* 11n or 8190 specific code */
#define COMP_FIRMWARE BIT24 /* Firmware downloading */
#define COMP_HT BIT25 /* 802.11n HT related information */
#define COMP_AMSDU BIT26 /* A-MSDU Debugging */
#define COMP_SCAN BIT27
#define COMP_DOWN BIT29 /* rm driver module */
#define COMP_RESET BIT30 /* Silent reset */
#define COMP_ERR BIT31 /* Error out, always on */
#define RTL819x_DEBUG
#ifdef RTL819x_DEBUG
#define RTL8192U_ASSERT(expr) \
do { \
if (!(expr)) { \
pr_debug("Assertion failed! %s, %s, %s, line = %d\n", \
#expr, __FILE__, __func__, __LINE__); \
} \
} while (0)
/*
* Debug out data buf.
* If you want to print DATA buffer related BA,
* please set ieee80211_debug_level to DATA|BA
*/
#define RT_DEBUG_DATA(level, data, datalen) \
do { \
if ((rt_global_debug_component & (level)) == (level)) { \
int i; \
u8 *pdata = (u8 *) data; \
pr_debug("RTL8192U: %s()\n", __func__); \
for (i = 0; i < (int)(datalen); i++) { \
printk("%2x ", pdata[i]); \
if ((i+1)%16 == 0) \
printk("\n"); \
} \
printk("\n"); \
} \
} while (0)
#else
#define RTL8192U_ASSERT(expr) do {} while (0)
#define RT_DEBUG_DATA(level, data, datalen) do {} while (0)
#endif /* RTL8169_DEBUG */
/* Queue Select Value in TxDesc */
#define QSLT_BK 0x1
#define QSLT_BE 0x0
#define QSLT_VI 0x4
#define QSLT_VO 0x6
#define QSLT_BEACON 0x10
#define QSLT_HIGH 0x11
#define QSLT_MGNT 0x12
#define QSLT_CMD 0x13
#define DESC90_RATE1M 0x00
#define DESC90_RATE2M 0x01
#define DESC90_RATE5_5M 0x02
#define DESC90_RATE11M 0x03
#define DESC90_RATE6M 0x04
#define DESC90_RATE9M 0x05
#define DESC90_RATE12M 0x06
#define DESC90_RATE18M 0x07
#define DESC90_RATE24M 0x08
#define DESC90_RATE36M 0x09
#define DESC90_RATE48M 0x0a
#define DESC90_RATE54M 0x0b
#define DESC90_RATEMCS0 0x00
#define DESC90_RATEMCS1 0x01
#define DESC90_RATEMCS2 0x02
#define DESC90_RATEMCS3 0x03
#define DESC90_RATEMCS4 0x04
#define DESC90_RATEMCS5 0x05
#define DESC90_RATEMCS6 0x06
#define DESC90_RATEMCS7 0x07
#define DESC90_RATEMCS8 0x08
#define DESC90_RATEMCS9 0x09
#define DESC90_RATEMCS10 0x0a
#define DESC90_RATEMCS11 0x0b
#define DESC90_RATEMCS12 0x0c
#define DESC90_RATEMCS13 0x0d
#define DESC90_RATEMCS14 0x0e
#define DESC90_RATEMCS15 0x0f
#define DESC90_RATEMCS32 0x20
#define RTL819X_DEFAULT_RF_TYPE RF_1T2R
#define IEEE80211_WATCH_DOG_TIME 2000
#define PHY_Beacon_RSSI_SLID_WIN_MAX 10
/* For Tx Power Tracking */
#define OFDM_Table_Length 19
#define CCK_Table_length 12
/* For rtl819x */
typedef struct _tx_desc_819x_usb {
/* DWORD 0 */
u16 PktSize;
u8 Offset;
u8 Reserved0:3;
u8 CmdInit:1;
u8 LastSeg:1;
u8 FirstSeg:1;
u8 LINIP:1;
u8 OWN:1;
/* DWORD 1 */
u8 TxFWInfoSize;