1 /*
2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 * Description: Header file of HAL power save public interfaces .
15 */
16
17 #ifndef HAL_POWER_SAVE_H
18 #define HAL_POWER_SAVE_H
19
20 #include "hal_common_ops_rom.h"
21
22 /*****************************************************************************
23 * 1 其他头文件包含
24 *****************************************************************************/
25 /*****************************************************************************
26 * STA ps feature
27 *****************************************************************************/
28 /*****************************************************************************
29 * 功能描述 : 设置MAC_P2P_NOA_CTRL寄存器中TWT的唤醒参数
30 *****************************************************************************/
hal_vap_set_twt(const hal_to_dmac_vap_stru * hal_vap,const twt_reg_param_stru * twt_param,osal_u8 count,osal_u8 trigger)31 static INLINE__ osal_void hal_vap_set_twt(const hal_to_dmac_vap_stru *hal_vap, const twt_reg_param_stru *twt_param,
32 osal_u8 count, osal_u8 trigger)
33 {
34 hal_public_hook_func(_vap_set_twt)(hal_vap, twt_param, count, trigger);
35 }
36
37 /*****************************************************************************
38 * 功能描述 : 设置MAC_P2P_NOA_CTRL寄存器中TWT的校准参数
39 *****************************************************************************/
hal_cali_twt(const hal_to_dmac_vap_stru * hal_vap)40 static INLINE__ osal_void hal_cali_twt(const hal_to_dmac_vap_stru *hal_vap)
41 {
42 hal_public_hook_func(_cali_twt)(hal_vap);
43 }
44
45 #ifdef _PRE_WLAN_FEATURE_MAC_PARSE_TIM
46 /*****************************************************************************
47 * 功能描述 : 设置bcn tim ie的偏移地址寄存器
48 *****************************************************************************/
hal_mac_set_bcn_tim_pos(const hal_to_dmac_vap_stru * hal_vap,osal_u16 pos)49 static INLINE__ osal_void hal_mac_set_bcn_tim_pos(const hal_to_dmac_vap_stru *hal_vap, osal_u16 pos)
50 {
51 hal_public_hook_func(_mac_set_bcn_tim_pos)(hal_vap, pos);
52 }
53
54 /*****************************************************************************
55 * 功能描述 : 设置硬件解析beacon开关
56 *****************************************************************************/
hal_pm_set_mac_parse_tim(osal_u8 flag)57 static INLINE__ osal_void hal_pm_set_mac_parse_tim(osal_u8 flag)
58 {
59 hal_public_hook_func(_pm_set_mac_parse_tim)(flag);
60 }
61
62 /*****************************************************************************
63 * 功能描述 : 设置mac aid寄存器
64 *****************************************************************************/
hal_set_mac_aid(const hal_to_dmac_vap_stru * hal_vap,osal_u16 aid)65 static INLINE__ osal_void hal_set_mac_aid(const hal_to_dmac_vap_stru *hal_vap, osal_u16 aid)
66 {
67 hal_public_hook_func(_set_mac_aid)(hal_vap, aid);
68 }
69 #endif
70
71 /*****************************************************************************
72 * 功能描述 : 设置PSM寄存器中listen_interval的值
73 *****************************************************************************/
hal_set_psm_listen_interval(const hal_to_dmac_vap_stru * hal_vap,osal_u16 interval)74 static INLINE__ osal_void hal_set_psm_listen_interval(const hal_to_dmac_vap_stru *hal_vap, osal_u16 interval)
75 {
76 hal_public_hook_func(_set_psm_listen_interval)(hal_vap, interval);
77 }
78
79 /*****************************************************************************
80 * 功能描述 : 设置PSM寄存器中listen_interval_count的值
81 *****************************************************************************/
hal_set_psm_listen_interval_count(hal_to_dmac_vap_stru * hal_vap,osal_u16 interval_count)82 static INLINE__ osal_void hal_set_psm_listen_interval_count(hal_to_dmac_vap_stru *hal_vap, osal_u16 interval_count)
83 {
84 hal_public_hook_func(_set_psm_listen_interval_count)(hal_vap, interval_count);
85 }
86
87 /*****************************************************************************
88 * 功能描述 : 设置PSM寄存器中tbtt offset的值
89 *****************************************************************************/
hal_set_tbtt_offset(const hal_to_dmac_vap_stru * hal_vap,osal_u16 offset)90 static INLINE__ osal_void hal_set_tbtt_offset(const hal_to_dmac_vap_stru *hal_vap, osal_u16 offset)
91 {
92 hal_public_hook_func(_set_tbtt_offset)(hal_vap, offset);
93 }
94
95 #ifdef _PRE_WLAN_FEATURE_POWERSAVE
96 /*****************************************************************************
97 * 功能描述 : 设置PSM寄存器中ext tbtt offset的值
98 *****************************************************************************/
hal_set_psm_ext_tbtt_offset(const hal_to_dmac_vap_stru * hal_vap,osal_u16 offset)99 static INLINE__ osal_void hal_set_psm_ext_tbtt_offset(const hal_to_dmac_vap_stru *hal_vap, osal_u16 offset)
100 {
101 hal_public_hook_func(_set_psm_ext_tbtt_offset)(hal_vap, offset);
102 }
103 #endif
104 /*****************************************************************************
105 * 功能描述 : 设置beacon period寄存器
106 *****************************************************************************/
hal_vap_set_psm_beacon_period(const hal_to_dmac_vap_stru * hal_vap,osal_u32 beacon_period)107 static INLINE__ osal_void hal_vap_set_psm_beacon_period(const hal_to_dmac_vap_stru *hal_vap, osal_u32 beacon_period)
108 {
109 hal_public_hook_func(_set_psm_beacon_period)(hal_vap, beacon_period);
110 }
111
112 /*****************************************************************************
113 * 功能描述 : 设置beacon等待的超时值
114 *****************************************************************************/
hal_set_beacon_timeout(osal_u16 value)115 static INLINE__ osal_void hal_set_beacon_timeout(osal_u16 value)
116 {
117 hal_public_hook_func(_set_beacon_timeout)(value);
118 }
119
120 /*****************************************************************************
121 * 功能描述 : 设置DTIM寄存器
122 *****************************************************************************/
hal_set_sta_dtim_period(const hal_to_dmac_vap_stru * hal_vap,osal_u32 dtim_period)123 static INLINE__ osal_void hal_set_sta_dtim_period(const hal_to_dmac_vap_stru *hal_vap, osal_u32 dtim_period)
124 {
125 hal_public_hook_func(_set_sta_dtim_period)(hal_vap, dtim_period);
126 }
127
128 /*****************************************************************************
129 函 数 名 : hal_get_psm_dtim_count
130 功能描述 : 获取ditm count寄存器
131 *****************************************************************************/
hal_get_psm_dtim_count(const hal_to_dmac_vap_stru * hal_vap)132 static INLINE__ osal_u8 hal_get_psm_dtim_count(const hal_to_dmac_vap_stru *hal_vap)
133 {
134 return hal_public_hook_func(_get_psm_dtim_count)(hal_vap);
135 }
136
137 /*****************************************************************************
138 函 数 名 : hal_get_psm_dtim_count
139 功能描述 : 获取ditm count寄存器
140 *****************************************************************************/
hal_set_psm_dtim_count(hal_to_dmac_vap_stru * hal_vap,osal_u8 dtim_count)141 static INLINE__ osal_void hal_set_psm_dtim_count(hal_to_dmac_vap_stru *hal_vap, osal_u8 dtim_count)
142 {
143 hal_public_hook_func(_set_psm_dtim_count)(hal_vap, dtim_count);
144 }
145
146 /*****************************************************************************
147 * AP ps feature
148 *****************************************************************************/
149 /*****************************************************************************
150 * 功能描述 : 使能sta ps ctrl寄存器
151 *****************************************************************************/
hal_tx_enable_peer_sta_ps_ctrl(osal_u8 lut_index)152 static INLINE__ osal_void hal_tx_enable_peer_sta_ps_ctrl(osal_u8 lut_index)
153 {
154 hal_public_hook_func(_tx_enable_peer_sta_ps_ctrl)(lut_index);
155 }
156
157 /*****************************************************************************
158 * 功能描述 : 去使能sta ps ctrl寄存器
159 *****************************************************************************/
hal_tx_disable_peer_sta_ps_ctrl(osal_u8 lut_index)160 static INLINE__ osal_void hal_tx_disable_peer_sta_ps_ctrl(osal_u8 lut_index)
161 {
162 hal_public_hook_func(_tx_disable_peer_sta_ps_ctrl)(lut_index);
163 }
164
165 /*****************************************************************************
166 * 功能描述 : 使能resp_ps_bit_ctrl
167 *****************************************************************************/
hal_tx_enable_resp_ps_bit_ctrl(osal_u8 lut_index)168 static INLINE__ osal_void hal_tx_enable_resp_ps_bit_ctrl(osal_u8 lut_index)
169 {
170 hal_public_hook_func(_tx_enable_resp_ps_bit_ctrl)(lut_index);
171 }
172
173 /*****************************************************************************
174 * 功能描述 : 去使能resp_ps_bit_ctrl
175 *****************************************************************************/
hal_tx_disable_resp_ps_bit_ctrl(osal_u8 lut_index)176 static INLINE__ osal_void hal_tx_disable_resp_ps_bit_ctrl(osal_u8 lut_index)
177 {
178 hal_public_hook_func(_tx_disable_resp_ps_bit_ctrl)(lut_index);
179 }
180
181 /*****************************************************************************
182 * 功能描述 : 使能所有resp_ps_bit_ctrl
183 *****************************************************************************/
hal_tx_enable_resp_ps_bit_ctrl_all(osal_void)184 static INLINE__ osal_void hal_tx_enable_resp_ps_bit_ctrl_all(osal_void)
185 {
186 hal_public_hook_func(_tx_enable_resp_ps_bit_ctrl_all)();
187 }
188
189 /*****************************************************************************
190 * 功能描述 : 去使能所有resp_ps_bit_ctrl
191 *****************************************************************************/
hal_tx_disable_resp_ps_bit_ctrl_all(osal_void)192 static INLINE__ osal_void hal_tx_disable_resp_ps_bit_ctrl_all(osal_void)
193 {
194 hal_public_hook_func(_tx_disable_resp_ps_bit_ctrl_all)();
195 }
196 /*****************************************************************************
197 * 功能描述 : 去使能所有resp_ps_bit_ctrl
198 *****************************************************************************/
hal_set_tx_queue_suspend_mode(osal_u8 mask,osal_u8 mode)199 static INLINE__ osal_void hal_set_tx_queue_suspend_mode(osal_u8 mask, osal_u8 mode)
200 {
201 hal_public_hook_func(_set_tx_queue_suspend_mode)(mask, mode);
202 }
203 #endif /* end of hal_power_save.h */
204
205