ASoC: Remove duplicate ADC/DAC widgets from wm_hubs.c
[linux/fpc-iii.git] / drivers / staging / winbond / mto.h
blob56f2465723b30cbd5a6378ed4ae1ad97f5cb8ee4
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 struct wbsoft_priv;
18 #define MTO_DEFAULT_TH_CNT 5
19 #define MTO_DEFAULT_TH_SQ3 112 //OLD IS 13 reference JohnXu
20 #define MTO_DEFAULT_TH_IDLE_SLOT 15
21 #define MTO_DEFAULT_TH_PR_INTERF 30
22 #define MTO_DEFAULT_TMR_AGING 25 // unit: slot time 10 reference JohnXu
23 #define MTO_DEFAULT_TMR_PERIODIC 5 // unit: slot time
25 #define MTO_ANTENNA_DIVERSITY_OFF 0
26 #define MTO_ANTENNA_DIVERSITY_ON 1
28 // LA20040210_DTO kevin
29 //#define MTO_PREAMBLE_LONG 0
30 //#define MTO_PREAMBLE_SHORT 1
31 #define MTO_PREAMBLE_LONG WLAN_PREAMBLE_TYPE_LONG
32 #define MTO_PREAMBLE_SHORT WLAN_PREAMBLE_TYPE_SHORT
34 typedef enum {
35 TOGGLE_STATE_IDLE = 0,
36 TOGGLE_STATE_WAIT0 = 1,
37 TOGGLE_STATE_WAIT1 = 2,
38 TOGGLE_STATE_MAKEDESISION = 3,
39 TOGGLE_STATE_BKOFF = 4
40 } TOGGLE_STATE;
42 typedef enum {
43 RATE_CHGSTATE_IDLE = 0,
44 RATE_CHGSTATE_CALCULATE = 1,
45 RATE_CHGSTATE_BACKOFF = 2
46 } TX_RATE_REDUCTION_STATE;
48 //============================================================================
49 // struct _MTOParameters --
51 // Defines the parameters used in the MAC Throughput Optimization algorithm
52 //============================================================================
53 typedef struct _MTO_PARAMETERS
55 u8 Th_Fixant;
56 u8 Th_Cnt;
57 u8 Th_SQ3;
58 u8 Th_IdleSlot;
60 u16 Tmr_Aging;
61 u8 Th_PrInterf;
62 u8 Tmr_Periodic;
64 //--------- wkchen added -------------
65 u32 TxFlowCount; //to judge what kind the tx flow(sparse or busy) is
66 //------------------------------------------------
68 //--------- DTO threshold parameters -------------
69 u16 DTO_PeriodicCheckCycle;
70 u16 DTO_RssiThForAntDiv;
72 u16 DTO_TxCountThForCalcNewRate;
73 u16 DTO_TxRateIncTh;
75 u16 DTO_TxRateDecTh;
76 u16 DTO_TxRateEqTh;
78 u16 DTO_TxRateBackOff;
79 u16 DTO_TxRetryRateReduce;
81 u16 DTO_TxPowerIndex; //0 ~ 31
82 u16 reserved_1;
83 //------------------------------------------------
85 u8 PowerChangeEnable;
86 u8 AntDiversityEnable;
87 u8 Ant_mac;
88 u8 Ant_div;
90 u8 CCA_Mode;
91 u8 CCA_Mode_Setup;
92 u8 Preamble_Type;
93 u8 PreambleChangeEnable;
95 u8 DataRateLevel;
96 u8 DataRateChangeEnable;
97 u8 FragThresholdLevel;
98 u8 FragThresholdChangeEnable;
100 u16 RTSThreshold;
101 u16 RTSThreshold_Setup;
103 u32 AvgIdleSlot;
104 u32 Pr_Interf;
105 u32 AvgGapBtwnInterf;
107 u8 RTSChangeEnable;
108 u8 Ant_sel;
109 u8 aging_timeout;
110 u8 reserved_2;
112 u32 Cnt_Ant[2];
113 u32 SQ_Ant[2];
115 // 20040510 remove from globe vairable
116 u32 TmrCnt;
117 u32 BackoffTmr;
118 TOGGLE_STATE ToggleState;
119 TX_RATE_REDUCTION_STATE TxRateReductionState;
121 u8 Last_Rate;
122 u8 Co_efficent;
123 u8 FallbackRateLevel;
124 u8 OfdmRateLevel;
126 u8 RatePolicy;
127 u8 reserved_3[3];
129 // For RSSI turning
130 s32 RSSI_high;
131 s32 RSSI_low;
133 } MTO_PARAMETERS, *PMTO_PARAMETERS;
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 MTO_INITTXRATE_MODE (adapter->sHwData.SoftwareSet&0x2) //bit 1
144 // 20040510 Turbo add
145 #define MTO_TMR_CNT() MTO_DATA().TmrCnt
146 #define MTO_TOGGLE_STATE() MTO_DATA().ToggleState
147 #define MTO_TX_RATE_REDUCTION_STATE() MTO_DATA().TxRateReductionState
148 #define MTO_BACKOFF_TMR() MTO_DATA().BackoffTmr
149 #define MTO_LAST_RATE() MTO_DATA().Last_Rate
150 #define MTO_CO_EFFICENT() MTO_DATA().Co_efficent
152 #define MTO_TH_CNT() MTO_DATA().Th_Cnt
153 #define MTO_TH_SQ3() MTO_DATA().Th_SQ3
154 #define MTO_TH_IDLE_SLOT() MTO_DATA().Th_IdleSlot
155 #define MTO_TH_PR_INTERF() MTO_DATA().Th_PrInterf
157 #define MTO_TMR_AGING() MTO_DATA().Tmr_Aging
158 #define MTO_TMR_PERIODIC() MTO_DATA().Tmr_Periodic
160 #define MTO_POWER_CHANGE_ENABLE() MTO_DATA().PowerChangeEnable
161 #define MTO_ANT_DIVERSITY_ENABLE() adapter->sLocalPara.boAntennaDiversity
162 #define MTO_ANT_MAC() MTO_DATA().Ant_mac
163 #define MTO_ANT_DIVERSITY() MTO_DATA().Ant_div
164 #define MTO_CCA_MODE() MTO_DATA().CCA_Mode
165 #define MTO_CCA_MODE_SETUP() MTO_DATA().CCA_Mode_Setup
166 #define MTO_PREAMBLE_TYPE() MTO_DATA().Preamble_Type
167 #define MTO_PREAMBLE_CHANGE_ENABLE() MTO_DATA().PreambleChangeEnable
169 #define MTO_RATE_LEVEL() MTO_DATA().DataRateLevel
170 #define MTO_OFDM_RATE_LEVEL() MTO_DATA().OfdmRateLevel
171 #define MTO_RATE_CHANGE_ENABLE() MTO_DATA().DataRateChangeEnable
172 #define MTO_FRAG_TH_LEVEL() MTO_DATA().FragThresholdLevel
173 #define MTO_FRAG_CHANGE_ENABLE() MTO_DATA().FragThresholdChangeEnable
174 #define MTO_RTS_THRESHOLD() MTO_DATA().RTSThreshold
175 #define MTO_RTS_CHANGE_ENABLE() MTO_DATA().RTSChangeEnable
176 #define MTO_RTS_THRESHOLD_SETUP() MTO_DATA().RTSThreshold_Setup
178 #define MTO_AVG_IDLE_SLOT() MTO_DATA().AvgIdleSlot
179 #define MTO_PR_INTERF() MTO_DATA().Pr_Interf
180 #define MTO_AVG_GAP_BTWN_INTERF() MTO_DATA().AvgGapBtwnInterf
182 #define MTO_ANT_SEL() MTO_DATA().Ant_sel
183 #define MTO_CNT_ANT(x) MTO_DATA().Cnt_Ant[(x)]
184 #define MTO_SQ_ANT(x) MTO_DATA().SQ_Ant[(x)]
185 #define MTO_AGING_TIMEOUT() MTO_DATA().aging_timeout
188 #define MTO_TXFLOWCOUNT() MTO_DATA().TxFlowCount
189 //--------- DTO threshold parameters -------------
190 #define MTOPARA_PERIODIC_CHECK_CYCLE() MTO_DATA().DTO_PeriodicCheckCycle
191 #define MTOPARA_RSSI_TH_FOR_ANTDIV() MTO_DATA().DTO_RssiThForAntDiv
192 #define MTOPARA_TXCOUNT_TH_FOR_CALC_RATE() MTO_DATA().DTO_TxCountThForCalcNewRate
193 #define MTOPARA_TXRATE_INC_TH() MTO_DATA().DTO_TxRateIncTh
194 #define MTOPARA_TXRATE_DEC_TH() MTO_DATA().DTO_TxRateDecTh
195 #define MTOPARA_TXRATE_EQ_TH() MTO_DATA().DTO_TxRateEqTh
196 #define MTOPARA_TXRATE_BACKOFF() MTO_DATA().DTO_TxRateBackOff
197 #define MTOPARA_TXRETRYRATE_REDUCE() MTO_DATA().DTO_TxRetryRateReduce
198 #define MTOPARA_TXPOWER_INDEX() MTO_DATA().DTO_TxPowerIndex
199 //------------------------------------------------
202 extern u16 MTO_Frag_Th_Tbl[];
204 #define MTO_DATA_RATE() MTO_Data_Rate_Tbl[MTO_RATE_LEVEL()]
205 #define MTO_FRAG_TH() MTO_Frag_Th_Tbl[MTO_FRAG_TH_LEVEL()]
207 typedef struct {
208 u8 tx_rate;
209 u8 tx_retry_rate;
210 } TXRETRY_REC;
212 typedef struct _STATISTICS_INFO {
213 u32 Rate54M;
214 u32 Rate48M;
215 u32 Rate36M;
216 u32 Rate24M;
217 u32 Rate18M;
218 u32 Rate12M;
219 u32 Rate9M;
220 u32 Rate6M;
221 u32 Rate11MS;
222 u32 Rate11ML;
223 u32 Rate55MS;
224 u32 Rate55ML;
225 u32 Rate2MS;
226 u32 Rate2ML;
227 u32 Rate1M;
228 u32 Rate54MOK;
229 u32 Rate48MOK;
230 u32 Rate36MOK;
231 u32 Rate24MOK;
232 u32 Rate18MOK;
233 u32 Rate12MOK;
234 u32 Rate9MOK;
235 u32 Rate6MOK;
236 u32 Rate11MSOK;
237 u32 Rate11MLOK;
238 u32 Rate55MSOK;
239 u32 Rate55MLOK;
240 u32 Rate2MSOK;
241 u32 Rate2MLOK;
242 u32 Rate1MOK;
243 u32 SQ3;
244 s32 RSSIAVG;
245 s32 RSSIMAX;
246 s32 TXRATE;
247 s32 TxRetryRate;
248 s32 BSS_PK_CNT;
249 s32 NIDLESLOT;
250 s32 SLOT_CNT;
251 s32 INTERF_CNT;
252 s32 GAP_CNT;
253 s32 DS_EVM;
254 s32 RcvBeaconNum;
255 s32 RXRATE;
256 s32 RxBytes;
257 s32 TxBytes;
258 s32 Antenna;
259 } STATISTICS_INFO, *PSTATISTICS_INFO;
261 extern void MTO_Init(struct wbsoft_priv *);
262 extern void MTO_PeriodicTimerExpired(struct wbsoft_priv *);
263 extern void MTO_SetDTORateRange(struct wbsoft_priv *, u8 *, u8);
264 extern u8 MTO_GetTxRate(struct wbsoft_priv *adapter, u32 fpdu_len);
265 extern u8 MTO_GetTxFallbackRate(struct wbsoft_priv *adapter);
266 extern void MTO_SetTxCount(struct wbsoft_priv *adapter, u8 t0, u8 index);
268 #endif //__MTO_H__