sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_reset.c
static HAL_BOOL
ar5416FillVpdTable(uint8_t pwrMin, uint8_t pwrMax, uint8_t *pPwrList,
                   uint8_t *pVpdList, uint16_t numIntercepts, uint8_t *pRetVpdList)
{
    uint16_t  i, k;
    uint8_t   currPwr = pwrMin;
    uint16_t  idxL, idxR;

    HALASSERT(pwrMax > pwrMin);
    for (i = 0; i <= (pwrMax - pwrMin) / 2; i++) {
        getLowerUpperIndex(currPwr, pPwrList, numIntercepts,
                           &(idxL), &(idxR));
        if (idxR < 1)
            idxR = 1;           /* extrapolate below */
        if (idxL == numIntercepts - 1)
            idxL = (uint16_t)(numIntercepts - 2);   /* extrapolate above */
        if (pPwrList[idxL] == pPwrList[idxR])
            k = pVpdList[idxL];
        else
            k = (uint16_t)( ((currPwr - pPwrList[idxL]) * pVpdList[idxR] + (pPwrList[idxR] - currPwr) * pVpdList[idxL]) /
                  (pPwrList[idxR] - pPwrList[idxL]) );
        HALASSERT(k < 256);
        pRetVpdList[i] = (uint8_t)k;
        currPwr += 2;               /* half dB steps */
    }

    return AH_TRUE;
}
/**************************************************************
 * ar5416FillVpdTable
 *
 * Fill the Vpdlist for indices Pmax-Pmin
 * Note: pwrMin, pwrMax and Vpdlist are all in dBm * 4
 */
ar5416FillVpdTable
Fill the Vpdlist for indices Pmax-Pmin
Note: pwrMin, pwrMax and Vpdlist are all in dBm * 4
ar5416FillVpdTable Fill the Vpdlist for indices Pmax - Pmin Note : pwrMin pwrMax and Vpdlist are all in dBm * 4
static HAL_BOOL
ar5416FillVpdTable(uint8_t pwrMin, uint8_t pwrMax, uint8_t *pPwrList,
                   uint8_t *pVpdList, uint16_t numIntercepts, uint8_t *pRetVpdList)
{
    uint16_t  i, k;
    uint8_t   currPwr = pwrMin;
    uint16_t  idxL, idxR;
    HALASSERT(pwrMax > pwrMin);
    for (i = 0; i <= (pwrMax - pwrMin) / 2; i++) {
        getLowerUpperIndex(currPwr, pPwrList, numIntercepts,
                           &(idxL), &(idxR));
        if (idxR < 1)
            idxR = 1;           
        if (idxL == numIntercepts - 1)
            idxL = (uint16_t)(numIntercepts - 2);   
        if (pPwrList[idxL] == pPwrList[idxR])
            k = pVpdList[idxL];
        else
            k = (uint16_t)( ((currPwr - pPwrList[idxL]) * pVpdList[idxR] + (pPwrList[idxR] - currPwr) * pVpdList[idxL]) /
                  (pPwrList[idxR] - pPwrList[idxL]) );
        HALASSERT(k < 256);
        pRetVpdList[i] = (uint8_t)k;
        currPwr += 2;               
    }
    return AH_TRUE;
}
static HAL_BOOL ar5416FillVpdTable ( uint8_t pwrMin , uint8_t pwrMax , uint8_t * pPwrList , uint8_t * pVpdList , uint16_t numIntercepts , uint8_t * pRetVpdList ) { uint16_t i , k ; uint8_t currPwr = pwrMin ; uint16_t idxL , idxR ; HALASSERT ( pwrMax > pwrMin ) ; for ( i = 0 ; i <= ( pwrMax - pwrMin ) / 2 ; i ++ ) { getLowerUpperIndex ( currPwr , pPwrList , numIntercepts , & ( idxL ) , & ( idxR ) ) ; if ( idxR < 1 ) idxR = 1 ; if ( idxL == numIntercepts - 1 ) idxL = ( uint16_t ) ( numIntercepts - 2 ) ; if ( pPwrList [ idxL ] == pPwrList [ idxR ] ) k = pVpdList [ idxL ] ; else k = ( uint16_t ) ( ( ( currPwr - pPwrList [ idxL ] ) * pVpdList [ idxR ] + ( pPwrList [ idxR ] - currPwr ) * pVpdList [ idxL ] ) / ( pPwrList [ idxR ] - pPwrList [ idxL ] ) ) ; HALASSERT ( k < 256 ) ; pRetVpdList [ i ] = ( uint8_t ) k ; currPwr += 2 ; } return AH_TRUE ; }
ar5416FillVpdTable
 Fill the Vpdlist for indices Pmax-Pmin
 Note: pwrMin, pwrMax and Vpdlist are all in dBm * 4
ar5416FillVpdTable Fill the Vpdlist for indices Pmax - Pmin Note : pwrMin pwrMax and Vpdlist are all in dBm * 4
/* extrapolate below */ /* extrapolate above */ /* half dB steps */