From owner-svn-src-all@FreeBSD.ORG Wed Jun 26 04:46:04 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 8AB4EAE5; Wed, 26 Jun 2013 04:46:04 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7D6AA1D4F; Wed, 26 Jun 2013 04:46:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5Q4k4Q6087296; Wed, 26 Jun 2013 04:46:04 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5Q4k4k8087292; Wed, 26 Jun 2013 04:46:04 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201306260446.r5Q4k4k8087292@svn.freebsd.org> From: Adrian Chadd Date: Wed, 26 Jun 2013 04:46:04 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jun 2013 04:46:04 -0000 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_ */