]> git.karo-electronics.de Git - mv-sheeva.git/blob - drivers/staging/rtl8187se/r8180.h
ad43cfa96d866563bdb9121eb17d326ffcb9bd8d
[mv-sheeva.git] / drivers / staging / rtl8187se / r8180.h
1 /*
2    This is part of rtl8180 OpenSource driver.
3    Copyright (C) Andrea Merello 2004-2005  <andreamrl@tiscali.it>
4    Released under the terms of GPL (General Public Licence)
5
6    Parts of this driver are based on the GPL part of the
7    official realtek driver
8
9    Parts of this driver are based on the rtl8180 driver skeleton
10    from Patric Schenke & Andres Salomon
11
12    Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
13
14    We want to tanks the Authors of those projects and the Ndiswrapper
15    project Authors.
16 */
17
18 #ifndef R8180H
19 #define R8180H
20
21
22 #define RTL8180_MODULE_NAME "r8180"
23 #define DMESG(x,a...) printk(KERN_INFO RTL8180_MODULE_NAME ": " x "\n", ## a)
24 #define DMESGW(x,a...) printk(KERN_WARNING RTL8180_MODULE_NAME ": WW:" x "\n", ## a)
25 #define DMESGE(x,a...) printk(KERN_WARNING RTL8180_MODULE_NAME ": EE:" x "\n", ## a)
26
27 #include <linux/module.h>
28 #include <linux/kernel.h>
29 //#include <linux/config.h>
30 #include <linux/init.h>
31 #include <linux/ioport.h>
32 #include <linux/sched.h>
33 #include <linux/types.h>
34 #include <linux/slab.h>
35 #include <linux/netdevice.h>
36 #include <linux/pci.h>
37 #include <linux/etherdevice.h>
38 #include <linux/delay.h>
39 #include <linux/rtnetlink.h>    //for rtnl_lock()
40 #include <linux/wireless.h>
41 #include <linux/timer.h>
42 #include <linux/proc_fs.h>      // Necessary because we use the proc fs
43 #include <linux/if_arp.h>
44 #include "ieee80211/ieee80211.h"
45 #include <asm/io.h>
46 //#include <asm/semaphore.h>
47
48 #define EPROM_93c46 0
49 #define EPROM_93c56 1
50
51 #define RTL_IOCTL_WPA_SUPPLICANT                SIOCIWFIRSTPRIV+30
52
53 #define DEFAULT_FRAG_THRESHOLD 2342U
54 #define MIN_FRAG_THRESHOLD     256U
55 //#define       MAX_FRAG_THRESHOLD     2342U
56 #define DEFAULT_RTS_THRESHOLD 2342U
57 #define MIN_RTS_THRESHOLD 0U
58 #define MAX_RTS_THRESHOLD 2342U
59 #define DEFAULT_BEACONINTERVAL 0x64U
60 #define DEFAULT_BEACON_ESSID "Rtl8180"
61
62 #define DEFAULT_SSID ""
63 #define DEFAULT_RETRY_RTS 7
64 #define DEFAULT_RETRY_DATA 7
65 #define PRISM_HDR_SIZE 64
66
67
68 #define MGNT_QUEUE                                              0
69 #define BK_QUEUE                                                1
70 #define BE_QUEUE                                                2
71 #define VI_QUEUE                                                3
72 #define VO_QUEUE                                                4
73 #define HIGH_QUEUE                                              5
74 #define BEACON_QUEUE                                    6
75
76 #define LOW_QUEUE                                               BE_QUEUE
77 #define NORMAL_QUEUE                                    MGNT_QUEUE
78
79 #define aSifsTime       10
80
81 #define sCrcLng         4
82 #define sAckCtsLng      112             // bits in ACK and CTS frames
83 //+by amy 080312
84 #define RATE_ADAPTIVE_TIMER_PERIOD      300
85
86 typedef enum _WIRELESS_MODE {
87         WIRELESS_MODE_UNKNOWN = 0x00,
88         WIRELESS_MODE_A = 0x01,
89         WIRELESS_MODE_B = 0x02,
90         WIRELESS_MODE_G = 0x04,
91         WIRELESS_MODE_AUTO = 0x08,
92 } WIRELESS_MODE;
93
94 typedef enum _VERSION_8185{
95         // RTL8185
96         VERSION_8185_UNKNOWN,
97         VERSION_8185_C, // C-cut
98         VERSION_8185_D, // D-cut
99         // RTL8185B
100         VERSION_8185B_B, // B-cut
101         VERSION_8185B_D, // D-cut
102         VERSION_8185B_E, // E-cut
103         //RTL8187S-PCIE
104         VERSION_8187S_B, // B-cut
105         VERSION_8187S_C, // C-cut
106         VERSION_8187S_D, // D-cut
107
108 }VERSION_8185,*PVERSION_8185;
109 typedef struct  ChnlAccessSetting {
110         u16 SIFS_Timer;
111         u16 DIFS_Timer;
112         u16 SlotTimeTimer;
113         u16 EIFS_Timer;
114         u16 CWminIndex;
115         u16 CWmaxIndex;
116 }*PCHANNEL_ACCESS_SETTING,CHANNEL_ACCESS_SETTING;
117
118 typedef enum{
119         NIC_8185 = 1,
120         NIC_8185B
121         } nic_t;
122
123 typedef u32 AC_CODING;
124 #define AC0_BE  0               // ACI: 0x00    // Best Effort
125 #define AC1_BK  1               // ACI: 0x01    // Background
126 #define AC2_VI  2               // ACI: 0x10    // Video
127 #define AC3_VO  3               // ACI: 0x11    // Voice
128 #define AC_MAX  4               // Max: define total number; Should not to be used as a real enum.
129
130 //
131 // ECWmin/ECWmax field.
132 // Ref: WMM spec 2.2.2: WME Parameter Element, p.13.
133 //
134 typedef union _ECW{
135         u8      charData;
136         struct
137         {
138                 u8      ECWmin:4;
139                 u8      ECWmax:4;
140         }f;     // Field
141 }ECW, *PECW;
142
143 //
144 // ACI/AIFSN Field.
145 // Ref: WMM spec 2.2.2: WME Parameter Element, p.12.
146 //
147 typedef union _ACI_AIFSN{
148         u8      charData;
149
150         struct
151         {
152                 u8      AIFSN:4;
153                 u8      ACM:1;
154                 u8      ACI:2;
155                 u8      Reserved:1;
156         }f;     // Field
157 }ACI_AIFSN, *PACI_AIFSN;
158
159 //
160 // AC Parameters Record Format.
161 // Ref: WMM spec 2.2.2: WME Parameter Element, p.12.
162 //
163 typedef union _AC_PARAM{
164         u32     longData;
165         u8      charData[4];
166
167         struct
168         {
169                 ACI_AIFSN       AciAifsn;
170                 ECW             Ecw;
171                 u16             TXOPLimit;
172         }f;     // Field
173 }AC_PARAM, *PAC_PARAM;
174
175 /* it is a wrong definition. -xiong-2006-11-17
176 typedef struct ThreeWireReg {
177         u16     longData;
178         struct {
179                 u8      enableB;
180                 u8      data;
181                 u8      clk;
182                 u8      read_write;
183         } struc;
184 } ThreeWireReg;
185 */
186
187 typedef union _ThreeWire{
188         struct _ThreeWireStruc{
189                 u16             data:1;
190                 u16             clk:1;
191                 u16             enableB:1;
192                 u16             read_write:1;
193                 u16             resv1:12;
194 //              u2Byte  resv2:14;
195 //              u2Byte  ThreeWireEnable:1;
196 //              u2Byte  resv3:1;
197         }struc;
198         u16                     longData;
199 }ThreeWireReg;
200
201
202 typedef struct buffer
203 {
204         struct buffer *next;
205         u32 *buf;
206         dma_addr_t dma;
207 } buffer;
208
209 //YJ,modified,080828
210 typedef struct Stats
211 {
212         unsigned long txrdu;
213         unsigned long rxrdu;
214         unsigned long rxnolast;
215         unsigned long rxnodata;
216 //      unsigned long rxreset;
217 //      unsigned long rxwrkaround;
218         unsigned long rxnopointer;
219         unsigned long txnperr;
220         unsigned long txresumed;
221         unsigned long rxerr;
222         unsigned long rxoverflow;
223         unsigned long rxint;
224         unsigned long txbkpokint;
225         unsigned long txbepoking;
226         unsigned long txbkperr;
227         unsigned long txbeperr;
228         unsigned long txnpokint;
229         unsigned long txhpokint;
230         unsigned long txhperr;
231         unsigned long ints;
232         unsigned long shints;
233         unsigned long txoverflow;
234         unsigned long rxdmafail;
235         unsigned long txbeacon;
236         unsigned long txbeaconerr;
237         unsigned long txlpokint;
238         unsigned long txlperr;
239         unsigned long txretry;//retry number  tony 20060601
240         unsigned long rxcrcerrmin;//crc error (0-500)
241         unsigned long rxcrcerrmid;//crc error (500-1000)
242         unsigned long rxcrcerrmax;//crc error (>1000)
243         unsigned long rxicverr;//ICV error
244 } Stats;
245
246 #define MAX_LD_SLOT_NUM 10
247 #define KEEP_ALIVE_INTERVAL                             20 // in seconds.
248 #define CHECK_FOR_HANG_PERIOD                   2 //be equal to watchdog check time
249 #define DEFAULT_KEEP_ALIVE_LEVEL                        1
250 #define DEFAULT_SLOT_NUM                                        2
251 #define POWER_PROFILE_AC                                        0
252 #define POWER_PROFILE_BATTERY                   1
253
254 typedef struct _link_detect_t
255 {
256         u32                             RxFrameNum[MAX_LD_SLOT_NUM];    // number of Rx Frame / CheckForHang_period  to determine link status
257         u16                             SlotNum;        // number of CheckForHang period to determine link status, default is 2
258         u16                             SlotIndex;
259
260         u32                             NumTxOkInPeriod;  //number of packet transmitted during CheckForHang
261         u32                             NumRxOkInPeriod;  //number of packet received during CheckForHang
262
263         u8                              IdleCount;     // (KEEP_ALIVE_INTERVAL / CHECK_FOR_HANG_PERIOD)
264         u32                             LastNumTxUnicast;
265         u32                             LastNumRxUnicast;
266
267         bool                            bBusyTraffic;    //when it is set to 1, UI cann't scan at will.
268 }link_detect_t, *plink_detect_t;
269
270 //YJ,modified,080828,end
271
272 //by amy for led
273 //================================================================================
274 // LED customization.
275 //================================================================================
276
277 typedef enum _LED_STRATEGY_8185{
278         SW_LED_MODE0, //
279         SW_LED_MODE1, //
280         HW_LED, // HW control 2 LEDs, LED0 and LED1 (there are 4 different control modes)
281 }LED_STRATEGY_8185, *PLED_STRATEGY_8185;
282 //by amy for led
283 //by amy for power save
284 typedef enum _LED_CTL_MODE{
285         LED_CTL_POWER_ON = 1,
286         LED_CTL_LINK = 2,
287         LED_CTL_NO_LINK = 3,
288         LED_CTL_TX = 4,
289         LED_CTL_RX = 5,
290         LED_CTL_SITE_SURVEY = 6,
291         LED_CTL_POWER_OFF = 7
292 }LED_CTL_MODE;
293
294 typedef enum _RT_RF_POWER_STATE
295 {
296         eRfOn,
297         eRfSleep,
298         eRfOff
299 }RT_RF_POWER_STATE;
300
301 enum    _ReasonCode{
302         unspec_reason   = 0x1,
303         auth_not_valid  = 0x2,
304         deauth_lv_ss    = 0x3,
305         inactivity              = 0x4,
306         ap_overload             = 0x5,
307         class2_err              = 0x6,
308         class3_err              = 0x7,
309         disas_lv_ss             = 0x8,
310         asoc_not_auth   = 0x9,
311
312         //----MIC_CHECK
313         mic_failure             = 0xe,
314         //----END MIC_CHECK
315
316         // Reason code defined in 802.11i D10.0 p.28.
317         invalid_IE              = 0x0d,
318         four_way_tmout  = 0x0f,
319         two_way_tmout   = 0x10,
320         IE_dismatch             = 0x11,
321         invalid_Gcipher = 0x12,
322         invalid_Pcipher = 0x13,
323         invalid_AKMP    = 0x14,
324         unsup_RSNIEver = 0x15,
325         invalid_RSNIE   = 0x16,
326         auth_802_1x_fail= 0x17,
327         ciper_reject            = 0x18,
328
329         // Reason code defined in 7.3.1.7, 802.1e D13.0, p.42. Added by Annie, 2005-11-15.
330         QoS_unspec              = 0x20, // 32
331         QAP_bandwidth   = 0x21, // 33
332         poor_condition  = 0x22, // 34
333         no_facility             = 0x23, // 35
334                                                         // Where is 36???
335         req_declined    = 0x25, // 37
336         invalid_param   = 0x26, // 38
337         req_not_honored= 0x27,  // 39
338         TS_not_created  = 0x2F, // 47
339         DL_not_allowed  = 0x30, // 48
340         dest_not_exist  = 0x31, // 49
341         dest_not_QSTA   = 0x32, // 50
342 };
343 typedef enum _RT_PS_MODE
344 {
345         eActive,        // Active/Continuous access.
346         eMaxPs,         // Max power save mode.
347         eFastPs         // Fast power save mode.
348 }RT_PS_MODE;
349 //by amy for power save
350 typedef struct r8180_priv
351 {
352         struct pci_dev *pdev;
353
354         short epromtype;
355         int irq;
356         struct ieee80211_device *ieee80211;
357
358         short card_8185; /* O: rtl8180, 1:rtl8185 V B/C, 2:rtl8185 V D, 3:rtl8185B */
359         short card_8185_Bversion; /* if TCR reports card V B/C this discriminates */
360         short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
361         short enable_gpio0;
362         enum card_type {PCI,MINIPCI,CARDBUS,USB/*rtl8187*/}card_type;
363         short hw_plcp_len;
364         short plcp_preamble_mode; // 0:auto 1:short 2:long
365
366         spinlock_t irq_lock;
367         spinlock_t irq_th_lock;
368         spinlock_t tx_lock;
369         spinlock_t ps_lock;
370         spinlock_t rf_ps_lock;
371
372         u16 irq_mask;
373         short irq_enabled;
374         struct net_device *dev;
375         short chan;
376         short sens;
377         short max_sens;
378         u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
379         u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
380         //u8 challow[15]; //channels from 1 to 14, 0 not used
381         u8 channel_plan;  // it's the channel plan index
382         short up;
383         short crcmon; //if 1 allow bad crc frame reception in monitor mode
384         short prism_hdr;
385
386         struct timer_list scan_timer;
387         /*short scanpending;
388         short stopscan;*/
389         spinlock_t scan_lock;
390         u8 active_probe;
391         //u8 active_scan_num;
392         struct semaphore wx_sem;
393         struct semaphore rf_state;
394         short hw_wep;
395
396         short digphy;
397         short antb;
398         short diversity;
399         u8 cs_treshold;
400         short rcr_csense;
401         short rf_chip;
402         u32 key0[4];
403         short (*rf_set_sens)(struct net_device *dev,short sens);
404         void (*rf_set_chan)(struct net_device *dev,short ch);
405         void (*rf_close)(struct net_device *dev);
406         void (*rf_init)(struct net_device *dev);
407         void (*rf_sleep)(struct net_device *dev);
408         void (*rf_wakeup)(struct net_device *dev);
409         //short rate;
410         short promisc;
411         /*stats*/
412         struct Stats stats;
413         struct _link_detect_t link_detect;  //YJ,add,080828
414         struct iw_statistics wstats;
415         struct proc_dir_entry *dir_dev;
416
417         /*RX stuff*/
418         u32 *rxring;
419         u32 *rxringtail;
420         dma_addr_t rxringdma;
421         struct buffer *rxbuffer;
422         struct buffer *rxbufferhead;
423         int rxringcount;
424         u16 rxbuffersize;
425
426         struct sk_buff *rx_skb;
427
428         short rx_skb_complete;
429
430         u32 rx_prevlen;
431
432         /*TX stuff*/
433 /*
434         u32 *txlpring;
435         u32 *txhpring;
436         u32 *txnpring;
437         dma_addr_t txlpringdma;
438         dma_addr_t txhpringdma;
439         dma_addr_t txnpringdma;
440         u32 *txlpringtail;
441         u32 *txhpringtail;
442         u32 *txnpringtail;
443         u32 *txlpringhead;
444         u32 *txhpringhead;
445         u32 *txnpringhead;
446         struct buffer *txlpbufs;
447         struct buffer *txhpbufs;
448         struct buffer *txnpbufs;
449         struct buffer *txlpbufstail;
450         struct buffer *txhpbufstail;
451         struct buffer *txnpbufstail;
452 */
453         u32 *txmapring;
454         u32 *txbkpring;
455         u32 *txbepring;
456         u32 *txvipring;
457         u32 *txvopring;
458         u32 *txhpring;
459         dma_addr_t txmapringdma;
460         dma_addr_t txbkpringdma;
461         dma_addr_t txbepringdma;
462         dma_addr_t txvipringdma;
463         dma_addr_t txvopringdma;
464         dma_addr_t txhpringdma;
465         u32 *txmapringtail;
466         u32 *txbkpringtail;
467         u32 *txbepringtail;
468         u32 *txvipringtail;
469         u32 *txvopringtail;
470         u32 *txhpringtail;
471         u32 *txmapringhead;
472         u32 *txbkpringhead;
473         u32 *txbepringhead;
474         u32 *txvipringhead;
475         u32 *txvopringhead;
476         u32 *txhpringhead;
477         struct buffer *txmapbufs;
478         struct buffer *txbkpbufs;
479         struct buffer *txbepbufs;
480         struct buffer *txvipbufs;
481         struct buffer *txvopbufs;
482         struct buffer *txhpbufs;
483         struct buffer *txmapbufstail;
484         struct buffer *txbkpbufstail;
485         struct buffer *txbepbufstail;
486         struct buffer *txvipbufstail;
487         struct buffer *txvopbufstail;
488         struct buffer *txhpbufstail;
489
490         int txringcount;
491         int txbuffsize;
492         //struct tx_pendingbuf txnp_pending;
493         //struct tasklet_struct irq_tx_tasklet;
494         struct tasklet_struct irq_rx_tasklet;
495         u8 dma_poll_mask;
496         //short tx_suspend;
497
498         /* adhoc/master mode stuff */
499         u32 *txbeaconringtail;
500         dma_addr_t txbeaconringdma;
501         u32 *txbeaconring;
502         int txbeaconcount;
503         struct buffer *txbeaconbufs;
504         struct buffer *txbeaconbufstail;
505         //char *master_essid;
506         //u16 master_beaconinterval;
507         //u32 master_beaconsize;
508         //u16 beacon_interval;
509
510         u8 retry_data;
511         u8 retry_rts;
512         u16 rts;
513
514 //add for RF power on power off by lizhaoming 080512
515         u8       RegThreeWireMode; // See "Three wire mode" defined above, 2006.05.31, by rcnjko.
516
517 //by amy for led
518         LED_STRATEGY_8185 LedStrategy;
519 //by amy for led
520
521 //by amy for power save
522         struct timer_list watch_dog_timer;
523         bool bInactivePs;
524         bool bSwRfProcessing;
525         RT_RF_POWER_STATE       eInactivePowerState;
526         RT_RF_POWER_STATE eRFPowerState;
527         u32 RfOffReason;
528         bool RFChangeInProgress;
529         bool bInHctTest;
530         bool SetRFPowerStateInProgress;
531         u8   RFProgType;
532         bool bLeisurePs;
533         RT_PS_MODE dot11PowerSaveMode;
534         //u32 NumRxOkInPeriod;   //YJ,del,080828
535         //u32 NumTxOkInPeriod;   //YJ,del,080828
536         u8   TxPollingTimes;
537
538         bool    bApBufOurFrame;// TRUE if AP buffer our unicast data , we will keep eAwake untill receive data or timeout.
539         u8      WaitBufDataBcnCount;
540         u8      WaitBufDataTimeOut;
541
542 //by amy for power save
543 //by amy for antenna
544         u8 EEPROMSwAntennaDiversity;
545         bool EEPROMDefaultAntenna1;
546         u8 RegSwAntennaDiversityMechanism;
547         bool bSwAntennaDiverity;
548         u8 RegDefaultAntenna;
549         bool bDefaultAntenna1;
550         u8 SignalStrength;
551         long Stats_SignalStrength;
552         long LastSignalStrengthInPercent; // In percentange, used for smoothing, e.g. Moving Average.
553         u8       SignalQuality; // in 0-100 index.
554         long Stats_SignalQuality;
555         long RecvSignalPower; // in dBm.
556         long Stats_RecvSignalPower;
557         u8       LastRxPktAntenna;      // +by amy 080312 Antenn which received the lasted packet. 0: Aux, 1:Main. Added by Roger, 2008.01.25.
558         u32 AdRxOkCnt;
559         long AdRxSignalStrength;
560         u8 CurrAntennaIndex;                    // Index to current Antenna (both Tx and Rx).
561         u8 AdTickCount;                         // Times of SwAntennaDiversityTimer happened.
562         u8 AdCheckPeriod;                               // # of period SwAntennaDiversityTimer to check Rx signal strength for SW Antenna Diversity.
563         u8 AdMinCheckPeriod;                    // Min value of AdCheckPeriod.
564         u8 AdMaxCheckPeriod;                    // Max value of AdCheckPeriod.
565         long AdRxSsThreshold;                   // Signal strength threshold to switch antenna.
566         long AdMaxRxSsThreshold;                        // Max value of AdRxSsThreshold.
567         bool bAdSwitchedChecking;               // TRUE if we shall shall check Rx signal strength for last time switching antenna.
568         long AdRxSsBeforeSwitched;              // Rx signal strength before we swithed antenna.
569         struct timer_list SwAntennaDiversityTimer;
570 //by amy for antenna
571 //{by amy 080312
572 //
573         // Crystal calibration.
574         // Added by Roger, 2007.12.11.
575         //
576         bool            bXtalCalibration; // Crystal calibration.
577         u8                      XtalCal_Xin; // Crystal calibration for Xin. 0~7.5pF
578         u8                      XtalCal_Xout; // Crystal calibration for Xout. 0~7.5pF
579         //
580         // Tx power tracking with thermal meter indication.
581         // Added by Roger, 2007.12.11.
582         //
583         bool            bTxPowerTrack; // Tx Power tracking.
584         u8                      ThermalMeter; // Thermal meter reference indication.
585         //
586         // Dynamic Initial Gain Adjustment Mechanism. Added by Bruce, 2007-02-14.
587         //
588         bool                            bDigMechanism; // TRUE if DIG is enabled, FALSE ow.
589         bool                            bRegHighPowerMechanism; // For High Power Mechanism. 061010, by rcnjko.
590         u32                                     FalseAlarmRegValue;
591         u8                                      RegDigOfdmFaUpTh; // Upper threhold of OFDM false alarm, which is used in DIG.
592         u8                                      DIG_NumberFallbackVote;
593         u8                                      DIG_NumberUpgradeVote;
594         // For HW antenna diversity, added by Roger, 2008.01.30.
595         u32                     AdMainAntennaRxOkCnt;           // Main antenna Rx OK count.
596         u32                     AdAuxAntennaRxOkCnt;            // Aux antenna Rx OK count.
597         bool            bHWAdSwitched;                          // TRUE if we has switched default antenna by HW evaluation.
598         // RF High Power upper/lower threshold.
599         u8                                      RegHiPwrUpperTh;
600         u8                                      RegHiPwrLowerTh;
601         // RF RSSI High Power upper/lower Threshold.
602         u8                                      RegRSSIHiPwrUpperTh;
603         u8                                      RegRSSIHiPwrLowerTh;
604         // Current CCK RSSI value to determine CCK high power, asked by SD3 DZ, by Bruce, 2007-04-12.
605         u8                      CurCCKRSSI;
606         bool        bCurCCKPkt;
607         //
608         // High Power Mechanism. Added by amy, 080312.
609         //
610         bool                                    bToUpdateTxPwr;
611         long                                    UndecoratedSmoothedSS;
612         long                                    UndercorateSmoothedRxPower;
613         u8                                              RSSI;
614         char                                    RxPower;
615          u8 InitialGain;
616          //For adjust Dig Threshhold during Legacy/Leisure Power Save Mode
617         u32                             DozePeriodInPast2Sec;
618          // Don't access BB/RF under disable PLL situation.
619         u8                                      InitialGainBackUp;
620          u8 RegBModeGainStage;
621 //by amy for rate adaptive
622     struct timer_list rateadapter_timer;
623         u32    RateAdaptivePeriod;
624         bool   bEnhanceTxPwr;
625         bool   bUpdateARFR;
626         int        ForcedDataRate; // Force Data Rate. 0: Auto, 0x02: 1M ~ 0x6C: 54M.)
627         u32     NumTxUnicast; //YJ,add,080828,for keep alive
628         u8      keepAliveLevel; //YJ,add,080828,for KeepAlive
629         unsigned long   NumTxOkTotal;
630         u16                                 LastRetryCnt;
631         u16                                     LastRetryRate;
632         unsigned long       LastTxokCnt;
633         unsigned long           LastRxokCnt;
634         u16                                     CurrRetryCnt;
635         unsigned long           LastTxOKBytes;
636         unsigned long               NumTxOkBytesTotal;
637         u8                          LastFailTxRate;
638         long                        LastFailTxRateSS;
639         u8                          FailTxRateCount;
640         u32                         LastTxThroughput;
641         //for up rate
642         unsigned short          bTryuping;
643         u8                                      CurrTxRate;     //the rate before up
644         u16                                     CurrRetryRate;
645         u16                                     TryupingCount;
646         u8                                      TryDownCountLowData;
647         u8                                      TryupingCountNoData;
648
649         u8                  CurrentOperaRate;
650 //by amy for rate adaptive
651 //by amy 080312}
652 //      short wq_hurryup;
653 //      struct workqueue_struct *workqueue;
654         struct work_struct reset_wq;
655         struct work_struct watch_dog_wq;
656         struct work_struct tx_irq_wq;
657         short ack_tx_to_ieee;
658
659         u8 PowerProfile;
660         u32 CSMethod;
661         u8 cck_txpwr_base;
662         u8 ofdm_txpwr_base;
663         u8 dma_poll_stop_mask;
664
665         //u8 RegThreeWireMode;
666         u8 MWIEnable;
667         u16 ShortRetryLimit;
668         u16 LongRetryLimit;
669         u16 EarlyRxThreshold;
670         u32 TransmitConfig;
671         u32 ReceiveConfig;
672         u32 IntrMask;
673
674         struct  ChnlAccessSetting  ChannelAccessSetting;
675 }r8180_priv;
676
677 #define MANAGE_PRIORITY 0
678 #define BK_PRIORITY 1
679 #define BE_PRIORITY 2
680 #define VI_PRIORITY 3
681 #define VO_PRIORITY 4
682 #define HI_PRIORITY 5
683 #define BEACON_PRIORITY 6
684
685 #define LOW_PRIORITY VI_PRIORITY
686 #define NORM_PRIORITY VO_PRIORITY
687 //AC2Queue mapping
688 #define AC2Q(_ac) (((_ac) == WME_AC_VO) ? VO_PRIORITY : \
689                 ((_ac) == WME_AC_VI) ? VI_PRIORITY : \
690                 ((_ac) == WME_AC_BK) ? BK_PRIORITY : \
691                 BE_PRIORITY)
692
693 short rtl8180_tx(struct net_device *dev,u8* skbuf, int len,int priority,
694         short morefrag,short fragdesc,int rate);
695
696 u8 read_nic_byte(struct net_device *dev, int x);
697 u32 read_nic_dword(struct net_device *dev, int x);
698 u16 read_nic_word(struct net_device *dev, int x) ;
699 void write_nic_byte(struct net_device *dev, int x,u8 y);
700 void write_nic_word(struct net_device *dev, int x,u16 y);
701 void write_nic_dword(struct net_device *dev, int x,u32 y);
702 void force_pci_posting(struct net_device *dev);
703
704 void rtl8180_rtx_disable(struct net_device *);
705 void rtl8180_rx_enable(struct net_device *);
706 void rtl8180_tx_enable(struct net_device *);
707 void rtl8180_start_scanning(struct net_device *dev);
708 void rtl8180_start_scanning_s(struct net_device *dev);
709 void rtl8180_stop_scanning(struct net_device *dev);
710 void rtl8180_disassociate(struct net_device *dev);
711 //void fix_rx_fifo(struct net_device *dev);
712 void rtl8180_set_anaparam(struct net_device *dev,u32 a);
713 void rtl8185_set_anaparam2(struct net_device *dev,u32 a);
714 void rtl8180_set_hw_wep(struct net_device *dev);
715 void rtl8180_no_hw_wep(struct net_device *dev);
716 void rtl8180_update_msr(struct net_device *dev);
717 //void rtl8180_BSS_create(struct net_device *dev);
718 void rtl8180_beacon_tx_disable(struct net_device *dev);
719 void rtl8180_beacon_rx_disable(struct net_device *dev);
720 void rtl8180_conttx_enable(struct net_device *dev);
721 void rtl8180_conttx_disable(struct net_device *dev);
722 int rtl8180_down(struct net_device *dev);
723 int rtl8180_up(struct net_device *dev);
724 void rtl8180_commit(struct net_device *dev);
725 void rtl8180_set_chan(struct net_device *dev,short ch);
726 void rtl8180_set_master_essid(struct net_device *dev,char *essid);
727 void rtl8180_update_beacon_security(struct net_device *dev);
728 void write_phy(struct net_device *dev, u8 adr, u8 data);
729 void write_phy_cck(struct net_device *dev, u8 adr, u32 data);
730 void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data);
731 void rtl8185_tx_antenna(struct net_device *dev, u8 ant);
732 void rtl8185_rf_pins_enable(struct net_device *dev);
733 void IBSS_randomize_cell(struct net_device *dev);
734 void IPSEnter(struct net_device *dev);
735 void IPSLeave(struct net_device *dev);
736 int get_curr_tx_free_desc(struct net_device *dev, int priority);
737 void UpdateInitialGain(struct net_device *dev);
738 bool SetAntennaConfig87SE(struct net_device *dev, u8  DefaultAnt, bool bAntDiversity);
739
740 //#ifdef CONFIG_RTL8185B
741 void rtl8185b_adapter_start(struct net_device *dev);
742 void rtl8185b_rx_enable(struct net_device *dev);
743 void rtl8185b_tx_enable(struct net_device *dev);
744 void rtl8180_reset(struct net_device *dev);
745 void rtl8185b_irq_enable(struct net_device *dev);
746 void fix_rx_fifo(struct net_device *dev);
747 void fix_tx_fifo(struct net_device *dev);
748 void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
749 void rtl8180_rate_adapter(struct work_struct * work);
750 //#endif
751 bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet, u32 ChangeSource);
752
753 #endif