Add a HAL local routine to map the 2GHz channel frequency to an IEEE

channel.

There's some HAL code in the AR9300 HAL that requires a back-mapping
and using the net80211 code isn't appropriate here.
This commit is contained in:
adrian 2013-06-26 04:46:03 +00:00
parent 385685bc78
commit 42eb189c98
2 changed files with 22 additions and 0 deletions

View File

@ -1409,3 +1409,21 @@ ath_hal_EepromDataRead(struct ath_hal *ah, u_int off, uint16_t *data)
(*data) = ah->ah_eepromdata[off];
return AH_TRUE;
}
/*
* Do a 2GHz specific MHz->IEEE based on the hardware
* frequency.
*
* This is the unmapped frequency which is programmed into the hardware.
*/
int
ath_hal_mhz2ieee_2ghz(struct ath_hal *ah, HAL_CHANNEL_INTERNAL *ichan)
{
if (ichan->channel == 2484)
return 14;
if (ichan->channel < 2484)
return ((int) ichan->channel - 2407) / 5;
else
return 15 + ((ichan->channel - 2512) / 20);
}

View File

@ -1021,5 +1021,9 @@ ath_hal_getantennaallowed(struct ath_hal *ah,
return (chan->ic_maxantgain);
}
/*
* Map the given 2GHz channel to an IEEE number.
*/
extern int ath_hal_mhz2ieee_2ghz(struct ath_hal *, HAL_CHANNEL_INTERNAL *);
#endif /* _ATH_AH_INTERAL_H_ */