• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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: wifi_alg.h 的头文件
15  */
16 
17 
18 #ifndef SERVICE_WIFI_ALG_H
19 #define SERVICE_WIFI_ALG_H
20 
21 #include "errcode.h"
22 
23 #ifdef __cplusplus
24 #if __cplusplus
25 extern "C" {
26 #endif
27 #endif
28 
29 /**
30  * @defgroup middleware_service_wifi_alg ALG
31  * @ingroup  middleware_service_wifi
32  * @{
33  */
34 
35 /**
36  * @if Eng
37  * @brief  fixed rate value.
38  * @else
39  * @brief  固定速率值。
40  * @endif
41  */
42 typedef struct {
43     uint32_t rate_value;    /*!< @if Eng fixed rate value.
44                                      @else  固定速率值。  @endif */
45 } alg_param_stru;
46 
47 /**
48  * @if Eng
49  * @brief  Set Fixed Rate for TX packets.
50  *
51  * @param  [in]  auto_rate Auto rate or fixed rate.
52  * @param  [in]  alg_param Rate index.
53  *
54  * @retval ERRCODE_SUCC        Execute successfully.
55  * @retval Other               Execute failed.
56  * @else
57  * @brief  设置TX方向发送报文的速率模式。
58  *
59  * @param  [in]  auto_rate 表示速率使用固定模式或自动模式。
60  * @param  [in]  alg_param 速率等级。
61  *
62  * @retval ERRCODE_SUCC  成功。
63  * @retval Other         失败。
64  * @endif
65  */
66 errcode_t wifi_set_fixed_tx_rate(unsigned char auto_rate, alg_param_stru *alg_param);
67 
68 /**
69  * @if Eng
70  * @brief  Get current best rate for specified user.
71  * @param  [in]  mac           Mac address.
72  * @param  [in]  mac_len       Mac address len.
73  * @param  [in]  tx_best_rate obtained best rate.
74  * @retval ERRCODE_SUCC        Execute successfully.
75  * @retval Other               Execute failed.
76  * @else
77  * @brief  获取用户当前的最优速率。
78  * @param  [in]  mac           用户的mac地址。
79  * @param  [in]  mac_len       mac地址长度。
80  * @param  [in]  tx_best_rate 获取的用户最佳速率。
81  * @retval ERRCODE_SUCC  成功。
82  * @retval Other         失败。
83  * @endif
84  */
85 errcode_t wifi_get_negotiated_rate(const uint8_t *mac, int32_t mac_len, uint32_t *tx_best_rate);
86 
87 /**
88  * @if Eng
89  * @brief  Set TPC mode.
90  * @param  [in]  tpc_value TPC mode to be set: 0-off_mode, 1-promote_mode, 2-auto_mode.
91  * @retval ERRCODE_SUCC        Execute successfully.
92  * @retval Other               Execute failed.
93  * @else
94  * @brief  设置TPC模式。
95  * @param  [in]  tpc_value 设置的TPC模式:0-关闭动态调整,1-功率提升模式,2-自动调整模式。
96  * @retval ERRCODE_SUCC  成功。
97  * @retval Other         失败。
98  * @endif
99  */
100 errcode_t wifi_set_tpc_mode(uint32_t tpc_value);
101 
102 /**
103  * @if Eng
104  * @brief  Set RTS mode.
105  * @param  [in]  mode       RTS mode to be set: 0-auto_mode, 1-threshold_mode, 2-off_mode.
106  * @param  [in]  pkt_length The length of the packet sent, used when rts is in the threshold mode.
107  * @retval ERRCODE_SUCC        Execute successfully.
108  * @retval Other               Execute failed.
109  * @else
110  * @brief  设置RTS模式。
111  * @param  [in]  mode       设置的RTS模式:0-自动模式,1-超过配置报文长度发送RTS 未超过不发,2-不发RTS。
112  * @param  [in]  pkt_length RTS模式为1时配置的RTS报文长度门限。
113  * @retval ERRCODE_SUCC  成功。
114  * @retval Other         失败。
115  * @endif
116  */
117 errcode_t wifi_set_rts_mode(uint8_t mode, uint16_t pkt_length);
118 
119 /**
120  * @if Eng
121  * @brief  Set CCA threshold.
122  * @param  [in]  mode      Whether to set the CCA threshold for 20M or for 40M, 0-20M, 1-40M.
123  * @param  [in]  threshold The value of the CCA threshold to be set.
124  * @retval ERRCODE_SUCC        Execute successfully.
125  * @retval Other               Execute failed.
126  * @else
127  * @brief  设置CCA门限。
128  * @param  [in]  mode      为20M或40M设置CCA门限,0-20M,1-40M。
129  * @param  [in]  threshold CCA门限值。
130  * @retval ERRCODE_SUCC  成功。
131  * @retval Other         失败。
132  * @endif
133  */
134 errcode_t wifi_set_cca_threshold(uint8_t mode, int8_t threshold);
135 
136 #ifdef _PRE_WLAN_FEATURE_INTRF_MODE
137 /**
138  * @if Eng
139  * @brief  Set the INTRF mode.
140  * @param  [in]  ifname Device name.
141  * @param  [in]  enable Enable or disable the intrf mode.
142  * @param  [in]  flag   Intrf mode config flag.
143  * @retval ERRCODE_SUCC        Execute successfully.
144  * @retval Other               Execute failed.
145  * @else
146  * @brief  设置抗干扰模式。
147  * @param  [in]  ifname 设备名。
148  * @param  [in]  enable 是否使能抗干扰模式。
149  * @param  [in]  flag   抗干扰措施使能bit配置。
150  * @retval ERRCODE_SUCC  成功。
151  * @retval Other         失败。
152  * @endif
153  */
154 errcode_t wifi_set_intrf_mode(const char *ifname, uint8_t enable, uint16_t flag);
155 #endif
156 
157 /**
158  * @}
159  */
160 
161 #ifdef __cplusplus
162 #if __cplusplus
163 }
164 #endif
165 #endif
166 
167 #endif // SERVICE_WIFI_ALG_H
168