svn commit: r252236 - head/sys/dev/ath/ath_hal
Adrian Chadd
adrian at FreeBSD.org
Wed Jun 26 04:46:04 UTC 2013
Author: adrian
Date: Wed Jun 26 04:46:03 2013
New Revision: 252236
URL: http://svnweb.freebsd.org/changeset/base/252236
Log:
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.
Modified:
head/sys/dev/ath/ath_hal/ah.c
head/sys/dev/ath/ath_hal/ah_internal.h
Modified: head/sys/dev/ath/ath_hal/ah.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ah.c Wed Jun 26 04:34:45 2013 (r252235)
+++ head/sys/dev/ath/ath_hal/ah.c Wed Jun 26 04:46:03 2013 (r252236)
@@ -1409,3 +1409,21 @@ ath_hal_EepromDataRead(struct ath_hal *a
(*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);
+}
Modified: head/sys/dev/ath/ath_hal/ah_internal.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_internal.h Wed Jun 26 04:34:45 2013 (r252235)
+++ head/sys/dev/ath/ath_hal/ah_internal.h Wed Jun 26 04:46:03 2013 (r252236)
@@ -1021,5 +1021,9 @@ ath_hal_getantennaallowed(struct ath_hal
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_ */
More information about the svn-src-all
mailing list