1 /**************************************************************************** 2 **+-----------------------------------------------------------------------+** 3 **| |** 4 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved. |** 5 **| All rights reserved. |** 6 **| |** 7 **| Redistribution and use in source and binary forms, with or without |** 8 **| modification, are permitted provided that the following conditions |** 9 **| are met: |** 10 **| |** 11 **| * Redistributions of source code must retain the above copyright |** 12 **| notice, this list of conditions and the following disclaimer. |** 13 **| * Redistributions in binary form must reproduce the above copyright |** 14 **| notice, this list of conditions and the following disclaimer in |** 15 **| the documentation and/or other materials provided with the |** 16 **| distribution. |** 17 **| * Neither the name Texas Instruments nor the names of its |** 18 **| contributors may be used to endorse or promote products derived |** 19 **| from this software without specific prior written permission. |** 20 **| |** 21 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |** 22 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |** 23 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |** 24 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |** 25 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |** 26 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |** 27 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |** 28 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |** 29 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |** 30 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |** 31 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |** 32 **| |** 33 **+-----------------------------------------------------------------------+** 34 ****************************************************************************/ 35 36 /***************************************************************************/ 37 /* */ 38 /* MODULE: tx.h */ 39 /* PURPOSE: Tx module Header file */ 40 /* */ 41 /***************************************************************************/ 42 #ifndef _RATE_ADAPTATION_H_ 43 #define _RATE_ADAPTATION_H_ 44 45 #include "osTIType.h" 46 #include "paramIn.h" 47 #include "paramOut.h" 48 49 #define DEF_LOW_RATE_THRESHOLD DRV_RATE_AUTO /* TBD Below this rate generate roaming event */ 50 51 #define RATE_ADAPTATION_MODULE_LOG CTRL_DATA_MODULE_LOG 52 53 54 #define TS_EXCEEDS(currTime,expTime) (currTime > expTime) 55 #define TS_ADVANCE(currTime,expTime,delta) (expTime = currTime + (delta)) 56 57 58 /*#define NUM_OF_RATES_ENTRIES 5*/ 59 60 typedef struct 61 { 62 rate_e rate; 63 UINT8 rateNumber; /* Rate as actual number - used to compare 2 rates */ 64 modulationType_e modulation; 65 BOOL fourXEnable; 66 UINT8 rateAdaptFallBack; 67 UINT8 rateAdaptStepUp; 68 BOOL valid; 69 70 }rateModulation4x_table_t; 71 72 typedef struct 73 { 74 TI_HANDLE hOs; 75 TI_HANDLE hReport; 76 TI_HANDLE hCtrlData; 77 TI_HANDLE hEvHandler; 78 79 80 /* Rate Adaptation Algorithm Parameters */ 81 UINT32 expirTimeTick; 82 UINT32 txCount; 83 UINT32 txFailCount; 84 UINT32 txRateFallBackCount; 85 UINT32 txSkipCount; 86 UINT8 currRateIndex; 87 UINT8 maxRateIndex; 88 UINT8 stepUpFlag; 89 UINT8 stepUpTxPacketsThreshold; /* RATE_NUM_SETPUP_PKTS 10 The amount of packets to commite the alghorithem after step up.*/ 90 UINT8 contTxPacketsThreshold; /*#define WDRV_TX_RATE_NUM_CONT_PKTS 30 The amount of packets to commite the alghorithem in contiuse. */ 91 UINT8 lowRateThreshold; 92 UINT32 ctrlDataFBShortInterval; 93 UINT32 ctrlDataFBLongInterval; 94 95 TI_HANDLE pTimer; 96 TI_HANDLE hAPConnection; 97 UINT32 rateAdapt_timeout; 98 99 100 rateModulation4x_table_t RatesMap[MAX_SUPPORTED_RATES]; 101 102 tspecsRateParameters_t tspecsRateParameters[MAX_NUM_OF_AC]; 103 104 } rateAdaptation_t; 105 106 rateAdaptation_t* rateAdaptation_create(TI_HANDLE hOs); 107 108 TI_STATUS rateAdaptation_config(rateAdaptation_t* pRateAdaptation, 109 TI_HANDLE hOs, 110 TI_HANDLE hReport, 111 TI_HANDLE hCtrlData, 112 TI_HANDLE hEvHandler, 113 TI_HANDLE hAPConnection, 114 rateAdaptationInitParam_t* rateAdaptationInitParam); 115 116 TI_STATUS rateAdaptation_destroy(rateAdaptation_t* pRateAdaptation); 117 118 TI_STATUS rateAdaptation_start(rateAdaptation_t* pRateAdaptation); 119 120 TI_STATUS rateAdaptation_stop(rateAdaptation_t* pRateAdaptation); 121 122 TI_STATUS rateAdaptation_stopTimer(rateAdaptation_t* pRateAdaptation); 123 124 TI_STATUS rateAdaptation_updateRateAdaptation(rateAdaptation_t* pRateAdaptation, 125 rate_e actualTxRate, 126 rate_e requestTxRate, 127 UINT32 TxStatus, 128 int txNumWaiting); 129 130 TI_STATUS rateAdaptation_configLowRateThrsh(rateAdaptation_t* pRateAdaptation, UINT8 rate); 131 132 /* Get functions */ 133 rateModulation4x_table_t* rateAdaptation_getCurrent(rateAdaptation_t* pRateAdaptation); 134 rate_e rateAdaptation_getCurrentRate(rateAdaptation_t* pRateAdaptation); 135 modulationType_e rateAdaptation_getCurrentModulation(rateAdaptation_t* pRateAdaptation); 136 BOOL rateAdaptation_getCurrentFourXEnable(rateAdaptation_t* pRateAdaptation); 137 138 /* Set functions */ 139 TI_STATUS rateAdaptation_setCurrentRate(rateAdaptation_t* pRateAdaptation, rate_e rate); 140 TI_STATUS rateAdaptation_setMaxActivRate(rateAdaptation_t* pRateAdaptation, rate_e rate); 141 void rateAdaptation_updateModulation(rateAdaptation_t* pRateAdaptation, 142 modulationType_e modulation, 143 bssType_e bssType); 144 145 void rateAdaptation_update4xEnable(rateAdaptation_t* pRateAdaptation, 146 BOOL enable4x, 147 bssType_e bssType); 148 149 TI_STATUS rateAdaptation_buildRateMapTable(rateAdaptation_t *pRateAdaptation, 150 ctrlData_rateAdapt_t *currTable, 151 UINT32 supportedBitMap, 152 UINT32 clientBitMap, 153 modulationType_e modulation, 154 BOOL enable4x, 155 bssType_e bssType); 156 157 /* utils functions */ 158 TI_STATUS rateAdaptation_Utils_IsRateInBitmap(rateAdaptation_t *pRateAdaptation, 159 UINT32 ratesBitMap, 160 rate_e rate); 161 162 UINT32 rateAdaptation_Utils_buildRateBitMap(rateAdaptation_t *pRateAdaptation, 163 ctrlData_rateAdapt_t *currTable, 164 rate_e rate, 165 UINT32 supportedBitMap, 166 UINT32 clientBitMap); 167 168 BOOL rateAdaptation_isRateInTable(ctrlData_rateAdapt_t *currTable, 169 rate_e rate); 170 171 void rateAdaptation_setTspecsRateEvent(rateAdaptation_t* pRateAdaptation, 172 UINT8 acID, 173 BOOL enableEvent); 174 175 void rateAdaptation_setTspecsRateThresholds(rateAdaptation_t* pRateAdaptation, 176 UINT8 acID, 177 UINT8 highRateThreshold, 178 UINT8 lowRateThreshold); 179 180 void rateAdaptation_print(rateAdaptation_t* pRateAdaptation); 181 182 #endif 183