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