diff options
| author | Peng Xu <pxu@qca.qualcomm.com> | 2014-05-20 15:56:42 -0700 |
|---|---|---|
| committer | Akash Patel <c_akashp@qca.qualcomm.com> | 2014-05-27 17:05:00 -0700 |
| commit | 61e463ca46684a67d58ccdf2dc0e430473f8fa58 (patch) | |
| tree | d6801492ed8319fefe446e4eee1c581848418ecc | |
| parent | 8f3c6a57a5c1605251ff45e1c2131fae33ff2e6a (diff) | |
qca_cld:sap Support HT40 in 2.4G ACS
This allows the ACS algorithm to choose the best channel in 2.4G
in HT40 mode.
Change-Id: I25675bfff163d90ff1e01557557aa780b8923c69
CRs-fixed: 651911
| -rw-r--r-- | CORE/SAP/src/sapChSelect.c | 117 |
1 files changed, 113 insertions, 4 deletions
diff --git a/CORE/SAP/src/sapChSelect.c b/CORE/SAP/src/sapChSelect.c index 48da308a60d0..e60547724b8d 100644 --- a/CORE/SAP/src/sapChSelect.c +++ b/CORE/SAP/src/sapChSelect.c @@ -166,6 +166,14 @@ sapAcsChannelInfo acsHT80Channels[ ] = { {149, ACS_WEIGHT_MAX}, }; +sapAcsChannelInfo acsHT40Channels24G[ ] = { + {1, ACS_WEIGHT_MAX}, + {2, ACS_WEIGHT_MAX}, + {3, ACS_WEIGHT_MAX}, + {4, ACS_WEIGHT_MAX}, + {9, ACS_WEIGHT_MAX}, +}; + typedef enum { CHWIDTH_HT20, CHWIDTH_HT40, @@ -1991,7 +1999,7 @@ void sapSortChlWeightHT80(tSapChSelSpectInfo *pSpectInfoParams) } /*========================================================================== - FUNCTION sapSortChlWeightHT40 + FUNCTION sapSortChlWeightHT40_24G DESCRIPTION Funtion to sort the channels with the least weight first for HT40 channels @@ -2009,8 +2017,106 @@ void sapSortChlWeightHT80(tSapChSelSpectInfo *pSpectInfoParams) SIDE EFFECTS ============================================================================*/ -void sapSortChlWeightHT40(tSapChSelSpectInfo *pSpectInfoParams, - v_U32_t operatingBand) +void sapSortChlWeightHT40_24G(tSapChSelSpectInfo *pSpectInfoParams) +{ + v_U8_t i, j; + tSapSpectChInfo *pSpectInfo; + v_U32_t tmpWeight1, tmpWeight2; + + pSpectInfo = pSpectInfoParams->pSpectCh; + /*for each HT40 channel, calculate the combined weight of the + two 20MHz weight */ + for (i = 0; i < ARRAY_SIZE(acsHT40Channels24G); i++) + { + for (j = 0; j < pSpectInfoParams->numSpectChans; j++) + { + if (pSpectInfo[j].chNum == acsHT40Channels24G[i].chStartNum) + break; + } + if (j == pSpectInfoParams->numSpectChans) + continue; + + if ((pSpectInfo[j].chNum +4) == pSpectInfo[j+4].chNum) + { + /* check if there is another channel combination possiblity + e.g., {1, 5} & {5, 9} */ + if ((pSpectInfo[j+4].chNum + 4)== pSpectInfo[j+8].chNum) + { + /* need to compare two channel pairs */ + tmpWeight1 = pSpectInfo[j].weight + pSpectInfo[j+4].weight; + tmpWeight2 = pSpectInfo[j+4].weight + pSpectInfo[j+8].weight; + if (tmpWeight1 <= tmpWeight2) + { + if (pSpectInfo[j].weight <= pSpectInfo[j+4].weight) + { + pSpectInfo[j].weight = tmpWeight1; + pSpectInfo[j+4].weight = ACS_WEIGHT_MAX; + pSpectInfo[j+8].weight = ACS_WEIGHT_MAX; + } + else + { + pSpectInfo[j+4].weight = tmpWeight1; + pSpectInfo[j].weight = ACS_WEIGHT_MAX; + pSpectInfo[j+8].weight = ACS_WEIGHT_MAX; + } + } + else + { + if (pSpectInfo[j+4].weight <= pSpectInfo[j+8].weight) + { + pSpectInfo[j+4].weight = tmpWeight2; + pSpectInfo[j].weight = ACS_WEIGHT_MAX; + pSpectInfo[j+8].weight = ACS_WEIGHT_MAX; + } + else + { + pSpectInfo[j+8].weight = tmpWeight2; + pSpectInfo[j].weight = ACS_WEIGHT_MAX; + pSpectInfo[j+4].weight = ACS_WEIGHT_MAX; + } + } + } + else + { + tmpWeight1 = pSpectInfo[j].weight + pSpectInfo[j+4].weight; + if (pSpectInfo[j].weight <= pSpectInfo[j+4].weight) + { + pSpectInfo[j].weight = tmpWeight1; + pSpectInfo[j+4].weight = ACS_WEIGHT_MAX; + } + else + { + pSpectInfo[j+4].weight = tmpWeight1; + pSpectInfo[j].weight = ACS_WEIGHT_MAX; + } + } + } + else + pSpectInfo[j].weight = ACS_WEIGHT_MAX; + } +} + + +/*========================================================================== + FUNCTION sapSortChlWeightHT40_5G + + DESCRIPTION + Funtion to sort the channels with the least weight first for HT40 channels + + DEPENDENCIES + NA. + + PARAMETERS + + IN + pSpectInfoParams : Pointer to the tSapChSelSpectInfo structure + + RETURN VALUE + void : NULL + + SIDE EFFECTS +============================================================================*/ +void sapSortChlWeightHT40_5G(tSapChSelSpectInfo *pSpectInfoParams) { v_U8_t i, j; tSapSpectChInfo *pSpectInfo; @@ -2114,7 +2220,10 @@ void sapSortChlWeightAll(ptSapContext pSapCtx, switch (chWidth) { case CHWIDTH_HT40: - sapSortChlWeightHT40(pSpectInfoParams, operatingBand); + if (eSAP_RF_SUBBAND_2_4_GHZ == operatingBand) + sapSortChlWeightHT40_24G(pSpectInfoParams); + else + sapSortChlWeightHT40_5G(pSpectInfoParams); break; case CHWIDTH_HT80: |
