WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
alg_intf_det.h
浏览该文件的文档.
1/*
2 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2022-2022. All rights reserved.
3 * Description: Header file for alg_intf_det.c
4 */
5
6
7#ifndef __ALG_INTF_DET_H__
8#define __ALG_INTF_DET_H__
9
10#ifdef _PRE_WLAN_FEATURE_INTF_DET
11
12/******************************************************************************
13 1 其他头文件包含
14******************************************************************************/
15#include "osal_types.h"
16#include "oal_fsm.h"
17#include "mac_vap_ext.h"
18#include "msg_alg_rom.h"
19#ifdef __cplusplus
20#if __cplusplus
21extern "C" {
22#endif
23#endif
24/******************************************************************************
25 2 宏定义
26******************************************************************************/
27#ifdef _PRE_WLAN_FEATURE_NEGTIVE_DET
28#define ALG_INTF_DET_STATISTIC_CNT_TH 10 /* 连续统计门限 */
29#define ALG_INTF_DET_GLA_SHIFT 4
30#endif
31/******************************************************************************
32 3 枚举定义
33******************************************************************************/
34#ifdef _PRE_WLAN_FEATURE_NEGTIVE_DET
35typedef enum {
36 ALG_INTF_DET_EVENT_DUTY_CYCLE = 0,
37 ALG_INTF_DET_EVENT_NEG_GAIN,
38 ALG_INTF_DET_EVENT_HOST_PK,
39 ALG_INTF_DET_EVENT_HOST_NPK,
40 ALG_INTF_DET_EVENT_PKADJ_COMP,
41 ALG_INTF_DET_EVENT_DETATCH,
42
43 ALG_INTF_DET_EVENT_BUTT
44} alg_intf_det_event_enum;
45typedef osal_u16 alg_intf_det_event_enum_uint16;
46#endif
47
48/******************************************************************************
49 4 STRUCT定义
50******************************************************************************/
51/* 记录最近10次干扰繁忙度 */
52typedef struct {
53 osal_u8 cur_index; /* 当前所在位置 */
54 osal_u8 total_cnt; /* 当前干扰繁忙度记录的总个数 */
55 osal_u8 resv[2]; /* 对齐 */
56 osal_u16 intf_duty_cyc_20_recoard[ALG_INTF_DET_STATISTIC_CNT_TH]; /* 记录20M最近10次干扰繁忙度 */
57 osal_u16 intf_duty_cyc_40_recoard[ALG_INTF_DET_STATISTIC_CNT_TH]; /* 记录40M最近10次干扰繁忙度 */
58 osal_u32 sum_of_intf_duty_cyc_20; /* 记录20M最近10次干扰繁忙度总数 */
59 osal_u32 sum_of_intf_duty_cyc_40; /* 记录40M最近10次干扰繁忙度总数 */
60} alg_intf_det_intf_duty_cyc_info_stru;
61
62/* 保存干扰检测同频干扰相关的信息:eg rx non-direct占空比等 */
63typedef struct {
64 osal_u16 nondir_duty_cyc_th_sta; /* 判别同频干扰nondir占空比门限(千分之x) */
65 osal_u8 intf_cycle_cnt_sta; /* 连续多少个周期检测到同频干扰 */
66 osal_u8 nonintf_cycle_cnt_sta; /* 连续多少个周期没有检测到同频干扰 */
67
68 osal_u16 nonintf_duty_th_sta; /* 无干扰的占空比门限 */
69 oal_bool_enum_uint8 coch_intf_state_sta; /* 同频干扰的检测状态 */
70 osal_u8 resv;
71} alg_intf_det_coch_info_stru;
72
73#ifdef _PRE_WLAN_FEATURE_NEGTIVE_DET
74/* 保存干扰检测邻频干扰相关的信息:eg 干扰繁忙度等 */
75typedef struct {
76 osal_u16 chn_scan_cycle_ms; /* 设置信道扫描的时间:ms */
77 osal_u16 strong_intf_ratio_th; /* 判断是否存在强邻频、叠频干扰的繁忙度阈值 */
78
79 osal_u16 nonintf_ratio_th; /* 判断N个周期为无干扰状态的繁忙度阈值 */
80 osal_u16 intf_sync_err_th; /* 判断是否存在邻频、叠频干扰的sync error阈值 */
81
82 osal_s8 intf_aveg_rssi_th; /* 判断是否存在中等强度邻频、叠频干扰的pri20/40/80的噪底阈值 */
83 hal_alg_intf_det_mode_enum_uint8 intf_type; /* 指示当前的邻频干扰模式 */
84 osal_u8 intf_cyc_th[HAL_ALG_INTF_DET_ADJINTF_BUTT]; /* 不同干扰检测 模式的连续判断阈值 */
85} alg_intf_det_adjch_info_stru;
86
87typedef struct _alg_intf_det_duty_cyc {
88 osal_u16 duty_cyc_ratio_20;
89 osal_u16 duty_cyc_ratio_40;
90} alg_intf_det_duty_cyc_stru;
91
92typedef struct _alg_intf_det_handler {
93 oal_fsm_stru oal_fsm; /* 干扰检测状态机 */
94 alg_intf_det_duty_cyc_stru duty_cyc_info[ALG_INTF_DET_STATE_BUTT];
95 oal_bool_enum_uint8 is_fsm_attached;
96 osal_u8 curr_mode_cnt;
97 osal_u8 resv[2]; /* 2:数组大小 */
98} alg_intf_det_handler_stru;
99
100#else
101/* 保存干扰检测邻频干扰相关的信息:eg 干扰繁忙度等 */
102typedef struct {
103 osal_u16 chn_scan_cycle_ms; /* 设置信道扫描的时间:ms */
104 osal_u16 strong_intf_ratio_th; /* 判断是否存在强邻频、叠频干扰的繁忙度阈值 */
105
106 osal_u16 nonintf_ratio_th; /* 判断N个周期为无干扰状态的繁忙度阈值 */
107 osal_u16 intf_sync_err_th; /* 判断是否存在邻频、叠频干扰的sync error阈值 */
108
109 osal_s8 resv;
110 osal_s8 intf_aveg_rssi_th; /* 判断是否存在中等强度邻频、叠频干扰的pri20/40/80的噪底阈值 */
111 hal_alg_intf_det_mode_enum_uint8 intf_type; /* 指示当前的邻频干扰模式 */
112 osal_u8 non_intf_cyc_th; /* 连续无干扰检测的阈值 */
113} alg_intf_det_adjch_info_stru;
114#endif
115
116/* 同频干扰统计值 */
117typedef struct {
118 osal_u32 rx_nondir_time; /* 周期内接收non-direct包的时间 */
119 osal_u32 rx_direct_time; /* 周期内接收direct包的时间 */
120 osal_u32 tx_time; /* 周期内处于发送状态的时间 */
121 osal_u32 total_stats_time_ms; /* 统计周期 */
122 osal_u16 rx_nondir_duty_cyc; /* rx non-direct包占空比 */
123 osal_u16 rx_direct_duty_cyc; /* rx direct时间占空比 */
124 osal_u16 tx_time_duty_cyc; /* 发送时间占空比 */
125 osal_u16 rx_nondir_duty_cyc_last; /* 上个周期的接收non-direct包占空比 */
126 osal_u16 tx_time_duty_cyc_last; /* 上个周期的发送时间占空比 */
127 osal_u16 rx_direct_duty_cyc_last; /* 上个周期的接收dir时间占空比 */
128
129 /* 弱干扰免疫负增益测试 */
130 osal_u32 tx_time_last; /* 上个周期的tx time for test */
131 osal_u32 tx_time_avg; /* 多个周期的平均tx time值 for test */
132} alg_intf_det_coch_stat_stru;
133
134/* 邻频叠频干扰统计 */
135typedef struct {
136 osal_u16 duty_cyc_ratio_20; /* pri20干扰繁忙度(千分之x) */
137 osal_u16 duty_cyc_ratio_40; /* pri40干扰繁忙度(千分之x) */
138 osal_u16 duty_cyc_ratio_sec20; /* sec20干扰繁忙度(千分之x) */
139 osal_u16 sync_err_ratio; /* 同步错误比值(千分之x) */
140
141 osal_u8 intf_det_ilde_cnt; /* 空闲功率非0值的次数 */
142 osal_s8 intf_det_avg_rssi_20; /* pri20 RSSI平均值 */
143 osal_s8 intf_det_avg_rssi_40; /* pri40 RSSI平均值 */
144 osal_u8 intf_adj_cnt; /* 降带宽符合条件的周期数 */
145
146 osal_u8 cert_intf_cyc_cnt; /* 连续多少个周期没有检测到认证干扰计数 */
147 osal_u8 non_intf_cyc_cnt; /* 无干扰的连续计数 */
148 osal_u8 strong_intf_cyc_cnt; /* 强干扰的连续计数 */
149 osal_u8 middle_intf_cyc_cnt; /* 中干扰的连续计数 */
150
151 /* 共存用 */
152 osal_u32 abort_time_us;
153} alg_intf_det_adjch_stat_stru;
154
155/* device下抗干扰特性对应的信息结构体 */
156typedef struct {
157 osal_u8 intf_det_mode; /* 干扰检测的工作模式 */
158 osal_u8 intf_det_debug; /* 干扰检测日志开关,跟工作模式相对应 */
159 oal_bool_enum_uint8 intf_det_log; /* log使能 */
160 osal_u8 adjust_cycle_cnt; /* 判定周期调整时无干扰周期计数 */
161 osal_u16 intf_det_cycle_ms; /* 干扰检测周期 */
162 oal_bool_enum_uint8 statistic_update; /* device侧是否有上报数据更新 */
163 osal_s8 intf_aveg_rssi_th; /* 判断是否存在中等强度邻频、叠频干扰的pri20/40/80的噪底阈值 */
164 osal_u16 strong_intf_ratio_th; /* 判断是否存在强邻频、叠频干扰的繁忙度阈值 */
165 osal_u16 nonintf_ratio_th; /* 判断N个周期为无干扰状态的繁忙度阈值 */
166
167 /* 主定时器 */
168 frw_timeout_stru intf_det_timer; /* 干扰检测定时器 */
169 hal_to_dmac_device_stru *hal_device; /* hal device 指针 */
170
171 /* 同频干扰检测 */
172 alg_intf_det_coch_info_stru coch_intf_info; /* 同频干扰相关信息 */
173 alg_intf_det_coch_stat_stru coch_intf_stat; /* 同频干扰检测统计信息 */
174
175 /* 邻/叠频干扰检测 */
176 alg_intf_det_adjch_info_stru adjch_intf_info; /* 邻频干扰相关信息 */
177 alg_intf_det_adjch_stat_stru adjch_intf_stat; /* 邻频叠频干扰检测统计信息 */
178 alg_intf_det_notify_info_stru intf_det_notify; /* 干扰检测通知device */
179
180#ifdef _PRE_WLAN_FEATURE_NEGTIVE_DET
181 /* 干扰模式切换增益检测 */
182 oal_bool_enum_uint8 pk_mode;
183 hal_alg_pk_intf_stage_enum_uint8 pk_mode_stage;
184 oal_bool_enum_uint8 need_recover;
185 oal_bool_enum_uint8 has_set;
186#endif
187
188#ifdef _PRE_WLAN_FEATURE_NEGTIVE_DET
189 alg_intf_det_handler_stru intf_det_handler;
190#endif
191 alg_intf_det_intf_duty_cyc_info_stru last_10_times_intf_duty_cyc[ALG_INTF_DET_STATE_BUTT]; /* 最近10次干扰繁忙度 */
192} alg_intf_det_stru;
193
194/******************************************************************************
195 5 函数声明
196******************************************************************************/
197osal_s32 alg_intf_det_init(osal_void);
198osal_void alg_intf_det_exit(osal_void);
199oal_bool_enum_uint8 alg_intf_det_get_curr_coch_intf_type(hal_to_dmac_device_stru *hal_device);
200hal_alg_intf_det_mode_enum_uint8 alg_intf_det_get_curr_adjch_intf_type(hal_to_dmac_device_stru *hal_device);
201
202#ifdef __cplusplus
203#if __cplusplus
204}
205#endif
206#endif
207#endif /* #ifdef _PRE_WLAN_FEATURE_INTF_DET */
208#endif /* end of alg_intf_det.h */
osal_u8 hal_alg_intf_det_mode_enum_uint8
Definition hal_commom_ops_type_rom.h:276
@ HAL_ALG_INTF_DET_ADJINTF_BUTT
Definition hal_commom_ops_type_rom.h:274
osal_u8 oal_bool_enum_uint8
Definition oal_types_device_rom.h:45
int osal_s32
Definition osal_types.h:19
unsigned char osal_u8
Definition osal_types.h:11
signed char osal_s8
Definition osal_types.h:17
void osal_void
Definition osal_types.h:29
unsigned int osal_u32
Definition osal_types.h:13
unsigned short osal_u16
Definition osal_types.h:12
Definition oal_fsm.h:38
Definition alg_common_rom.h:77
Definition frw_ext_common_rom.h:20
Definition hal_ops_common_rom.h:529