diff options
author | adrian <adrian@FreeBSD.org> | 2011-10-04 00:32:10 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2011-10-04 00:32:10 +0000 |
commit | 78eb31771dca6256fe67785a81c6853c6a49dba1 (patch) | |
tree | 59b750a01213f0e1c86cfeb9a2802ab45a342d29 | |
parent | 4570b00aadd0e6681f79df36963b95919de07dd7 (diff) | |
download | FreeBSD-src-78eb31771dca6256fe67785a81c6853c6a49dba1.zip FreeBSD-src-78eb31771dca6256fe67785a81c6853c6a49dba1.tar.gz |
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.
-rw-r--r-- | sys/dev/ath/ath_hal/ar5416/ar5416.h | 1 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5416/ar5416_misc.c | 8 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5416/ar5416phy.h | 6 |
3 files changed, 15 insertions, 0 deletions
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416.h b/sys/dev/ath/ath_hal/ar5416/ar5416.h index a0f5dee..fa5629e 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416.h +++ b/sys/dev/ath/ath_hal/ar5416/ar5416.h @@ -190,6 +190,7 @@ extern void ar5416SetLedState(struct ath_hal *ah, HAL_LED_STATE state); 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); diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c b/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c index 981c6f4..f29cb7e 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c +++ b/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c @@ -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) { diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416phy.h b/sys/dev/ath/ath_hal/ar5416/ar5416phy.h index d7a5e0b..82e3801 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416phy.h +++ b/sys/dev/ath/ath_hal/ar5416/ar5416phy.h @@ -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 |