Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jun 2013 04:46:04 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r252236 - head/sys/dev/ath/ath_hal
Message-ID:  <201306260446.r5Q4k4k8087292@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306260446.r5Q4k4k8087292>