svn commit: r302468 - head/sys/contrib/dev/ath/ath_hal/ar9300
Adrian Chadd
adrian at FreeBSD.org
Fri Jul 8 22:59:16 UTC 2016
Author: adrian
Date: Fri Jul 8 22:59:15 2016
New Revision: 302468
URL: https://svnweb.freebsd.org/changeset/base/302468
Log:
[ath_hal] add in locationing timer support and capabilities.
* add support to read the timer and capability
* add support to enable/disable the location timer.
On AR9380 at least, enabling the location timer is required to make
the timer tick, otherwise location packets return a timestamp of 0.
However, it then makes /all/ RX packets use the RX location timestamp
instead of the TSF timestamp.
So, unless I find another magical way to do location timestamping,
we will have to dynamically switch things on/off and ensure the
TX/RX path handles the "different" timestamps correctly.
Tested:
* AR9380, STA mode
Modified:
head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c
Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c
==============================================================================
--- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c Fri Jul 8 22:39:37 2016 (r302467)
+++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c Fri Jul 8 22:59:15 2016 (r302468)
@@ -26,7 +26,9 @@
#include "ar9300/ar9300.h"
#include "ar9300/ar9300reg.h"
#include "ar9300/ar9300phy.h"
+#include "ar9300/ar9300desc.h"
+static u_int32_t ar9300_read_loc_timer(struct ath_hal *ah);
void
ar9300_get_hw_hangs(struct ath_hal *ah, hal_hw_hangs_t *hangs)
@@ -947,6 +949,14 @@ ar9300_get_capability(struct ath_hal *ah
return (HAL_ENOTSUPP);
(*result) = !! (ahp->ah_misc_mode & AR_PCU_TXOP_TBTT_LIMIT_ENA);
return (HAL_OK);
+ case HAL_CAP_TOA_LOCATIONING:
+ if (capability == 0)
+ return HAL_OK;
+ if (capability == 2) {
+ *result = ar9300_read_loc_timer(ah);
+ return (HAL_OK);
+ }
+ return HAL_ENOTSUPP;
default:
return ath_hal_getcapability(ah, type, capability, result);
}
@@ -1060,6 +1070,14 @@ ar9300_set_capability(struct ath_hal *ah
}
return AH_TRUE;
+ case HAL_CAP_TOA_LOCATIONING:
+ if (capability == 0)
+ return AH_TRUE;
+ if (capability == 1) {
+ ar9300_update_loc_ctl_reg(ah, setting);
+ return AH_TRUE;
+ }
+ return AH_FALSE;
/* fall thru... */
default:
return ath_hal_setcapability(ah, type, capability, setting, status);
@@ -3855,6 +3873,13 @@ ar9300SetDfs3StreamFix(struct ath_hal *a
return AH_FALSE;
}
+static u_int32_t
+ar9300_read_loc_timer(struct ath_hal *ah)
+{
+
+ return OS_REG_READ(ah, AR_LOC_TIMER_REG);
+}
+
HAL_BOOL
ar9300_set_ctl_pwr(struct ath_hal *ah, u_int8_t *ctl_array)
{
More information about the svn-src-head
mailing list