svn commit: r225957 - head/sys/dev/ath/ath_hal/ar5416

Adrian Chadd adrian at FreeBSD.org
Tue Oct 4 00:32:11 UTC 2011


Author: adrian
Date: Tue Oct  4 00:32:10 2011
New Revision: 225957
URL: http://svn.freebsd.org/changeset/base/225957

Log:
  Add an AR5416 aware version of the "current RSSI" function.
  
  Pre-11n devices and AR5416 use AR_PHY(263) for current RX RSSI.
  AR9130 and later have a fourth calibration register (for doing
  ADC calibration) and thus the register has moved to AR_PHY(271).
  
  This isn't currently used by any of the active code; I'm committing
  this for completeness and in case any third party code attempts to
  use it for legacy reasons.

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416.h
  head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
  head/sys/dev/ath/ath_hal/ar5416/ar5416phy.h

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416.h	Tue Oct  4 00:29:10 2011	(r225956)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h	Tue Oct  4 00:32:10 2011	(r225957)
@@ -190,6 +190,7 @@ extern	void ar5416SetLedState(struct ath
 extern	uint64_t ar5416GetTsf64(struct ath_hal *ah);
 extern	void ar5416SetTsf64(struct ath_hal *ah, uint64_t tsf64);
 extern	void ar5416ResetTsf(struct ath_hal *ah);
+extern	uint32_t ar5416GetCurRssi(struct ath_hal *ah);
 extern	HAL_BOOL ar5416SetAntennaSwitch(struct ath_hal *, HAL_ANT_SETTING);
 extern	HAL_BOOL ar5416SetDecompMask(struct ath_hal *, uint16_t, int);
 extern	void ar5416SetCoverageClass(struct ath_hal *, uint8_t, int);

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c	Tue Oct  4 00:29:10 2011	(r225956)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c	Tue Oct  4 00:32:10 2011	(r225957)
@@ -143,6 +143,14 @@ ar5416ResetTsf(struct ath_hal *ah)
 	OS_REG_WRITE(ah, AR_RESET_TSF, AR_RESET_TSF_ONCE);	
 }
 
+uint32_t
+ar5416GetCurRssi(struct ath_hal *ah)
+{
+	if (AR_SREV_OWL(ah))
+		return (OS_REG_READ(ah, AR_PHY_CURRENT_RSSI) & 0xff);
+	return (OS_REG_READ(ah, AR9130_PHY_CURRENT_RSSI) & 0xff);
+}
+
 HAL_BOOL
 ar5416SetAntennaSwitch(struct ath_hal *ah, HAL_ANT_SETTING settings)
 {

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416phy.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416phy.h	Tue Oct  4 00:29:10 2011	(r225956)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416phy.h	Tue Oct  4 00:32:10 2011	(r225957)
@@ -156,8 +156,14 @@
 #define	AR_PHY_CAL_MEAS_0(_i)	(0x9c10 + ((_i) << 12))
 #define	AR_PHY_CAL_MEAS_1(_i)	(0x9c14 + ((_i) << 12))
 #define	AR_PHY_CAL_MEAS_2(_i)	(0x9c18 + ((_i) << 12))
+/* This is AR9130 and later */
 #define	AR_PHY_CAL_MEAS_3(_i)	(0x9c1c + ((_i) << 12))
 
+/*
+ * AR5416 still uses AR_PHY(263) for current RSSI;
+ * AR9130 and later uses AR_PHY(271).
+ */
+#define	AR9130_PHY_CURRENT_RSSI	0x9c3c		/* rssi of current frame rx'd */
 
 #define AR_PHY_CCA          0x9864
 #define AR_PHY_MINCCA_PWR   0x0FF80000


More information about the svn-src-all mailing list