Exemplo n.º 1
0
void ath_ar_enable(struct ath_softc *sc)
{
	struct ath_dfs *dfs=sc->sc_dfs;
	struct dfs_ar_state *ar;
	HAL_CHANNEL *chan= &sc->sc_curchan;
	HAL_PHYERR_PARAM pe;
	u_int32_t rfilt=0;

	if (dfs == NULL) {
		DFS_DPRINTK(sc, ATH_DEBUG_DFS, "%s: sc_dfs is NULL\n",
			__func__);
		return;
	}

	ar = (struct dfs_ar_state *) &dfs->dfs_ar_state;
	if (dfs->dfs_proc_phyerr & (DFS_RADAR_EN | DFS_AR_EN)) {
		if ((chan->channel_flags & CHANNEL_108G) == CHANNEL_108G) {
			/* We are in turbo G, so enable AR */
			DFS_DPRINTK(sc, ATH_DEBUG_DFS, "%s: Enabling AR\n", __func__);
			dfs_reset_ar(sc);
			ar->ar_radarrssi = DFS_AR_RADAR_RSSI_THR;
			rfilt = ath_hal_getrxfilter(sc->sc_ah);
			pe.pe_firpwr = HAL_PHYERR_PARAM_NOVAL;
			pe.pe_height = HAL_PHYERR_PARAM_NOVAL;
			pe.pe_prssi = HAL_PHYERR_PARAM_NOVAL;
			pe.pe_inband = HAL_PHYERR_PARAM_NOVAL;
			pe.pe_relpwr = HAL_PHYERR_PARAM_NOVAL;
			pe.pe_maxlen = HAL_PHYERR_PARAM_NOVAL;
			pe.pe_relstep = HAL_PHYERR_PARAM_NOVAL;
			pe.pe_usefir128 = 0;
			pe.pe_blockradar = 0;
			pe.pe_enmaxrssi = 0;
			pe.pe_rrssi = ar->ar_radarrssi;
			ath_hal_enabledfs(sc->sc_ah, &pe);
			/* Enable strong signal fast antenna diversity since accurate 
			 * 1-2us radar
			 * detection is not important for AR anyways.
			 */
			ath_hal_setcapability(sc->sc_ah, HAL_CAP_DIVERSITY, 
					      HAL_CAP_STRONG_DIV, dfs->dfs_rinfo.rn_fastdivGCval, NULL);
			rfilt |= HAL_RX_FILTER_PHYRADAR;
			ath_hal_setrxfilter(sc->sc_ah, rfilt);
		}
	} else {
		DFS_DPRINTK(sc, ATH_DEBUG_DFS, "%s: Disabling AR\n", __func__);
		rfilt = ath_hal_getrxfilter(sc->sc_ah);
		rfilt &= ~HAL_RX_FILTER_PHYRADAR;
		ath_hal_setrxfilter(sc->sc_ah,rfilt);
		/* Enable strong signal fast antenna diversity */
		ath_hal_setcapability(sc->sc_ah, HAL_CAP_DIVERSITY, 
				      HAL_CAP_STRONG_DIV, dfs->dfs_rinfo.rn_fastdivGCval, NULL);

	}
}
Exemplo n.º 2
0
void
ath_phyerr_disable(struct ath_softc *sc)
{
    u_int32_t rfilt;

    rfilt = ath_hal_getrxfilter(sc->sc_ah);
    rfilt &= ~HAL_RX_FILTER_PHYERR;
    ath_hal_setrxfilter(sc->sc_ah,rfilt);
    ath_hal_disablePhyDiag(sc->sc_ah);
}
Exemplo n.º 3
0
void ath_ar_disable(struct ath_softc *sc)
{
	u_int32_t rfilt;
	HAL_CHANNEL *chan=&sc->sc_curchan;
	struct ath_dfs *dfs=sc->sc_dfs;
	if (dfs == NULL) {
		DFS_DPRINTK(sc, ATH_DEBUG_DFS, "%s: sc_dfs is NULL\n",
			__func__);
		return;
	}
	if ((chan->channel_flags & CHANNEL_108G) == CHANNEL_108G) {
		/* Enable strong signal fast antenna diversity */
		ath_hal_setcapability(sc->sc_ah, HAL_CAP_DIVERSITY, 
				      HAL_CAP_STRONG_DIV, dfs->dfs_rinfo.rn_fastdivGCval, NULL);
		rfilt = ath_hal_getrxfilter(sc->sc_ah);
		rfilt &= ~HAL_RX_FILTER_PHYERR;
		ath_hal_setrxfilter(sc->sc_ah, rfilt);
		dfs_reset_ar(sc);
		dfs_reset_arq(sc);
	}
}
Exemplo n.º 4
0
void
ath_phyerr_enable(struct ath_softc *sc, struct ieee80211_channel *chan)
{
    u_int32_t rfilt;
    struct ieee80211com *ic = &sc->sc_ic;
    u_int32_t index;
    struct ath_phyerr_state *pe;
    enum ieee80211_phymode mode;

    pe = (struct ath_phyerr_state *) sc->sc_phyerr_state;
    mode = ieee80211_chan2mode(ic, chan);
    if ((sc->sc_phyerr_cap & (ATH_RADAR_AR_EN | ATH_RADAR_EN)) &&
            (ic->ic_opmode == IEEE80211_M_HOSTAP) &&
            ((mode == IEEE80211_MODE_11A) ||
             (mode == IEEE80211_MODE_TURBO_A) ||
             (mode == IEEE80211_MODE_TURBO_G))) {
        if (mode == IEEE80211_MODE_TURBO_G) {
            /* We are in turbo G, so enable AR*/
            index = get_radar_chan_index(sc);
            pe->pe_curRadar = &pe->pe_radarState[index];
            ath_reset_ar(sc);
            pe->pe_curRadar->rad_radarRssi = ATH_AR_RADAR_RSSI_THR;
            ath_hal_setcapability(sc->sc_ah, HAL_CAP_PHYDIAG,
                                  HAL_CAP_RADAR_RRSSI,
                                  pe->pe_curRadar->rad_radarRssi, NULL);
        } else {
            ath_reset_radar(sc);
            index = get_radar_chan_index(sc);
            pe->pe_curRadar = &pe->pe_radarState[index];

            pe->pe_curRadar->rad_firpwr = ATH_RADAR_FIRPWR;
            ath_hal_setcapability(sc->sc_ah, HAL_CAP_PHYDIAG,
                                  HAL_CAP_RADAR_FIRPWR,
                                  (u_int32_t) pe->pe_curRadar->rad_firpwr, NULL);

            /* XXX - need to Set firpwr */
            pe->pe_curRadar->rad_radarRssi = ATH_RADAR_RRSSI;
            ath_hal_setcapability(sc->sc_ah, HAL_CAP_PHYDIAG,
                                  HAL_CAP_RADAR_RRSSI,
                                  pe->pe_curRadar->rad_radarRssi, NULL);
            pe->pe_curRadar->rad_height = ATH_RADAR_HEIGHT;
            ath_hal_setcapability(sc->sc_ah, HAL_CAP_PHYDIAG,
                                  HAL_CAP_RADAR_HEIGHT,
                                  pe->pe_curRadar->rad_height, NULL);
            pe->pe_curRadar->rad_pulseRssi = ATH_RADAR_PRSSI;
            ath_hal_setcapability(sc->sc_ah, HAL_CAP_PHYDIAG,
                                  HAL_CAP_RADAR_PRSSI,
                                  pe->pe_curRadar->rad_pulseRssi, NULL);
            pe->pe_curRadar->rad_inband = ATH_RADAR_INBAND;
            ath_hal_setcapability(sc->sc_ah, HAL_CAP_PHYDIAG,
                                  HAL_CAP_RADAR_INBAND,
                                  pe->pe_curRadar->rad_inband, NULL);
        }
        rfilt = ath_hal_getrxfilter(sc->sc_ah);
        rfilt |= HAL_RX_FILTER_PHYRADAR;
        ath_hal_setrxfilter(sc->sc_ah,rfilt);
        ath_hal_enablePhyDiag(sc->sc_ah);
    } else {
        rfilt = ath_hal_getrxfilter(sc->sc_ah);
        rfilt &= ~HAL_RX_FILTER_PHYRADAR;
        ath_hal_setrxfilter(sc->sc_ah,rfilt);
    }
}
Exemplo n.º 5
0
Arquivo: dfs.c Projeto: jorneytu/wlan
int dfs_radar_enable(struct ath_softc *sc)
{
	struct ath_dfs *dfs=sc->sc_dfs;
	u_int32_t rfilt;
	HAL_CHANNEL *chan=&sc->sc_curchan;
	struct ath_hal *ah = sc->sc_ah;
	HAL_CHANNEL *ext_ch=ath_hal_get_extension_channel(ah);

	if (dfs == NULL) {
		DFS_DPRINTK(sc, ATH_DEBUG_DFS, "%s: sc_dfs is NULL\n",
			__func__);
		return -EIO;
	}
	rfilt = ath_hal_getrxfilter(ah);
	if ((dfs->dfs_proc_phyerr & (DFS_RADAR_EN | DFS_AR_EN)) &&
	    (sc->sc_opmode == HAL_M_HOSTAP || sc->sc_opmode == HAL_M_IBSS)) {
            	if (chan->privFlags & CHANNEL_DFS) {
			struct dfs_state *rs_pri=NULL, *rs_ext=NULL;
			u_int8_t index_pri, index_ext;
			HAL_PHYERR_PARAM pe;
			dfs->sc_dfs_cac_time = ATH_DFS_WAIT_MS;

                        if (dfs->dfsdomain == DFS_ETSI_DOMAIN) {
                            if(IS_CHANNEL_WEATHER_RADAR(chan->channel)) {
                                dfs->sc_dfs_cac_time = ATH_DFS_WEATHER_CHANNEL_WAIT_MS;
                            } else {
                                 if (ext_ch && IS_CHANNEL_WEATHER_RADAR(ext_ch->channel)) {
                                     dfs->sc_dfs_cac_time = ATH_DFS_WEATHER_CHANNEL_WAIT_MS;
                                 }
                            }
                        }
                        if(dfs->sc_dfs_cac_time != ATH_DFS_WAIT_MS)
                            printk("WARNING!!! 10 minute CAC period as channel is a weather radar channel\n");
			/*
			  Disable radar detection in case we need to setup
			 * a new channel state and radars are somehow being
			 * reported. Avoids locking problem.
			 */

			rfilt = ath_hal_getrxfilter(ah);
			rfilt &= ~HAL_RX_FILTER_PHYRADAR;
			ath_hal_setrxfilter(ah, rfilt);
			/* Enable strong signal fast antenna diversity */
			ath_hal_setcapability(ah, HAL_CAP_DIVERSITY, 
					      HAL_CAP_STRONG_DIV, dfs->dfs_rinfo.rn_fastdivGCval, NULL);
			dfs_reset_alldelaylines(sc);

			rs_pri = dfs_getchanstate(sc, &index_pri, 0);
			if (ext_ch) {
                            rs_ext = dfs_getchanstate(sc, &index_ext, 1);
                            sc->sc_extchan = *ext_ch;
                        }
    			if (rs_pri != NULL && ((ext_ch==NULL)||(rs_ext != NULL))) {
				if (index_pri != dfs->dfs_curchan_radindex)
					dfs_reset_alldelaylines(sc);

				dfs->dfs_curchan_radindex = (int16_t) index_pri;
                                
                                if (rs_ext)
			            dfs->dfs_extchan_radindex = (int16_t) index_ext;

				pe.pe_firpwr = rs_pri->rs_firpwr;
				pe.pe_rrssi = rs_pri->rs_radarrssi;
				pe.pe_height = rs_pri->rs_height;
				pe.pe_prssi = rs_pri->rs_pulserssi;
				pe.pe_inband = rs_pri->rs_inband;
				/* 5413 specific */
				pe.pe_relpwr = rs_pri->rs_relpwr;
				pe.pe_relstep = rs_pri->rs_relstep;
				pe.pe_maxlen = rs_pri->rs_maxlen;


				/* Disable strong signal fast antenna diversity */
				ath_hal_setcapability(ah, HAL_CAP_DIVERSITY,
						      HAL_CAP_STRONG_DIV, 1, NULL);

				ath_hal_enabledfs(sc->sc_ah, &pe);
				rfilt |= HAL_RX_FILTER_PHYRADAR;
				ath_hal_setrxfilter(ah, rfilt);
				DFS_DPRINTK(sc, ATH_DEBUG_DFS, "Enabled radar detection on channel %d\n",
					chan->channel);

                                dfs->dur_multiplier =  (ath_hal_is_fast_clock_enabled(sc->sc_ah) ? (DFS_FAST_CLOCK_MULTIPLIER) : (DFS_NO_FAST_CLOCK_MULTIPLIER));
                    	DFS_DPRINTK(sc, ATH_DEBUG_DFS3,
			"%s: duration multiplier is %d\n", __func__, dfs->dur_multiplier);

				/*
				 * Fast antenna diversity for strong signals disturbs
				 * radar detection of 1-2us pusles. Enable fast diveristy
				 * but disable the strong signal aspect of it
				 */
				if (ath_hal_getcapability(ah, HAL_CAP_DIVERSITY, 1, NULL) == HAL_OK) {
					ath_hal_setcapability(ah, HAL_CAP_DIVERSITY, 
							      HAL_CAP_STRONG_DIV, 0, NULL);
				}
			} else
				DFS_DPRINTK(sc, ATH_DEBUG_DFS, "%s: No more radar states left\n",
					__func__);
		} else {
			if (!(chan->channelFlags & CHANNEL_2GHZ)) {
				/* Enable strong signal fast antenna diversity */
				ath_hal_setcapability(ah, HAL_CAP_DIVERSITY, 
						      HAL_CAP_STRONG_DIV, dfs->dfs_rinfo.rn_fastdivGCval, NULL);
				/* Disable Radar if not 2GHZ channel and not DFS */
				rfilt &= ~HAL_RX_FILTER_PHYRADAR;
				ath_hal_setrxfilter(ah, rfilt);
			}
		}
	} else {
		/* Enable strong signal fast antenna diversity */
		ath_hal_setcapability(ah, HAL_CAP_DIVERSITY, 
				      HAL_CAP_STRONG_DIV, dfs->dfs_rinfo.rn_fastdivGCval, NULL);
		/* Disable Radar if RADAR or AR not enabled */
		rfilt &= ~HAL_RX_FILTER_PHYRADAR;
		ath_hal_setrxfilter(ah, rfilt);
	}
	return 0;
}