2 This is part of rtl8187 OpenSource driver.
3 Copyright (C) Andrea Merello 2004-2005 <andreamrl@tiscali.it>
4 Released under the terms of GPL (General Public Licence)
6 Parts of this driver are based on the GPL part of the
7 official realtek driver
9 Parts of this driver are based on the rtl8192 driver skeleton
10 from Patric Schenke & Andres Salomon
12 Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
14 We want to tanks the Authors of those projects and the Ndiswrapper
21 #include <linux/module.h>
22 #include <linux/kernel.h>
23 //#include <linux/config.h>
24 #include <linux/init.h>
25 #include <linux/ioport.h>
26 #include <linux/sched.h>
27 #include <linux/types.h>
28 #include <linux/slab.h>
29 #include <linux/netdevice.h>
30 #include <linux/pci.h>
31 //#include <linux/usb.h>
32 #include <linux/etherdevice.h>
33 #include <linux/delay.h>
34 #include <linux/rtnetlink.h> //for rtnl_lock()
35 #include <linux/wireless.h>
36 #include <linux/timer.h>
37 #include <linux/proc_fs.h> // Necessary because we use the proc fs
38 #include <linux/if_arp.h>
39 #include <linux/random.h>
40 #include <linux/version.h>
42 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
43 #include <asm/semaphore.h>
45 #include "ieee80211.h"
50 #define RTL819xE_MODULE_NAME "rtl819xE"
51 //added for HW security, john.0629
54 #define MAX_KEY_LEN 61
55 #define KEY_BUF_SIZE 5
57 #define BIT0 0x00000001
58 #define BIT1 0x00000002
59 #define BIT2 0x00000004
60 #define BIT3 0x00000008
61 #define BIT4 0x00000010
62 #define BIT5 0x00000020
63 #define BIT6 0x00000040
64 #define BIT7 0x00000080
65 #define BIT8 0x00000100
66 #define BIT9 0x00000200
67 #define BIT10 0x00000400
68 #define BIT11 0x00000800
69 #define BIT12 0x00001000
70 #define BIT13 0x00002000
71 #define BIT14 0x00004000
72 #define BIT15 0x00008000
73 #define BIT16 0x00010000
74 #define BIT17 0x00020000
75 #define BIT18 0x00040000
76 #define BIT19 0x00080000
77 #define BIT20 0x00100000
78 #define BIT21 0x00200000
79 #define BIT22 0x00400000
80 #define BIT23 0x00800000
81 #define BIT24 0x01000000
82 #define BIT25 0x02000000
83 #define BIT26 0x04000000
84 #define BIT27 0x08000000
85 #define BIT28 0x10000000
86 #define BIT29 0x20000000
87 #define BIT30 0x40000000
88 #define BIT31 0x80000000
90 #define Rx_Smooth_Factor 20
91 /* 2007/06/04 MH Define sliding window for RSSI history. */
92 #define PHY_RSSI_SLID_WIN_MAX 100
93 #define PHY_Beacon_RSSI_SLID_WIN_MAX 10
95 #define IC_VersionCut_D 0x3
96 #define IC_VersionCut_E 0x4
98 #if 0 //we need to use RT_TRACE instead DMESG as RT_TRACE will clearly show debug level wb.
99 #define DMESG(x,a...) printk(KERN_INFO RTL819xE_MODULE_NAME ": " x "\n", ## a)
100 #define DMESGW(x,a...) printk(KERN_WARNING RTL819xE_MODULE_NAME ": WW:" x "\n", ## a)
101 #define DMESGE(x,a...) printk(KERN_WARNING RTL819xE_MODULE_NAME ": EE:" x "\n", ## a)
103 #define DMESG(x,a...)
104 #define DMESGW(x,a...)
105 #define DMESGE(x,a...)
106 extern u32 rt_global_debug_component
;
107 #define RT_TRACE(component, x, args...) \
108 do { if(rt_global_debug_component & component) \
109 printk(KERN_DEBUG RTL819xE_MODULE_NAME ":" x "\n" , \
113 #define COMP_TRACE BIT0 // For function call tracing.
114 #define COMP_DBG BIT1 // Only for temporary debug message.
115 #define COMP_INIT BIT2 // during driver initialization / halt / reset.
118 #define COMP_RECV BIT3 // Reveive part data path.
119 #define COMP_SEND BIT4 // Send part path.
120 #define COMP_IO BIT5 // I/O Related. Added by Annie, 2006-03-02.
121 #define COMP_POWER BIT6 // 802.11 Power Save mode or System/Device Power state related.
122 #define COMP_EPROM BIT7 // 802.11 link related: join/start BSS, leave BSS.
123 #define COMP_SWBW BIT8 // For bandwidth switch.
124 #define COMP_SEC BIT9// For Security.
127 #define COMP_TURBO BIT10 // For Turbo Mode related. By Annie, 2005-10-21.
128 #define COMP_QOS BIT11 // For QoS.
130 #define COMP_RATE BIT12 // For Rate Adaptive mechanism, 2006.07.02, by rcnjko. #define COMP_EVENTS 0x00000080 // Event handling
131 #define COMP_RXDESC BIT13 // Show Rx desc information for SD3 debug. Added by Annie, 2006-07-15.
132 #define COMP_PHY BIT14
133 #define COMP_DIG BIT15 // For DIG, 2006.09.25, by rcnjko.
134 #define COMP_TXAGC BIT16 // For Tx power, 060928, by rcnjko.
135 #define COMP_HALDM BIT17 // For HW Dynamic Mechanism, 061010, by rcnjko.
136 #define COMP_POWER_TRACKING BIT18 //FOR 8190 TX POWER TRACKING
137 #define COMP_EVENTS BIT19 // Event handling
139 #define COMP_RF BIT20 // For RF.
140 //1!!!!!!!!!!!!!!!!!!!!!!!!!!!
141 //1//1Attention Please!!!<11n or 8190 specific code should be put below this line>
142 //1!!!!!!!!!!!!!!!!!!!!!!!!!!!
144 #define COMP_FIRMWARE BIT21 //for firmware downloading
145 #define COMP_HT BIT22 // For 802.11n HT related information. by Emily 2006-8-11
147 #define COMP_RESET BIT23
148 #define COMP_CMDPKT BIT24
149 #define COMP_SCAN BIT25
150 #define COMP_IPS BIT26
151 #define COMP_DOWN BIT27 // for rm driver module
152 #define COMP_INTR BIT28 // for interrupt
153 #define COMP_ERR BIT31 // for error out, always on
156 #define RTL819x_DEBUG
158 #define assert(expr) \
160 printk( "Assertion failed! %s,%s,%s,line=%d\n", \
161 #expr,__FILE__,__FUNCTION__,__LINE__); \
163 //wb added to debug out data buf
164 //if you want print DATA buffer related BA, please set ieee80211_debug_level to DATA|BA
165 #define RT_DEBUG_DATA(level, data, datalen) \
166 do{ if ((rt_global_debug_component & (level)) == (level)) \
169 u8* pdata = (u8*) data; \
170 printk(KERN_DEBUG RTL819xE_MODULE_NAME ": %s()\n", __FUNCTION__); \
171 for(i=0; i<(int)(datalen); i++) \
173 printk("%2x ", pdata[i]); \
174 if ((i+1)%16 == 0) printk("\n"); \
180 #define assert(expr) do {} while (0)
181 #define RT_DEBUG_DATA(level, data, datalen) do {} while(0)
182 #endif /* RTL8169_DEBUG */
186 // Queue Select Value in TxDesc
192 #define QSLT_BEACON 0x10
193 #define QSLT_HIGH 0x11
194 #define QSLT_MGNT 0x12
195 #define QSLT_CMD 0x13
197 #define DESC90_RATE1M 0x00
198 #define DESC90_RATE2M 0x01
199 #define DESC90_RATE5_5M 0x02
200 #define DESC90_RATE11M 0x03
201 #define DESC90_RATE6M 0x04
202 #define DESC90_RATE9M 0x05
203 #define DESC90_RATE12M 0x06
204 #define DESC90_RATE18M 0x07
205 #define DESC90_RATE24M 0x08
206 #define DESC90_RATE36M 0x09
207 #define DESC90_RATE48M 0x0a
208 #define DESC90_RATE54M 0x0b
209 #define DESC90_RATEMCS0 0x00
210 #define DESC90_RATEMCS1 0x01
211 #define DESC90_RATEMCS2 0x02
212 #define DESC90_RATEMCS3 0x03
213 #define DESC90_RATEMCS4 0x04
214 #define DESC90_RATEMCS5 0x05
215 #define DESC90_RATEMCS6 0x06
216 #define DESC90_RATEMCS7 0x07
217 #define DESC90_RATEMCS8 0x08
218 #define DESC90_RATEMCS9 0x09
219 #define DESC90_RATEMCS10 0x0a
220 #define DESC90_RATEMCS11 0x0b
221 #define DESC90_RATEMCS12 0x0c
222 #define DESC90_RATEMCS13 0x0d
223 #define DESC90_RATEMCS14 0x0e
224 #define DESC90_RATEMCS15 0x0f
225 #define DESC90_RATEMCS32 0x20
227 #define RTL819X_DEFAULT_RF_TYPE RF_1T2R
228 #define EEPROM_Default_LegacyHTTxPowerDiff 0x4
229 #define IEEE80211_WATCH_DOG_TIME 2000
232 typedef struct _tx_desc_819x_pci
{
274 }tx_desc_819x_pci
, *ptx_desc_819x_pci
;
277 typedef struct _tx_desc_cmd_819x_pci
{
302 }tx_desc_cmd_819x_pci
, *ptx_desc_cmd_819x_pci
;
305 typedef struct _tx_fwinfo_819x_pci
{
312 u8 Short
:1; //Short PLCP for CCK, or short GI for 11n MCS
313 u8 TxBandwidth
:1; // This is used for HT MCS rate only.
314 u8 TxSubCarrier
:2; // This is used for legacy OFDM rate only.
316 u8 AllowAggregation
:1;
317 u8 RtsHT
:1; //Interpre RtsRate field as high throughput data rate
318 u8 RtsShort
:1; //Short PLCP for CCK, or short GI for 11n MCS
319 u8 RtsBandwidth
:1; // This is used for HT MCS rate only.
320 u8 RtsSubcarrier
:2; // This is used for legacy OFDM rate only.
322 u8 EnableCPUDur
:1; //Enable firmware to recalculate and assign packet duration
333 }tx_fwinfo_819x_pci
, *ptx_fwinfo_819x_pci
;
335 typedef struct rtl8192_rx_info
{
337 struct net_device
*dev
;
340 typedef struct _rx_desc_819x_pci
{
363 }rx_desc_819x_pci
, *prx_desc_819x_pci
;
365 typedef struct _rx_fwinfo_819x_pci
{
386 }rx_fwinfo_819x_pci
, *prx_fwinfo_819x_pci
;
388 #define MAX_DEV_ADDR_SIZE 8 /* support till 64 bit bus width OS */
389 #define MAX_FIRMWARE_INFORMATION_SIZE 32 /*2006/04/30 by Emily forRTL8190*/
390 #define MAX_802_11_HEADER_LENGTH (40 + MAX_FIRMWARE_INFORMATION_SIZE)
391 #define ENCRYPTION_MAX_OVERHEAD 128
392 //#define USB_HWDESC_HEADER_LEN sizeof(tx_desc_819x_usb)
393 //#define TX_PACKET_SHIFT_BYTES (USB_HWDESC_HEADER_LEN + sizeof(tx_fwinfo_819x_usb))
394 #define MAX_FRAGMENT_COUNT 8
395 #define MAX_TRANSMIT_BUFFER_SIZE (1600+(MAX_802_11_HEADER_LENGTH+ENCRYPTION_MAX_OVERHEAD)*MAX_FRAGMENT_COUNT)
397 #define scrclng 4 // octets for crc32 (FCS, ICV)
398 /* 8190 Loopback Mode definition */
399 typedef enum _rtl819x_loopback
{
400 RTL819X_NO_LOOPBACK
= 0,
401 RTL819X_MAC_LOOPBACK
= 1,
402 RTL819X_DMA_LOOPBACK
= 2,
403 RTL819X_CCK_LOOPBACK
= 3,
406 /* due to rtl8192 firmware */
407 typedef enum _desc_packet_type_e
{
408 DESC_PACKET_TYPE_INIT
= 0,
409 DESC_PACKET_TYPE_NORMAL
= 1,
412 typedef enum _firmware_source
{
413 FW_SOURCE_IMG_FILE
= 0,
414 FW_SOURCE_HEADER_FILE
= 1, //from header file
415 }firmware_source_e
, *pfirmware_source_e
;
417 typedef enum _firmware_status
{
418 FW_STATUS_0_INIT
= 0,
419 FW_STATUS_1_MOVE_BOOT_CODE
= 1,
420 FW_STATUS_2_MOVE_MAIN_CODE
= 2,
421 FW_STATUS_3_TURNON_CPU
= 3,
422 FW_STATUS_4_MOVE_DATA_CODE
= 4,
423 FW_STATUS_5_READY
= 5,
426 typedef struct _rt_firmare_seg_container
{
429 }fw_seg_container
, *pfw_seg_container
;
431 typedef struct _rt_firmware
{
432 firmware_status_e firmware_status
;
433 u16 cmdpacket_frag_thresold
;
434 #define RTL8190_MAX_FIRMWARE_CODE_SIZE 64000 //64k
435 #define MAX_FW_INIT_STEP 3
436 u8 firmware_buf
[MAX_FW_INIT_STEP
][RTL8190_MAX_FIRMWARE_CODE_SIZE
];
437 u16 firmware_buf_size
[MAX_FW_INIT_STEP
];
438 }rt_firmware
, *prt_firmware
;
440 #define MAX_RECEIVE_BUFFER_SIZE 9100 // Add this to 9100 bytes to receive A-MSDU from RT-AP
442 /* Firmware Queue Layout */
443 #define NUM_OF_FIRMWARE_QUEUE 10
444 #define NUM_OF_PAGES_IN_FW 0x100
445 #define NUM_OF_PAGE_IN_FW_QUEUE_BE 0x0aa
446 #define NUM_OF_PAGE_IN_FW_QUEUE_BK 0x007
447 #define NUM_OF_PAGE_IN_FW_QUEUE_VI 0x024
448 #define NUM_OF_PAGE_IN_FW_QUEUE_VO 0x007
449 #define NUM_OF_PAGE_IN_FW_QUEUE_HCCA 0
450 #define NUM_OF_PAGE_IN_FW_QUEUE_CMD 0x2
451 #define NUM_OF_PAGE_IN_FW_QUEUE_MGNT 0x10
452 #define NUM_OF_PAGE_IN_FW_QUEUE_HIGH 0
453 #define NUM_OF_PAGE_IN_FW_QUEUE_BCN 0x4
454 #define NUM_OF_PAGE_IN_FW_QUEUE_PUB 0xd
455 #define APPLIED_RESERVED_QUEUE_IN_FW 0x80000000
456 #define RSVD_FW_QUEUE_PAGE_BK_SHIFT 0x00
457 #define RSVD_FW_QUEUE_PAGE_BE_SHIFT 0x08
458 #define RSVD_FW_QUEUE_PAGE_VI_SHIFT 0x10
459 #define RSVD_FW_QUEUE_PAGE_VO_SHIFT 0x18
460 #define RSVD_FW_QUEUE_PAGE_MGNT_SHIFT 0x10
461 #define RSVD_FW_QUEUE_PAGE_CMD_SHIFT 0x08
462 #define RSVD_FW_QUEUE_PAGE_BCN_SHIFT 0x00
463 #define RSVD_FW_QUEUE_PAGE_PUB_SHIFT 0x08
466 //#define RWCAM 0xA0 // Software read/write CAM config
467 //#define WCAMI 0xA4 // Software write CAM input content
468 //#define RCAMO 0xA8 // Output value from CAM according to 0xa0 setting
469 #define DCAM 0xAC // Debug CAM Interface
470 #define AESMSK_FC 0xB2 // AES Mask register for frame control (0xB2~0xB3). Added by Annie, 2006-03-06.
473 #define CAM_CONTENT_COUNT 8
474 //#define CFG_DEFAULT_KEY BIT5
475 #define CFG_VALID BIT15
477 //----------------------------------------------------------------------------
478 // 8187B WPA Config Register (offset 0xb0, 1 byte)
479 //----------------------------------------------------------------------------
480 #define SCR_UseDK 0x01
481 #define SCR_TxSecEnable 0x02
482 #define SCR_RxSecEnable 0x04
484 //----------------------------------------------------------------------------
485 // 8187B CAM Config Setting (offset 0xb0, 1 byte)
486 //----------------------------------------------------------------------------
487 #define CAM_VALID 0x8000
488 #define CAM_NOTVALID 0x0000
489 #define CAM_USEDK 0x0020
493 #define CAM_WEP40 0x01
494 #define CAM_TKIP 0x02
496 #define CAM_WEP104 0x05
498 //#define CAM_SIZE 16
499 #define TOTAL_CAM_ENTRY 16
500 #define CAM_ENTRY_LEN_IN_DW 6 // 6, unit: in u4byte. Added by Annie, 2006-05-25.
501 #define CAM_ENTRY_LEN_IN_BYTE (CAM_ENTRY_LEN_IN_DW*sizeof(u32)) // 24, unit: in u1byte. Added by Annie, 2006-05-25.
503 #define CAM_CONFIG_USEDK 1
504 #define CAM_CONFIG_NO_USEDK 0
506 #define CAM_WRITE 0x00010000
507 #define CAM_READ 0x00000000
508 #define CAM_POLLINIG 0x80000000
510 //=================================================================
511 //=================================================================
514 #define EPROM_93c46 0
515 #define EPROM_93c56 1
517 #define DEFAULT_FRAG_THRESHOLD 2342U
518 #define MIN_FRAG_THRESHOLD 256U
519 #define DEFAULT_BEACONINTERVAL 0x64U
520 #define DEFAULT_BEACON_ESSID "Rtl819xU"
522 #define DEFAULT_SSID ""
523 #define DEFAULT_RETRY_RTS 7
524 #define DEFAULT_RETRY_DATA 7
525 #define PRISM_HDR_SIZE 64
527 #define PHY_RSSI_SLID_WIN_MAX 100
530 typedef enum _WIRELESS_MODE
{
531 WIRELESS_MODE_UNKNOWN
= 0x00,
532 WIRELESS_MODE_A
= 0x01,
533 WIRELESS_MODE_B
= 0x02,
534 WIRELESS_MODE_G
= 0x04,
535 WIRELESS_MODE_AUTO
= 0x08,
536 WIRELESS_MODE_N_24G
= 0x10,
537 WIRELESS_MODE_N_5G
= 0x20
540 #define RTL_IOCTL_WPA_SUPPLICANT SIOCIWFIRSTPRIV+30
542 typedef struct buffer
550 typedef struct rtl_reg_debug
{
556 unsigned char length
;
558 unsigned char buf
[0xff];
563 typedef struct tx_pendingbuf
565 struct ieee80211_txb
*txb
;
572 typedef struct _rt_9x_tx_rate_history
{
575 // HT_MCS[0][]: BW=0 SG=0
576 // HT_MCS[1][]: BW=1 SG=0
577 // HT_MCS[2][]: BW=0 SG=1
578 // HT_MCS[3][]: BW=1 SG=1
580 }rt_tx_rahis_t
, *prt_tx_rahis_t
;
582 typedef struct _RT_SMOOTH_DATA_4RF
{
583 char elements
[4][100];//array to store values
584 u32 index
; //index to current array to store
585 u32 TotalNum
; //num of valid elements
586 u32 TotalVal
[4]; //sum of valid elements
587 }RT_SMOOTH_DATA_4RF
, *PRT_SMOOTH_DATA_4RF
;
589 typedef enum _tag_TxCmd_Config_Index
{
590 TXCMD_TXRA_HISTORY_CTRL
= 0xFF900000,
591 TXCMD_RESET_TX_PKT_BUFF
= 0xFF900001,
592 TXCMD_RESET_RX_PKT_BUFF
= 0xFF900002,
593 TXCMD_SET_TX_DURATION
= 0xFF900003,
594 TXCMD_SET_RX_RSSI
= 0xFF900004,
595 TXCMD_SET_TX_PWR_TRACKING
= 0xFF900005,
603 //unsigned long rxnolast;
604 //unsigned long rxnodata;
605 // unsigned long rxreset;
606 // unsigned long rxnopointer;
608 unsigned long rxframgment
;
609 unsigned long rxcmdpkt
[4]; //08/05/08 amy rx cmd element txfeedback/bcn report/cfg set/query
610 unsigned long rxurberr
;
611 unsigned long rxstaterr
;
612 unsigned long rxcrcerrmin
;//crc error (0-500)
613 unsigned long rxcrcerrmid
;//crc error (500-1000)
614 unsigned long rxcrcerrmax
;//crc error (>1000)
615 unsigned long received_rate_histogram
[4][32]; //0: Total, 1:OK, 2:CRC, 3:ICV, 2007 07 03 cosa
616 unsigned long received_preamble_GI
[2][32]; //0: Long preamble/GI, 1:Short preamble/GI
617 unsigned long rx_AMPDUsize_histogram
[5]; // level: (<4K), (4K~8K), (8K~16K), (16K~32K), (32K~64K)
618 unsigned long rx_AMPDUnum_histogram
[5]; // level: (<5), (5~10), (10~20), (20~40), (>40)
619 unsigned long numpacket_matchbssid
; // debug use only.
620 unsigned long numpacket_toself
; // debug use only.
621 unsigned long num_process_phyinfo
; // debug use only.
622 unsigned long numqry_phystatus
;
623 unsigned long numqry_phystatusCCK
;
624 unsigned long numqry_phystatusHT
;
625 unsigned long received_bwtype
[5]; //0: 20M, 1: funn40M, 2: upper20M, 3: lower20M, 4: duplicate
626 unsigned long txnperr
;
627 unsigned long txnpdrop
;
628 unsigned long txresumed
;
629 // unsigned long rxerr;
630 unsigned long rxoverflow
;
632 unsigned long txnpokint
;
633 // unsigned long txhpokint;
634 // unsigned long txhperr;
636 unsigned long shints
;
637 unsigned long txoverflow
;
638 // unsigned long rxdmafail;
639 // unsigned long txbeacon;
640 // unsigned long txbeaconerr;
641 unsigned long txlpokint
;
642 unsigned long txlpdrop
;
643 unsigned long txlperr
;
644 unsigned long txbeokint
;
645 unsigned long txbedrop
;
646 unsigned long txbeerr
;
647 unsigned long txbkokint
;
648 unsigned long txbkdrop
;
649 unsigned long txbkerr
;
650 unsigned long txviokint
;
651 unsigned long txvidrop
;
652 unsigned long txvierr
;
653 unsigned long txvookint
;
654 unsigned long txvodrop
;
655 unsigned long txvoerr
;
656 unsigned long txbeaconokint
;
657 unsigned long txbeacondrop
;
658 unsigned long txbeaconerr
;
659 unsigned long txmanageokint
;
660 unsigned long txmanagedrop
;
661 unsigned long txmanageerr
;
662 unsigned long txcmdpktokint
;
663 unsigned long txdatapkt
;
664 unsigned long txfeedback
;
665 unsigned long txfeedbackok
;
666 unsigned long txoktotal
;
667 unsigned long txokbytestotal
;
668 unsigned long txokinperiod
;
669 unsigned long txmulticast
;
670 unsigned long txbytesmulticast
;
671 unsigned long txbroadcast
;
672 unsigned long txbytesbroadcast
;
673 unsigned long txunicast
;
674 unsigned long txbytesunicast
;
675 unsigned long rxbytesunicast
;
676 unsigned long txfeedbackfail
;
677 unsigned long txerrtotal
;
678 unsigned long txerrbytestotal
;
679 unsigned long txerrmulticast
;
680 unsigned long txerrbroadcast
;
681 unsigned long txerrunicast
;
682 unsigned long txretrycount
;
683 unsigned long txfeedbackretry
;
685 unsigned long slide_signal_strength
[100];
686 unsigned long slide_evm
[100];
687 unsigned long slide_rssi_total
; // For recording sliding window's RSSI value
688 unsigned long slide_evm_total
; // For recording sliding window's EVM value
689 long signal_strength
; // Transformed, in dbm. Beautified signal strength for UI, not correct.
691 long last_signal_strength_inpercent
;
692 long recv_signal_power
; // Correct smoothed ss in Dbm, only used in driver to report real power now.
693 u8 rx_rssi_percentage
[4];
694 u8 rx_evm_percentage
[2];
696 rt_tx_rahis_t txrate
;
697 u32 Slide_Beacon_pwdb
[100]; //cosa add for beacon rssi
698 u32 Slide_Beacon_Total
; //cosa add for beacon rssi
699 RT_SMOOTH_DATA_4RF cck_adc_pwdb
;
700 u32 CurrentShowTxate
;
707 #define HAL_PRIME_CHNL_OFFSET_DONT_CARE 0
708 #define HAL_PRIME_CHNL_OFFSET_LOWER 1
709 #define HAL_PRIME_CHNL_OFFSET_UPPER 2
713 typedef struct ChnlAccessSetting
{
720 }*PCHANNEL_ACCESS_SETTING
,CHANNEL_ACCESS_SETTING
;
722 typedef struct _BB_REGISTER_DEFINITION
{
723 u32 rfintfs
; // set software control: // 0x870~0x877[8 bytes]
724 u32 rfintfi
; // readback data: // 0x8e0~0x8e7[8 bytes]
725 u32 rfintfo
; // output data: // 0x860~0x86f [16 bytes]
726 u32 rfintfe
; // output enable: // 0x860~0x86f [16 bytes]
727 u32 rf3wireOffset
; // LSSI data: // 0x840~0x84f [16 bytes]
728 u32 rfLSSI_Select
; // BB Band Select: // 0x878~0x87f [8 bytes]
729 u32 rfTxGainStage
; // Tx gain stage: // 0x80c~0x80f [4 bytes]
730 u32 rfHSSIPara1
; // wire parameter control1 : // 0x820~0x823,0x828~0x82b, 0x830~0x833, 0x838~0x83b [16 bytes]
731 u32 rfHSSIPara2
; // wire parameter control2 : // 0x824~0x827,0x82c~0x82f, 0x834~0x837, 0x83c~0x83f [16 bytes]
732 u32 rfSwitchControl
; //Tx Rx antenna control : // 0x858~0x85f [16 bytes]
733 u32 rfAGCControl1
; //AGC parameter control1 : // 0xc50~0xc53,0xc58~0xc5b, 0xc60~0xc63, 0xc68~0xc6b [16 bytes]
734 u32 rfAGCControl2
; //AGC parameter control2 : // 0xc54~0xc57,0xc5c~0xc5f, 0xc64~0xc67, 0xc6c~0xc6f [16 bytes]
735 u32 rfRxIQImbalance
; //OFDM Rx IQ imbalance matrix : // 0xc14~0xc17,0xc1c~0xc1f, 0xc24~0xc27, 0xc2c~0xc2f [16 bytes]
736 u32 rfRxAFE
; //Rx IQ DC ofset and Rx digital filter, Rx DC notch filter : // 0xc10~0xc13,0xc18~0xc1b, 0xc20~0xc23, 0xc28~0xc2b [16 bytes]
737 u32 rfTxIQImbalance
; //OFDM Tx IQ imbalance matrix // 0xc80~0xc83,0xc88~0xc8b, 0xc90~0xc93, 0xc98~0xc9b [16 bytes]
738 u32 rfTxAFE
; //Tx IQ DC Offset and Tx DFIR type // 0xc84~0xc87,0xc8c~0xc8f, 0xc94~0xc97, 0xc9c~0xc9f [16 bytes]
739 u32 rfLSSIReadBack
; //LSSI RF readback data // 0x8a0~0x8af [16 bytes]
740 }BB_REGISTER_DEFINITION_T
, *PBB_REGISTER_DEFINITION_T
;
742 typedef enum _RT_RF_TYPE_819xU
{
748 }RT_RF_TYPE_819xU
, *PRT_RF_TYPE_819xU
;
751 typedef struct _rate_adaptive
753 u8 rate_adaptive_disabled
;
757 u32 high_rssi_thresh_for_ra
;
758 u32 high2low_rssi_thresh_for_ra
;
759 u8 low2high_rssi_thresh_for_ra40M
;
760 u32 low_rssi_thresh_for_ra40M
;
761 u8 low2high_rssi_thresh_for_ra20M
;
762 u32 low_rssi_thresh_for_ra20M
;
763 u32 upper_rssi_threshold_ratr
;
764 u32 middle_rssi_threshold_ratr
;
765 u32 low_rssi_threshold_ratr
;
766 u32 low_rssi_threshold_ratr_40M
;
767 u32 low_rssi_threshold_ratr_20M
;
768 u8 ping_rssi_enable
; //cosa add for test
769 u32 ping_rssi_ratr
; //cosa add for test
770 u32 ping_rssi_thresh_for_ra
;//cosa add for test
773 } rate_adaptive
, *prate_adaptive
;
774 #define TxBBGainTableLength 37
775 #define CCKTxBBGainTableLength 23
776 typedef struct _txbbgain_struct
778 long txbb_iq_amplifygain
;
780 } txbbgain_struct
, *ptxbbgain_struct
;
782 typedef struct _ccktxbbgain_struct
784 //The Value is from a22 to a29 one Byte one time is much Safer
785 u8 ccktxbb_valuearray
[8];
786 } ccktxbbgain_struct
,*pccktxbbgain_struct
;
789 typedef struct _init_gain
797 } init_gain
, *pinit_gain
;
799 /* 2007/11/02 MH Define RF mode temporarily for test. */
800 typedef enum tag_Rf_Operatetion_State
807 typedef enum _RT_STATUS
{
812 }RT_STATUS
,*PRT_STATUS
;
814 typedef enum _RT_CUSTOMER_ID
817 RT_CID_8187_ALPHA0
= 1,
818 RT_CID_8187_SERCOMM_PS
= 2,
819 RT_CID_8187_HW_LED
= 3,
820 RT_CID_8187_NETGEAR
= 4,
822 RT_CID_819x_CAMEO
= 6,
823 RT_CID_819x_RUNTOP
= 7,
824 RT_CID_819x_Senao
= 8,
825 RT_CID_TOSHIBA
= 9, // Merge by Jacken, 2008/01/31.
826 RT_CID_819x_Netcore
= 10,
827 RT_CID_Nettronix
= 11,
831 }RT_CUSTOMER_ID
, *PRT_CUSTOMER_ID
;
833 //================================================================================
834 // LED customization.
835 //================================================================================
837 typedef enum _LED_STRATEGY_8190
{
838 SW_LED_MODE0
, // SW control 1 LED via GPIO0. It is default option.
839 SW_LED_MODE1
, // SW control for PCI Express
840 SW_LED_MODE2
, // SW control for Cameo.
841 SW_LED_MODE3
, // SW contorl for RunTop.
842 SW_LED_MODE4
, // SW control for Netcore
843 SW_LED_MODE5
, //added by vivi, for led new mode, DLINK
844 SW_LED_MODE6
, //added by vivi, for led new mode, PRONET
845 HW_LED
, // HW control 2 LEDs, LED0 and LED1 (there are 4 different control modes)
846 }LED_STRATEGY_8190
, *PLED_STRATEGY_8190
;
848 #define CHANNEL_PLAN_LEN 10
852 typedef struct _TX_FWINFO_STRUCUTRE
{
863 u8 AllowAggregation
:1;
882 typedef struct _TX_FWINFO_8190PCI
{
889 u8 Short
:1; //Short PLCP for CCK, or short GI for 11n MCS
890 u8 TxBandwidth
:1; // This is used for HT MCS rate only.
891 u8 TxSubCarrier
:2; // This is used for legacy OFDM rate only.
893 u8 AllowAggregation
:1;
894 u8 RtsHT
:1; //Interpre RtsRate field as high throughput data rate
895 u8 RtsShort
:1; //Short PLCP for CCK, or short GI for 11n MCS
896 u8 RtsBandwidth
:1; // This is used for HT MCS rate only.
897 u8 RtsSubcarrier
:2; // This is used for legacy OFDM rate only.
899 u8 EnableCPUDur
:1; //Enable firmware to recalculate and assign packet duration
904 u32 TxPerPktInfoFeedback
:1; // 1: indicate that the transimission info of this packet should be gathered by Firmware and retured by Rx Cmd.
906 u32 TxAGCOffset
:4; // Only 90 support
907 u32 TxAGCSign
:1; // Only 90 support
908 u32 RAW_TXD
:1; // MAC will send data in txpktbuffer without any processing,such as CRC check
909 u32 Retry_Limit
:4; // CCX Support relative retry limit FW page only support 4 bits now.
915 }TX_FWINFO_8190PCI
, *PTX_FWINFO_8190PCI
;
917 typedef struct _phy_ofdm_rx_status_report_819xpci
932 }phy_sts_ofdm_819xpci_t
;
934 typedef struct _phy_cck_rx_status_report_819xpci
936 /* For CCK rate descriptor. This is a unsigned 8:1 variable. LSB bit presend
937 0.5. And MSB 7 bts presend a signed value. Range from -64~+63.5. */
941 }phy_sts_cck_819xpci_t
;
943 typedef struct _phy_ofdm_rx_status_rxsc_sgien_exintfflag
{
948 }phy_ofdm_rx_status_rxsc_sgien_exintfflag
;
950 typedef enum _RT_OP_MODE
{
952 RT_OP_MODE_INFRASTRUCTURE
,
955 }RT_OP_MODE
, *PRT_OP_MODE
;
958 /* 2007/11/02 MH Define RF mode temporarily for test. */
959 typedef enum tag_Rf_OpType
961 RF_OP_By_SW_3wire
= 0,
966 typedef enum _RESET_TYPE
{
967 RESET_TYPE_NORESET
= 0x00,
968 RESET_TYPE_NORMAL
= 0x01,
969 RESET_TYPE_SILENT
= 0x02
972 typedef struct _tx_ring
{
975 struct _tx_ring
* next
;
976 }__attribute__ ((packed
)) tx_ring
, * ptx_ring
;
978 struct rtl8192_tx_ring
{
979 tx_desc_819x_pci
*desc
;
982 unsigned int entries
;
983 struct sk_buff_head queue
;
986 #define NIC_SEND_HANG_THRESHOLD_NORMAL 4
987 #define NIC_SEND_HANG_THRESHOLD_POWERSAVE 8
988 #define MAX_TX_QUEUE 9 // BK, BE, VI, VO, HCCA, MANAGEMENT, COMMAND, HIGH, BEACON.
990 #define MAX_RX_COUNT 64
991 #define MAX_TX_QUEUE_COUNT 9
993 typedef struct r8192_priv
995 struct pci_dev
*pdev
;
996 //added for maintain info from eeprom
1000 u8 eeprom_CustomerID
;
1001 u16 eeprom_ChannelPlan
;
1002 RT_CUSTOMER_ID CustomerID
;
1003 LED_STRATEGY_8190 LedStrategy
;
1008 struct ieee80211_device
*ieee80211
;
1009 bool being_init_adapter
;
1011 short card_8192
; /* O: rtl8192, 1:rtl8185 V B/C, 2:rtl8185 V D */
1012 u8 card_8192_version
; /* if TCR reports card V B/C this discriminates */
1013 // short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
1015 enum card_type
{PCI
,MINIPCI
,CARDBUS
,USB
/*rtl8187*/}card_type
;
1017 short plcp_preamble_mode
;
1019 spinlock_t irq_lock
;
1020 spinlock_t irq_th_lock
;
1022 spinlock_t rf_ps_lock
;
1023 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
1024 struct semaphore mutex
;
1028 spinlock_t rf_lock
; //used to lock rf write operation added by wb
1032 // short irq_enabled;
1033 // struct net_device *dev; //comment this out.
1039 rx_desc_819x_pci
*rx_ring
;
1040 dma_addr_t rx_ring_dma
;
1041 unsigned int rx_idx
;
1042 struct sk_buff
*rx_buf
[MAX_RX_COUNT
];
1047 struct sk_buff
*rx_skb
;
1050 dma_addr_t rxringdma
;
1051 struct buffer
*rxbuffer
;
1052 struct buffer
*rxbufferhead
;
1053 short rx_skb_complete
;
1055 struct rtl8192_tx_ring tx_ring
[MAX_TX_QUEUE_COUNT
];
1060 //struct tx_pendingbuf txnp_pending;
1061 //struct tasklet_struct irq_tx_tasklet;
1062 struct tasklet_struct irq_rx_tasklet
;
1063 struct tasklet_struct irq_tx_tasklet
;
1064 struct tasklet_struct irq_prepare_beacon_tasklet
;
1065 struct buffer
*txmapbufs
;
1066 struct buffer
*txbkpbufs
;
1067 struct buffer
*txbepbufs
;
1068 struct buffer
*txvipbufs
;
1069 struct buffer
*txvopbufs
;
1070 struct buffer
*txcmdbufs
;
1071 struct buffer
*txmapbufstail
;
1072 struct buffer
*txbkpbufstail
;
1073 struct buffer
*txbepbufstail
;
1074 struct buffer
*txvipbufstail
;
1075 struct buffer
*txvopbufstail
;
1076 struct buffer
*txcmdbufstail
;
1077 /* adhoc/master mode stuff */
1078 ptx_ring txbeaconringtail
;
1079 dma_addr_t txbeaconringdma
;
1080 ptx_ring txbeaconring
;
1082 struct buffer
*txbeaconbufs
;
1083 struct buffer
*txbeaconbufstail
;
1090 ptx_ring txmapringtail
;
1091 ptx_ring txbkpringtail
;
1092 ptx_ring txbepringtail
;
1093 ptx_ring txvipringtail
;
1094 ptx_ring txvopringtail
;
1095 ptx_ring txcmdringtail
;
1096 ptx_ring txmapringhead
;
1097 ptx_ring txbkpringhead
;
1098 ptx_ring txbepringhead
;
1099 ptx_ring txvipringhead
;
1100 ptx_ring txvopringhead
;
1101 ptx_ring txcmdringhead
;
1102 dma_addr_t txmapringdma
;
1103 dma_addr_t txbkpringdma
;
1104 dma_addr_t txbepringdma
;
1105 dma_addr_t txvipringdma
;
1106 dma_addr_t txvopringdma
;
1107 dma_addr_t txcmdringdma
;
1108 // u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
1109 // u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
1110 // u8 cck_txpwr_base;
1111 // u8 ofdm_txpwr_base;
1112 // u8 challow[15]; //channels from 1 to 14, 0 not used
1114 short crcmon
; //if 1 allow bad crc frame reception in monitor mode
1117 // struct timer_list scan_timer;
1118 /*short scanpending;
1120 // spinlock_t scan_lock;
1122 //u8 active_scan_num;
1123 struct semaphore wx_sem
;
1124 struct semaphore rf_sem
; //used to lock rf write operation added by wb, modified by david
1131 // short rcr_csense;
1132 u8 rf_type
; //0 means 1T2R, 1 means 2T4R
1133 RT_RF_TYPE_819xU rf_chip
;
1136 short (*rf_set_sens
)(struct net_device
*dev
,short sens
);
1137 u8 (*rf_set_chan
)(struct net_device
*dev
,u8 ch
);
1138 void (*rf_close
)(struct net_device
*dev
);
1139 void (*rf_init
)(struct net_device
*dev
);
1144 struct iw_statistics wstats
;
1145 struct proc_dir_entry
*dir_dev
;
1150 // dma_addr_t rxringdma;
1152 #ifdef THOMAS_BEACON
1155 #ifdef THOMAS_TASKLET
1156 atomic_t irt_counter
;//count for irq_rx_tasklet
1158 #ifdef JACKSON_NEW_RX
1159 struct sk_buff
**pp_rxskb
;
1163 /* modified by davad for Rx process */
1164 struct sk_buff_head rx_queue
;
1165 struct sk_buff_head skb_queue
;
1166 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
1167 struct tq_struct qos_activate
;
1169 struct work_struct qos_activate
;
1172 atomic_t tx_pending
[0x10];//UART_PRIORITY+1
1174 struct urb
*rxurb_task
;
1176 //2 Tx Related variables
1177 u16 ShortRetryLimit
;
1180 u8 RegCWinMin
; // For turbo mode CW adaptive. Added by Annie, 2005-10-27.
1182 u32 LastRxDescTSFHigh
;
1183 u32 LastRxDescTSFLow
;
1186 //2 Rx Related variables
1187 u16 EarlyRxThreshold
;
1197 struct ChnlAccessSetting ChannelAccessSetting
;
1199 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1200 struct work_struct reset_wq
;
1202 struct tq_struct reset_wq
;
1205 /**********************************************************/
1207 // Data Rate Config. Added by Annie, 2006-04-13.
1215 prt_firmware pFirmware
;
1216 rtl819x_loopback_e LoopbackMode
;
1217 firmware_source_e firmware_source
;
1218 bool AutoloadFailFlag
;
1219 u16 EEPROMTxPowerDiff
;
1220 u16 EEPROMAntPwDiff
; // Antenna gain offset from B/C/D to A
1221 u8 EEPROMThermalMeter
;
1223 u8 EEPROMCrystalCap
;
1225 u8 EEPROMTxPowerLevelCCK
[14];// CCK channel 1~14
1226 // The following definition is for eeprom 93c56
1227 u8 EEPROMRfACCKChnl1TxPwLevel
[3]; //RF-A CCK Tx Power Level at channel 7
1228 u8 EEPROMRfAOfdmChnlTxPwLevel
[3];//RF-A CCK Tx Power Level at [0],[1],[2] = channel 1,7,13
1229 u8 EEPROMRfCCCKChnl1TxPwLevel
[3]; //RF-C CCK Tx Power Level at channel 7
1230 u8 EEPROMRfCOfdmChnlTxPwLevel
[3];//RF-C CCK Tx Power Level at [0],[1],[2] = channel 1,7,13
1231 u8 EEPROMTxPowerLevelCCK_V1
[3];
1232 u8 EEPROMTxPowerLevelOFDM24G
[14]; // OFDM 2.4G channel 1~14
1233 u8 EEPROMTxPowerLevelOFDM5G
[24]; // OFDM 5G
1234 u8 EEPROMLegacyHTTxPowerDiff
; // Legacy to HT rate power diff
1235 bool bTXPowerDataReadFromEEPORM
;
1237 u16 RegChannelPlan
; // Channel Plan specifed by user, 15: following setting of EEPROM, 0-14: default channel plan index specified by user.
1241 // Rf off action for power save
1242 u8 bHwRfOffAction
; //0:No action, 1:By GPIO, 2:By Disable
1244 BB_REGISTER_DEFINITION_T PHYRegDef
[4]; //Radio A/B/C/D
1245 // Read/write are allow for following hardware information variables
1246 u32 MCSTxPowerLevelOriginalOffset
[6];
1247 u32 CCKTxPowerLevelOriginalOffset
;
1248 u8 TxPowerLevelCCK
[14]; // CCK channel 1~14
1249 u8 TxPowerLevelCCK_A
[14]; // RF-A, CCK channel 1~14
1250 u8 TxPowerLevelCCK_C
[14];
1251 u8 TxPowerLevelOFDM24G
[14]; // OFDM 2.4G channel 1~14
1252 u8 TxPowerLevelOFDM5G
[14]; // OFDM 5G
1253 u8 TxPowerLevelOFDM24G_A
[14]; // RF-A, OFDM 2.4G channel 1~14
1254 u8 TxPowerLevelOFDM24G_C
[14]; // RF-C, OFDM 2.4G channel 1~14
1255 u8 LegacyHTTxPowerDiff
; // Legacy to HT rate power diff
1257 char RF_C_TxPwDiff
; // Antenna gain offset, rf-c to rf-a
1258 u8 AntennaTxPwDiff
[3]; // Antenna gain offset, index 0 for B, 1 for C, and 2 for D
1259 u8 CrystalCap
; // CrystalCap.
1260 u8 ThermalMeter
[2]; // ThermalMeter, index 0 for RFIC0, and 1 for RFIC1
1261 //05/27/2008 cck power enlarge
1265 u8 CCKPresentAttentuation_20Mdefault
;
1266 u8 CCKPresentAttentuation_40Mdefault
;
1267 char CCKPresentAttentuation_difference
;
1268 char CCKPresentAttentuation
;
1269 // Use to calculate PWBD.
1271 long undecorated_smoothed_pwdb
;
1272 long undecorated_smoothed_cck_adc_pwdb
[4];
1274 u8 SwChnlInProgress
;
1277 u8 SetBWModeInProgress
;
1278 HT_CHANNEL_WIDTH CurrentChannelBW
;
1282 u8 nCur40MhzPrimeSC
; // Control channel sub-carrier
1283 // Joseph test for shorten RF configuration time.
1284 // We save RF reg0 in this variable to reduce RF reading.
1288 bool brfpath_rxenable
[4];
1290 struct timer_list watch_dog_timer
;
1292 //+by amy 080515 for dynamic mechenism
1293 //Add by amy Tx Power Control for Near/Far Range 2008/05/15
1294 bool bdynamic_txpower
; //bDynamicTxPower
1295 bool bDynamicTxHighPower
; // Tx high power state
1296 bool bDynamicTxLowPower
; // Tx low power state
1297 bool bLastDTPFlag_High
;
1298 bool bLastDTPFlag_Low
;
1300 bool bstore_last_dtpflag
;
1301 bool bstart_txctrl_bydtp
; //Define to discriminate on High power State or on sitesuvey to change Tx gain index
1302 //Add by amy for Rate Adaptive
1303 rate_adaptive rate_adaptive
;
1304 //Add by amy for TX power tracking
1305 //2008/05/15 Mars OPEN/CLOSE TX POWER TRACKING
1306 txbbgain_struct txbbgain_table
[TxBBGainTableLength
];
1307 u8 txpower_count
;//For 6 sec do tracking again
1308 bool btxpower_trackingInit
;
1311 u8 Record_CCK_20Mindex
;
1312 u8 Record_CCK_40Mindex
;
1313 //2007/09/10 Mars Add CCK TX Power Tracking
1314 ccktxbbgain_struct cck_txbbgain_table
[CCKTxBBGainTableLength
];
1315 ccktxbbgain_struct cck_txbbgain_ch14_table
[CCKTxBBGainTableLength
];
1316 u8 rfa_txpowertrackingindex
;
1317 u8 rfa_txpowertrackingindex_real
;
1318 u8 rfa_txpowertracking_default
;
1319 u8 rfc_txpowertrackingindex
;
1320 u8 rfc_txpowertrackingindex_real
;
1321 u8 rfc_txpowertracking_default
;
1322 bool btxpower_tracking
;
1325 //For Backup Initial Gain
1326 init_gain initgain_backup
;
1327 u8 DefaultInitialGain
[4];
1328 // For EDCA Turbo mode, Added by amy 080515.
1329 bool bis_any_nonbepkts
;
1330 bool bcurrent_turbo_EDCA
;
1332 bool bis_cur_rdlstate
;
1333 struct timer_list fsync_timer
;
1334 bool bfsync_processing
; // 500ms Fsync timer is active or not
1336 u32 rateCountDiffRecord
;
1337 u32 ContiuneDiffCount
;
1342 u8 framesyncMonitor
;
1343 //Added by amy 080516 for RX related
1345 u8 nrxAMPDU_aggr_num
;
1347 /*Last RxDesc TSF value*/
1348 u32 last_rxdesc_tsf_high
;
1349 u32 last_rxdesc_tsf_low
;
1354 bool RFChangeInProgress
; // RF Chnage in progress, by Bruce, 2007-10-30
1355 bool SetRFPowerStateInProgress
;
1357 //by amy for reset_count
1361 u32 txpower_checkcnt
;
1362 u32 txpower_tracking_callback_cnt
;
1363 u8 thermal_read_val
[40];
1364 u8 thermal_readback_index
;
1365 u32 ccktxpower_adjustcnt_not_ch14
;
1366 u32 ccktxpower_adjustcnt_ch14
;
1367 u8 tx_fwinfo_force_subcarriermode
;
1368 u8 tx_fwinfo_force_subcarrierval
;
1370 //by amy for silent reset
1371 RESET_TYPE ResetProgress
;
1372 bool bForcedSilentReset
;
1373 bool bDisableNormalResetCheck
;
1376 int IrpPendingCount
;
1377 bool bResetInProgress
;
1379 u8 InitialGainOperateType
;
1381 //define work item by amy 080526
1382 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1383 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
1384 struct delayed_work update_beacon_wq
;
1385 struct delayed_work watch_dog_wq
;
1386 struct delayed_work txpower_tracking_wq
;
1387 struct delayed_work rfpath_check_wq
;
1388 struct delayed_work gpio_change_rf_wq
;
1389 struct delayed_work initialgain_operate_wq
;
1391 struct work_struct update_beacon_wq
;
1392 struct work_struct watch_dog_wq
;
1393 struct work_struct txpower_tracking_wq
;
1394 struct work_struct rfpath_check_wq
;
1395 struct work_struct gpio_change_rf_wq
;
1396 struct work_struct initialgain_operate_wq
;
1398 struct workqueue_struct
*priv_wq
;
1400 struct tq_struct update_beacon_wq
;
1401 /* used for periodly scan */
1402 struct tq_struct txpower_tracking_wq
;
1403 struct tq_struct rfpath_check_wq
;
1404 struct tq_struct watch_dog_wq
;
1405 struct tq_struct gpio_change_rf_wq
;
1406 struct tq_struct initialgain_operate_wq
;
1411 // now mirging to rtl8187B
1414 LOW_PRIORITY = 0x02,
1421 BULK_PRIORITY
= 0x01,
1432 BEACON_PRIORITY
, //0x0A
1437 UART_PRIORITY
//0x0F
1445 #if 0 //defined in Qos.h
1446 //typedef u32 AC_CODING;
1447 #define AC0_BE 0 // ACI: 0x00 // Best Effort
1448 #define AC1_BK 1 // ACI: 0x01 // Background
1449 #define AC2_VI 2 // ACI: 0x10 // Video
1450 #define AC3_VO 3 // ACI: 0x11 // Voice
1451 #define AC_MAX 4 // Max: define total number; Should not to be used as a real enum.
1454 // ECWmin/ECWmax field.
1455 // Ref: WMM spec 2.2.2: WME Parameter Element, p.13.
1468 // Ref: WMM spec 2.2.2: WME Parameter Element, p.12.
1470 typedef union _ACI_AIFSN
{
1480 }ACI_AIFSN
, *PACI_AIFSN
;
1483 // AC Parameters Record Format.
1484 // Ref: WMM spec 2.2.2: WME Parameter Element, p.12.
1486 typedef union _AC_PARAM
{
1496 }AC_PARAM
, *PAC_PARAM
;
1499 bool init_firmware(struct net_device
*dev
);
1500 void rtl819xE_tx_cmd(struct net_device
*dev
, struct sk_buff
*skb
);
1501 short rtl8192_tx(struct net_device
*dev
, struct sk_buff
* skb
);
1502 u32
read_cam(struct net_device
*dev
, u8 addr
);
1503 void write_cam(struct net_device
*dev
, u8 addr
, u32 data
);
1504 u8
read_nic_byte(struct net_device
*dev
, int x
);
1505 u8
read_nic_byte_E(struct net_device
*dev
, int x
);
1506 u32
read_nic_dword(struct net_device
*dev
, int x
);
1507 u16
read_nic_word(struct net_device
*dev
, int x
) ;
1508 void write_nic_byte(struct net_device
*dev
, int x
,u8 y
);
1509 void write_nic_byte_E(struct net_device
*dev
, int x
,u8 y
);
1510 void write_nic_word(struct net_device
*dev
, int x
,u16 y
);
1511 void write_nic_dword(struct net_device
*dev
, int x
,u32 y
);
1512 void force_pci_posting(struct net_device
*dev
);
1514 void rtl8192_rtx_disable(struct net_device
*);
1515 void rtl8192_rx_enable(struct net_device
*);
1516 void rtl8192_tx_enable(struct net_device
*);
1518 void rtl8192_disassociate(struct net_device
*dev
);
1519 //void fix_rx_fifo(struct net_device *dev);
1520 void rtl8185_set_rf_pins_enable(struct net_device
*dev
,u32 a
);
1522 void rtl8192_set_anaparam(struct net_device
*dev
,u32 a
);
1523 void rtl8185_set_anaparam2(struct net_device
*dev
,u32 a
);
1524 void rtl8192_update_msr(struct net_device
*dev
);
1525 int rtl8192_down(struct net_device
*dev
);
1526 int rtl8192_up(struct net_device
*dev
);
1527 void rtl8192_commit(struct net_device
*dev
);
1528 void rtl8192_set_chan(struct net_device
*dev
,short ch
);
1529 void write_phy(struct net_device
*dev
, u8 adr
, u8 data
);
1530 void write_phy_cck(struct net_device
*dev
, u8 adr
, u32 data
);
1531 void write_phy_ofdm(struct net_device
*dev
, u8 adr
, u32 data
);
1532 void rtl8185_tx_antenna(struct net_device
*dev
, u8 ant
);
1533 void rtl8187_set_rxconf(struct net_device
*dev
);
1534 //short check_nic_enough_desc(struct net_device *dev, priority_t priority);
1535 void rtl8192_start_beacon(struct net_device
*dev
);
1536 void CamResetAllEntry(struct net_device
* dev
);
1537 void EnableHWSecurityConfig8192(struct net_device
*dev
);
1538 void setKey(struct net_device
*dev
, u8 EntryNo
, u8 KeyIndex
, u16 KeyType
, u8
*MacAddr
, u8 DefaultKey
, u32
*KeyContent
);
1539 void CamPrintDbgReg(struct net_device
* dev
);
1540 extern void dm_cck_txpower_adjust(struct net_device
*dev
,bool binch14
);
1541 extern void firmware_init_param(struct net_device
*dev
);
1542 extern RT_STATUS
cmpk_message_handle_tx(struct net_device
*dev
, u8
* codevirtualaddress
, u32 packettype
, u32 buffer_len
);
1543 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
1544 void rtl8192_hw_wakeup_wq (struct work_struct
*work
);
1546 void rtl8192_hw_wakeup_wq(struct net_device
*dev
);
1549 short rtl8192_is_tx_queue_empty(struct net_device
*dev
);
1551 void IPSEnter(struct net_device
*dev
);
1552 void IPSLeave(struct net_device
*dev
);