当前位置: 首页>>代码示例>>C++>>正文


C++ ATH5K_DBG_UNLIMIT函数代码示例

本文整理汇总了C++中ATH5K_DBG_UNLIMIT函数的典型用法代码示例。如果您正苦于以下问题:C++ ATH5K_DBG_UNLIMIT函数的具体用法?C++ ATH5K_DBG_UNLIMIT怎么用?C++ ATH5K_DBG_UNLIMIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ATH5K_DBG_UNLIMIT函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ath5k_ani_set_noise_immunity_level

void
ath5k_ani_set_noise_immunity_level(struct ath5k_hw *ah, int level)
{
#if 0
	static const s8 lo[] = { -52, -56, -60, -64, -70 };
	static const s8 hi[] = { -18, -18, -16, -14, -12 };
	static const s8 sz[] = { -34, -41, -48, -55, -62 };
	static const s8 fr[] = { -70, -72, -75, -78, -80 };
#else
	static const s8 lo[] = { -64, -70 };
	static const s8 hi[] = { -14, -12 };
	static const s8 sz[] = { -55, -62 };
	static const s8 fr[] = { -78, -80 };
#endif
	if (level < 0 || level >= ARRAY_SIZE(sz)) {
		ATH5K_ERR(ah, "noise immunity level %d out of range",
			  level);
		return;
	}

	AR5K_REG_WRITE_BITS(ah, AR5K_PHY_DESIRED_SIZE,
				AR5K_PHY_DESIRED_SIZE_TOT, sz[level]);
	AR5K_REG_WRITE_BITS(ah, AR5K_PHY_AGCCOARSE,
				AR5K_PHY_AGCCOARSE_LO, lo[level]);
	AR5K_REG_WRITE_BITS(ah, AR5K_PHY_AGCCOARSE,
				AR5K_PHY_AGCCOARSE_HI, hi[level]);
	AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SIG,
				AR5K_PHY_SIG_FIRPWR, fr[level]);

	ah->ani_state.noise_imm_level = level;
	ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "new level %d", level);
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:32,代码来源:ani.c

示例2: ath5k_ani_set_ofdm_weak_signal_detection

/**
 * ath5k_ani_set_ofdm_weak_signal_detection() - Set OFDM weak signal detection
 * @ah: The &struct ath5k_hw
 * @on: turn on or off
 */
void
ath5k_ani_set_ofdm_weak_signal_detection(struct ath5k_hw *ah, bool on)
{
    static const int m1l[] = { 127, 50 };
    static const int m2l[] = { 127, 40 };
    static const int m1[] = { 127, 0x4d };
    static const int m2[] = { 127, 0x40 };
    static const int m2cnt[] = { 31, 16 };
    static const int m2lcnt[] = { 63, 48 };

    AR5K_REG_WRITE_BITS(ah, AR5K_PHY_WEAK_OFDM_LOW_THR,
                        AR5K_PHY_WEAK_OFDM_LOW_THR_M1, m1l[on]);
    AR5K_REG_WRITE_BITS(ah, AR5K_PHY_WEAK_OFDM_LOW_THR,
                        AR5K_PHY_WEAK_OFDM_LOW_THR_M2, m2l[on]);
    AR5K_REG_WRITE_BITS(ah, AR5K_PHY_WEAK_OFDM_HIGH_THR,
                        AR5K_PHY_WEAK_OFDM_HIGH_THR_M1, m1[on]);
    AR5K_REG_WRITE_BITS(ah, AR5K_PHY_WEAK_OFDM_HIGH_THR,
                        AR5K_PHY_WEAK_OFDM_HIGH_THR_M2, m2[on]);
    AR5K_REG_WRITE_BITS(ah, AR5K_PHY_WEAK_OFDM_HIGH_THR,
                        AR5K_PHY_WEAK_OFDM_HIGH_THR_M2_COUNT, m2cnt[on]);
    AR5K_REG_WRITE_BITS(ah, AR5K_PHY_WEAK_OFDM_LOW_THR,
                        AR5K_PHY_WEAK_OFDM_LOW_THR_M2_COUNT, m2lcnt[on]);

    if (on)
        AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_WEAK_OFDM_LOW_THR,
                             AR5K_PHY_WEAK_OFDM_LOW_THR_SELFCOR_EN);
    else
        AR5K_REG_DISABLE_BITS(ah, AR5K_PHY_WEAK_OFDM_LOW_THR,
                              AR5K_PHY_WEAK_OFDM_LOW_THR_SELFCOR_EN);

    ah->ani_state.ofdm_weak_sig = on;
    ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "turned %s",
                      on ? "on" : "off");
}
开发者ID:JackWangCUMT,项目名称:linux,代码行数:39,代码来源:ani.c

示例3: ath5k_ani_calibration

/**
 * ath5k_ani_calibration() - The main ANI calibration function
 * @ah: The &struct ath5k_hw
 *
 * We count OFDM and CCK errors relative to the time where we did not send or
 * receive ("listen" time) and raise or lower immunity accordingly.
 * This is called regularly (every second) from the calibration timer, but also
 * when an error threshold has been reached.
 *
 * In order to synchronize access from different contexts, this should be
 * called only indirectly by scheduling the ANI tasklet!
 */
void
ath5k_ani_calibration(struct ath5k_hw *ah)
{
    struct ath5k_ani_state *as = &ah->ani_state;
    int listen, ofdm_high, ofdm_low, cck_high, cck_low;

    /* get listen time since last call and add it to the counter because we
     * might not have restarted the "ani period" last time.
     * always do this to calculate the busy time also in manual mode */
    listen = ath5k_hw_ani_get_listen_time(ah, as);
    as->listen_time += listen;

    if (as->ani_mode != ATH5K_ANI_MODE_AUTO)
        return;

    ath5k_ani_save_and_clear_phy_errors(ah, as);

    ofdm_high = as->listen_time * ATH5K_ANI_OFDM_TRIG_HIGH / 1000;
    cck_high = as->listen_time * ATH5K_ANI_CCK_TRIG_HIGH / 1000;
    ofdm_low = as->listen_time * ATH5K_ANI_OFDM_TRIG_LOW / 1000;
    cck_low = as->listen_time * ATH5K_ANI_CCK_TRIG_LOW / 1000;

    ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI,
                      "listen %d (now %d)", as->listen_time, listen);
    ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI,
                      "check high ofdm %d/%d cck %d/%d",
                      as->ofdm_errors, ofdm_high, as->cck_errors, cck_high);

    if (as->ofdm_errors > ofdm_high || as->cck_errors > cck_high) {
        /* too many PHY errors - we have to raise immunity */
        bool ofdm_flag = as->ofdm_errors > ofdm_high ? true : false;
        ath5k_ani_raise_immunity(ah, as, ofdm_flag);
        ath5k_ani_period_restart(as);

    } else if (as->listen_time > 5 * ATH5K_ANI_LISTEN_PERIOD) {
        /* If more than 5 (TODO: why 5?) periods have passed and we got
         * relatively little errors we can try to lower immunity */
        ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI,
                          "check low ofdm %d/%d cck %d/%d",
                          as->ofdm_errors, ofdm_low, as->cck_errors, cck_low);

        if (as->ofdm_errors <= ofdm_low && as->cck_errors <= cck_low)
            ath5k_ani_lower_immunity(ah, as);

        ath5k_ani_period_restart(as);
    }
}
开发者ID:JackWangCUMT,项目名称:linux,代码行数:59,代码来源:ani.c

示例4: ath5k_ani_set_firstep_level

void
ath5k_ani_set_firstep_level(struct ath5k_hw *ah, int level)
{
	const int val[] = { 0, 4, 8 };

	if (level < 0 || level >= ARRAY_SIZE(val)) {
		ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_ANI,
			"level out of range %d", level);
		return;
	}

	AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SIG,
				AR5K_PHY_SIG_FIRSTEP, val[level]);

	ah->ah_sc->ani_state.firstep_level = level;
	ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_ANI, "new level %d", level);
}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:17,代码来源:ani.c

示例5: ath5k_ani_set_spur_immunity_level

void
ath5k_ani_set_spur_immunity_level(struct ath5k_hw *ah, int level)
{
	const int val[] = { 2, 4, 6, 8, 10, 12, 14, 16 };

	if (level < 0 || level >= ARRAY_SIZE(val) ||
	    level > ah->ah_sc->ani_state.max_spur_level) {
		ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_ANI,
			"level out of range %d", level);
		return;
	}

	AR5K_REG_WRITE_BITS(ah, AR5K_PHY_OFDM_SELFCORR,
		AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1, val[level]);

	ah->ah_sc->ani_state.spur_level = level;
	ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_ANI, "new level %d", level);
}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:18,代码来源:ani.c

示例6: ath5k_ani_set_cck_weak_signal_detection

/**
 * ath5k_ani_set_cck_weak_signal_detection() - Set CCK weak signal detection
 * @ah: The &struct ath5k_hw
 * @on: turn on or off
 */
void
ath5k_ani_set_cck_weak_signal_detection(struct ath5k_hw *ah, bool on)
{
    static const int val[] = { 8, 6 };
    AR5K_REG_WRITE_BITS(ah, AR5K_PHY_CCK_CROSSCORR,
                        AR5K_PHY_CCK_CROSSCORR_WEAK_SIG_THR, val[on]);
    ah->ani_state.cck_weak_sig = on;
    ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "turned %s",
                      on ? "on" : "off");
}
开发者ID:JackWangCUMT,项目名称:linux,代码行数:15,代码来源:ani.c

示例7: ath5k_ani_calibration

void
ath5k_ani_calibration(struct ath5k_hw *ah)
{
	struct ath5k_ani_state *as = &ah->ani_state;
	int listen, ofdm_high, ofdm_low, cck_high, cck_low;

	listen = ath5k_hw_ani_get_listen_time(ah, as);
	as->listen_time += listen;

	if (as->ani_mode != ATH5K_ANI_MODE_AUTO)
		return;

	ath5k_ani_save_and_clear_phy_errors(ah, as);

	ofdm_high = as->listen_time * ATH5K_ANI_OFDM_TRIG_HIGH / 1000;
	cck_high = as->listen_time * ATH5K_ANI_CCK_TRIG_HIGH / 1000;
	ofdm_low = as->listen_time * ATH5K_ANI_OFDM_TRIG_LOW / 1000;
	cck_low = as->listen_time * ATH5K_ANI_CCK_TRIG_LOW / 1000;

	ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI,
		"listen %d (now %d)", as->listen_time, listen);
	ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI,
		"check high ofdm %d/%d cck %d/%d",
		as->ofdm_errors, ofdm_high, as->cck_errors, cck_high);

	if (as->ofdm_errors > ofdm_high || as->cck_errors > cck_high) {
		
		bool ofdm_flag = as->ofdm_errors > ofdm_high ? true : false;
		ath5k_ani_raise_immunity(ah, as, ofdm_flag);
		ath5k_ani_period_restart(as);

	} else if (as->listen_time > 5 * ATH5K_ANI_LISTEN_PERIOD) {
		ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI,
			"check low ofdm %d/%d cck %d/%d",
			as->ofdm_errors, ofdm_low, as->cck_errors, cck_low);

		if (as->ofdm_errors <= ofdm_low && as->cck_errors <= cck_low)
			ath5k_ani_lower_immunity(ah, as);

		ath5k_ani_period_restart(as);
	}
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:42,代码来源:ani.c

示例8: ath5k_ani_lower_immunity

/**
 * ath5k_ani_lower_immunity() - Decrease noise immunity
 * @ah: The &struct ath5k_hw
 * @as: The &struct ath5k_ani_state
 *
 * Try to lower noise immunity (=increase sensitivity) in several steps
 * depending on the average RSSI of the beacons we received.
 */
static void
ath5k_ani_lower_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as)
{
    int rssi = ewma_read(&ah->ah_beacon_rssi_avg);

    ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "lower immunity");

    if (ah->opmode == NL80211_IFTYPE_AP) {
        /* AP mode */
        if (as->firstep_level > 0) {
            ath5k_ani_set_firstep_level(ah, as->firstep_level - 1);
            return;
        }
    } else {
        /* STA and IBSS mode (see TODO above) */
        if (rssi > ATH5K_ANI_RSSI_THR_HIGH) {
            /* beacon signal is high, leave OFDM weak signal
             * detection off or it may oscillate
             * TODO: who said it's off??? */
        } else if (rssi > ATH5K_ANI_RSSI_THR_LOW) {
            /* beacon RSSI is mid-range: turn on ODFM weak signal
             * detection and next, lower firstep level */
            if (as->ofdm_weak_sig == false) {
                ath5k_ani_set_ofdm_weak_signal_detection(ah,
                        true);
                return;
            }
            if (as->firstep_level > 0) {
                ath5k_ani_set_firstep_level(ah,
                                            as->firstep_level - 1);
                return;
            }
        } else {
            /* beacon signal is low: only reduce firstep level */
            if (as->firstep_level > 0) {
                ath5k_ani_set_firstep_level(ah,
                                            as->firstep_level - 1);
                return;
            }
        }
    }

    /* all modes */
    if (as->spur_level > 0) {
        ath5k_ani_set_spur_immunity_level(ah, as->spur_level - 1);
        return;
    }

    /* finally, reduce noise immunity */
    if (as->noise_imm_level > 0) {
        ath5k_ani_set_noise_immunity_level(ah, as->noise_imm_level - 1);
        return;
    }
}
开发者ID:JackWangCUMT,项目名称:linux,代码行数:62,代码来源:ani.c

示例9: ath5k_ani_set_noise_immunity_level

void
ath5k_ani_set_noise_immunity_level(struct ath5k_hw *ah, int level)
{
	/* TODO:
	 * ANI documents suggest the following five levels to use, but the HAL
	 * and ath9k use only use the last two levels, making this
	 * essentially an on/off option. There *may* be a reason for this (???),
	 * so i stick with the HAL version for now...
	 */
#if 0
	const s8 hi[] = { -18, -18, -16, -14, -12 };
	const s8 lo[] = { -52, -56, -60, -64, -70 };
	const s8 sz[] = { -34, -41, -48, -55, -62 };
	const s8 fr[] = { -70, -72, -75, -78, -80 };
#else
	const s8 sz[] = { -55, -62 };
	const s8 lo[] = { -64, -70 };
	const s8 hi[] = { -14, -12 };
	const s8 fr[] = { -78, -80 };
#endif
	if (level < 0 || level >= ARRAY_SIZE(sz)) {
		ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_ANI,
			"level out of range %d", level);
		return;
	}

	AR5K_REG_WRITE_BITS(ah, AR5K_PHY_DESIRED_SIZE,
				AR5K_PHY_DESIRED_SIZE_TOT, sz[level]);
	AR5K_REG_WRITE_BITS(ah, AR5K_PHY_AGCCOARSE,
				AR5K_PHY_AGCCOARSE_LO, lo[level]);
	AR5K_REG_WRITE_BITS(ah, AR5K_PHY_AGCCOARSE,
				AR5K_PHY_AGCCOARSE_HI, hi[level]);
	AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SIG,
				AR5K_PHY_SIG_FIRPWR, fr[level]);

	ah->ah_sc->ani_state.noise_imm_level = level;
	ATH5K_DBG_UNLIMIT(ah->ah_sc, ATH5K_DEBUG_ANI, "new level %d", level);
}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:38,代码来源:ani.c

示例10: ath5k_ani_lower_immunity

static void
ath5k_ani_lower_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as)
{
	int rssi = ewma_read(&ah->ah_beacon_rssi_avg);

	ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "lower immunity");

	if (ah->opmode == NL80211_IFTYPE_AP) {
		
		if (as->firstep_level > 0) {
			ath5k_ani_set_firstep_level(ah, as->firstep_level - 1);
			return;
		}
	} else {
		
		if (rssi > ATH5K_ANI_RSSI_THR_HIGH) {
		} else if (rssi > ATH5K_ANI_RSSI_THR_LOW) {
			if (!as->ofdm_weak_sig) {
				ath5k_ani_set_ofdm_weak_signal_detection(ah,
									 true);
				return;
			}
			if (as->firstep_level > 0) {
				ath5k_ani_set_firstep_level(ah,
							as->firstep_level - 1);
				return;
			}
		} else {
			
			if (as->firstep_level > 0) {
				ath5k_ani_set_firstep_level(ah,
							as->firstep_level - 1);
				return;
			}
		}
	}

	
	if (as->spur_level > 0) {
		ath5k_ani_set_spur_immunity_level(ah, as->spur_level - 1);
		return;
	}

	
	if (as->noise_imm_level > 0) {
		ath5k_ani_set_noise_immunity_level(ah, as->noise_imm_level - 1);
		return;
	}
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:49,代码来源:ani.c

示例11: ath5k_ani_init

/**
 * ath5k_ani_init() - Initialize ANI
 * @ah: The &struct ath5k_hw
 * @mode: One of enum ath5k_ani_mode
 *
 * Initialize ANI according to mode.
 */
void
ath5k_ani_init(struct ath5k_hw *ah, enum ath5k_ani_mode mode)
{
    /* ANI is only possible on 5212 and newer */
    if (ah->ah_version < AR5K_AR5212)
        return;

    if (mode < ATH5K_ANI_MODE_OFF || mode > ATH5K_ANI_MODE_AUTO) {
        ATH5K_ERR(ah, "ANI mode %d out of range", mode);
        return;
    }

    /* clear old state information */
    memset(&ah->ani_state, 0, sizeof(ah->ani_state));

    /* older hardware has more spur levels than newer */
    if (ah->ah_mac_srev < AR5K_SREV_AR2414)
        ah->ani_state.max_spur_level = 7;
    else
        ah->ani_state.max_spur_level = 2;

    /* initial values for our ani parameters */
    if (mode == ATH5K_ANI_MODE_OFF) {
        ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "ANI off\n");
    } else if (mode == ATH5K_ANI_MODE_MANUAL_LOW) {
        ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI,
                          "ANI manual low -> high sensitivity\n");
        ath5k_ani_set_noise_immunity_level(ah, 0);
        ath5k_ani_set_spur_immunity_level(ah, 0);
        ath5k_ani_set_firstep_level(ah, 0);
        ath5k_ani_set_ofdm_weak_signal_detection(ah, true);
        ath5k_ani_set_cck_weak_signal_detection(ah, true);
    } else if (mode == ATH5K_ANI_MODE_MANUAL_HIGH) {
        ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI,
                          "ANI manual high -> low sensitivity\n");
        ath5k_ani_set_noise_immunity_level(ah,
                                           ATH5K_ANI_MAX_NOISE_IMM_LVL);
        ath5k_ani_set_spur_immunity_level(ah,
                                          ah->ani_state.max_spur_level);
        ath5k_ani_set_firstep_level(ah, ATH5K_ANI_MAX_FIRSTEP_LVL);
        ath5k_ani_set_ofdm_weak_signal_detection(ah, false);
        ath5k_ani_set_cck_weak_signal_detection(ah, false);
    } else if (mode == ATH5K_ANI_MODE_AUTO) {
        ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "ANI auto\n");
        ath5k_ani_set_noise_immunity_level(ah, 0);
        ath5k_ani_set_spur_immunity_level(ah, 0);
        ath5k_ani_set_firstep_level(ah, 0);
        ath5k_ani_set_ofdm_weak_signal_detection(ah, true);
        ath5k_ani_set_cck_weak_signal_detection(ah, false);
    }

    /* newer hardware has PHY error counter registers which we can use to
     * get OFDM and CCK error counts. older hardware has to set rxfilter and
     * report every single PHY error by calling ath5k_ani_phy_error_report()
     */
    if (mode == ATH5K_ANI_MODE_AUTO) {
        if (ah->ah_capabilities.cap_has_phyerr_counters)
            ath5k_enable_phy_err_counters(ah);
        else
            ath5k_hw_set_rx_filter(ah, ath5k_hw_get_rx_filter(ah) |
                                   AR5K_RX_FILTER_PHYERR);
    } else {
        if (ah->ah_capabilities.cap_has_phyerr_counters)
            ath5k_disable_phy_err_counters(ah);
        else
            ath5k_hw_set_rx_filter(ah, ath5k_hw_get_rx_filter(ah) &
                                   ~AR5K_RX_FILTER_PHYERR);
    }

    ah->ani_state.ani_mode = mode;
}
开发者ID:JackWangCUMT,项目名称:linux,代码行数:78,代码来源:ani.c

示例12: ath5k_ani_raise_immunity

/**
 * ath5k_ani_raise_immunity() - Increase noise immunity
 * @ah: The &struct ath5k_hw
 * @as: The &struct ath5k_ani_state
 * @ofdm_trigger: If this is true we are called because of too many OFDM errors,
 * the algorithm will tune more parameters then.
 *
 * Try to raise noise immunity (=decrease sensitivity) in several steps
 * depending on the average RSSI of the beacons we received.
 */
static void
ath5k_ani_raise_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as,
                         bool ofdm_trigger)
{
    int rssi = ewma_read(&ah->ah_beacon_rssi_avg);

    ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "raise immunity (%s)",
                      ofdm_trigger ? "ODFM" : "CCK");

    /* first: raise noise immunity */
    if (as->noise_imm_level < ATH5K_ANI_MAX_NOISE_IMM_LVL) {
        ath5k_ani_set_noise_immunity_level(ah, as->noise_imm_level + 1);
        return;
    }

    /* only OFDM: raise spur immunity level */
    if (ofdm_trigger &&
            as->spur_level < ah->ani_state.max_spur_level) {
        ath5k_ani_set_spur_immunity_level(ah, as->spur_level + 1);
        return;
    }

    /* AP mode */
    if (ah->opmode == NL80211_IFTYPE_AP) {
        if (as->firstep_level < ATH5K_ANI_MAX_FIRSTEP_LVL)
            ath5k_ani_set_firstep_level(ah, as->firstep_level + 1);
        return;
    }

    /* STA and IBSS mode */

    /* TODO: for IBSS mode it would be better to keep a beacon RSSI average
     * per each neighbour node and use the minimum of these, to make sure we
     * don't shut out a remote node by raising immunity too high. */

    if (rssi > ATH5K_ANI_RSSI_THR_HIGH) {
        ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI,
                          "beacon RSSI high");
        /* only OFDM: beacon RSSI is high, we can disable ODFM weak
         * signal detection */
        if (ofdm_trigger && as->ofdm_weak_sig == true) {
            ath5k_ani_set_ofdm_weak_signal_detection(ah, false);
            ath5k_ani_set_spur_immunity_level(ah, 0);
            return;
        }
        /* as a last resort or CCK: raise firstep level */
        if (as->firstep_level < ATH5K_ANI_MAX_FIRSTEP_LVL) {
            ath5k_ani_set_firstep_level(ah, as->firstep_level + 1);
            return;
        }
    } else if (rssi > ATH5K_ANI_RSSI_THR_LOW) {
        /* beacon RSSI in mid range, we need OFDM weak signal detect,
         * but can raise firstep level */
        ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI,
                          "beacon RSSI mid");
        if (ofdm_trigger && as->ofdm_weak_sig == false)
            ath5k_ani_set_ofdm_weak_signal_detection(ah, true);
        if (as->firstep_level < ATH5K_ANI_MAX_FIRSTEP_LVL)
            ath5k_ani_set_firstep_level(ah, as->firstep_level + 1);
        return;
    } else if (ah->ah_current_channel->band == IEEE80211_BAND_2GHZ) {
        /* beacon RSSI is low. in B/G mode turn of OFDM weak signal
         * detect and zero firstep level to maximize CCK sensitivity */
        ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI,
                          "beacon RSSI low, 2GHz");
        if (ofdm_trigger && as->ofdm_weak_sig == true)
            ath5k_ani_set_ofdm_weak_signal_detection(ah, false);
        if (as->firstep_level > 0)
            ath5k_ani_set_firstep_level(ah, 0);
        return;
    }

    /* TODO: why not?:
    if (as->cck_weak_sig == true) {
    	ath5k_ani_set_cck_weak_signal_detection(ah, false);
    }
    */
}
开发者ID:JackWangCUMT,项目名称:linux,代码行数:88,代码来源:ani.c

示例13: ath5k_ani_init

void
ath5k_ani_init(struct ath5k_hw *ah, enum ath5k_ani_mode mode)
{
	
	if (ah->ah_version < AR5K_AR5212)
		return;

	if (mode < ATH5K_ANI_MODE_OFF || mode > ATH5K_ANI_MODE_AUTO) {
		ATH5K_ERR(ah, "ANI mode %d out of range", mode);
		return;
	}

	
	memset(&ah->ani_state, 0, sizeof(ah->ani_state));

	
	if (ah->ah_mac_srev < AR5K_SREV_AR2414)
		ah->ani_state.max_spur_level = 7;
	else
		ah->ani_state.max_spur_level = 2;

	
	if (mode == ATH5K_ANI_MODE_OFF) {
		ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "ANI off\n");
	} else if (mode == ATH5K_ANI_MODE_MANUAL_LOW) {
		ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI,
			"ANI manual low -> high sensitivity\n");
		ath5k_ani_set_noise_immunity_level(ah, 0);
		ath5k_ani_set_spur_immunity_level(ah, 0);
		ath5k_ani_set_firstep_level(ah, 0);
		ath5k_ani_set_ofdm_weak_signal_detection(ah, true);
		ath5k_ani_set_cck_weak_signal_detection(ah, true);
	} else if (mode == ATH5K_ANI_MODE_MANUAL_HIGH) {
		ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI,
			"ANI manual high -> low sensitivity\n");
		ath5k_ani_set_noise_immunity_level(ah,
					ATH5K_ANI_MAX_NOISE_IMM_LVL);
		ath5k_ani_set_spur_immunity_level(ah,
					ah->ani_state.max_spur_level);
		ath5k_ani_set_firstep_level(ah, ATH5K_ANI_MAX_FIRSTEP_LVL);
		ath5k_ani_set_ofdm_weak_signal_detection(ah, false);
		ath5k_ani_set_cck_weak_signal_detection(ah, false);
	} else if (mode == ATH5K_ANI_MODE_AUTO) {
		ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "ANI auto\n");
		ath5k_ani_set_noise_immunity_level(ah, 0);
		ath5k_ani_set_spur_immunity_level(ah, 0);
		ath5k_ani_set_firstep_level(ah, 0);
		ath5k_ani_set_ofdm_weak_signal_detection(ah, true);
		ath5k_ani_set_cck_weak_signal_detection(ah, false);
	}

	if (mode == ATH5K_ANI_MODE_AUTO) {
		if (ah->ah_capabilities.cap_has_phyerr_counters)
			ath5k_enable_phy_err_counters(ah);
		else
			ath5k_hw_set_rx_filter(ah, ath5k_hw_get_rx_filter(ah) |
						   AR5K_RX_FILTER_PHYERR);
	} else {
		if (ah->ah_capabilities.cap_has_phyerr_counters)
			ath5k_disable_phy_err_counters(ah);
		else
			ath5k_hw_set_rx_filter(ah, ath5k_hw_get_rx_filter(ah) &
						   ~AR5K_RX_FILTER_PHYERR);
	}

	ah->ani_state.ani_mode = mode;
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:67,代码来源:ani.c

示例14: ath5k_ani_raise_immunity

static void
ath5k_ani_raise_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as,
			 bool ofdm_trigger)
{
	int rssi = ewma_read(&ah->ah_beacon_rssi_avg);

	ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "raise immunity (%s)",
		ofdm_trigger ? "ODFM" : "CCK");

	
	if (as->noise_imm_level < ATH5K_ANI_MAX_NOISE_IMM_LVL) {
		ath5k_ani_set_noise_immunity_level(ah, as->noise_imm_level + 1);
		return;
	}

	
	if (ofdm_trigger &&
	    as->spur_level < ah->ani_state.max_spur_level) {
		ath5k_ani_set_spur_immunity_level(ah, as->spur_level + 1);
		return;
	}

	
	if (ah->opmode == NL80211_IFTYPE_AP) {
		if (as->firstep_level < ATH5K_ANI_MAX_FIRSTEP_LVL)
			ath5k_ani_set_firstep_level(ah, as->firstep_level + 1);
		return;
	}

	


	if (rssi > ATH5K_ANI_RSSI_THR_HIGH) {
		ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI,
				  "beacon RSSI high");
		if (ofdm_trigger && as->ofdm_weak_sig) {
			ath5k_ani_set_ofdm_weak_signal_detection(ah, false);
			ath5k_ani_set_spur_immunity_level(ah, 0);
			return;
		}
		
		if (as->firstep_level < ATH5K_ANI_MAX_FIRSTEP_LVL) {
			ath5k_ani_set_firstep_level(ah, as->firstep_level + 1);
			return;
		}
	} else if (rssi > ATH5K_ANI_RSSI_THR_LOW) {
		ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI,
				  "beacon RSSI mid");
		if (ofdm_trigger && !as->ofdm_weak_sig)
			ath5k_ani_set_ofdm_weak_signal_detection(ah, true);
		if (as->firstep_level < ATH5K_ANI_MAX_FIRSTEP_LVL)
			ath5k_ani_set_firstep_level(ah, as->firstep_level + 1);
		return;
	} else if (ah->ah_current_channel->band == IEEE80211_BAND_2GHZ) {
		ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI,
				  "beacon RSSI low, 2GHz");
		if (ofdm_trigger && as->ofdm_weak_sig)
			ath5k_ani_set_ofdm_weak_signal_detection(ah, false);
		if (as->firstep_level > 0)
			ath5k_ani_set_firstep_level(ah, 0);
		return;
	}

}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:64,代码来源:ani.c


注:本文中的ATH5K_DBG_UNLIMIT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。