1 ANI

ANI(Adapt Noise Immunity)就是基于CCK错包率,和/或CCK错包率,自动调整抗扰等级,从而提高或降低灵敏度,达到提高整体性能的目标。

2 关键常量

firstep_table    = { -4, -2,  0,  2,  4,  6,  8, 10, 12};  /*FIR滤波级别表*/

cycpwr_thr1_table = { -6, -4, -2,  0,  2,  4,  6,  8 }; /*功率阈值表*/

ofdm_level_table[] = {

/*     SI  FS  WS */

{  0,  0,  1  }, /* lvl 0 */

{  1,  1,  1  }, /* lvl 1 */

{  2,  2,  1  }, /* lvl 2 */

{  3,  2,  1  }, /* lvl 3  (default) */

{  4,  3,  1  }, /* lvl 4 */

{  5,  4,  1  }, /* lvl 5 */

{  6,  5,  1  }, /* lvl 6 */

{  7,  6,  1  }, /* lvl 7 */

{  7,  7,  1  }, /* lvl 8 */

{  7,  8,  0  }  /* lvl 9 */

};

/*SI Spur-Immunity-level;FS=FIRStep;WS=OFDM weak sigal on */

cck_level_table[] = {

/*     FS  MRC-CCK */

{  0,  1  },  /* lvl 0 */

{  1,  1  },  /* lvl 1 */

{  2,  1  },  /* lvl 2  (default) */

{  3,  1  },  /* lvl 3 */

{  4,  0  },  /* lvl 4 */

{  5,  0  },  /* lvl 5 */

{  6,  0  },  /* lvl 6 */

{  7,  0  },  /* lvl 7 (only for high rssi) */

{  8,  0  }   /* lvl 8 (only for high rssi) */

};

/*FS=First Step; MRC-CCK: Maximal Ratio Combining for CCK*/

3 重要函数

3.1 加载

ar9300_ani_attach(struct ath_hal *ah)

for (i = 0; i < 256; i++) {

ahp->ah_ani[i].ofdm_trig_high = 1000;

ahp->ah_ani[i].ofdm_trig_low = 400;

ahp->ah_ani[i].cck_trig_high = 600;

ahp->ah_ani[i].cck_trig_low = 300;

ahp->ah_ani[i].rssi_thr_high = 40;

ahp->ah_ani[i].rssi_thr_low =7;

ahp->ah_ani[i].ofdm_noise_immunity_level =3;

ahp->ah_ani[i].cck_noise_immunity_level =2;

ahp->ah_ani[i].ofdm_weak_sig_detect_off = 0;

ahp->ah_ani[i].spur_immunity_level = 3;

ahp->ah_ani[i].firstep_level = 2;

ahp->ah_ani[i].mrc_cck_off =0;

ahp->ah_ani[i].ofdms_turn = true;

ahp->ah_ani[i].must_restore = false;

}

OS_REG_WRITE(ah, AR_PHY_ERR_1, 0); 寄存器MAC_PCU_PHY_ERR_CNT_1 归0

OS_REG_WRITE(ah, AR_PHY_ERR_2, 0); 寄存器MAC_PCU_PHY_ERR_CNT_2归0

ar9300_enable_mib_counters(ah);

归档ACKFAIL,RTSFAIL,FCSFAIL,RTSOK,BEACONCOUNT计数

FLT_OFDM,FLT_CCK计数归0,启动MAC_PCU_PHY_ERR_CNT_1_MASK对错误OFDM计数,启动MAC_PCU_PHY_ERR_CNT_2_MASK对错误CCK计数

ahp->ah_ani_period =1000

如果ANI使能,则ahp->ah_proc_phy_err |= HAL_PROCESS_ANI;

3.2 初始化

ar9300_ani_init_defaults(struct ath_hal *ah, HAL_HT_MACMODE macmode)

index = ar9300_get_ani_channel_index(ah, chan); 基于信道存放

ani_state = &ahp->ah_ani[index];

ahp->ah_curani = ani_state;

val = OS_REG_READ(ah, AR_PHY_SFCORR);取BB_sfcorr值,self-coordinate

利用val值,填充

ani_state->ini_def.m1_thresh,

ani_state->ini_def.m2_thresh,和

ani_state->ini_def.m2_count_thr

val = OS_REG_READ(ah, AR_PHY_SFCORR_LOW);取BB_sfcorr_low值,并填充

ani_state->ini_def.m1_thresh_low,

ani_state->ini_def.m2_thresh_low,

ani_state->ini_def.m2_count_thr_low

val = OS_REG_READ(ah, AR_PHY_SFCORR_EXT); 取BB_sfcorr_ext值,填充

ani_state->ini_def.m1_thresh_ext,

ani_state->ini_def.m2_thresh_ext,

ani_state->ini_def.m1_thresh_low_ext,

ani_state->ini_def.m2_thresh_low_ext

ani_state->ini_def.firstep 源自BB_find_signal的0x0003F000

ani_state->ini_def.firstep_low源自BB_find_signal_low的(0x3f << 6)

ani_state->ini_def.cycpwr_thr1 源自BB_timing_control_5的0x000000FE

ani_state->ini_def.cycpwr_thr1_ext源自BB_ext_chan_pwr_thr_2_b0的0x0000FE00

ani_state->spur_immunity_level=3

ani_state->firstep_level=2

ani_state->ofdm_weak_sig_detect_off=0

ani_state->mrc_cck_off=0

ani_state->cycle_count = 0;

3.3 OFDM抗扰

ar9300_ani_set_odfm_noise_immunity_level(struct ath_hal *ah,

u_int8_t ofdm_noise_immunity_level)

ani_state->rssi =当前值;

ani_state->ofdm_noise_immunity_level
= ofdm_noise_immunity_level; 调整值

if
(ani_state->spur_immunity_level !=

ofdm_level_table[ofdm_noise_immunity_level].spur_immunity_level)

调用ar9300_ani_control调整SI等级

if
(ani_state->firstep_level !=

ofdm_level_table[ofdm_noise_immunity_level].fir_step_level &&

ofdm_level_table[ofdm_noise_immunity_level].fir_step_level >=

cck_level_table[ani_state->cck_noise_immunity_level].fir_step_level)

调用ar9300_ani_control调整FIR阶次;FIRStep是OFDM和CCK中的小者

若ani_state->rssi
<= ani_state->rssi_thr_high 且ani_state->ofdm_weak_sig_detect_off,则调用ar9300_ani_control开启HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION

若ani_state->ofdm_weak_sig_detect_off
=

ofdm_level_table[ofdm_noise_immunity_level].ofdm_weak_signal_on,则基于后者的值,调用ar9300_ani_control开关HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION

3.4 CCK抗扰

ar9300_ani_set_cck_noise_immunity_level(struct
ath_hal *ah,

u_int8_t
cck_noise_immunity_level)

更新ani_state->rssi

ani_state->cck_noise_immunity_level
= cck_noise_immunity_level;

level =
ani_state->ofdm_noise_immunity_level; OFDM抗扰等级

if (ani_state->firstep_level !=

cck_level_table[cck_noise_immunity_level].fir_step_level &&

cck_level_table[cck_noise_immunity_level].fir_step_level >=

ofdm_level_table[level].fir_step_level)

调用ar9300_ani_control调整FIR 阶次

DRAGONFLY和SCORPION型硬件,不调整MRC_CCK;否则,

若ani_state->mrc_cck_off
==

cck_level_table[cck_noise_immunity_level].mrc_cck_on

则调用ar9300_ani_control调整mrc_cck开关。

3.5 ANI控制

ar9300_ani_control(struct
ath_hal *ah, HAL_ANI_CMD cmd, int param)

case
OFDM_WEAK_SIGNAL_DETECTION

基于param为0或1,为BB_sfcorr_low,BB_sfcorr,BB_sfcorr_ext寄存器分别写入关闭检测的值,或由ar9300_ani_init_defaults初始化好的值。

BB_self_corr_low的0x00000001基于param值复位或置位。

ani_state->ofdm_weak_sig_detect_off
=param值取反

case FIRSTEP_LEVEL

value =

firstep_table[param] - firstep_table[2] + ani_state->ini_def.firstep;

设置BB_find_signal中0x0003F000位为value

value2 =

firstep_table[param] -firstep_table[2] + ani_state->ini_def.firstep_low;

设置BB_find_signal_low中(0x3f
<< 6)位为value2

ani_state->firstep_level =
param;

case SI_LEVEL

value =

cycpwr_thr1_table[param] - cycpwr_thr1_table[3]
+ ani_state->ini_def.cycpwr_thr1;

设置BB_ext_chan_pwr_thr_2_b0中0x0000FE00位为value

ani_state->spur_immunity_level
= param;

case MRC_CCK

若为on,则为低级别抗噪,也是缺省;否则,为高等级抗噪

非POSEIDON平台时,BB_mrc_cck_ctrl的bit0,bit1设置为param值。

ani_state->mrc_cck_off =param值取反

3.6 OFDMERR触发器处理

ar9300_ani_ofdm_err_trigger(struct
ath_hal *ah)

调用ar9300_ani_set_odfm_noise_immunity_level上调

ani_state->ofdm_noise_immunity_level
1个等级

CCKERR触发器处理

ar9300_ani_cck_err_trigger(struct
ath_hal *ah)

调用ar9300_ani_set_cck_noise_immunity_level
上调

ani_state->cck_noise_immunity_level
1个等级

总之,只要OFDM/CCK错误统计越界,则上调抗噪等级,灵敏度降低。

3.7 抗噪调低处理

ar9300_ani_lower_immunity(struct
ath_hal *ah)

优先调用ar9300_ani_set_odfm_noise_immunity_level调低ofdm_noise_immunity_level
1个等级

或者调用ar9300_ani_set_cck_noise_immunity_level
调低cck_noise_immunity_level 1个等级

4 抗噪处理

ar9300_ani_ar_poll(struct ath_hal *ah, const HAL_NODE_STATS *stats,

HAL_CHANNEL *chan, HAL_ANISTATS *ani_stats)

ani_state = ahp->ah_curani;

ahp->ah_stats.ast_nodestats = *stats;

listen_time = ar9300_ani_get_listen_time(ah, ani_stats); 返回一个0(非法)或正值

ani_state->listen_time += listen_time;

ar9300_update_mib_mac_stats(ah);

ofdm_phy_err_cnt = OFDM错误统计值;

cck_phy_err_cnt = CCK错误统计值

ahp->ah_stats.ast_ani_ofdmerrs和ahp->ah_stats.ast_ani_cckerrs 累加本轮递增值

统计ofdm_phy_err_rate和cck_phy_err_rate 值,均为本listen_time期内的错误比率

若ani_state->listen_time >=100 则

old_phy_noise_spur = ani_state->phy_noise_spur;

若ofdm_phy_err_rate <= ani_state->ofdm_trig_low 且

cck_phy_err_rate <= ani_state->cck_trig_low) 则

若ani_state->listen_time >= 5000 则ani_state->phy_noise_spur = 0;

否则ani_state->phy_noise_spur = 1;

若ani_state->listen_time > 5 * ahp->ah_ani_period 则

若ofdm_phy_err_rate <= ani_state->ofdm_trig_low 且

cck_phy_err_rate <= ani_state->cck_trig_low 则

调用ar9300_ani_lower_immunity  调低抗噪等级

调用ar9300_ani_restar重启计数

否则若ani_state->listen_time > ahp->ah_ani_period 则

若ofdm_phy_err_rate > ani_state->ofdm_trig_high 且

cck_phy_err_rate <= ani_state->cck_trig_high 或 检测odfm 则

调用ar9300_ani_ofdm_err_trigger,上调抗噪等级

调用ar9300_ani_restart重启计数

检测ofdm标记复位

否则 若cck_phy_err_rate > ani_state->cck_trig_high 则

调用ar9300_ani_cck_err_trigger,上调抗噪等级

调用ar9300_ani_restart 重启计数

检测ofdm标记置位

5 总结

启用了ANI(缺省)时,会基于OFDM Err和CCK Err统计值,自动调整抗噪等级,从而提高或降低接收机灵敏度(是否能调整PLCP灵敏度未知)。所以在一个需要高灵敏的场景下,需要先关闭ANI功能,然后直接手工调整:

弱信号寄存器:BB_sfcorr_low, BB_sfcorr, BB_ext_chan_scorr_thr的值,并确保BB_sfcorr_low的bit0为1(启用)或为0(关闭);

FIR阶次寄存器:BB_find_signal,BB_find_signal_low

冲激(毛刺)寄存器:BB_timing_control_5,BB_ext_chan_pwr_thr_2_b0

MRC(Maximal Ratio Combining)寄存器: BB_mrc_cck_ctrl的bit1-0,全为0或1;MRC对CCK有额外要求,如果低速下效果满意,可以取反测试一下。

ANI功能分析的更多相关文章

  1. Unity3D骨骼动画的分解(CleanData.Ani详解)

    CleanData是什么 CleanData以前没有特定的名字,(在easydown这个开源项目中,作为一个GameObjParser模块存在).在某三国项目中,我们使用GameObjParser将N ...

  2. PhyLab2.0需求与功能分析改进文档(NABCD)

    PhyLab1.0需求规格说明文档 1. 概述 1.1 项目概述 软剑攻城队小组于2015学年开发了PhyLab物理实验网站,一经发布好评如潮.网站的核心功能是提供预习报告和自动数据处理,而后加入了论 ...

  3. 简简单单制作鼠标静态动态 ani cur 小结 鼠标形状指针

    近日在网上看到一个视频录制软件里的鼠标样子的指针感觉蛮好的自己制作了一个,效果还不错,几乎跟那个鼠标形状一模一样啦.总结了下制作过程现分享如下:1.首先用ps建立一个30*30像素的空白图片 然后将自 ...

  4. Ani动态光标格式解析

    数据结构: Ani文件中的数据是按区段存放的,区段数据结构如下: 标识符(4字节ASCII),数据长度(一个DWORD),数据 按照此规则来看Ani文件,文件起始12字节可以理解为标准文件头,除数据长 ...

  5. iTop软件功能分析以及优缺点比较

    iTop软件功能分析以及优缺点比较 iTop对标文档 1. 概述 2. CMDB 3. 主要功能模块 3.1 配置管理(Configuration Managment) 3.2 用户请求管理(Help ...

  6. php框架rbac功能分析

    四大php框架rbac功能分析对比

  7. (转)基因芯片数据GO和KEGG功能分析

    随着人类基因组计划(Human Genome Project)即全部核苷酸测序的即将完成,人类基因组研究的重心逐渐进入后基因组时代(Postgenome Era),向基因的功能及基因的多样性倾斜.通过 ...

  8. C#图片缩放平移 —— 从功能分析到编码实现

    序 一直都是在看别人的博客,查到想要的,看完后把页面一关就万事大吉了,没啥感觉:直到后来遇到了同样的问题,总想不起来咋弄,关键是还查不到以前看过的,郁闷!现在想想,还是“好记性不如烂笔头”啊,自己弄过 ...

  9. 配置CiscoWorks 2000 ANI同步

    配置CiscoWorks 2000 ANI同步       在CiscoWorks 2000的LAN ManagementSolution(LMS)中,Cisco包含了一种ANI的自动发现过程和Res ...

随机推荐

  1. HTTP协议中PUT和POST使用区别

          有的观点认为,应该用POST来创建一个资源,用PUT来更新一个资源:有的观点认为,应该用PUT来创建一个资源,用POST来更新一个资源:还有的观点认为可以用PUT和POST中任何一个来做创 ...

  2. Codechef March Challenge 2014——The Street

    The Street Problem Code: STREETTA https://www.codechef.com/problems/STREETTA Submit Tweet All submis ...

  3. 【编程开发】PHP---面向对象

    面向对象编程 类:在现实世界中,任何事物都有种类的概念:车 类是由特征和行为构成的. 特征:都是不动的,从出厂的时候就已经内置好了(属性) 行为:一种动的状态.(方法(函数)) 行为依赖于这些特征,而 ...

  4. JAVA_SE基础——50.接口关系下的多态

    接口关系下的多态和继承关系下的多态 相差无几,应该更简单些~ 多态: 父类的引用类型变量指向了子类的对象或者是接口类型的引用类型变量指向了接口实现类 的对象. 实现关系下的多态: 接口  变量  = ...

  5. python 基础 set 集合类型补充

    为啥今天又重提这个数据类型呢?平时用的少,等要用起来的时候才发现,自己对这块啥都不知道了,so,今天就把这块再梳理一下咯. 一.set集合,是一个无序且不重复的元素集合.这一点是非常重要的. 二.集合 ...

  6. Jenkins中展示HTML测试报告

    背景:测试报告是用reportNG生成的,属于java自动化测试项目. 1)         安装插件 首先要安装HTML Publisher plugin,这个在插件管理里面搜索并安装即可,如下我已 ...

  7. springmvc的ModelAttribute注解

    先看一个没有使用@ModelAttribute的Controller方法. @RequestMapping("/save") public String save(User use ...

  8. SpringCloud的应用发布(四)顺序启动各个应用

    一.部署应用 二.启动应用(注意顺序) 三.观察效果 1.查看进程和日志 ps -ef | grep java tail -f AppYml.txt 2.验证功能

  9. CSS属性操作/下

    CSS属性操作/下 1.伪类 anchor伪类 跟<a>/</a>有关:专用于控制链接的显示效果 a:link(没有接触过的链接),用于定义了链接的常规状态. a:hover( ...

  10. 用js来实现那些数据结构06(队列)

    其实队列跟栈有很多相似的地方,包括其中的一些方法和使用方式,只是队列使用了与栈完全不同的原则,栈是后进先出原则,而队列是先进先出(First In First Out). 一.队列    队列是一种特 ...