WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
hal_rf.h
浏览该文件的文档.
1/*
2 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2020-2022. All rights reserved.
3 * Description: Header file for hal_rf.c.
4 */
5
6#ifndef __HAL_RF_H__
7#define __HAL_RF_H__
8
9/*****************************************************************************
10 1 其他头文件包含
11*****************************************************************************/
12#include "hal_ext_if.h"
13#include "hal_device.h"
14#include "fe_rf_customize.h"
15#include "fe_hal_rf_reg_if.h"
17#include "fe_rf_dev.h"
18#ifdef __cplusplus
19#if __cplusplus
20extern "C" {
21#endif
22#endif
23
24#undef THIS_FILE_ID
25#define THIS_FILE_ID OAM_FILE_ID_HAL_RF_H
26/*****************************************************************************
27 2 共用宏定义
28*****************************************************************************/
29#define HH503_SOC_BUCK_RO 0x400032B4
30
31/* wifi校准buf长度 */
32#define RF_CALI_DATA_BUF_LEN (0x6cd8)
33#define RF_SINGLE_CHAN_CALI_DATA_BUF_LEN (RF_CALI_DATA_BUF_LEN >> 1)
34#define HH503_TEMPERATURE_THRESH 50
35
36#ifdef _PRE_WLAN_03_MPW_RF
37#define HH503_TOP_TST_SW2 30
38#endif /* end of _PRE_WLAN_03_MPW_RF */
39
40#ifdef _PRE_WLAN_03_MPW_RF
41#define HH503_PLL_LD_REG34 34
42#endif
43
44#define HH503_RF_TCXO_25MHZ 1
45#define HH503_RF_TCXO_40MHZ 2
46#define HH503_RF_TCXO_384MHZ 3
47
48#define HH503_RF_LPF_GAIN_DEFAULT_VAL 0x4688
49#define HH503_RF_DAC_GAIN_DEFAULT_VAL 0x24
50
51/* PLL使能默认值配置 */
52#ifdef _PRE_WLAN_03_MPW_RF
53#define HH503_WL_PLL1_RFLDO789_ENABLE 0xFF00
54#endif
55
56#define HH503_RF_2G_CHANNEL_NUM 13
57#define HH503_RF_5G_CHANNEL_NUM 7
58
59#define HH503_RF_FREQ_2_CHANNEL_NUM 14 /* 2g支持信道数目 */
60#define HH503_RF_FREQ_5_CHANNEL_NUM 29 /* 5g支持信道数目 */
61
62#define HH503_CALI_CHN_INDEX_2422 0
63#define HH503_CALI_CHN_INDEX_2447 1
64#define HH503_CALI_CHN_INDEX_2472 2
65
66#define CHANNEL_NUM5_IDX 4
67#define CHANNEL_NUM10_IDX 9
68
69#define HH503_CALI_CHN_INDEX_4950 0
70#define HH503_CALI_CHN_INDEX_5210 1
71#define HH503_CALI_CHN_INDEX_5290 2
72#define HH503_CALI_CHN_INDEX_5530 3
73#define HH503_CALI_CHN_INDEX_5610 4
74#define HH503_CALI_CHN_INDEX_5690 5
75#define HH503_CALI_CHN_INDEX_5775 6
76
77#define HH503_RF_TEMP_STS_RSV 0x7
78
79#define HH503_RF_TEMP_INVALID (-100) /* 温度非法值 */
80
81#ifdef _PRE_PLAT_FEATURE_CUSTOMIZE
82/* RF定制化PA偏置寄存器个数 */
83#define HH503_TX2G_PA_GATE_VCTL_REG_NUM (9)
84#define HH503_TX2G_PA_VRECT_GATE_THIN_REG_NUM (32)
85#define HH503_TX2G_REG_280_BAND2_3_NUM (2)
86#define HH503_TX2G_PA_GATE_REG_NUM (HH503_TX2G_PA_GATE_VCTL_REG_NUM + HH503_TX2G_PA_VRECT_GATE_THIN_REG_NUM + \
87 HH503_TX2G_REG_280_BAND2_3_NUM)
88#endif
89
90/* RF发送和接收带宽枚举 */
100
101typedef enum {
103 RF_EN_OFF, /* 全关,包括RF_LDO */
107
108/* 校准信道序号结构体 */
115
116typedef struct {
117 hal_rf_trx_type_enum trx_type; /* 发送链路类型 */
118 hal_rf_trx_type_enum trx_type_hist; /* 历史发送链路类型 */
119 osal_bool trx_type_change; /* 发送链路类型标志 */
120 osal_u8 rf_enabled : 1, /* rf使能标志 */
121 ldo_2g_wf0_on : 1, /* 2.4g WF0 ldo打开标志 */
122 ldo_2g_wf1_on : 1, /* 2.4g WF0 ldo打开标志 */
123 ldo_5g_wf0_on : 1, /* 5g ldo打开标志 */
124 ldo_5g_wf1_on : 1, /* 5g ldo打开标志 */
125 resv : 3; /* 5:保留位 */
126 hal_rf_chn_param chn_para; /* 工作信道参数 */
127} hal_rf;
128
129/*****************************************************************************
130 RF函数声明
131*****************************************************************************/
132/*****************************************************************************
133 ABB相关接口
134*****************************************************************************/
135#ifdef _PRE_PLAT_FEATURE_CUSTOMIZE
136typedef struct {
137 /* 2g */
138 hal_cfg_custom_gain_db_per_band_stru gain_db_2g[HAL_DEVICE_2G_BAND_NUM_FOR_LOSS];
139#ifdef _PRE_WLAN_SUPPORT_5G
140 /* 5g */
141 hal_cfg_custom_gain_db_per_band_stru gain_db_5g[HAL_DEVICE_5G_BAND_NUM_FOR_LOSS];
142#endif
143} hh503_cfg_custom_gain_db_rf_stru;
144
145typedef struct {
146 osal_s8 cfg_delta_pwr_ref_rssi_2g[HAL_DEVICE_2G_DELTA_RSSI_NUM];
147#ifdef _PRE_WLAN_SUPPORT_5G
148 osal_s8 cfg_delta_pwr_ref_rssi_5g[HAL_DEVICE_5G_DELTA_RSSI_NUM];
149#endif
150} hh503_cfg_custom_delta_pwr_ref_stru;
151
152/* 03 rf相关的定制化参数结构体 */
153typedef struct {
154 /* INI */
155 hh503_cfg_custom_gain_db_rf_stru rf_gain_db_rf[WLAN_RF_CHANNEL_NUMS]; /* 2.4g 5g插损 */
156 hh503_cfg_custom_delta_pwr_ref_stru delta_pwr_ref_cfg[WLAN_RF_CHANNEL_NUMS]; /* 2.4g 5g delta_rssi值 */
157 osal_u16 aus_dyn_cali_dscr_interval[WLAN_BAND_BUTT]; /* 动态校准开关2.4g 5g */
158 osal_u8 far_dist_pow_gain_switch; /* 超远距离功率增益开关 */
159 osal_u8 band_5g_enable; /* 软件配置mac dev是否支持5g */
160 osal_u8 tone_amp_grade; /* 单音幅度档位 */
161 osal_u8 far_dist_dsss_scale_promote_switch; /* 超远距11b 1m 2m dbb scale提升使能开关 */
162
163 /* BIT3:CHA1_5G BIT2:CHA0_5G BIT1:CHA1_2G BIT0:CHA0_2G */
164 osal_u8 chn_radio_cap;
165 osal_u8 rsv[3];
166
167 /* cca ed thr */
168 hal_cfg_custom_cca_stru cfg_cus_cca;
169
170 /* 过温/恢复门限 */
171 osal_u16 over_temp_protect_thread;
172 osal_u16 recovery_temp_protect_thread;
173} hh503_rf_custom_stru;
174
175typedef struct {
176 osal_s32 power;
177 osal_u16 mode_ctrl;
178 osal_u16 mode_gain;
179 osal_u16 pa_gain;
180 osal_u16 abb_gain;
181 osal_u32 scaling;
182} hh503_adjust_tx_power_stru;
183
184typedef struct {
185 osal_s32 power; /* 命令行中的功率 */
186 osal_u8 tpc_code; /* 功率对应的tpc code, 用于设置wifi aware action帧功率 */
187 osal_u8 resrv[3];
188} hh503_adjust_tx_power_level_stru;
189
190typedef struct {
191 osal_u8 index; /* 插损值的索引值 */
192 osal_u8 channel_num_min; /* 插损值信道最小区间 */
193 osal_u8 channel_num_max; /* 插损值信道最大区间 */
194 osal_u8 reseve;
195} hh503_band_num_for_loss;
196
197/* 插损值索引与信道范围的对应关系 */
198static const hh503_band_num_for_loss g_band_num_for_loss[] = {
199 {0, 1, 4, 0}, {1, 6, 11, 0}, {2, 13, 14, 0},
200 {0, 184, 196, 0}, {1, 36, 48, 0}, {2, 52, 64, 0},
201 {3, 100, 112, 0}, {4, 116, 128, 0}, {5, 132, 140, 0},
202 {6, 149, 165, 0}
203};
204#endif // #ifdef _PRE_PLAT_FEATURE_CUSTOMIZE
205
207
208/* 回调函数实现 */
212 osal_u16 remain);
218 oal_bool_enum_uint8 rf_linectl);
221
222/*****************************************************************************
223 11 ROM回调函数类型定义
224*****************************************************************************/
225/* hal */
228
229#ifdef _PRE_WLAN_FEATURE_TEMP_PROTECT
230typedef osal_void (*hh503_read_max_temperature_cb)(osal_s16 *ps_temperature);
231#endif
235 osal_u16 frame_len, osal_u16 remain);
239
240#ifdef _PRE_PLAT_FEATURE_CUSTOMIZE
241typedef osal_u32 (*hh503_config_custom_dts_cali_cb)(const osal_u8 *param);
242#endif
248 oal_bool_enum_uint8 rf_linectl);
249#ifdef _PRE_WLAN_FEATURE_ALWAYS_TX
250osal_void hal_rf_get_rx_ppdu_info(osal_u8 flag);
251#endif
254#ifdef __cplusplus
255#if __cplusplus
256}
257#endif
258#endif
259
260#endif /* end of hal_rf.h */
hal_rf_trx_type_enum
Definition hal_common_ops_device_rom.h:1605
#define HAL_DEVICE_5G_DELTA_RSSI_NUM
Definition hal_device.h:27
#define HAL_DEVICE_2G_DELTA_RSSI_NUM
Definition hal_device.h:26
#define HAL_DEVICE_5G_BAND_NUM_FOR_LOSS
Definition hal_device.h:25
#define HAL_DEVICE_2G_BAND_NUM_FOR_LOSS
Definition hal_device.h:24
osal_void(* hh503_adjust_tx_power_cb)(osal_u8 ch, osal_s8 power)
Definition hal_rf.h:244
osal_void hh503_pow_set_rf_regctl_enable_ext(const hal_to_dmac_device_stru *hal_device, oal_bool_enum_uint8 rf_linectl)
osal_void(* hh503_config_rssi_for_loss_cb)(osal_u8 channel_num, osal_s8 *rssi)
Definition hal_rf.h:237
osal_void(* hh503_restore_tx_power_cb)(osal_u8 ch)
Definition hal_rf.h:245
osal_void hh503_set_rf_bw(wlan_bw_cap_enum_uint8 bw)
osal_u8 hh503_get_tpc_code_ext(osal_void)
osal_void hh503_cali_send_func_ext(hal_to_dmac_device_stru *hal_device, osal_u8 *cali_data, osal_u16 frame_len, osal_u16 remain)
osal_void(* hh503_set_rf_custom_reg_cb)(hal_to_dmac_device_stru *hal_device)
Definition hal_rf.h:238
osal_u8 hh503_rf_bandwidth_enum_uint8
Definition hal_rf.h:99
osal_void hh503_initialize_rf_sys_ext(hal_to_dmac_device_stru *hal_device)
osal_u8(* hh503_get_rx_chain_cb)(osal_void)
Definition hal_rf.h:226
osal_void hal_radar_sensing_switch_abb_lo_tx_top_test_reg12(osal_bool is_on)
osal_u8 rf_off_flag_enum_uint8
Definition hal_rf.h:106
rf_off_flag_enum
Definition hal_rf.h:101
@ RF_EN_OFF
Definition hal_rf.h:103
@ RF_OFF_BUTT
Definition hal_rf.h:104
@ RFLDO_EN_OFF
Definition hal_rf.h:102
osal_void hh503_adjust_tx_power_level_ext(osal_u8 ch, osal_s8 power)
osal_void(* hh503_pow_set_rf_regctl_enable_cb)(hal_to_dmac_device_stru *hal_device, oal_bool_enum_uint8 rf_linectl)
Definition hal_rf.h:247
osal_void(* hh503_cali_send_func_cb)(hal_to_dmac_device_stru *hal_device, osal_u8 *cali_data, osal_u16 frame_len, osal_u16 remain)
Definition hal_rf.h:234
#define HH503_RF_FREQ_5_CHANNEL_NUM
Definition hal_rf.h:60
osal_void(* hh503_initialize_rf_sys_cb)(hal_to_dmac_device_stru *hal_device)
Definition hal_rf.h:243
#define HH503_RF_FREQ_2_CHANNEL_NUM
Definition hal_rf.h:59
osal_void(* hh503_dpd_cfr_set_11b_cb)(hal_to_dmac_device_stru *hal_device, osal_u8 is_11b)
Definition hal_rf.h:233
osal_void hh503_set_rf_custom_reg_ext(const hal_to_dmac_device_stru *hal_device)
osal_u32 hh503_config_custom_rf_ext(const osal_u8 *param)
osal_void(* hh503_rf_set_trx_type_cb)(hal_rf_trx_type_enum trx_type)
Definition hal_rf.h:232
osal_u8(* hh503_rf_get_subband_idx_cb)(wlan_channel_band_enum_uint8 band, osal_u8 channel_idx)
Definition hal_rf.h:246
osal_void(* hh503_set_rf_bw_cb)(wlan_bw_cap_enum_uint8 bw)
Definition hal_rf.h:227
osal_void hh503_config_rssi_for_loss_ext(osal_u8 channel_num, osal_s8 *rssi)
osal_void hh503_rf_set_trx_type_ext(hal_rf_trx_type_enum trx_type)
osal_void hh503_dpd_cfr_set_11b_ext(const hal_to_dmac_device_stru *hal_device, osal_u8 is_11b)
osal_u32(* hh503_config_custom_rf_cb)(const osal_u8 *param)
Definition hal_rf.h:236
hh503_rf_bandwidth_enum
Definition hal_rf.h:91
@ HH503_RF_BAND_CTRL_20M
Definition hal_rf.h:93
@ HH503_RF_BAND_CTRL_40M
Definition hal_rf.h:94
@ HH503_RF_BAND_CTRL_BUTT
Definition hal_rf.h:97
@ HH503_RF_BAND_CTRL_10M
Definition hal_rf.h:92
@ HH503_RF_BAND_CTRL_80M
Definition hal_rf.h:95
osal_void hal_set_cal_tone(osal_u32 tone_cfg)
osal_u8 rsv[3]
Definition oal_net.h:2
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
osal_u8 osal_bool
Definition osal_types.h:27
signed char osal_s8
Definition osal_types.h:17
short osal_s16
Definition osal_types.h:18
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
#define ch(x, y, z)
Definition sha256.c:18
Definition hal_common_ops_device_rom.h:542
Definition fe_extern_if_device.h:34
Definition hal_rf.h:116
osal_u8 rf_enabled
Definition hal_rf.h:120
osal_u8 resv
Definition hal_rf.h:125
hal_rf_chn_param chn_para
Definition hal_rf.h:126
hal_rf_trx_type_enum trx_type
Definition hal_rf.h:117
osal_u8 ldo_5g_wf0_on
Definition hal_rf.h:123
osal_u8 ldo_2g_wf0_on
Definition hal_rf.h:121
hal_rf_trx_type_enum trx_type_hist
Definition hal_rf.h:118
osal_u8 ldo_2g_wf1_on
Definition hal_rf.h:122
osal_bool trx_type_change
Definition hal_rf.h:119
osal_u8 ldo_5g_wf1_on
Definition hal_rf.h:124
Definition hal_rf.h:109
osal_u8 other_dpa_idx_2g
Definition hal_rf.h:112
osal_u8 other_dpa_idx_5g
Definition hal_rf.h:113
Definition hal_ops_common_rom.h:529
#define WLAN_RF_CHANNEL_NUMS
Definition wlan_spec_rom.h:214
osal_u8 wlan_bw_cap_enum_uint8
Definition wlan_types.h:455
@ WLAN_BAND_BUTT
Definition wlan_types_base_rom.h:95
osal_u8 wlan_channel_band_enum_uint8
Definition wlan_types_base_rom.h:97