[ath_hal] [ar9300] initial radar detection glue.

* flesh out a "get default DFS parameters" routine
* remove the stub that returns NULL
* fix up the enable DFS method to do what FreeBSD does - specifically, allow pe_enabled
  to be set/cleared.

This allows the radar pulse reporting code to function, but it doesn't yet
do anything useful.
This commit is contained in:
adrian 2017-02-02 09:19:57 +00:00
parent ae5f530142
commit 907009c8af
4 changed files with 29 additions and 12 deletions

View File

@ -1489,6 +1489,7 @@ extern HAL_BOOL ar9300_radar_wait(struct ath_hal *ah, struct ieee80211_channel
extern struct dfs_pulse * ar9300_get_dfs_radars(struct ath_hal *ah,
u_int32_t dfsdomain, int *numradars, struct dfs_bin5pulse **bin5pulses,
int *numb5radars, HAL_PHYERR_PARAM *pe);
extern HAL_BOOL ar9300_get_default_dfs_thresh(struct ath_hal *ah, HAL_PHYERR_PARAM *pe);
extern void ar9300_adjust_difs(struct ath_hal *ah, u_int32_t val);
extern u_int32_t ar9300_dfs_config_fft(struct ath_hal *ah, HAL_BOOL is_enable);
extern void ar9300_cac_tx_quiet(struct ath_hal *ah, HAL_BOOL enable);

View File

@ -219,7 +219,7 @@ ar9300_attach_freebsd_ops(struct ath_hal *ah)
/* DFS functions */
ah->ah_enableDfs = ar9300_enable_dfs;
ah->ah_getDfsThresh = ar9300_get_dfs_thresh;
ah->ah_getDfsDefaultThresh = ar9300_freebsd_get_dfs_default_thresh;
ah->ah_getDfsDefaultThresh = ar9300_get_default_dfs_thresh;
// procradarevent
ah->ah_isFastClockEnabled = ar9300_is_fast_clock_enabled;
ah->ah_get11nExtBusy = ar9300_get_11n_ext_busy;
@ -696,16 +696,6 @@ ar9300_freebsd_get_mib_cycle_counts(struct ath_hal *ah,
return (AH_FALSE);
}
HAL_BOOL
ar9300_freebsd_get_dfs_default_thresh(struct ath_hal *ah,
HAL_PHYERR_PARAM *pe)
{
/* XXX not yet */
return (AH_FALSE);
}
/*
* Clear multicast filter by index - from FreeBSD ar5212_recv.c
*/

View File

@ -235,7 +235,14 @@ ar9300_enable_dfs(struct ath_hal *ah, HAL_PHYERR_PARAM *pe)
int reg_writes = 0;
val = OS_REG_READ(ah, AR_PHY_RADAR_0);
val |= AR_PHY_RADAR_0_FFT_ENA | AR_PHY_RADAR_0_ENA;
val |= AR_PHY_RADAR_0_FFT_ENA;
if (pe->pe_enabled != HAL_PHYERR_PARAM_NOVAL) {
val &= ~AR_PHY_RADAR_0_ENA;
val |= SM(pe->pe_enabled, AR_PHY_RADAR_0_ENA);
}
if (pe->pe_firpwr != HAL_PHYERR_PARAM_NOVAL) {
val &= ~AR_PHY_RADAR_0_FIRPWR;
val |= SM(pe->pe_firpwr, AR_PHY_RADAR_0_FIRPWR);
@ -328,6 +335,7 @@ ar9300_get_dfs_thresh(struct ath_hal *ah, HAL_PHYERR_PARAM *pe)
pe->pe_height = MS(val, AR_PHY_RADAR_0_HEIGHT);
pe->pe_prssi = MS(val, AR_PHY_RADAR_0_PRSSI);
pe->pe_inband = MS(val, AR_PHY_RADAR_0_INBAND);
pe->pe_enabled = !! MS(val, AR_PHY_RADAR_0_ENA);
val = OS_REG_READ(ah, AR_PHY_RADAR_1);
@ -425,6 +433,23 @@ ar9300_get_dfs_radars(
return dfs_radars;
}
HAL_BOOL
ar9300_get_default_dfs_thresh(struct ath_hal *ah, HAL_PHYERR_PARAM *pe)
{
pe->pe_firpwr = AR9300_DFS_FIRPWR;
pe->pe_rrssi = AR9300_DFS_RRSSI;
pe->pe_height = AR9300_DFS_HEIGHT;
pe->pe_prssi = AR9300_DFS_PRSSI;
/* see prssi comment above */
pe->pe_inband = AR9300_DFS_INBAND;
pe->pe_relpwr = AR9300_DFS_RELPWR;
pe->pe_relstep = AR9300_DFS_RELSTEP;
pe->pe_maxlen = AR9300_DFS_MAXLEN;
return (AH_TRUE);
}
void ar9300_adjust_difs(struct ath_hal *ah, u_int32_t val)
{
if (val == 0) {

View File

@ -222,6 +222,7 @@
#define AR_PHY_TIMING5_RSSI_THR1A_ENA (0x1 << 15)
/* BB_radar_detection) */
#define AR_PHY_RADAR_0_ENA 0x00000001 /* Enable radar detection */
#define AR_PHY_RADAR_0_ENA_S 0
#define AR_PHY_RADAR_0_FFT_ENA 0x80000000 /* Enable FFT data */
#define AR_PHY_RADAR_0_INBAND 0x0000003e /* Inband pulse threshold */
#define AR_PHY_RADAR_0_INBAND_S 1