Date: Fri, 24 Aug 2012 00:52:38 +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: r239634 - head/sys/dev/ath/ath_hal Message-ID: <201208240052.q7O0qcXA028975@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Fri Aug 24 00:52:37 2012 New Revision: 239634 URL: http://svn.freebsd.org/changeset/base/239634 Log: Add ath_hal_get_curmode() - this is used by the Osprey HAL. Obtained from: Qualcomm Atheros Modified: head/sys/dev/ath/ath_hal/ah.c head/sys/dev/ath/ath_hal/ah.h Modified: head/sys/dev/ath/ath_hal/ah.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah.c Fri Aug 24 00:43:10 2012 (r239633) +++ head/sys/dev/ath/ath_hal/ah.c Fri Aug 24 00:52:37 2012 (r239634) @@ -420,6 +420,50 @@ ath_hal_computetxtime(struct ath_hal *ah return txTime; } +int +ath_hal_get_curmode(struct ath_hal *ah, const struct ieee80211_channel *chan) +{ + /* + * Pick a default mode at bootup. A channel change is inevitable. + */ + if (!chan) + return HAL_MODE_11NG_HT20; + + if (IEEE80211_IS_CHAN_TURBO(chan)) + return HAL_MODE_TURBO; + + /* check for NA_HT before plain A, since IS_CHAN_A includes NA_HT */ + if (IEEE80211_IS_CHAN_5GHZ(chan) && IEEE80211_IS_CHAN_HT20(chan)) + return HAL_MODE_11NA_HT20; + if (IEEE80211_IS_CHAN_5GHZ(chan) && IEEE80211_IS_CHAN_HT40U(chan)) + return HAL_MODE_11NA_HT40PLUS; + if (IEEE80211_IS_CHAN_5GHZ(chan) && IEEE80211_IS_CHAN_HT40D(chan)) + return HAL_MODE_11NA_HT40MINUS; + if (IEEE80211_IS_CHAN_A(chan)) + return HAL_MODE_11A; + + /* check for NG_HT before plain G, since IS_CHAN_G includes NG_HT */ + if (IEEE80211_IS_CHAN_2GHZ(chan) && IEEE80211_IS_CHAN_HT20(chan)) + return HAL_MODE_11NG_HT20; + if (IEEE80211_IS_CHAN_2GHZ(chan) && IEEE80211_IS_CHAN_HT40U(chan)) + return HAL_MODE_11NG_HT40PLUS; + if (IEEE80211_IS_CHAN_2GHZ(chan) && IEEE80211_IS_CHAN_HT40D(chan)) + return HAL_MODE_11NG_HT40MINUS; + + /* + * XXX For FreeBSD, will this work correctly given the DYN + * chan mode (OFDM+CCK dynamic) ? We have pure-G versions DYN-BG.. + */ + if (IEEE80211_IS_CHAN_G(chan)) + return HAL_MODE_11G; + if (IEEE80211_IS_CHAN_B(chan)) + return HAL_MODE_11B; + + HALASSERT(0); + return HAL_MODE_11NG_HT20; +} + + typedef enum { WIRELESS_MODE_11a = 0, WIRELESS_MODE_TURBO = 1, Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Fri Aug 24 00:43:10 2012 (r239633) +++ head/sys/dev/ath/ath_hal/ah.h Fri Aug 24 00:52:37 2012 (r239634) @@ -1390,6 +1390,12 @@ extern void __ahdecl ath_hal_process_noi extern u_int __ahdecl ath_hal_getwirelessmodes(struct ath_hal*); /* + * Get the HAL wireless mode for the given channel. + */ +extern int ath_hal_get_curmode(struct ath_hal *ah, + const struct ieee80211_channel *chan); + +/* * Calculate the packet TX time for a legacy or 11n frame */ extern uint32_t __ahdecl ath_hal_pkt_txtime(struct ath_hal *ah,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208240052.q7O0qcXA028975>