ar9285_diversity.c (220593) | ar9285_diversity.c (220599) |
---|---|
1/* 2 * Copyright (c) 2008-2010 Atheros Communications Inc. 3 * Copyright (c) 2011 Adrian Chadd, Xenion Pty Ltd. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/* 2 * Copyright (c) 2008-2010 Atheros Communications Inc. 3 * Copyright (c) 2011 Adrian Chadd, Xenion Pty Ltd. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/dev/ath/ath_hal/ar9002/ar9285_diversity.c 220593 2011-04-13 11:32:15Z adrian $ | 26 * $FreeBSD: head/sys/dev/ath/ath_hal/ar9002/ar9285_diversity.c 220599 2011-04-13 15:08:51Z adrian $ |
27 */ 28#include "opt_ah.h" 29 30#include "ah.h" 31#include "ah_desc.h" 32#include "ah_internal.h" 33#include "ah_eeprom_v4k.h" 34 --- 331 unchanged lines hidden (view full) --- 366 struct ar9285_ant_comb *antcomb = &AH9285(ah)->ant_comb; 367 int alt_ratio = 0, alt_rssi_avg = 0, main_rssi_avg = 0, curr_alt_set; 368 int curr_main_set, curr_bias; 369 int main_rssi = rs->rs_rssi_ctl[0]; 370 int alt_rssi = rs->rs_rssi_ctl[1]; 371 int rx_ant_conf, main_ant_conf; 372 HAL_BOOL short_scan = AH_FALSE; 373 | 27 */ 28#include "opt_ah.h" 29 30#include "ah.h" 31#include "ah_desc.h" 32#include "ah_internal.h" 33#include "ah_eeprom_v4k.h" 34 --- 331 unchanged lines hidden (view full) --- 366 struct ar9285_ant_comb *antcomb = &AH9285(ah)->ant_comb; 367 int alt_ratio = 0, alt_rssi_avg = 0, main_rssi_avg = 0, curr_alt_set; 368 int curr_main_set, curr_bias; 369 int main_rssi = rs->rs_rssi_ctl[0]; 370 int alt_rssi = rs->rs_rssi_ctl[1]; 371 int rx_ant_conf, main_ant_conf; 372 HAL_BOOL short_scan = AH_FALSE; 373 |
374 if (! ar9285_check_div_comb(ah)) 375 return; 376 |
|
374 rx_ant_conf = (rs->rs_rssi_ctl[2] >> ATH_ANT_RX_CURRENT_SHIFT) & 375 ATH_ANT_RX_MASK; 376 main_ant_conf = (rs->rs_rssi_ctl[2] >> ATH_ANT_RX_MAIN_SHIFT) & 377 ATH_ANT_RX_MASK; 378 379 /* Record packet only when alt_rssi is positive */ 380 if (alt_rssi > 0) { 381 antcomb->total_pkt_count++; --- 28 unchanged lines hidden (view full) --- 410 alt_ratio = ((antcomb->alt_recv_cnt * 100) / 411 antcomb->total_pkt_count); 412 main_rssi_avg = (antcomb->main_total_rssi / 413 antcomb->total_pkt_count); 414 alt_rssi_avg = (antcomb->alt_total_rssi / 415 antcomb->total_pkt_count); 416 } 417 | 377 rx_ant_conf = (rs->rs_rssi_ctl[2] >> ATH_ANT_RX_CURRENT_SHIFT) & 378 ATH_ANT_RX_MASK; 379 main_ant_conf = (rs->rs_rssi_ctl[2] >> ATH_ANT_RX_MAIN_SHIFT) & 380 ATH_ANT_RX_MASK; 381 382 /* Record packet only when alt_rssi is positive */ 383 if (alt_rssi > 0) { 384 antcomb->total_pkt_count++; --- 28 unchanged lines hidden (view full) --- 413 alt_ratio = ((antcomb->alt_recv_cnt * 100) / 414 antcomb->total_pkt_count); 415 main_rssi_avg = (antcomb->main_total_rssi / 416 antcomb->total_pkt_count); 417 alt_rssi_avg = (antcomb->alt_total_rssi / 418 antcomb->total_pkt_count); 419 } 420 |
418 | |
419 ar9285_antdiv_comb_conf_get(ah, &div_ant_conf); 420 curr_alt_set = div_ant_conf.alt_lna_conf; 421 curr_main_set = div_ant_conf.main_lna_conf; 422 curr_bias = div_ant_conf.fast_div_bias; 423 424 antcomb->count++; 425 426 if (antcomb->count == ATH_ANT_DIV_COMB_MAX_COUNT) { --- 153 unchanged lines hidden (view full) --- 580 581 antcomb->quick_scan_cnt++; 582 583div_comb_done: 584 ath_ant_div_conf_fast_divbias(&div_ant_conf); 585 586 ar9285_antdiv_comb_conf_set(ah, &div_ant_conf); 587 | 421 ar9285_antdiv_comb_conf_get(ah, &div_ant_conf); 422 curr_alt_set = div_ant_conf.alt_lna_conf; 423 curr_main_set = div_ant_conf.main_lna_conf; 424 curr_bias = div_ant_conf.fast_div_bias; 425 426 antcomb->count++; 427 428 if (antcomb->count == ATH_ANT_DIV_COMB_MAX_COUNT) { --- 153 unchanged lines hidden (view full) --- 582 583 antcomb->quick_scan_cnt++; 584 585div_comb_done: 586 ath_ant_div_conf_fast_divbias(&div_ant_conf); 587 588 ar9285_antdiv_comb_conf_set(ah, &div_ant_conf); 589 |
590 if (curr_alt_set != div_ant_conf.alt_lna_conf) 591 HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: lna_conf: %x -> %x\n", 592 __func__, curr_alt_set, div_ant_conf.alt_lna_conf); 593 if (curr_main_set != div_ant_conf.main_lna_conf) 594 HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: main_lna_conf: %x -> %x\n", 595 __func__, curr_main_set, div_ant_conf.main_lna_conf); 596 if (curr_bias != div_ant_conf.fast_div_bias) 597 HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: fast_div_bias: %x -> %x\n", 598 __func__, curr_bias, div_ant_conf.fast_div_bias); 599 |
|
588 antcomb->scan_start_time = ticks; 589 antcomb->total_pkt_count = 0; 590 antcomb->main_total_rssi = 0; 591 antcomb->alt_total_rssi = 0; 592 antcomb->main_recv_cnt = 0; 593 antcomb->alt_recv_cnt = 0; 594} | 600 antcomb->scan_start_time = ticks; 601 antcomb->total_pkt_count = 0; 602 antcomb->main_total_rssi = 0; 603 antcomb->alt_total_rssi = 0; 604 antcomb->main_recv_cnt = 0; 605 antcomb->alt_recv_cnt = 0; 606} |