ide: move ->failed_pc to ide_drive_t
[linux-ginger.git] / drivers / staging / winbond / mto.h
blob0d3775eb25731c4c7a3d42ae4b5db7d4986a98d2
1 //==================================================================
2 // MTO.H
3 //
4 // Revision history
5 //=================================
6 // 20030110 UN20 Pete Chao
7 // Initial Release
8 //
9 // Copyright (c) 2003 Winbond Electronics Corp. All rights reserved.
10 //==================================================================
11 #ifndef __MTO_H__
12 #define __MTO_H__
14 #include <linux/types.h>
16 #define MTO_DEFAULT_TH_CNT 5
17 #define MTO_DEFAULT_TH_SQ3 112 //OLD IS 13 reference JohnXu
18 #define MTO_DEFAULT_TH_IDLE_SLOT 15
19 #define MTO_DEFAULT_TH_PR_INTERF 30
20 #define MTO_DEFAULT_TMR_AGING 25 // unit: slot time 10 reference JohnXu
21 #define MTO_DEFAULT_TMR_PERIODIC 5 // unit: slot time
23 #define MTO_ANTENNA_DIVERSITY_OFF 0
24 #define MTO_ANTENNA_DIVERSITY_ON 1
26 // LA20040210_DTO kevin
27 //#define MTO_PREAMBLE_LONG 0
28 //#define MTO_PREAMBLE_SHORT 1
29 #define MTO_PREAMBLE_LONG WLAN_PREAMBLE_TYPE_LONG
30 #define MTO_PREAMBLE_SHORT WLAN_PREAMBLE_TYPE_SHORT
32 typedef enum {
33 TOGGLE_STATE_IDLE = 0,
34 TOGGLE_STATE_WAIT0 = 1,
35 TOGGLE_STATE_WAIT1 = 2,
36 TOGGLE_STATE_MAKEDESISION = 3,
37 TOGGLE_STATE_BKOFF = 4
38 } TOGGLE_STATE;
40 typedef enum {
41 RATE_CHGSTATE_IDLE = 0,
42 RATE_CHGSTATE_CALCULATE = 1,
43 RATE_CHGSTATE_BACKOFF = 2
44 } TX_RATE_REDUCTION_STATE;
46 //============================================================================
47 // struct _MTOParameters --
49 // Defines the parameters used in the MAC Throughput Optimization algorithm
50 //============================================================================
51 typedef struct _MTO_PARAMETERS
53 u8 Th_Fixant;
54 u8 Th_Cnt;
55 u8 Th_SQ3;
56 u8 Th_IdleSlot;
58 u16 Tmr_Aging;
59 u8 Th_PrInterf;
60 u8 Tmr_Periodic;
62 //--------- wkchen added -------------
63 u32 TxFlowCount; //to judge what kind the tx flow(sparse or busy) is
64 //------------------------------------------------
66 //--------- DTO threshold parameters -------------
67 u16 DTO_PeriodicCheckCycle;
68 u16 DTO_RssiThForAntDiv;
70 u16 DTO_TxCountThForCalcNewRate;
71 u16 DTO_TxRateIncTh;
73 u16 DTO_TxRateDecTh;
74 u16 DTO_TxRateEqTh;
76 u16 DTO_TxRateBackOff;
77 u16 DTO_TxRetryRateReduce;
79 u16 DTO_TxPowerIndex; //0 ~ 31
80 u16 reserved_1;
81 //------------------------------------------------
83 u8 PowerChangeEnable;
84 u8 AntDiversityEnable;
85 u8 Ant_mac;
86 u8 Ant_div;
88 u8 CCA_Mode;
89 u8 CCA_Mode_Setup;
90 u8 Preamble_Type;
91 u8 PreambleChangeEnable;
93 u8 DataRateLevel;
94 u8 DataRateChangeEnable;
95 u8 FragThresholdLevel;
96 u8 FragThresholdChangeEnable;
98 u16 RTSThreshold;
99 u16 RTSThreshold_Setup;
101 u32 AvgIdleSlot;
102 u32 Pr_Interf;
103 u32 AvgGapBtwnInterf;
105 u8 RTSChangeEnable;
106 u8 Ant_sel;
107 u8 aging_timeout;
108 u8 reserved_2;
110 u32 Cnt_Ant[2];
111 u32 SQ_Ant[2];
113 // 20040510 remove from globe vairable
114 u32 TmrCnt;
115 u32 BackoffTmr;
116 TOGGLE_STATE ToggleState;
117 TX_RATE_REDUCTION_STATE TxRateReductionState;
119 u8 Last_Rate;
120 u8 Co_efficent;
121 u8 FallbackRateLevel;
122 u8 OfdmRateLevel;
124 u8 RatePolicy;
125 u8 reserved_3[3];
127 // For RSSI turning
128 s32 RSSI_high;
129 s32 RSSI_low;
131 } MTO_PARAMETERS, *PMTO_PARAMETERS;
134 #define MTO_FUNC_INPUT struct wbsoft_priv * adapter
135 #define MTO_FUNC_INPUT_DATA adapter
136 #define MTO_DATA() (adapter->sMtoPara)
137 #define MTO_HAL() (&adapter->sHwData)
138 #define MTO_SET_PREAMBLE_TYPE(x) // 20040511 Turbo mark LM_PREAMBLE_TYPE(&pcore_data->lm_data) = (x)
139 #define MTO_ENABLE (adapter->sLocalPara.TxRateMode == RATE_AUTO)
140 #define MTO_TXPOWER_FROM_EEPROM (adapter->sHwData.PowerIndexFromEEPROM)
141 #define LOCAL_ANTENNA_NO() (adapter->sLocalPara.bAntennaNo)
142 #define LOCAL_IS_CONNECTED() (adapter->sLocalPara.wConnectedSTAindex != 0)
143 #define LOCAL_IS_IBSS_MODE() (adapter->asBSSDescriptElement[adapter->sLocalPara.wConnectedSTAindex].bBssType == IBSS_NET)
144 #define MTO_INITTXRATE_MODE (adapter->sHwData.SoftwareSet&0x2) //bit 1
145 // 20040510 Turbo add
146 #define MTO_TMR_CNT() MTO_DATA().TmrCnt
147 #define MTO_TOGGLE_STATE() MTO_DATA().ToggleState
148 #define MTO_TX_RATE_REDUCTION_STATE() MTO_DATA().TxRateReductionState
149 #define MTO_BACKOFF_TMR() MTO_DATA().BackoffTmr
150 #define MTO_LAST_RATE() MTO_DATA().Last_Rate
151 #define MTO_CO_EFFICENT() MTO_DATA().Co_efficent
153 #define MTO_TH_CNT() MTO_DATA().Th_Cnt
154 #define MTO_TH_SQ3() MTO_DATA().Th_SQ3
155 #define MTO_TH_IDLE_SLOT() MTO_DATA().Th_IdleSlot
156 #define MTO_TH_PR_INTERF() MTO_DATA().Th_PrInterf
158 #define MTO_TMR_AGING() MTO_DATA().Tmr_Aging
159 #define MTO_TMR_PERIODIC() MTO_DATA().Tmr_Periodic
161 #define MTO_POWER_CHANGE_ENABLE() MTO_DATA().PowerChangeEnable
162 #define MTO_ANT_DIVERSITY_ENABLE() adapter->sLocalPara.boAntennaDiversity
163 #define MTO_ANT_MAC() MTO_DATA().Ant_mac
164 #define MTO_ANT_DIVERSITY() MTO_DATA().Ant_div
165 #define MTO_CCA_MODE() MTO_DATA().CCA_Mode
166 #define MTO_CCA_MODE_SETUP() MTO_DATA().CCA_Mode_Setup
167 #define MTO_PREAMBLE_TYPE() MTO_DATA().Preamble_Type
168 #define MTO_PREAMBLE_CHANGE_ENABLE() MTO_DATA().PreambleChangeEnable
170 #define MTO_RATE_LEVEL() MTO_DATA().DataRateLevel
171 #define MTO_OFDM_RATE_LEVEL() MTO_DATA().OfdmRateLevel
172 #define MTO_RATE_CHANGE_ENABLE() MTO_DATA().DataRateChangeEnable
173 #define MTO_FRAG_TH_LEVEL() MTO_DATA().FragThresholdLevel
174 #define MTO_FRAG_CHANGE_ENABLE() MTO_DATA().FragThresholdChangeEnable
175 #define MTO_RTS_THRESHOLD() MTO_DATA().RTSThreshold
176 #define MTO_RTS_CHANGE_ENABLE() MTO_DATA().RTSChangeEnable
177 #define MTO_RTS_THRESHOLD_SETUP() MTO_DATA().RTSThreshold_Setup
179 #define MTO_AVG_IDLE_SLOT() MTO_DATA().AvgIdleSlot
180 #define MTO_PR_INTERF() MTO_DATA().Pr_Interf
181 #define MTO_AVG_GAP_BTWN_INTERF() MTO_DATA().AvgGapBtwnInterf
183 #define MTO_ANT_SEL() MTO_DATA().Ant_sel
184 #define MTO_CNT_ANT(x) MTO_DATA().Cnt_Ant[(x)]
185 #define MTO_SQ_ANT(x) MTO_DATA().SQ_Ant[(x)]
186 #define MTO_AGING_TIMEOUT() MTO_DATA().aging_timeout
189 #define MTO_TXFLOWCOUNT() MTO_DATA().TxFlowCount
190 //--------- DTO threshold parameters -------------
191 #define MTOPARA_PERIODIC_CHECK_CYCLE() MTO_DATA().DTO_PeriodicCheckCycle
192 #define MTOPARA_RSSI_TH_FOR_ANTDIV() MTO_DATA().DTO_RssiThForAntDiv
193 #define MTOPARA_TXCOUNT_TH_FOR_CALC_RATE() MTO_DATA().DTO_TxCountThForCalcNewRate
194 #define MTOPARA_TXRATE_INC_TH() MTO_DATA().DTO_TxRateIncTh
195 #define MTOPARA_TXRATE_DEC_TH() MTO_DATA().DTO_TxRateDecTh
196 #define MTOPARA_TXRATE_EQ_TH() MTO_DATA().DTO_TxRateEqTh
197 #define MTOPARA_TXRATE_BACKOFF() MTO_DATA().DTO_TxRateBackOff
198 #define MTOPARA_TXRETRYRATE_REDUCE() MTO_DATA().DTO_TxRetryRateReduce
199 #define MTOPARA_TXPOWER_INDEX() MTO_DATA().DTO_TxPowerIndex
200 //------------------------------------------------
203 extern u16 MTO_Frag_Th_Tbl[];
205 #define MTO_DATA_RATE() MTO_Data_Rate_Tbl[MTO_RATE_LEVEL()]
206 #define MTO_FRAG_TH() MTO_Frag_Th_Tbl[MTO_FRAG_TH_LEVEL()]
208 typedef struct {
209 u8 tx_rate;
210 u8 tx_retry_rate;
211 } TXRETRY_REC;
213 typedef struct _STATISTICS_INFO {
214 u32 Rate54M;
215 u32 Rate48M;
216 u32 Rate36M;
217 u32 Rate24M;
218 u32 Rate18M;
219 u32 Rate12M;
220 u32 Rate9M;
221 u32 Rate6M;
222 u32 Rate11MS;
223 u32 Rate11ML;
224 u32 Rate55MS;
225 u32 Rate55ML;
226 u32 Rate2MS;
227 u32 Rate2ML;
228 u32 Rate1M;
229 u32 Rate54MOK;
230 u32 Rate48MOK;
231 u32 Rate36MOK;
232 u32 Rate24MOK;
233 u32 Rate18MOK;
234 u32 Rate12MOK;
235 u32 Rate9MOK;
236 u32 Rate6MOK;
237 u32 Rate11MSOK;
238 u32 Rate11MLOK;
239 u32 Rate55MSOK;
240 u32 Rate55MLOK;
241 u32 Rate2MSOK;
242 u32 Rate2MLOK;
243 u32 Rate1MOK;
244 u32 SQ3;
245 s32 RSSIAVG;
246 s32 RSSIMAX;
247 s32 TXRATE;
248 s32 TxRetryRate;
249 s32 BSS_PK_CNT;
250 s32 NIDLESLOT;
251 s32 SLOT_CNT;
252 s32 INTERF_CNT;
253 s32 GAP_CNT;
254 s32 DS_EVM;
255 s32 RcvBeaconNum;
256 s32 RXRATE;
257 s32 RxBytes;
258 s32 TxBytes;
259 s32 Antenna;
260 } STATISTICS_INFO, *PSTATISTICS_INFO;
262 #endif //__MTO_H__