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 for wifi api. 15 */ 16 17 /** 18 * @defgroup soc_wifi_basic WiFi Basic Settings 19 * @ingroup soc_wifi 20 */ 21 22 #ifndef EXT_WIFI_API_H 23 #define EXT_WIFI_API_H 24 25 #include <stdint.h> 26 #include "osal_types.h" 27 #include "td_type.h" 28 29 #ifdef __cplusplus 30 #if __cplusplus 31 extern "C" { 32 #endif 33 #endif 34 35 /** 36 * mac transform string.CNcomment:地址转为字符串.CNend 37 */ 38 #ifndef MACSTR 39 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x" 40 #endif 41 42 #ifndef MAC2STR 43 #define mac2str(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] 44 #endif 45 46 #ifndef bit 47 #define bit(x) (1U << (x)) 48 #endif 49 50 /** 51 * @ingroup soc_wifi_basic 52 * 53 * TKIP of cipher mode.CNcomment:加密方式为TKIP.CNend 54 */ 55 #define WIFI_CIPHER_TKIP bit(3) 56 57 /** 58 * @ingroup soc_wifi_basic 59 * 60 * CCMP of cipher mode.CNcomment:加密方式为CCMP.CNend 61 */ 62 #define WIFI_CIPHER_CCMP bit(4) 63 64 /** 65 * @ingroup soc_wifi_basic 66 * 67 * Channel numbers of 2.4G frequency.CNcomment:2.4G频段的信道数量.CNend 68 */ 69 #define WIFI_24G_CHANNEL_NUMS 14 70 71 /** 72 * @ingroup soc_wifi_basic 73 * 74 * max interiface name length.CNcomment:网络接口名最大长度.CNend 75 */ 76 #define WIFI_IFNAME_MAX_SIZE 16 77 78 /** 79 * @ingroup soc_wifi_basic 80 * 81 * The minimum timeout of a single reconnection.CNcomment:最小单次重连超时时间.CNend 82 */ 83 #define WIFI_MIN_RECONNECT_TIMEOUT 2 84 85 /** 86 * @ingroup soc_wifi_basic 87 * 88 * The maximum timeout of a single reconnection, representing an infinite number of loop reconnections. 89 * CNcomment:最大单次重连超时时间,表示无限次循环重连.CNend 90 */ 91 #define WIFI_MAX_RECONNECT_TIMEOUT 65535 92 93 /** 94 * @ingroup soc_wifi_basic 95 * 96 * The minimum auto reconnect interval.CNcomment:最小自动重连间隔时间.CNend 97 */ 98 #define WIFI_MIN_RECONNECT_PERIOD 1 99 100 /** 101 * @ingroup soc_wifi_basic 102 * 103 * The maximum auto reconnect interval.CNcomment:最大自动重连间隔时间.CNend 104 */ 105 #define WIFI_MAX_RECONNECT_PERIOD 65535 106 107 /** 108 * @ingroup soc_wifi_basic 109 * 110 * The minmum times of auto reconnect.CNcomment:最小自动重连连接次数.CNend 111 */ 112 #define WIFI_MIN_RECONNECT_TIMES 1 113 114 /** 115 * @ingroup soc_wifi_basic 116 * 117 * The maximum times of auto reconnect.CNcomment:最大自动重连连接次数.CNend 118 */ 119 #define WIFI_MAX_RECONNECT_TIMES 65535 120 121 /** 122 * @ingroup soc_wifi_basic 123 * 124 * max scan number of ap.CNcomment:支持扫描ap的最多数目.CNend 125 */ 126 #define WIFI_SCAN_AP_LIMIT 64 127 128 /** 129 * @ingroup soc_wifi_basic 130 * 131 * length of status buff.CNcomment:获取连接状态字符串的长度.CNend 132 */ 133 #define WIFI_STATUS_BUF_LEN_LIMIT 512 134 135 /** 136 * @ingroup soc_wifi_basic 137 * 138 * Decimal only WPS pin code length.CNcomment:WPS中十进制pin码长度.CNend 139 */ 140 #define WIFI_WPS_PIN_LEN 8 141 142 /** 143 * @ingroup soc_wifi_basic 144 * 145 * default max num of station.CNcomment:默认支持的station最大个数.CNend 146 */ 147 #define WIFI_DEFAULT_MAX_NUM_STA 8 148 /** 149 * @ingroup soc_wifi_basic 150 * 151 * scan_cnt default value enable bit 0B0001.CNcomment:scan_cnt默认值使能位0B0001.CNend 152 */ 153 #define WIFI_SCAN_CNT_DEFAULT_ENABLE (1 << 0) 154 /** 155 * @ingroup soc_wifi_basic 156 * 157 * scan_time default value enable bit 0B0010.CNcomment:scan_time默认值使能位0B0010.CNend 158 */ 159 #define WIFI_SCAN_TIME_DEFAULT_ENABLE (1 << 1) 160 /** 161 * @ingroup soc_wifi_basic 162 * 163 * scan_channel_interval default value enable bit 0B0100.CNcomment:scan_channel_interval默认值使能位0B0100.CNend 164 */ 165 #define WIFI_SCAN_CHANNEL_INTERVAL_DEFAULT_ENABLE (1 << 2) 166 /** 167 * @ingroup soc_wifi_basic 168 * 169 * work_time_on_home_channel default value enable bit 0B1000.CNcomment:work_time_on_home_channel默认值使能位0B1000.CNend 170 */ 171 #define WIFI_WORK_TIME_ON_HOME_CHANNEL_DEFAULT_ENABLE (1 << 3) 172 173 /** 174 * @ingroup soc_wifi_basic 175 * 176 * single_probe_req_send_times default value enable bit 0B10000.CNcomment:probe_req_send_cnt默认值使能位0B10000.CNend 177 */ 178 #define WIFI_SINGLE_PROBE_REQ_SEND_TIMES_DEFAULT_ENABLE (1 << 4) 179 180 /** 181 * @ingroup soc_wifi_basic 182 * 183 * return success value.CNcomment:返回成功标识.CNend 184 */ 185 #define EXT_WIFI_OK 0 186 187 /** 188 * @ingroup soc_wifi_basic 189 * 190 * return failed value.CNcomment:返回值错误标识.CNend 191 */ 192 #define EXT_WIFI_FAIL (-1) 193 194 /** 195 * @ingroup soc_wifi_basic 196 * 197 * Max length of SSID.CNcomment:SSID最大长度定义.CNend 198 */ 199 #define EXT_WIFI_MAX_SSID_LEN 32 200 201 /** 202 * @ingroup soc_wifi_basic 203 * 204 * Length of MAC address.CNcomment:MAC地址长度定义.CNend 205 */ 206 #define EXT_WIFI_MAC_LEN 6 207 208 /** 209 * @ingroup soc_wifi_basic 210 * 211 * Length of device type.CNcomment:device type长度定义.CNend 212 */ 213 #define EXT_WIFI_DEV_TYPE_LEN 8 214 215 /** 216 * @ingroup soc_wifi_basic 217 * 218 * Length of device name.CNcomment:device name长度定义.CNend 219 */ 220 #define EXT_WIFI_DEV_NAME_LEN 32 221 222 /** 223 * @ingroup soc_wifi_basic 224 * 225 * Length of group name.CNcomment:group name长度定义.CNend 226 */ 227 #define EXT_WIFI_GROUP_NAME_LEN 100 228 229 /** 230 * @ingroup soc_wifi_basic 231 * 232 * String length of bssid, eg. 00:00:00:00:00:00.CNcomment:bssid字符串长度定义(00:00:00:00:00:00).CNend 233 */ 234 #define EXT_WIFI_TXT_ADDR_LEN 17 235 236 /** 237 * @ingroup soc_wifi_basic 238 * 239 * Length of Key.CNcomment:KEY 密码长度定义.CNend 240 */ 241 #define EXT_WIFI_AP_KEY_LEN 64 242 243 /** 244 * @ingroup soc_wifi_basic 245 * 246 * Maximum length of Key.CNcomment:KEY 最大密码长度.CNend 247 */ 248 #define EXT_WIFI_MAX_KEY_LEN 64 249 250 /** 251 * @ingroup soc_wifi_basic 252 * 253 * Return value of invalid channel.CNcomment:无效信道返回值.CNend 254 */ 255 #define EXT_WIFI_INVALID_CHANNEL 0xFF 256 257 /** 258 * @ingroup soc_wifi_basic 259 * 260 * Index of Vendor IE.CNcomment:Vendor IE 最大索引.CNend 261 */ 262 #define EXT_WIFI_VENDOR_IE_MAX_IDX 1 263 264 /** 265 * @ingroup soc_wifi_basic 266 * 267 * Max length of Vendor IE.CNcomment:Vendor IE 最大长度.CNend 268 */ 269 #define EXT_WIFI_VENDOR_IE_MAX_LEN 255 270 271 /** 272 * @ingroup soc_wifi_basic 273 * 274 * Minimum length of custom's frame.CNcomment:用户定制报文最小长度值.CNend 275 */ 276 #define EXT_WIFI_CUSTOM_PKT_MIN_LEN 24 277 278 /** 279 * @ingroup soc_wifi_basic 280 * 281 * Max length of custom's frame.CNcomment:用户定制报文最大长度值.CNend 282 */ 283 #define EXT_WIFI_CUSTOM_PKT_MAX_LEN 1400 284 285 /** 286 * @ingroup soc_wifi_basic 287 * 288 * Length of wpa psk.CNcomment:wpa psk的长度.CNend 289 */ 290 #define EXT_WIFI_STA_PSK_LEN 32 291 292 /** 293 * @ingroup soc_wifi_basic 294 * 295 * Max num of retry.CNcomment:软件重传的最大次数.CNend 296 */ 297 #define EXT_WIFI_RETRY_MAX_NUM 15 298 299 /** 300 * @ingroup soc_wifi_basic 301 * 302 * Max time of retry.CNcomment:软件重传的最大时间.CNend 303 */ 304 #define EXT_WIFI_RETRY_MAX_TIME 200 305 306 /** 307 * @ingroup soc_wifi_basic 308 * 309 * Minimum priority of callback task.CNcomment:事件回调task的最小优先级.CNend 310 */ 311 #define EXT_WIFI_CB_MIN_PRIO 10 312 313 /** 314 * @ingroup soc_wifi_basic 315 * 316 * Max priority of callback task.CNcomment:事件回调task的最大优先级.CNend 317 */ 318 #define EXT_WIFI_CB_MAX_PRIO 30 319 320 /** 321 * @ingroup soc_wifi_basic 322 * 323 * max usr ie length.CNcomment:用户IE字段最大长度CNend 324 */ 325 #define EXT_WIFI_USR_IE_MAX_SIZE 257 326 327 /** 328 * @ingroup soc_wifi_basic 329 * 330 * max identity length.CNcomment:身份字段最大长度CNend 331 */ 332 #define EXT_WIFI_IDENTITY_LEN 64 333 334 /* 驱动上报的私有断连错误码偏移量, 与驱动中mac_status_code_enum对应,大于此偏移的错误码认为是STA主动断开 */ 335 #define WIFI_MAC_REPORT_DISCONNECT_OFFSET 5200 336 /* 未找到network的私有错误码 */ 337 #define WIFI_NETWORK_NOT_FOUND_ERROR 5300 338 #define WLAN_REASON_MIC_FAILURE 14 339 /** 340 * @ingroup soc_wifi_basic 341 * 342 * Event type of WiFi event.CNcomment:WiFi的事件类型CNend 343 */ 344 typedef enum { 345 EXT_WIFI_CAP_DISABLE = 0, /**< 关闭某项WIFI能力 */ 346 EXT_WIFI_CAP_ENABLE, /**< 使能某项WIFI能力 */ 347 EXT_WIFI_CAP_BUTT 348 } ext_wifi_cap; 349 350 /** 351 * @ingroup soc_wifi_basic 352 * 353 * Reporting data type of monitor mode.CNcomment:混杂模式上报的数据类型.CNend 354 */ 355 typedef enum { 356 EXT_WIFI_MONITOR_OFF, /**< close monitor mode. CNcomment: 关闭混杂模式.CNend */ 357 EXT_WIFI_MONITOR_MCAST_DATA, /**< report multi-cast data frame. CNcomment: 上报组播(广播)数据包.CNend */ 358 EXT_WIFI_MONITOR_UCAST_DATA, /**< report single-cast data frame. CNcomment: 上报单播数据包.CNend */ 359 EXT_WIFI_MONITOR_MCAST_MANAGEMENT, /**< report multi-cast mgmt frame. CNcomment: 上报组播(广播)管理包.CNend */ 360 EXT_WIFI_MONITOR_UCAST_MANAGEMENT, /**< report sigle-cast mgmt frame. CNcomment: 上报单播管理包.CNend */ 361 362 EXT_WIFI_MONITOR_BUTT 363 } ext_wifi_monitor_mode; 364 365 /*! 366 * \typedef ext_wifi_mac_disconnect_reason 367 * \brief 驱动上报的私有断连状态码, 与mac_common_frame_rom.h的值对应 368 */ 369 typedef enum { 370 WLAN_JOIN_RSP_TIMEOUT = 5200, 371 WLAN_AUTH_RSP2_TIMEOUT = 5201, 372 WLAN_AUTH_RSP4_TIMEOUT = 5202, 373 WLAN_ASOC_RSP_TIMEOUT = 5203, 374 WLAN_AUTH_RSP_TIMEOUT = 5204, 375 WLAN_ACTIVE_DISCONNECT_OFFSET = 5205, 376 WLAN_DISASOC_MISC_LINKLOSS = 5206, 377 WLAN_MAC_EXT_AUTH_FAIL = 5210 378 } ext_wifi_mac_disconnect_reason; /* 驱动上报的私有断连状态 */ 379 /** 380 * @ingroup soc_wifi_basic 381 * 382 * Definition of protocol frame type.CNcomment:协议报文类型定义.CNend 383 */ 384 typedef enum { 385 EXT_WIFI_PKT_TYPE_BEACON, /**< Beacon packet. CNcomment: Beacon包.CNend */ 386 EXT_WIFI_PKT_TYPE_PROBE_REQ, /**< Probe Request packet. CNcomment: Probe Request包.CNend */ 387 EXT_WIFI_PKT_TYPE_PROBE_RESP, /**< Probe Response packet. CNcomment: Probe Response包.CNend */ 388 EXT_WIFI_PKT_TYPE_ASSOC_REQ, /**< Assoc Request packet. CNcomment: Assoc Request包.CNend */ 389 EXT_WIFI_PKT_TYPE_ASSOC_RESP, /**< Assoc Response packet. CNcomment: Assoc Response包.CNend */ 390 391 EXT_WIFI_PKT_TYPE_BUTT 392 }ext_wifi_pkt_type; 393 394 /** 395 * @ingroup soc_wifi_basic 396 * 397 * Interface type of wifi.CNcomment:wifi 接口类型.CNend 398 */ 399 typedef enum { 400 EXT_WIFI_IFTYPE_UNSPECIFIED, 401 EXT_WIFI_IFTYPE_ADHOC, 402 EXT_WIFI_IFTYPE_STATION = 2, /**< Station. CNcomment: STA类型.CNend */ 403 EXT_WIFI_IFTYPE_AP = 3, /**< SoftAp. CNcomment: SoftAp类型.CNend */ 404 EXT_WIFI_IFTYPE_AP_VLAN, 405 EXT_WIFI_IFTYPE_WDS, 406 EXT_WIFI_IFTYPE_MONITOR, 407 EXT_WIFI_IFTYPE_MESH_POINT = 7, /**< Mesh. CNcomment: Mesh类型.CNend */ 408 EXT_WIFI_IFTYPE_P2P_CLIENT, 409 EXT_WIFI_IFTYPE_P2P_GO, 410 EXT_WIFI_IFTYPE_P2P_DEVICE, 411 412 EXT_WIFI_IFTYPES_BUTT 413 } ext_wifi_iftype; 414 415 /** 416 * @ingroup soc_wifi_basic 417 * 418 * Definition of bandwith type.CNcomment:接口带宽定义.CNend 419 */ 420 typedef enum { 421 EXT_WIFI_BW_HIEX_5M, /**< 5M bandwidth. CNcomment: 窄带5M带宽.CNend */ 422 EXT_WIFI_BW_HIEX_10M, /**< 10M bandwidth. CNcomment: 窄带10M带宽.CNend */ 423 EXT_WIFI_BW_LEGACY_20M, /**< 20M bandwidth. CNcomment: 20M带宽.CNend */ 424 EXT_WIFI_BW_BUTT 425 } ext_wifi_bw; 426 427 /** 428 * @ingroup hi_wifi_basic 429 * 430 * The protocol mode of station which softap connected to.CNcomment:与softap连接的sta的phy协议.CNend 431 */ 432 typedef enum { 433 WIFI_11B_PHY_PROTOCOL_MODE = 0, /**< 11b CCK. CNcomment:11b.CNend */ 434 WIFI_LEGACY_OFDM_PHY_PROTOCOL_MODE = 1, /**< 11g/a OFDM. CNcomment:11g/a.CNend */ 435 WIFI_HT_PHY_PROTOCOL_MODE = 2, /**< 11n HT. CNcomment:11n.CNend */ 436 WIFI_HE_SU_FORMAT = 3, /**< 11ax HE SU Format type. CNcomment:11ax.CNend */ 437 } ext_phy_protocol_enum; 438 439 /** 440 * @ingroup soc_wifi_basic 441 * 442 * Authentification type enum.CNcomment:认证类型(连接网络不支持EXT_WIFI_SECURITY_WPAPSK).CNend 443 */ 444 typedef enum { 445 EXT_WIFI_SEC_TYPE_INVALID = -1, /**< INVALID. CNcomment: 认证类型:非法值.CNend */ 446 EXT_WIFI_SECURITY_OPEN, /**< OPEN. CNcomment: 认证类型:开放.CNend */ 447 EXT_WIFI_SECURITY_WEP, /**< WEP. CNcomment: 认证类型:WEP.CNend */ 448 EXT_WIFI_SECURITY_WPA2PSK, /**< WPA-PSK. CNcomment: 认证类型:WPA2-PSK.CNend */ 449 EXT_WIFI_SECURITY_WPAPSK_WPA2PSK_MIX, /**< WPA/WPA2-PSK MIX. CNcomment: 认证类型:WPA-PSK/WPA2-PSK混合.CNend */ 450 EXT_WIFI_SECURITY_WPAPSK, /**< WPA-PSK. CNcomment: 认证类型:WPA-PSK.CNend */ 451 EXT_WIFI_SECURITY_WPA, /**< WPA-Enterprise. CNcomment: 认证类型:WPA企业级.CNend */ 452 EXT_WIFI_SECURITY_WPA2, /**< WPA2-Enterprise. CNcomment: 认证类型:WPA2企业级.CNend */ 453 EXT_WIFI_SECURITY_SAE, /**< SAE. CNcomment: 认证类型:SAE.CNend */ 454 EXT_WIFI_SECURITY_WPA3_WPA2_PSK_MIX, /**< WPA3/WPA2-PSK MIX. CNcomment: 认证类型:WPA3/WPA2-PSK混合.CNend */ 455 EXT_WIFI_SECURITY_WPA3, /**< WPA3-Enterprise. CNcomment: 认证类型:WPA3企业级.CNend */ 456 EXT_WIFI_SECURITY_OWE, /**< OWE. CNcomment: 认证类型:OWE.CNend */ 457 EXT_WIFI_SECURITY_WAPI_PSK, /**< WAPI-PSK. CNcomment: 认证类型:WAPI-PSK.CNend */ 458 EXT_WIFI_SECURITY_WAPI_CERT, /**< WAPI-CERT. CNcomment: 认证类型:WAPI企业级.CNend */ 459 EXT_WIFI_SECURITY_WPA3_WPA2_MIX, /**< WPA3/WPA2-Enterprise MIX. CNcomment: 认证类型:WPA3/WPA2企业级混合.CNend */ 460 EXT_WIFI_SECURITY_WEP_OPEN, /**< WEP-OPEN. CNcomment: 认证类型:WEP-OPEN.CNend */ 461 EXT_WIFI_SECURITY_WPA3_192BIT, /**< WPA3-Enterprise 192bit. CNcomment: 认证类型:WPA3企业级192位.CNend */ 462 EXT_WIFI_SECURITY_UNKNOWN /**< UNKNOWN. CNcomment: 其他认证类型:UNKNOWN.CNend */ 463 } ext_wifi_auth_mode; 464 465 /** 466 * @ingroup soc_wifi_basic 467 * 468 * Encryption type enum.CNcoment:加密类型.CNend 469 * 470 */ 471 typedef enum { 472 EXT_WIFI_PARIWISE_UNKNOWN, /**< UNKNOWN. CNcomment: 加密类型:UNKNOWN.CNend */ 473 EXT_WIFI_PAIRWISE_AES, /**< AES. CNcomment: 加密类型:AES.CNend */ 474 EXT_WIFI_PAIRWISE_TKIP, /**< TKIP. CNcomment: 加密类型:TKIP.CNend */ 475 EXT_WIFI_PAIRWISE_TKIP_AES_MIX, /**< TKIP/AES MIX. CNcomment: 加密类型:TKIP AES混合.CNend */ 476 EXT_WIFI_PAIRWISE_CCMP256, /**< CCMP-256. CNcomment: 加密类型:CCMP-256.CNend */ 477 EXT_WIFI_PAIRWISE_CCMP256_CCMP, /**< CCMP-256/CCMP. CNcomment: 加密类型:CCMP-256 CCMP.CNend */ 478 EXT_WIFI_PAIRWISE_CCMP256_TKIP, /**< CCMP-256/TKIP. CNcomment: 加密类型:CCMP-256 TKIP.CNend */ 479 EXT_WIFI_PAIRWISE_BUTT 480 } ext_wifi_pairwise; 481 482 /** 483 * @ingroup soc_wifi_basic 484 * 485 * sae_pwe type enum.CNcomment:SAE PWE 生成类型.CNend 486 */ 487 typedef enum { 488 WIFI_SAE_PWE_UNSPECIFIED, /**< UNSPECIFIED */ 489 WIFI_SAE_PWE_HUNT_AND_PECK, /**< hunting-and-pecking loop only. */ 490 WIFI_SAE_PWE_HASH_TO_ELEMENT, /**< hash-to-element only */ 491 WIFI_SAE_PWE_BOTH /** <both hunting-and-pecking loop and hash-to-element enabled */ 492 } wifi_sae_pwe_option_enum; 493 494 /** 495 * @ingroup soc_wifi_basic 496 * 497 * Type of connect's status.CNcomment:连接状态.CNend 498 */ 499 typedef enum { 500 EXT_WIFI_DISCONNECTED, /**< Disconnected. CNcomment: 连接状态:未连接.CNend */ 501 EXT_WIFI_CONNECTED, /**< Connected. CNcomment: 连接状态:已连接.CNend */ 502 EXT_WIFI_CONNECTING, /**< Connecting. CNcomment: 连接状态:连接中.CNend */ 503 } ext_wifi_conn_status; 504 505 /** 506 * @ingroup soc_wifi_basic 507 * 508 * Frame type that usr ies will insert into.CNcomment: 待插入ie字段的帧类型.CNend 509 */ 510 typedef enum { 511 EXT_WIFI_EXTEND_IE1, 512 EXT_WIFI_EXTEND_IE2, 513 EXT_WIFI_EXTEND_IE3, 514 EXT_WIFI_EXTEND_IE4, 515 EXT_WIFI_EXTEND_IE_BUTT 516 } ext_wifi_extend_ie_index; 517 518 typedef enum { 519 EXT_WIFI_BEACON_IE = (1 << 0), 520 EXT_WIFI_PROBE_REQ_IE = (1 << 1), 521 EXT_WIFI_PROBE_RSP_IE = (1 << 2) 522 } ext_wifi_frame_type; 523 524 /** 525 * @ingroup soc_wifi_basic 526 * 527 * Event type of WiFi event.CNcomment:WiFi的事件类型.CNend 528 */ 529 typedef enum { 530 EXT_WIFI_EVT_UNKNOWN, /**< UNKNWON. 531 CNcomment: UNKNOWN.CNend */ 532 EXT_WIFI_EVT_SCAN_DONE, /**< Scan finish. 533 CNcomment: STA扫描完成.CNend */ 534 EXT_WIFI_EVT_CONNECTED, /**< Connected. 535 CNcomment: 已连接.CNend */ 536 EXT_WIFI_EVT_DISCONNECTED, /**< Disconnected. 537 CNcomment: 断开连接.CNend */ 538 EXT_WIFI_EVT_WPS_TIMEOUT, /**< WPS timeout. 539 CNcomment: WPS事件超时.CNend */ 540 EXT_WIFI_EVT_WPS_SUCCESS, /**< WPS success. 541 CNcomment: WPS事件成功.CNend */ 542 EXT_WIFI_EVT_WPS_FAIL, /**< WPS fail. 543 CNcomment: WPS事件失败.CNend */ 544 EXT_WIFI_EVT_MESH_CONNECTED, /**< MESH connected. 545 CNcomment: MESH已连接.CNend */ 546 EXT_WIFI_EVT_MESH_DISCONNECTED, /**< MESH disconnected. 547 CNcomment: MESH断开连接.CNend */ 548 EXT_WIFI_EVT_AP_START, /**< AP start. 549 CNcomment: AP开启.CNend */ 550 EXT_WIFI_EVT_AP_DISABLE, /**< AP disable. 551 CNcomment: AP未使能.CNend */ 552 EXT_WIFI_EVT_STA_CONNECTED, /**< STA connected with ap. 553 CNcomment: AP和STA已连接.CNend */ 554 EXT_WIFI_EVT_STA_DISCONNECTED, /**< STA disconnected from ap. 555 CNcomment: AP和STA断开连接.CNend */ 556 EXT_WIFI_EVT_STA_NO_NETWORK, /**< STA or P2P connect, but can't find network 557 CNcomment: STA或P2P连接时扫描不到网络.CNend */ 558 EXT_WIFI_EVT_MESH_CANNOT_FOUND, /**< MESH can't find network. 559 CNcomment: MESH关联扫不到对端.CNend */ 560 EXT_WIFI_EVT_MESH_SCAN_DONE, /**< MESH AP scan finish. 561 CNcomment: MESH AP扫描完成.CNend */ 562 EXT_WIFI_EVT_MESH_STA_SCAN_DONE, /**< MESH STA scan finish. 563 CNcomment: MESH STA扫描完成.CNend */ 564 EXT_WIFI_EVT_AP_SCAN_DONE, /**< AP scan finish. 565 CNcomment: AP扫描完成.CNend */ 566 EXT_WIFI_EVT_P2P_FIND_STOP, /**< P2P find stop. 567 CNcomment: p2p查找停止.CNend */ 568 EXT_WIFI_EVT_P2P_PROV_DISC_PBC_REQ, /**< p2p provision discovery pbc requets. 569 CNcomment: p2p pbc发现请求.CNend */ 570 EXT_WIFI_EVT_P2P_PROV_DISC_PBC_RESP, /**< p2p provision discovery pbc response. 571 CNcomment: p2p pbc发现回应.CNend */ 572 EXT_WIFI_EVT_P2P_GO_NEG_REQUEST, /**< p2p go neg request. 573 CNcomment: p2p go协商请求.CNend */ 574 EXT_WIFI_EVT_P2P_GO_NEG_SUCCESS, /**< p2p go neg success. 575 CNcomment: p2p go协商成功.CNend */ 576 EXT_WIFI_EVT_P2P_GO_NEG_FAILURE, /**< p2p go neg failure. 577 CNcomment: p2p go协商失败.CNend */ 578 EXT_WIFI_EVT_P2P_GROUP_FORMATION_SUCCESS, /**< p2p group formation success. 579 CNcomment: p2p组网成功.CNend */ 580 EXT_WIFI_EVT_P2P_GROUP_FORMATION_FAILURE, /**< p2p group formation failure. 581 CNcomment: p2p组网失败.CNend */ 582 EXT_WIFI_EVT_P2P_GROUP_STARTED, /**< p2p group start. 583 CNcomment: p2p组网开始.CNend */ 584 EXT_WIFI_EVT_P2P_INVITATION_RECIEVE, /**< p2p invite result. 585 CNcomment: p2p收到邀请事件.CNend */ 586 EXT_WIFI_EVT_P2P_INVITATION_RESULT, /**< p2p invite result. 587 CNcomment: p2p邀请结果.CNend */ 588 EXT_WIFI_EVT_P2P_INVITATION_ACCEPT, /**< p2p invite result. 589 CNcomment: p2p邀请接收结果.CNend */ 590 EXT_WIFI_EVT_BUTT 591 } ext_wifi_event_type; 592 593 /** 594 * @ingroup soc_wifi_basic 595 * 596 * Scan type enum.CNcomment:扫描类型.CNend 597 */ 598 typedef enum { 599 EXT_WIFI_BASIC_SCAN, /**< Common and all channel scan. CNcomment: 普通扫描.CNend */ 600 EXT_WIFI_CHANNEL_SCAN, /**< Specified channel scan. CNcomment: 指定信道扫描.CNend */ 601 EXT_WIFI_SSID_SCAN, /**< Specified SSID scan. CNcomment: 指定SSID扫描.CNend */ 602 EXT_WIFI_SSID_PREFIX_SCAN, /**< Prefix SSID scan. CNcomment: SSID前缀扫描.CNend */ 603 EXT_WIFI_BSSID_SCAN, /**< Specified BSSID scan. CNcomment: 指定BSSID扫描.CNend */ 604 } ext_wifi_scan_type; 605 606 /** 607 * @ingroup soc_wifi_basic 608 * 609 * WPA PSK usage type.CNcomment: WPA PSK使用策略.CNend 610 */ 611 typedef enum { 612 EXT_WIFI_WPA_PSK_NOT_USE, /**< Not use. CNcomment: 不使用.CNend */ 613 EXT_WIFI_WPA_PSK_USE_INNER, /**< Inner PSK. CNcomment: 使用内部PSK.CNend */ 614 EXT_WIFI_WPA_PSK_USE_OUTER, /**< Outer PSK. CNcomment: 使用外部PSK.CNend */ 615 } ext_wifi_wpa_psk_usage_type; 616 617 /** 618 * @ingroup soc_wifi_basic 619 * 620 * XLDO voltage.CNcomment: XLDO控制电压.CNend 621 */ 622 typedef enum { 623 EXT_WIFI_XLDO_VOLTAGE_0 = 0x00, /**< 1.5V. CNcomment: 1.5V.CNend */ 624 EXT_WIFI_XLDO_VOLTAGE_1 = 0x11, /**< 1.8V. CNcomment: 1.8V.CNend */ 625 EXT_WIFI_XLDO_VOLTAGE_2 = 0x22, /**< 2.1V. CNcomment: 2.1V.CNend */ 626 EXT_WIFI_XLDO_VOLTAGE_3 = 0x33, /**< 2.4V. CNcomment: 2.4V.CNend */ 627 } ext_wifi_xldo_voltage; 628 629 /** 630 * @ingroup soc_wifi_basic 631 * 632 * eap method.CNcomment: EAP方法.CNend 633 */ 634 typedef enum { 635 EXT_WIFI_EAP_METHOD_TLS, /**< EAP-TLS. CNcomment: EAP-TLS方法.CNend */ 636 EXT_WIFI_EAP_METHOD_BUTT 637 } ext_wifi_eap_method; 638 639 /** 640 * @ingroup soc_wifi_basic 641 * 642 * Scan type enum.CNcomment:重传报文类型.CNend 643 */ 644 typedef enum { 645 EXT_WIFI_RETRY_FRAME_DATA, /**< data frame retrans. CNcomment: 重传数据帧.CNend */ 646 EXT_WIFI_RETRY_FRAME_MGMT, /**< mgmt frame retrans. CNcomment: 重传管理帧.CNend */ 647 EXT_WIFI_RETRY_FRAME_BUTT, 648 } ext_wifi_retry_frame_type; 649 650 typedef struct { 651 unsigned int rate_value; /*!< @if Eng fixed rate value. 652 @else 固定速率值。 @endif */ 653 } ext_alg_param_stru; 654 655 typedef struct { 656 uint8_t enable; /*!< @if Eng enable. 657 @else PSD使能标记 0关1开。 @endif */ 658 uint8_t resv; 659 uint16_t duration; /*!< @if Eng duration. 660 @else 采样时长 取值1~65535单位min。 @endif */ 661 uint32_t cycle; /*!< @if Eng cycle. 662 @else 采样间隔 单位ms;取值100~1000。 @endif */ 663 } psd_option_param; 664 665 typedef struct { 666 int8_t mdata_en : 1; /*!< @if Eng get multi-cast data frame flag. 667 @else 使能接收组播(广播)数据包。 @endif */ 668 int8_t udata_en : 1; /*!< @if Eng get single-cast data frame flag. 669 @else 使能接收单播数据包。 @endif */ 670 int8_t mmngt_en : 1; /*!< @if Eng get multi-cast mgmt frame flag. 671 @else 使能接收组播(广播)管理包。 @endif */ 672 int8_t umngt_en : 1; /*!< @if Eng get single-cast mgmt frame flag. 673 @else 使能接收单播管理包。 @endif */ 674 int8_t custom_en : 1; /*!< @if Eng get beacon/probe response flag. 675 @else 使能接收beacon/probe request包。 @endif */ 676 int8_t resvd : 3; /*!< @if Eng reserved bits. 677 @else 保留字段。 @endif */ 678 } ext_wifi_ptype_filter_stru; 679 680 /** 681 * @ingroup soc_wifi_basic 682 * 683 * parameters of scan.CNcomment:station和mesh接口scan参数.CNend 684 */ 685 typedef struct { 686 /**< SSID. CNcomment: SSID 只支持ASCII字符.CNend */ 687 char ssid[EXT_WIFI_MAX_SSID_LEN + 1]; 688 /**< BSSID. CNcomment: BSSID.CNend */ 689 unsigned char bssid[EXT_WIFI_MAC_LEN]; 690 /**< SSID length. CNcomment: SSID长度.CNend */ 691 unsigned char ssid_len; 692 /**< Channel list. CNcomment: 信道号列表,范围1-14,不同区域有差异.CNend */ 693 unsigned char chan_list[WIFI_24G_CHANNEL_NUMS]; 694 /**< Numbers of channel list. CNcomment: 信道列表数目.CNend */ 695 unsigned char chan_num; 696 /**< Scan type. CNcomment: 扫描类型.CNend */ 697 ext_wifi_scan_type scan_type; 698 } ext_wifi_scan_params; 699 700 /** 701 * @ingroup soc_wifi_basic 702 * 703 * Struct of scan param.CNcomment:扫描参数结构体.CNend 704 */ 705 typedef struct { 706 /* default_enable. CNcomment:默认值使能位,1表示使能 */ 707 unsigned int default_enable; 708 /* scan_cnt. CNcomment:扫描次数,取值范围1~2,默认为2 */ 709 unsigned char scan_cnt; 710 /* scan_time. CNcomment:扫描驻留时间,取值范围20~120,默认为20 */ 711 unsigned char scan_time; 712 /* scan_channel_interval. CNcomment:间隔n个信道,切回工作信道工作一段时间,n取值范围1~6,默认6 */ 713 unsigned char scan_channel_interval; 714 /* work_time_on_home_channel. CNcomment:背景扫描时,返回工作信道工作的时间,取值范围30~120,默认110 */ 715 unsigned char work_time_on_home_channel; 716 /* single_probe_send_times. CNcomment:单个probe req报文的发送次数,取值范围1~3,默认1 */ 717 unsigned char single_probe_send_times; 718 unsigned char rsv[3]; 719 } ext_wifi_scan_param_stru; 720 721 /** 722 * @ingroup soc_wifi_basic 723 * 724 * Struct of scan result.CNcomment:扫描结果结构体.CNend 725 */ 726 typedef struct { 727 char ssid[EXT_WIFI_MAX_SSID_LEN + 1]; /**< SSID. CNcomment: SSID 只支持ASCII字符.CNend */ 728 unsigned char bssid[EXT_WIFI_MAC_LEN]; /**< BSSID. CNcomment: BSSID.CNend */ 729 ext_wifi_auth_mode auth; /**< Authentication type. CNcomment: 认证类型.CNend */ 730 unsigned int channel; /**< Channel number. CNcomment: 信道号,范围1-14,不同区域有差异.CNend */ 731 int rssi; /**< Signal Strength. CNcomment: 信号强度.CNend */ 732 unsigned char wps_flag : 1; /**< WPS flag. CNcomment: WPS标识.CNend */ 733 unsigned char wps_session : 1; /**< WPS session:PBC-0/PIN-1. CNcomment: WPS会话类型,PBC-0/PIN-1.CNend */ 734 unsigned char wmm : 1; /**< WMM flag. CNcomment: WMM标识.CNend */ 735 unsigned char ft_flag : 1; /**< FT flag. CNcomment: FT 标识 */ 736 unsigned char ext_mesh_flag : 1; /**< MESH flag. CNcomment: MESH标识.CNend */ 737 ext_wifi_pairwise pairwise; /**< Encryption type. CNcomment: 加密方式,不需指定时置0.CNend */ 738 } ext_wifi_ap_info; 739 740 /* 公共结构体定义 */ 741 typedef struct { 742 unsigned short length; /* 不仅是本公共结构体长度,该字段是发送到驱动的参数结构体的总长度, frw消息时使用 */ 743 unsigned char type; /* 业务类型 */ 744 unsigned char rsv; /* 预留 */ 745 int (*wifi_app_service_cb)(void *param); /* 统一的回调函数 */ 746 } wifi_app_common_input_param; 747 748 typedef struct { 749 unsigned char *ssid; /* 链表元素ssid ie; 从驱动回填 */ 750 unsigned char *bssid; /* 链表元素bssid; 从驱动回填 */ 751 unsigned short caps; /* 链表元素能力位; 从驱动回填 */ 752 unsigned short beacon_int; /* 链表元素beacon周期; 从驱动回填 */ 753 int freq; /* 链表元素信道中心频率; 从驱动回填 */ 754 int level; /* 链表元素rssi; 从驱动回填 */ 755 unsigned char *frame_ie; /* 链表元素ie指针; 从驱动回填 */ 756 unsigned short frame_ie_len; /* 链表元素ie长度; 从驱动回填 */ 757 unsigned char ssid_ie_len; /* 链表元素ssid ie长度; 从驱动回填 */ 758 unsigned char channel; /* 链表元素所在信道, 目前仅获取扫描结果时使用 */ 759 unsigned char index; /* 链表元素索引值, 目前仅获取扫描结果时使用 */ 760 unsigned char rsv[3]; /* 预留 */ 761 } wifi_app_common_output_param; 762 763 typedef struct { 764 wifi_app_common_input_param input_para; 765 wifi_app_common_output_param output_para; 766 } wifi_app_common_param; 767 768 /** 769 * @ingroup soc_wifi_basic 770 * 771 * Struct of connect parameters.CNcomment:station连接结构体.CNend 772 */ 773 typedef struct { 774 char ssid[EXT_WIFI_MAX_SSID_LEN + 1]; /**< SSID. CNcomment: SSID 只支持ASCII字符.CNend */ 775 ext_wifi_auth_mode auth; /**< Authentication mode. CNcomment: 认证类型.CNend */ 776 char key[EXT_WIFI_MAX_KEY_LEN + 1]; /**< Secret key. CNcomment: 秘钥.CNend */ 777 unsigned char bssid[EXT_WIFI_MAC_LEN]; /**< BSSID. CNcomment: BSSID.CNend */ 778 ext_wifi_pairwise pairwise; /**< Encryption type. CNcomment: 加密方式,不需指定时置0.CNend */ 779 unsigned char hex_flag; /**< Hex key flag. CNcomment: 表示当前密码为十六进制格式 */ 780 unsigned char ft_flag; /**< FT flag. CNcomment: FT 标识 */ 781 unsigned char resv[3]; /**< Reserved. CNcomment: 预留.CNend */ 782 } ext_wifi_assoc_request; 783 784 /** 785 * @ingroup soc_wifi_basic 786 * 787 * Struct of fast connect parameters.CNcomment:station快速连接结构体.CNend 788 */ 789 typedef struct { 790 ext_wifi_assoc_request req; /**< Association request. CNcomment: 关联请求.CNend */ 791 unsigned char channel; /**< Channel number. CNcomment: 信道号,范围1-14,不同区域有差异.CNend */ 792 unsigned char psk[EXT_WIFI_STA_PSK_LEN]; /**< PSK. CNcomment: PSL.CNend */ 793 ext_wifi_wpa_psk_usage_type psk_flag; /**< PSK TYPE. CNcomment: psk的标志,不需指定时置0.CNend */ 794 } ext_wifi_fast_assoc_request; 795 796 /** 797 * @ingroup soc_wifi_basic 798 * 799 * Status of sta's connection.CNcomment:获取station连接状态.CNend 800 */ 801 typedef struct { 802 char ssid[EXT_WIFI_MAX_SSID_LEN + 1]; /**< SSID. CNcomment: SSID 只支持ASCII字符.CNend */ 803 unsigned char bssid[EXT_WIFI_MAC_LEN]; /**< BSSID. CNcomment: BSSID.CNend */ 804 unsigned int channel; /**< Channel number. CNcomment: 信道号,范围1-14,不同区域有差异.CNend */ 805 ext_wifi_conn_status status; /**< Connect status. CNcomment: 连接状态.CNend */ 806 } ext_wifi_status; 807 808 /** 809 * @ingroup soc_wifi_basic 810 * 811 * Event type of wifi scan done.CNcomment:扫描完成事件.CNend 812 */ 813 typedef struct { 814 char ifname[WIFI_IFNAME_MAX_SIZE + 1]; /**< interface name. CNcomment: 接口名称.CNend */ 815 unsigned short bss_num; 816 } event_wifi_scan_done; 817 818 /** 819 * @ingroup soc_wifi_basic 820 * 821 * Event type of wifi connected CNcomment:wifi的connect事件信息.CNend 822 */ 823 typedef struct { 824 char ssid[EXT_WIFI_MAX_SSID_LEN + 1]; /**< SSID. CNcomment: SSID 只支持ASCII字符.CNend */ 825 unsigned char bssid[EXT_WIFI_MAC_LEN]; /**< BSSID. CNcomment: BSSID.CNend */ 826 unsigned char ssid_len; /**< SSID length. CNcomment: SSID长度.CNend */ 827 char ifname[WIFI_IFNAME_MAX_SIZE + 1]; /**< Iftype name. CNcomment: 接口名称.CNend */ 828 } event_wifi_connected; 829 830 /** 831 * @ingroup soc_wifi_basic 832 * 833 * Event type of wifi disconnected.CNcomment:wifi的断开事件信息.CNend 834 */ 835 typedef struct { 836 unsigned char bssid[EXT_WIFI_MAC_LEN]; /**< BSSID. CNcomment: BSSID.CNend */ 837 unsigned short reason_code; /**< reason code. CNcomment: 断开原因.CNend */ 838 char ifname[WIFI_IFNAME_MAX_SIZE + 1]; /**< Iftype name. CNcomment: 接口名称.CNend */ 839 unsigned char locally_generated; /**< locally_generated. CNcomment: 是否为主动触发的断连(1是0否).CNend */ 840 unsigned char wpa_state; /**< wpa_state. CNcomment: 当前WPA状态(enum wpa_states).CNend */ 841 } event_wifi_disconnected; 842 843 /** 844 * @ingroup soc_wifi_basic 845 * 846 * struct of interface name.CNcomment:wifi interface 名称.CNend 847 */ 848 typedef struct { 849 char ifname[WIFI_IFNAME_MAX_SIZE + 1]; /**< Iftype name. CNcomment: 接口名称.CNend */ 850 } event_wifi_interface_name; 851 852 /** 853 * @ingroup soc_wifi_basic 854 * 855 * Event type of wps fail.CNcomment:wifi wps协商失败事件信息.CNend 856 */ 857 typedef struct { 858 char ifname[WIFI_IFNAME_MAX_SIZE + 1]; /**< Iftype name. CNcomment: 接口名称.CNend */ 859 int msg; /**< wps fail message. CNcomment: wps失败信息.CNend */ 860 unsigned short int config_error; /**< wps config error. CNcomment: wps失败配置信息.CNend */ 861 unsigned short int error_indication; /**< wps reason_code. CNcomment: wps错误码.CNend */ 862 } event_wifi_wps_fail; 863 864 /** 865 * @ingroup soc_wifi_basic 866 * 867 * Event type of ap connected sta.CNcomment:ap连接sta事件信息.CNend 868 */ 869 typedef struct { 870 char addr[EXT_WIFI_MAC_LEN]; /**< user's mac address of SoftAp. CNcomment: 连接AP的sta地址.CNend */ 871 char ifname[WIFI_IFNAME_MAX_SIZE + 1]; 872 } event_ap_sta_connected; 873 874 /** 875 * @ingroup soc_wifi_basic 876 * 877 * Event type of ap disconnected sta.CNcomment:ap断开sta事件信息.CNend 878 */ 879 typedef struct { 880 unsigned char addr[EXT_WIFI_MAC_LEN]; /**< User's mac address of SoftAp. CNcomment: AP断开STA的MAC地址.CNend */ 881 unsigned short reason_code; /**< Reason code. CNcomment: AP断开连接的原因值.CNend */ 882 char ifname[WIFI_IFNAME_MAX_SIZE + 1]; 883 } event_ap_sta_disconnected; 884 885 /** 886 * @ingroup soc_wifi_basic 887 * 888 * Event type of mesh connected.CNcomment:mesh的connect事件信息.CNend 889 */ 890 typedef struct { 891 unsigned char addr[EXT_WIFI_MAC_LEN]; /**< User's mac address of MESH. CNcomment: MESH连接的peer MAC地址.CNend */ 892 } event_mesh_connected; 893 894 /** 895 * @ingroup soc_wifi_basic 896 * 897 * Event type of mesh disconnected.CNcomment:mesh的disconnect事件信息.CNend 898 */ 899 typedef struct { 900 unsigned char addr[EXT_WIFI_MAC_LEN]; /**< User's mac address of MESH. CNcomment: 断开连接的peer MAC地址.CNend */ 901 unsigned short reason_code; /**< Reason code. CNcomment: MESH断开连接的原因.CNend */ 902 } event_mesh_disconnected; 903 904 /** 905 * @ingroup soc_wifi_basic 906 * 907 * Event type of p2p provision discovery pbc request.CNcomment:p2p pbc 发现请求事件.CNend 908 */ 909 typedef struct { 910 unsigned char dev_addr[EXT_WIFI_MAC_LEN]; /**< User's device address of P2P. 911 CNcomment: 连接的peer MAC地址.CNend */ 912 unsigned char pri_dev_type[EXT_WIFI_DEV_TYPE_LEN]; /**< User's device type of P2P. 913 CNcomment: 连接的device类型.CNend */ 914 char dev_name[EXT_WIFI_DEV_NAME_LEN + 1]; /**< User's device name of P2P. 915 CNcomment: 连接的device名称.CNend */ 916 unsigned short int supp_config_methods; /**< User's config methods of P2P. 917 CNcomment: 连接方式.CNend */ 918 unsigned char dev_capab; /**< User's device capbility of P2P. 919 CNcomment: 连接的device能力.CNend */ 920 unsigned char group_capab; /**< User's group capbility of P2P. 921 CNcomment: 连接的group能力.CNend */ 922 char group[EXT_WIFI_GROUP_NAME_LEN]; /**< User's group interface name P2P. 923 CNcomment: 连接的group名称.CNend */ 924 } event_p2p_prov_disc_pbc_request; 925 926 /** 927 * @ingroup soc_wifi_basic 928 * 929 * Event type of p2p provision discovery pbc response.CNcomment:p2p pbc 发现回应事件.CNend 930 */ 931 typedef struct { 932 int peer_go; /**< User's peer go of P2P. CNcomment: 对端是否是go.CNend */ 933 unsigned char peer[EXT_WIFI_MAC_LEN]; /**< User's mac address of P2P. CNcomment: 连接的peer MAC地址.CNend */ 934 } event_p2p_prov_disc_pbc_response; 935 936 /** 937 * @ingroup soc_wifi_basic 938 * 939 * Event type of p2p go neg request.CNcomment:p2p的go协商请求事件.CNend 940 */ 941 typedef struct { 942 unsigned char addr[EXT_WIFI_MAC_LEN]; /**< User's mac address of P2P. CNcomment: 连接的peer MAC地址.CNend */ 943 unsigned short int dev_passwd_id; /**< User's device password id. CNcomment: 设备密码id.CNend */ 944 unsigned char go_intent; /**< User's go intent. CNcomment: 协商成为go的信息.CNend */ 945 } event_p2p_go_neg_request; 946 947 /** 948 * @ingroup soc_wifi_basic 949 * 950 * Event type of p2p go neg success.CNcomment:p2p的go协商成功事件.CNend 951 */ 952 typedef struct { 953 int role_go; /**< role. CNcomment:本端角色.CNend */ 954 int freq; /**< freq. CNcomment:频率.CNend */ 955 unsigned char peer_device_addr[EXT_WIFI_MAC_LEN]; /**< peer device addr. CNcomment:对端设备addr.CNend */ 956 unsigned char peer_interface_addr[EXT_WIFI_MAC_LEN]; /**< peer addr. CNcomment:对端mac地址.CNend */ 957 int wps_method; /**< wps methon. CNcomment:wps关联方式.CNend */ 958 } event_p2p_go_neg_success; 959 960 /** 961 * @ingroup soc_wifi_basic 962 * 963 * Event type of p2p go neg fail.CNcomment:p2p的go协商失败事件.CNend 964 */ 965 typedef struct { 966 int status; /**< status. CNcomment:失败状态事件信息.CNend */ 967 } event_p2p_go_neg_failure; 968 969 /** 970 * @ingroup soc_wifi_basic 971 * 972 * Event type of p2p group start.CNcomment:p2p group start 事件.CNend 973 */ 974 typedef struct { 975 char ifname[WIFI_IFNAME_MAX_SIZE + 1]; /**< interface name. CNcomment: 接口名称.CNend */ 976 int go; /**< go or not. CNcomment: 是否是go.CNend */ 977 char ssid_txt[EXT_WIFI_MAX_SSID_LEN * 4 + 1]; /**< group name. CNcomment: 组名称.CNend */ 978 int freq; /**< group' freq. CNcomment: 组的频率.CNend */ 979 unsigned char go_dev_addr[EXT_WIFI_MAC_LEN]; /**< go device addr. CNcomment: go的device地址.CNend */ 980 int persistent; /**< persistent or not. CNcomment: 是否是永久网络.CNend */ 981 } event_p2p_group_started; 982 983 /** 984 * @ingroup soc_wifi_basic 985 * 986 * Event type of p2p invite.CNcomment:p2p的invite接受事件.CNend 987 */ 988 typedef struct { 989 unsigned char sa[EXT_WIFI_MAC_LEN]; /**< sa addr. CNcomment:sa地址.CNend */ 990 unsigned char go_dev_addr[EXT_WIFI_MAC_LEN]; /**< go device addr. CNcomment:go device地址.CNend */ 991 unsigned char bssid[EXT_WIFI_MAC_LEN]; /**< bssid. CNcomment: bssid.CNend */ 992 int op_freq; /**< operational. freq CNcomment: 所在的频率.CNend */ 993 int persistent_id; /**< network id. freq CNcomment: 永久网络id.CNend */ 994 int unknow_network; /**< unknow network.CNcomment: 未在本地存储的网络.CNend */ 995 } event_p2p_invite_recieve; 996 997 /** 998 * @ingroup soc_wifi_basic 999 * 1000 * Event type of p2p invite result.CNcomment:p2p的邀请结果事件.CNend 1001 */ 1002 typedef struct { 1003 int status; 1004 } event_p2p_invite_result; 1005 1006 /** 1007 * @ingroup soc_wifi_basic 1008 * 1009 * Event type of p2p invite.CNcomment:p2p的invite接受事件.CNend 1010 */ 1011 typedef struct { 1012 unsigned char sa[EXT_WIFI_MAC_LEN]; /**< sa addr. CNcomment:sa地址.CNend */ 1013 unsigned char go_dev_addr[EXT_WIFI_MAC_LEN]; /**< go device addr. CNcomment:go device地址.CNend */ 1014 unsigned char bssid[EXT_WIFI_MAC_LEN]; /**< bssid. CNcomment: bssid.CNend */ 1015 int op_freq; /**< operational. freq CNcomment: 所在的频率.CNend */ 1016 int persistent_id; /**< network id. freq CNcomment: 永久网络id.CNend */ 1017 } event_p2p_invite_accept; 1018 1019 /** 1020 * @ingroup soc_wifi_basic 1021 * 1022 * Event type wifi information.CNcomment:wifi的事件信息体.CNend 1023 */ 1024 typedef union { 1025 event_wifi_scan_done wifi_scan_done; /**< Scan finish event. 1026 CNcomment: WIFI扫描完成事件信息.CNend */ 1027 event_wifi_connected wifi_connected; /**< STA's connected event. 1028 CNcomment: STA的连接事件信息.CNend */ 1029 event_wifi_disconnected wifi_disconnected; /**< STA's dsiconnected event. 1030 CNcomment: STA的断连事件信息.CNend */ 1031 event_wifi_interface_name wifi_wps_timeout; /**< STA's timeout event. 1032 CNcomment: STA的WPS超时事件信息.CNend */ 1033 event_wifi_interface_name wifi_wps_success; /**< STA's success event. 1034 CNcomment: STA的WPS断开连接事件信息.CNend */ 1035 event_wifi_wps_fail wifi_wps_fail; /**< STA's dsiconnected event. 1036 CNcomment: STA的wps断连事件信息.CNend */ 1037 event_wifi_interface_name wifi_ap_start; /**< AP's start event. 1038 CNcomment: AP启动事件信息.CNend */ 1039 event_wifi_interface_name wifi_ap_fail; /**< AP's fail event. 1040 CNcomment: AP启动失败事件信息.CNend */ 1041 event_ap_sta_connected ap_sta_connected; /**< AP's connected event . 1042 CNcomment: AP的连接事件信息.CNend */ 1043 event_ap_sta_disconnected ap_sta_disconnected; /**< AP's disconnected event. 1044 CNcomment: AP的断连事件信息.CNend */ 1045 event_wifi_interface_name scan_no_network; /**< can not scan network event. 1046 CNcomment: 扫描不到网络事件信息.CNend */ 1047 event_mesh_connected mesh_connected; /**< MESH's connected event. 1048 CNcomment: MESH连接事件信息.CNend */ 1049 event_mesh_disconnected mesh_disconnected; /**< MESH's disconnected event. 1050 CNcomment: MESH断连事件信息.CNend */ 1051 event_p2p_prov_disc_pbc_request p2p_disc_pbc_request; /**< p2p's pbc discovery request event. 1052 CNcomment: P2P PBC发现请求信息.CNend */ 1053 event_p2p_prov_disc_pbc_response p2p_disc_pbc_response; /**< p2p's pbc discovery responset event. 1054 CNcomment: P2P PBC回应请求信息.CNend */ 1055 event_p2p_go_neg_request p2p_go_neg_request; /**< p2p's go neg request event. 1056 CNcomment: P2P对端go协商请求信息.CNend */ 1057 event_p2p_go_neg_success p2p_go_neg_success; /**< p2p's go neg success event. 1058 CNcomment: P2P对端go协商请求成功.CNend */ 1059 event_p2p_go_neg_failure p2p_go_neg_failure; /**< p2p's go neg failure event. 1060 CNcomment: P2P对端go协商请求信息.CNend */ 1061 event_p2p_group_started p2p_go_group_started; /**< p2p's group start event. 1062 CNcomment: P2P组开始时间.CNend */ 1063 event_p2p_invite_recieve p2p_invite_recieve; /**< p2p's invite recieve event. 1064 CNcomment: P2P收到邀请信息.CNend */ 1065 event_p2p_invite_result p2p_invite_result; /**< p2p's invite result event. 1066 CNcomment: P2P邀请结果信息.CNend */ 1067 event_p2p_invite_accept p2p_invite_accept; /**< p2p's invite accept event. 1068 CNcomment: P2P邀请接受信息.CNend */ 1069 } ext_wifi_event_info; 1070 1071 /** 1072 * @ingroup soc_wifi_basic 1073 * 1074 * Struct of WiFi event.CNcomment:WiFi事件结构体.CNend 1075 * 1076 */ 1077 typedef struct { 1078 ext_wifi_event_type event; /**< Event type. CNcomment: 事件类型.CNend */ 1079 ext_wifi_event_info info; /**< Event information. CNcomment: 事件信息.CNend */ 1080 } ext_wifi_event; 1081 1082 /** 1083 * @ingroup soc_wifi_basic 1084 * 1085 * Struct of softap's basic config.CNcomment:softap基本配置.CNend 1086 * 1087 */ 1088 typedef struct { 1089 char ssid[EXT_WIFI_MAX_SSID_LEN + 1]; /**< SSID. CNcomment: SSID 只支持ASCII字符.CNend */ 1090 char key[EXT_WIFI_AP_KEY_LEN + 1]; /**< Secret key. CNcomment: 秘钥.CNend */ 1091 unsigned char channel_num; /**< Channel number. CNcomment: 信道号,范围1-14,不同区域有差异.CNend */ 1092 int ssid_hidden; /**< Hidden ssid. CNcomment: 是否隐藏SSID.CNend */ 1093 ext_wifi_auth_mode authmode; /**< Authentication mode. CNcomment: 认证方式.CNend */ 1094 ext_wifi_pairwise pairwise; /**< Encryption type. CNcomment: 加密方式,不需指定时置0.CNend */ 1095 } ext_wifi_softap_config; 1096 1097 /** 1098 * @ingroup soc_wifi_basic 1099 * 1100 * mac address of softap's user.CNcomment:与softap相连的station mac地址.CNend 1101 * 1102 */ 1103 typedef struct { 1104 unsigned char mac[EXT_WIFI_MAC_LEN]; /**< MAC address.CNcomment:与softap相连的station mac地址.CNend */ 1105 } ext_wifi_ap_sta_info; 1106 1107 /** 1108 * @ingroup soc_wifi_basic 1109 * 1110 * Struct of WPA psk calc config.CNcomment:计算WPA psk需要设置的参数.CNend 1111 */ 1112 typedef struct { 1113 unsigned char ssid[EXT_WIFI_MAX_SSID_LEN + 1]; /**< SSID. CNcomment: SSID 只支持ASCII字符.CNend */ 1114 char key[EXT_WIFI_AP_KEY_LEN + 1]; /**< Secret key. CNcomment: 秘钥.CNend */ 1115 } ext_wifi_sta_psk_config; 1116 1117 /** 1118 * @ingroup hi_wifi_basic 1119 * 1120 * Struct of scan result.CNcomment:扫描结果参数.CNend 1121 */ 1122 typedef struct { 1123 char ssid[EXT_WIFI_MAX_SSID_LEN + 1]; /**< Service set ID (SSID).CNcomment:SSID.CNend */ 1124 unsigned char bssid[EXT_WIFI_MAC_LEN]; /**< Basic service set ID (BSSID).CNcomment:BSSID.CNend */ 1125 char reserved; 1126 int security_type; /**< Security type.For details, see {@link wifi_security_enumType}.CNcomment:安全类型.CNend */ 1127 int rssi; /**< Received signal strength indicator (RSSI).CNcomment:RSSI.CNend */ 1128 int band; /**< Frequency band.CNcomment:频带.CNend */ 1129 int channel_num; /**< channel num.CNcomment:信道号.CNend */ 1130 } ext_wifi_scan_result_stru; 1131 1132 /** 1133 * @ingroup soc_wifi_basic 1134 * 1135 * Struct of report datarate.CNcomment:数据发包参数.CNend 1136 */ 1137 typedef struct { 1138 unsigned int best_rate; 1139 } ext_wifi_report_tx_params; 1140 1141 /** 1142 * @ingroup soc_wifi_basic 1143 * 1144 * callback function definition of wpa-enterprise param import.CNcommment:定制化扫描回调函数.CNend 1145 */ 1146 typedef void (*ext_wifi_scan_no_save_cb)(ext_wifi_scan_result_stru *scan_result); 1147 1148 /** 1149 * @ingroup soc_wifi_basic 1150 * 1151 * callback function definition of wpa-enterprise param import.CNcommment:企业级导入回调接口定义.CNend 1152 */ 1153 typedef int (*uapi_wifi_ent_import_cb)(unsigned char **buf, unsigned int *len); 1154 1155 /** 1156 * @ingroup soc_wifi_basic 1157 * 1158 * callback function definition of psd data report.CNcommment:PSD数据上报回调接口定义.CNend 1159 */ 1160 typedef int32_t (*wifi_psd_cb)(void *recv_buf, uint32_t data_len); 1161 1162 /** 1163 * @ingroup soc_wifi_basic 1164 * 1165 * parameters of wpa-enterprise callback.CNcomment:企业级回调注册参数.CNend 1166 */ 1167 typedef struct { 1168 uapi_wifi_ent_import_cb ca_cert_import; /**< Import CA certificate callback. CNcomment: 导入CA证书回调.CNend */ 1169 uapi_wifi_ent_import_cb cli_cert_import; /**< Import client certificate callback. CNcomment: 导入客户端证书回调.CNend */ 1170 uapi_wifi_ent_import_cb cli_key_import; /**< Import client private key callback. CNcomment: 导入客户端密钥回调.CNend */ 1171 } ext_wifi_ent_import_callback; 1172 1173 typedef struct { 1174 unsigned char user_idx; /* CSI白名单用户index 取值范围0~3,最多4个用户 */ 1175 unsigned char enable; /* CSI白名单用户开关,0去使能,忽略以下所有参数, 1使能,校验后续参数 */ 1176 unsigned char cfg_match_ta_ra_sel; /* CSI白名单地址过滤类型 0 RA 1 TA */ 1177 unsigned char resv; /**< 保留1位,字节对齐 */ 1178 unsigned char mac_addr[EXT_WIFI_MAC_LEN]; /* 白名单MAC地址 */ 1179 unsigned char frame_type_filter_bitmap; /* 帧类型过滤具体参数 取值范围0~7,bit0管理帧 bit1控制帧 bit2数据帧 */ 1180 unsigned char sub_type_filter_enable; /* 帧子类型过滤开关,0关闭 1打开,只有在1时才会校验sub_type_filter_bitmap */ 1181 unsigned char sub_type_filter; /* 帧子类型过滤具体参数 4位二进制数对应的十进制结果(如 1100即为12) */ 1182 unsigned char ppdu_filter_bitmap; /* ppdu format过滤具体参数 取值范围0~63 1183 bit[0]:non-HT 1184 bit[1]:HE_(ER)SU 1185 bit[2]:HE_MU_MIMO 1186 bit[3]:HE_MU_OFDMA 1187 bit[4]:HT 1188 bit[5]:VHT */ 1189 unsigned short period; /* CSI上报时间间隔 单位ms */ 1190 } ext_csi_config; 1191 1192 /** 1193 * @ingroup soc_wifi_basic 1194 * 1195 * callback function definition of monitor mode.CNcommment:混杂模式收包回调接口定义.CNend 1196 */ 1197 typedef int32_t (*wifi_promis_cb)(void* recv_buf, int32_t frame_len, int8_t rssi); 1198 1199 /** 1200 * @ingroup soc_wifi_basic 1201 * 1202 * callback function definition of wifi event.CNcommment:wifi事件回调接口定义.CNend 1203 */ 1204 typedef void (*uapi_wifi_event_cb)(const ext_wifi_event *event); 1205 1206 /** 1207 * @ingroup soc_wifi_basic 1208 * 1209 * callback function definition of wpa-enterprise param import.CNcommment:CSI调接口定义.CNend 1210 */ 1211 typedef void (*wifi_csi_data_cb)(unsigned char *csi_data, int len); 1212 1213 /** 1214 * @ingroup soc_wifi_basic 1215 * 1216 * function definition of wifi event.CNcommment:扫描完成接口定义.CNend 1217 */ 1218 unsigned int uapi_wifi_force_scan_complete(void); 1219 1220 /** 1221 * @ingroup soc_wifi_basic 1222 * 1223 * function definition of wifi event.CNcommment:删除驱动扫描链表接口定义.CNend 1224 */ 1225 unsigned int uapi_wifi_scan_results_clear(void); 1226 1227 /** 1228 * @ingroup soc_wifi_basic 1229 * 1230 * function definition of wifi event.CNcommment:获取扫描状态接口定义.CNend 1231 */ 1232 int uapi_wifi_get_scan_flag(void); 1233 1234 /** 1235 * @ingroup soc_wifi_basic 1236 * 1237 * function definition of wifi event.CNcommment:AP扫描接口定义.CNend 1238 */ 1239 int uapi_wifi_ap_scan(void); 1240 1241 /** 1242 * @ingroup soc_wifi_basic 1243 * 1244 * function definition of wifi event.CNcommment:可自定义回调函数扫描接口定义.CNend 1245 */ 1246 int uapi_wifi_sta_raw_scan(ext_wifi_scan_params *sp, ext_wifi_scan_no_save_cb cb); 1247 1248 /** 1249 * @ingroup soc_wifi_basic 1250 * 1251 * function definition of wifi event.CNcommment:设置CSI配置函数接口定义.CNend 1252 */ 1253 int uapi_wifi_csi_set_config(const char *ifname, const ext_csi_config *config); 1254 1255 /** 1256 * @ingroup soc_wifi_basic 1257 * 1258 * function definition of wifi event.CNcommment:CSI注册回调函数接口定义.CNend 1259 */ 1260 void uapi_csi_register_data_report_cb(wifi_csi_data_cb data_cb); 1261 1262 /** 1263 * @ingroup soc_wifi_basic 1264 * 1265 * function definition of wifi event.CNcommment:CSI启动函数接口定义.CNend 1266 */ 1267 int uapi_wifi_csi_start(void); 1268 1269 /** 1270 * @ingroup soc_wifi_basic 1271 * 1272 * function definition of wifi event.CNcommment:CSI关闭函数接口定义.CNend 1273 */ 1274 int uapi_wifi_csi_stop(void); 1275 1276 1277 /** 1278 * @ingroup soc_wifi_basic 1279 * 1280 * function definition of wifi event.CNcommment:设置报文重传函数接口定义.CNend 1281 */ 1282 td_s32 uapi_wifi_set_pkt_retry_policy(td_u8 frame_type, td_u8 retry_count); 1283 1284 /** 1285 * @ingroup soc_wifi_basic 1286 * 1287 * function definition of wifi event.CNcommment:mac_phy重置函数接口定义.CNend 1288 */ 1289 int uapi_wifi_mac_phy_reset(void); 1290 1291 /** 1292 * @ingroup soc_wifi_basic 1293 * 1294 * function definition of wifi event.CNcommment:设置RTS阈值函数接口定义.CNend 1295 */ 1296 td_u32 uapi_wifi_set_rts_threshold(td_u8 mode, td_u16 pkt_length); 1297 1298 /** 1299 * @ingroup soc_wifi_basic 1300 * 1301 * function definition of wifi event.CNcommment:设置phy发送速率函数接口定义.CNend 1302 */ 1303 uint32_t uapi_wifi_set_phy_txrate(td_u8 auto_rate, ext_alg_param_stru *alg_param); 1304 1305 /** 1306 * @ingroup soc_wifi_basic 1307 * 1308 * callback function definition of wifi event to get goodput and average send times. 1309 * CNcommment:wifi获取吞吐量、平均发送次数事件回调接口定义.CNend 1310 */ 1311 typedef unsigned int (*uapi_wifi_report_tx_params_callback)(ext_wifi_report_tx_params*); 1312 1313 /** 1314 * @ingroup soc_wifi_basic 1315 * 1316 * function definition of wifi event.CNcommment:设置算法抗干扰函数接口定义.CNend 1317 */ 1318 td_u32 uapi_wifi_enable_intrf_mode(const td_char *ifname, td_u8 enable, td_u16 flag); 1319 1320 /** 1321 * @ingroup soc_wifi_basic 1322 * 1323 * function definition of wifi event.CNcommment:获取发送参数函数接口定义.CNend 1324 */ 1325 td_s32 uapi_wifi_get_tx_params(const td_char *mac_addr, td_u8 mac_len, td_u32 *tx_best_rate); 1326 1327 /** 1328 * @ingroup soc_wifi_basic 1329 * 1330 * function definition of wifi event.CNcommment:设置低功耗函数接口定义.CNend 1331 */ 1332 td_s32 uapi_set_low_current_boot_mode(td_u16 flag); 1333 1334 /** 1335 * @ingroup soc_wifi_basic 1336 * @brief Set wow switch.CNcomment:设置wow特性开关.CNend 1337 * 1338 * @par Description: 1339 * Set wow switch.CNcomment:设置wow 特性开关.CNend 1340 * 1341 * @attention 1.Should be called before uapi_wifi_init(). 1342 * CNcomment:只能在uapi_wifi_init()函数前调用.CNend 1343 * @param enable [IN] Type #unsigned char,0:disable. 1:enable. Others:invalid 1344 * 1345 * @retval #EXT_OK Excute successfully 1346 * @retval #Other Error code 1347 * 1348 * @par Dependency: 1349 * @li soc_wifi_api.h: WiFi API 1350 * @see NULL 1351 * @since 1352 */ 1353 int uapi_wifi_set_wow_switch(uint8_t enable); 1354 1355 /** 1356 * @ingroup soc_wifi_basic 1357 * @brief Set wow switch.CNcomment:配置wow特定唤醒报文格式.CNend 1358 * 1359 * @par Description: 1360 * Set wow pattern.CNcomment:配置wow特性唤醒报文格式, 支持添加/删除/清除操作 .CNend 1361 * 1362 * @attention 1.Should be called before uapi_wifi_init(). 1363 * CNcomment:只能在uapi_wifi_init()函数前调用.CNend 1364 * @param type [IN] Type #unsigned char, 0:add. 1:del. 2:clr Others:invalid 1365 * 1366 * index [IN] Type #unsigned char, range [0-3]. Others:invalid 1367 * 1368 * pattern [IN] Type #unsigned char *, 自定义唤醒报文格式, HEX格式字符串 1369 * 1370 * @retval #EXT_OK Excute successfully 1371 * @retval #Other Error code 1372 * 1373 * @par Dependency: 1374 * @li soc_wifi_api.h: WiFi API 1375 * @see NULL 1376 * @since 1377 */ 1378 int uapi_wifi_set_wow_pattern(unsigned char type, unsigned char index, unsigned char *pattern); 1379 1380 /** 1381 * @ingroup soc_wifi_basic 1382 * @brief Wifi initialize.CNcomment:wifi初始化.CNend 1383 * 1384 * @par Description: 1385 Wifi driver initialize.CNcomment:wifi驱动初始化,不创建wifi设备.CNend 1386 * 1387 * @attention NULL 1388 * @param vap_res_num [IN] Type #const unsigned char, vap num[rang: 1-3].CNcomment:vap资源个数,取值[1-3].CNend 1389 * @param user_res_num [IN] Type #const unsigned char, user resource num[1-7]. 1390 * CNcomment:用户资源个数,多vap时共享,取值[1-7].CNend 1391 * 1392 * @retval #EXT_WIFI_OK Excute successfully 1393 * @retval #Other Error code 1394 * @par Dependency: 1395 * @li soc_wifi_api.h: WiFi API 1396 * @see NULL 1397 * @since 1398 */ 1399 td_s32 uapi_wifi_init(const td_u8 vap_res_num, const td_u8 user_res_num); 1400 1401 /** 1402 * @ingroup soc_wifi_basic 1403 * @brief Wifi de-initialize.CNcomment:wifi去初始化.CNend 1404 * 1405 * @par Description: 1406 * Wifi driver de-initialize.CNcomment:wifi驱动去初始化.CNend 1407 * 1408 * @attention NULL 1409 * @param NULL 1410 * 1411 * @retval #EXT_WIFI_OK Excute successfully 1412 * @retval #Other Error code 1413 * @par Dependency: 1414 * @li soc_wifi_api.h: WiFi API 1415 * @see NULL 1416 * @since 1417 */ 1418 int uapi_wifi_deinit(void); 1419 1420 /** 1421 * @ingroup soc_wifi_basic 1422 * @brief Get wifi initialize status.CNcomment:获取wifi初始化状态.CNend 1423 * 1424 * @par Description: 1425 Get wifi initialize status.CNcomment:获取wifi初始化状态.CNend 1426 * 1427 * @attention NULL 1428 * @param NULL 1429 * 1430 * @retval #1 Wifi is initialized.CNcoment:Wifi已经初始化.CNend 1431 * @retval #0 Wifi is not initialized.CNcoment:Wifi没有初始化.CNend 1432 * @par Dependency: 1433 * @li soc_wifi_api.h: WiFi API 1434 * @see NULL 1435 * @since 1436 */ 1437 unsigned char uapi_wifi_get_init_status(void); 1438 1439 /** 1440 * @ingroup soc_wifi_basic 1441 * @brief Config sae pwe settings of sta.CNcomment:配置station的sae pwe.CNend 1442 * 1443 * @par Description: 1444 * Config sae pwe settings of sta, set before sta start.CNcomment:配置station的sae pwe, 在sta start之前调用.CNend 1445 * 1446 * @attention Default sae pwe enum value 2. CNcomment:默认sae pwe枚举值2.CNend 1447 * @param pwe [IN] Type #wifi_sae_pwe_option_enum, sae pwe enum value.CNcoment:sae pwe枚举值.CNend 1448 * 1449 * @retval #EXT_WIFI_OK Execute successfully. 1450 * @retval #EXT_WIFI_FAIL Execute failed. 1451 * @par Dependency: 1452 * @li soc_wifi_api.h: WiFi API 1453 * @see NULL 1454 * @since 1455 */ 1456 int wifi_sta_set_sae_pwe(wifi_sae_pwe_option_enum pwe); 1457 1458 /** 1459 * @ingroup soc_wifi_basic 1460 * @brief Config sae pwe settings of softap.CNcomment:配置softap的sae pwe.CNend 1461 * 1462 * @par Description: 1463 * Config sae pwe settings of softap, set before softap start. 1464 * CNcomment:配置softap的sae pwe, 在softap start之前调用.CNend 1465 * 1466 * @attention Default sae pwe enum value 2. CNcomment:默认sae pwe枚举值2.CNend 1467 * @param pwe [IN] Type #wifi_sae_pwe_option_enum, sae pwe enum value.CNcoment:sae pwe枚举值.CNend 1468 * 1469 * @retval #EXT_WIFI_OK Execute successfully. 1470 * @retval #EXT_WIFI_FAIL Execute failed. 1471 * @par Dependency: 1472 * @li soc_wifi_api.h: WiFi API 1473 * @see NULL 1474 * @since 1475 */ 1476 int wifi_softap_set_sae_pwe(wifi_sae_pwe_option_enum pwe); 1477 1478 /** 1479 * @ingroup soc_wifi_basic 1480 * @brief Start wifi station.CNcomment:开启STA.CNend 1481 * 1482 * @par Description: 1483 * Start wifi station.CNcomment:开启STA.CNend 1484 * 1485 * @attention 1. Multiple interfaces of the same type are not supported.CNcomment:1. 不支持使用多个同类型接口.CNend\n 1486 * 2. Dual interface coexistence support: STA + AP or STA + MESH. 1487 * CNcomment:2. 双接口共存支持:STA + AP or STA + MESH.CNend\n 1488 * 3. The memories of <ifname> and <len> should be requested by the caller, 1489 * the input value of len must be the same as the length of ifname 1490 * (The minimum length is 6 bytes and the recommended length is 17 bytes).\n 1491 * CNcomment:3. <ifname>和<len>由调用者申请内存,用户写入len的值必须与ifname长度一致。 1492 * (最小长度是6字节,建议长度为17Bytes).CNend\n 1493 * 4. This is a blocking function.CNcomment:4.此函数为阻塞函数.CNend 1494 * @param ifname [IN/OUT] Type #char *, device name.CNcomment:接口名.CNend 1495 * @param len [IN/OUT] Type #int *, length of device name.CNcomment:接口名长度.CNend 1496 * 1497 * @retval #EXT_WIFI_OK Execute successfully. 1498 * @retval #EXT_WIFI_FAIL Execute failed. 1499 * @par Dependency: 1500 * @li soc_wifi_api.h: WiFi API 1501 * @see NULL 1502 * @since 1503 */ 1504 int uapi_wifi_sta_start(char *ifname, int *len); 1505 1506 /** 1507 * @ingroup soc_wifi_basic 1508 * @brief Close wifi station.CNcomment:关闭STA.CNend 1509 * 1510 * @par Description: 1511 * Close wifi station.CNcomment:关闭STA.CNend 1512 * 1513 * @attention 1. This is a blocking function.CNcomment:1.此函数为阻塞函数.CNend 1514 * @param NULL 1515 * 1516 * @retval #EXT_WIFI_OK Execute successfully. 1517 * @retval #EXT_WIFI_FAIL Execute failed. 1518 * @par Dependency: 1519 * @li soc_wifi_api.h: WiFi API 1520 * @see NULL 1521 * @since 1522 */ 1523 int uapi_wifi_sta_stop(void); 1524 1525 /** 1526 * @ingroup soc_wifi_basic 1527 * @brief Start sta basic scanning in all channels.CNcomment:station进行全信道基础扫描.CNend 1528 * 1529 * @par Description: 1530 * Start sta basic scanning in all channels.CNcomment:启动station全信道基础扫描.CNend 1531 * 1532 * @attention NULL 1533 * @param NULL 1534 * 1535 * @retval #EXT_WIFI_OK Execute successfully. 1536 * @retval #EXT_WIFI_FAIL Execute failed. 1537 * @par Dependency: 1538 * @li soc_wifi_api.h: WiFi API 1539 * @see NULL 1540 * @since 1541 */ 1542 int uapi_wifi_sta_scan(void); 1543 1544 /** 1545 * @ingroup soc_wifi_basic 1546 * @brief Start station scanning with specified parameter.CNcomment:station执行带特定参数的扫描.CNend 1547 * 1548 * @par Description: 1549 * Start station scanning with specified parameter.CNcomment:station执行带特定参数的扫描.CNend 1550 * 1551 * @attention 1. advance scan can scan with ssid only,channel only,bssid only,prefix_ssid only, 1552 * and the combination parameters scanning does not support.\n 1553 * CNcomment:1. 高级扫描分别单独支持 ssid扫描,信道扫描,bssid扫描,ssid前缀扫描, 不支持组合参数扫描方式.CNend\n 1554 * 2. Scanning mode, subject to the type set by scan_type. 1555 * CNcomment:2 .扫描方式,以scan_type传入的类型为准。CNend \n 1556 * 3. SSID only supports ASCII characters. 1557 * CNcomment:3. SSID 只支持ASCII字符.CNend 1558 * @param sp [IN] Type #ext_wifi_scan_params * parameters of scan.CNcomment:扫描网络参数设置.CNend 1559 * 1560 * @retval #EXT_WIFI_OK Execute successfully. 1561 * @retval #EXT_WIFI_FAIL Execute failed. 1562 * @par Dependency: 1563 * @li soc_wifi_api.h: WiFi API 1564 * @see NULL 1565 * @since 1566 */ 1567 int uapi_wifi_sta_advance_scan(ext_wifi_scan_params *sp); 1568 1569 /** 1570 * @ingroup soc_wifi_basic 1571 * @brief sta start scan.CNcomment:station进行扫描.CNend 1572 * 1573 * @par Description: 1574 * Get station scan result.CNcomment:获取station扫描结果.CNend 1575 * @attention 1. The memories of <ap_list> and <ap_num> memories are requested by the caller. \n 1576 * The <ap_list> size up to : OAL_SIZEOF(ext_wifi_ap_info ap_list) * 32. \n 1577 * CNcomment:1. <ap_list>和<ap_num>由调用者申请内存, 1578 * <ap_list>size最大为:OAL_SIZEOF(ext_wifi_ap_info ap_list) * 32.CNend \n 1579 * 2. ap_num: parameters can be passed in to specify the number of scanned results.The maximum is 32. \n 1580 * CNcomment:2. ap_num: 可以传入参数,指定获取扫描到的结果数量,最大为32。CNend \n 1581 * 3. If the user callback function is used, ap num refers to bss_num in event_wifi_scan_done. \n 1582 * CNcomment:3. 如果使用上报用户的回调函数,ap_num参考event_wifi_scan_done中的bss_num。CNend \n 1583 * 4. ap_num should be same with number of ext_wifi_ap_info structures applied, 1584 * Otherwise, it will cause memory overflow. \n 1585 * CNcomment:4. ap_num和申请的ext_wifi_ap_info结构体数量一致,否则可能造成内存溢出。CNend \n 1586 * 5. SSID only supports ASCII characters. \n 1587 * CNcomment:5. SSID 只支持ASCII字符.CNend \n 1588 * 6. The rssi in the scan results needs to be divided by 100 to get the actual rssi.\n 1589 * CNcomment:6. 扫描结果中的rssi需要除以100才能获得实际的rssi.CNend 1590 * @param ap_list [IN/OUT] Type #ext_wifi_ap_info * scan result.CNcomment:扫描的结果.CNend 1591 * @param ap_num [IN/OUT] Type #unsigned int *, number of scan result.CNcomment:扫描到的网络数目.CNend 1592 * 1593 * @retval #EXT_WIFI_OK Execute successfully. 1594 * @retval #EXT_WIFI_FAIL Execute failed. 1595 * @par Dependency: 1596 * @li soc_wifi_api.h: WiFi API 1597 * @see NULL 1598 * @since 1599 */ 1600 int uapi_wifi_sta_scan_results(ext_wifi_ap_info *ap_list, unsigned int *ap_num); 1601 1602 /** 1603 * @ingroup soc_wifi_basic 1604 * @brief Clear sta scan result.CNcomment:清除sta扫描链表.CNend 1605 * 1606 * @par Description: 1607 * Clear sta scan result.CNcomment:清除sta扫描链表.CNend 1608 * 1609 * @attention 1. This is a blocking function.CNcomment:1.此函数为阻塞函数.CNend 1610 * @param NULL 1611 * 1612 * @retval #EXT_WIFI_OK Execute successfully. 1613 * @retval #EXT_WIFI_FAIL Execute failed. 1614 * @par Dependency: 1615 * @li soc_wifi_api.h: WiFi API 1616 * @see NULL 1617 * @since 1618 */ 1619 int uapi_wifi_sta_scan_results_clear(void); 1620 1621 /** 1622 * @ingroup soc_wifi_basic 1623 * @brief Clear sta scan result.CNcomment:发送bss query报文.CNend 1624 * 1625 * @par Description: 1626 * Clear sta scan result.CNcomment:发送bss query报文.CNend 1627 * 1628 * @attention 1. This is a blocking function.CNcomment:1.此函数为阻塞函数.CNend 1629 * @param NULL 1630 * 1631 * @retval #EXT_WIFI_OK Execute successfully. 1632 * @retval #EXT_WIFI_FAIL Execute failed. 1633 * @par Dependency: 1634 * @li soc_wifi_api.h: WiFi API 1635 * @see NULL 1636 * @since 1637 */ 1638 int uapi_wifi_wnm_bss_query(int reason_code, int candidate_list); 1639 1640 /** 1641 * @ingroup soc_wifi_basic 1642 * @brief sta start connect.CNcomment:station进行连接网络.CNend 1643 * 1644 * @par Description: 1645 * sta start connect.CNcomment:station进行连接网络.CNend 1646 * 1647 * @attention 1.<ssid> and <bssid> cannot be empty at the same time. CNcomment:1. <ssid>与<bssid>不能同时为空.CNend\n 1648 * 2. When <auth_type> is set to OPEN/EXT_WIFI_SECURITY_WPA2/EXT_WIFI_SECURITY_WPA3/ 1649 * EXT_WIFI_SECURITY_WPA3_WPA2_MIX, the <passwd> parameter is not required. 1650 * CNcomment:2. <auth_type>设置为OPEN/EXT_WIFI_SECURITY_WPA2/EXT_WIFI_SECURITY_WPA3/ 1651 * EXT_WIFI_SECURITY_WPA3_WPA2_MIX,时,无需<passwd>参数.CNend\n 1652 * 3. This function is non-blocking.CNcomment:3. 此函数为非阻塞式.CNend\n 1653 * 4. Pairwise can be set, default is 0.CNcomment:4. pairwise 可设置, 默认为0.CNend\n 1654 * 5. If the station is already connected to a network, disconnect the existing connection and 1655 * then connect to the new network.\n 1656 * CNcomment:5. 若station已接入某个网络,则先断开已有连接,然后连接新网络.CNend\n 1657 * 6. If the wrong SSID, BSSID or key is passed in, the EXT_WIFI_OK will be returned, 1658 * but sta cannot connect the ap. 1659 * CNcomment:6. 如果传入错误的ssid,bssid或者不正确的密码,返回成功,但连接ap失败。CNend\n 1660 * 7. SSID only supports ASCII characters. 1661 * CNcomment:7. SSID 只支持ASCII字符.CNend \n 1662 * 8. Only support auth mode as bellow: 1663 * EXT_WIFI_SECURITY_SAE, 1664 * EXT_WIFI_SECURITY_WPA3_WPA2_PSK_MIX, 1665 * EXT_WIFI_SECURITY_WPAPSK_WPA2PSK_MIX, 1666 * EXT_WIFI_SECURITY_WPA2PSK, 1667 * EXT_WIFI_SECURITY_WPA2, 1668 * EXT_WIFI_SECURITY_WPA3, 1669 * EXT_WIFI_SECURITY_WPA3_WPA2_MIX, 1670 * EXT_WIFI_SECURITY_WAPI_PSK, 1671 * EXT_WIFI_SECURITY_WEP, 1672 * EXT_WIFI_SECURITY_OPEN 1673 * CNcomment:8. 只支持以下认证模式: 1674 * EXT_WIFI_SECURITY_SAE, 1675 * EXT_WIFI_SECURITY_WPA3_WPA2_PSK_MIX, 1676 * EXT_WIFI_SECURITY_WPAPSK_WPA2PSK_MIX, 1677 * EXT_WIFI_SECURITY_WPA2PSK, 1678 * EXT_WIFI_SECURITY_WPA2, 1679 * EXT_WIFI_SECURITY_WPA3, 1680 * EXT_WIFI_SECURITY_WPA3_WPA2_MIX, 1681 * EXT_WIFI_SECURITY_WAPI_PSK, 1682 * EXT_WIFI_SECURITY_WEP, 1683 * EXT_WIFI_SECURITY_OPEN \n 1684 * 9. WEP supports 64 bit and 128 bit encryption. 1685 * for 64 bit encryption, the encryption key is 10 hexadecimal characters or 5 ASCII characters; 1686 * for 128 bit encryption, the encryption key is 26 hexadecimal characters or 13 ASCII characters。\n 1687 * CNcomment:9. WEP支持64位和128位加密,对于64位加密,加密密钥为10个十六进制字符或5个ASCII字符; 1688 * 对于128位加密,加密密钥为26个十六进制字符或13个ASCII字符。CNend\n 1689 * 10. When the key of WEP is in the form of ASCII character, 1690 * the key in the input struct needs to be added with double quotation marks; 1691 * when the key of WEP is in the form of hexadecimal character, 1692 * the key in the input struct does not need to add double quotation marks.\n 1693 * CNcomment:10. WEP的秘钥为ASCIl字符形式时,入参结构体中的key需要添加双引号; 1694 * WEP的秘钥为为十六进制字符时,入参结构体中的key不需要添加双引号。CNend\n 1695 * 11. If the auth type is EXT_WIFI_SECURITY_SAE, PMF is temporarily enabled as required.\n 1696 * CNcomment:11. 当使用EXT_WIFI_SECURITY_SAE进行认证时,默认临时开启PMF(强制)。CNend\n 1697 * 12. If the auth type is EXT_WIFI_SECURITY_WPA3_WPA2_PSK_MIX, PMF is temporarily enabled as optional.\n 1698 * CNcomment:12. 当使用EXT_WIFI_SECURITY_WPA3_WPA2_PSK_MIX进行认证时,默认临时开启PMF(可选)。CNend\n 1699 * 13. If the auth type is EXT_WIFI_SECURITY_WPA3, PMF is temporarily enabled as required.\n 1700 * CNcomment:13. 当使用EXT_WIFI_SECURITY_WPA3进行认证时,默认临时开启PMF(强制)。CNend\n 1701 * 14. If the auth type is EXT_WIFI_SECURITY_WPA3_WPA2_MIX, PMF is temporarily enabled as optional.\n 1702 * CNcomment:14. 当使用EXT_WIFI_SECURITY_WPA3_WPA2_MIX进行认证时,默认临时开启PMF(可选)。CNend\n 1703 * 1704 * @param req [IN] Type #const ext_wifi_assoc_request * connect parameters of network.CNcomment:连接网络参数设置.CNend 1705 * @retval #EXT_WIFI_OK Execute successfully. 1706 * @retval #EXT_WIFI_FAIL Execute failed. 1707 * @par Dependency: 1708 * @li soc_wifi_api.h: WiFi API 1709 * @see NULL 1710 * @since 1711 */ 1712 int uapi_wifi_sta_connect(const ext_wifi_assoc_request *req); 1713 1714 /** 1715 * @ingroup soc_wifi_basic 1716 * @brief Start fast connect.CNcomment:station进行快速连接网络.CNend 1717 * 1718 * @par Description: 1719 * Start fast connect.CNcomment:station进行快速连接网络.CNend 1720 * 1721 * @attention 1. <ssid> and <bssid> cannot be empty at the same time. CNcomment:1.<ssid>与<bssid>不能同时为空.CNend\n 1722 * 2. When <auth_type> is set to OPEN, the <passwd> parameter is not required. 1723 * CNcomment:2.<auth_type>设置为OPEN时,无需<passwd>参数.CNend\n 1724 * 3. <chn> There are differences in the range of values, and China is 1-13. 1725 * CNcomment:3.<chn>取值范围不同区域有差异,中国为1-13.CNend\n 1726 * 4. This is a blocking function.CNcomment:4.此函数为阻塞函数.CNend\n 1727 * 5. Pairwise can be set, set to zero by default.CNcomment:5. pairwise 可设置,默认置零.CNend\n 1728 * 6. <psk> and <psk_flag> are optional parameters, set to zero by default. \n 1729 * CNcomment:6. <psk>和<psk_flag>为可选参数,无需使用时填0.CNend\n 1730 * 7. If the wrong SSID, BSSID or key is passed in, the EXT_WIFI_FAIL will be returned, 1731 * and sta cannot connect the ap. 1732 * CNcomment:7. 如果传入错误的ssid,bssid或者不正确的密码,返回失败并且连接ap失败。CNend\n 1733 * 8. SSID only supports ASCII characters. 1734 * CNcomment:8. SSID 只支持ASCII字符.CNend \n 1735 * 9. The PSK internal cache calculated in advance will be cleared after the function execution is completed. 1736 * CNcomment:9. 提前计算的PSK内部缓存将在函数执行完成后清除.CNend \n 1737 * 10. The PSK calculated in advance do not support WPA3-PSK. 1738 * CNcomment:10. PSK提前计算不支持WPA3-PSK.CNend 1739 * 11. If the auth type is EXT_WIFI_SECURITY_SAE, PMF is temporarily enabled as required.\n 1740 * CNcomment:11. 当使用EXT_WIFI_SECURITY_SAE进行认证时,默认临时开启PMF(强制)。CNend\n 1741 * 12. If the auth type is EXT_WIFI_SECURITY_WPA3_WPA2_PSK_MIX, PMF is temporarily enabled as optional.\n 1742 * CNcomment:12. 当使用EXT_WIFI_SECURITY_WPA3_WPA2_PSK_MIX进行认证时,默认临时开启PMF(可选)。CNend\n 1743 * 1744 * @param fast_request [IN] Type #const ext_wifi_fast_assoc_request *, fast connect parameters. CNcomment:快速连接网络参数.CNend 1745 1746 * @retval #EXT_WIFI_OK Execute successfully. 1747 * @retval #EXT_WIFI_FAIL Execute failed. 1748 * @par Dependency: 1749 * @li soc_wifi_api.h: WiFi API 1750 * @see NULL 1751 * @since 1752 */ 1753 int uapi_wifi_sta_fast_connect(const ext_wifi_fast_assoc_request *fast_request); 1754 1755 /** 1756 * @ingroup soc_wifi_basic 1757 * @brief Disconnect from network.CNcomment:station断开相连的网络.CNend 1758 * 1759 * @par Description: 1760 * Disconnect from network.CNcomment:station断开相连的网络.CNend 1761 * 1762 * @attention NULL 1763 * @param NULL 1764 * 1765 * @retval #EXT_WIFI_OK Execute successfully. 1766 * @retval #EXT_WIFI_FAIL Execute failed. 1767 * @par Dependency: 1768 * @li soc_wifi_api.h: WiFi API 1769 * @see NULL 1770 * @since 1771 */ 1772 int uapi_wifi_sta_disconnect(void); 1773 1774 /** 1775 * @ingroup soc_wifi_basic 1776 * @brief Set reconnect policy.CNcomment:station设置重新连接网络机制.CNend 1777 * 1778 * @par Description: 1779 * Set reconnect policy.CNcomment:station设置重新连接网络机制.CNend 1780 * 1781 * @attention 1. It is recommended called after STA start or connected successfully. 1782 * CNcomment:1. 在STA启动后或者关联成功后调用该接口.CNend\n 1783 * 2. The reconnection policy will be triggered when the station is disconnected from ap.\n 1784 * CNcomment:2. 重连机制将于station下一次去关联时生效,当前已经去关联设置无效.CNend\n 1785 * 3. The Settings will take effect on the next reconnect timer.\n 1786 * CNcomment:3. 重关联过程中更新重关联配置将于下一次重连计时生效.CNend\n 1787 * 4. After calling station connect/disconnect or station stop, stop reconnecting. 1788 * CNcomment:4. 调用station connect/disconnect或station stop,停止重连.CNend\n 1789 * 5. If the target network cannot be found by scanning, 1790 the reconnection policy cannot trigger to take effect.\n 1791 * CNcomment:5. 若扫描不到目标网络,重连机制无法触发生效.CNend\n 1792 * 6. When the <seconds> value is 65535, it means infinite loop reconnection. 1793 * CNcomment:6. <seconds>取值为65535时,表示无限次循环重连.CNend\n 1794 * 7.Enable reconnect, user and lwip will not receive disconnect event when disconnected from ap until 15 1795 * seconds later and still don't reconnect to ap successfully. 1796 * CNcomment:7. 使能自动重连,wifi将在15s内尝试自动重连并在此期间不上报去关联事件到用户和lwip协议栈, 1797 * 做到15秒内重连成功用户和上层网络不感知.CNend\n 1798 * 8.Must call again if add/down/delete SoftAp or MESH's interface status after last call. 1799 * CNcomment:8. 调用后如果添加/禁用/删除了SoftAp,MESH接口的状态,需要再次调用该接口.CNend\n 1800 1801 * @param enable [IN] Type #int enable reconnect.0-disable/1-enable.CNcomment:使能重连网络参数.CNend 1802 * @param seconds [IN] Type #unsigned int reconnect timeout in seconds for once, range:[2-65535]. 1803 * CNcomment:单次重连超时时间,取值[2-65535].CNend 1804 * @param period [IN] Type #unsigned int reconnect period in seconds, range:[1-65535]. 1805 CNcomment:重连间隔周期,取值[1-65535].CNend 1806 * @param max_try_count [IN] Type #unsigned int max reconnect try count number,range:[1-65535]. 1807 CNcomment:最大重连次数,取值[1-65535].CNend 1808 * 1809 * @retval #EXT_WIFI_OK Execute successfully. 1810 * @retval #EXT_WIFI_FAIL Execute failed. 1811 * @par Dependency: 1812 * @li soc_wifi_api.h: WiFi API 1813 * @see NULL 1814 * @since 1815 */ 1816 int uapi_wifi_sta_set_reconnect_policy(int enable, unsigned int seconds, 1817 unsigned int period, unsigned int max_try_count); 1818 1819 /** 1820 * @ingroup soc_wifi_basic 1821 * @brief STA reconnect without deleting the network configuration, only used for WFA tests. 1822 CNcomment:station模式下重新发起关联但不删除network配置信息,仅WFA测试使用.CNend 1823 * 1824 * @par Description: 1825 * STA reconnect without deleting the network configuration, only used for WFA tests. 1826 CNcomment:station模式下重新发起关联但不删除network配置信息,仅WFA测试使用.CNend 1827 * 1828 * @attention 1. It is recommended called after STA connected successfully, Otherwise, it is invalid. 1829 * CNcomment:1. 建议在STA关联成功后调用该接口,否则无效CNend\n 1830 1831 * @retval #EXT_WIFI_OK Execute successfully. 1832 * @retval #EXT_WIFI_FAIL Execute failed. 1833 * @par Dependency: 1834 * @li soc_wifi_api.h: WiFi API 1835 * @see NULL 1836 * @since 1837 */ 1838 int uapi_wifi_sta_reconnect_for_wfa_test(void); 1839 1840 /** 1841 * @ingroup soc_wifi_basic 1842 * @brief Get status of sta.CNcomment:获取station连接的网络状态.CNend 1843 * 1844 * @par Description: 1845 * Get status of sta.CNcomment:获取station连接的网络状态.CNend 1846 * 1847 * @attention NULL 1848 * @param connect_status [IN/OUT] Type #ext_wifi_status *, connect status, memory is requested by the caller. 1849 * CNcomment:连接状态, 由调用者申请内存.CNend 1850 * 1851 * @retval #EXT_WIFI_OK Execute successfully. 1852 * @retval #EXT_WIFI_FAIL Execute failed. 1853 * @par Dependency: 1854 * @li soc_wifi_api.h: WiFi API 1855 * @see NULL 1856 * @since 1857 */ 1858 int uapi_wifi_sta_get_connect_info(ext_wifi_status *connect_status); 1859 1860 /** 1861 * @ingroup soc_wifi_basic 1862 * @brief Start pbc connect in WPS.CNcomment:设置WPS进行pbc连接.CNend 1863 * 1864 * @par Description: 1865 * Start pbc connect in WPS.CNcomment:设置WPS进行pbc连接.CNend 1866 * 1867 * @attention 1. bssid can be NULL or MAC. CNcomment:1. bssid 可以指定mac或者填NULL.CNend 1868 * 2. Bssid length must be 6 bytes.CNcomment:地址长度必须为6字节。CNend \n; 1869 * 1870 * @param bssid [IN] Type #const unsigned char * mac address 1871 * @param bssid_len [IN] Type #unsigned int the length of mac address 1872 * 1873 * @retval #EXT_WIFI_OK Execute successfully. 1874 * @retval #EXT_WIFI_FAIL Execute failed. 1875 * @par Dependency: 1876 * @li soc_wifi_api.h: WiFi API 1877 * @see NULL 1878 * @since 1879 */ 1880 int uapi_wifi_sta_wps_pbc(const unsigned char *bssid, unsigned int bssid_len); 1881 1882 /** 1883 * @ingroup soc_wifi_basic 1884 * @brief Start pin connect in WPS.CNcomment:WPS通过pin码连接网络.CNend 1885 * 1886 * @par Description: 1887 * Start pin connect in WPS.CNcomment:WPS通过pin码连接网络.CNend 1888 * 1889 * @attention 1. Bssid can be NULL or MAC. CNcomment:1. bssid 可以指定mac或者填NULL.CNend \n 1890 * 2. Decimal only WPS pin code length is 8 Bytes.CNcomment:2. WPS中pin码仅限十进制,长度为8 Bytes.CNend 1891 * 3. Bssid length must be 6 bytes.CNcomment:地址长度必须为6字节。CNend \n; 1892 * 1893 * @param pin [IN] Type #const char * pin code 1894 * @param bssid [IN] Type #const unsigned char * mac address 1895 * @param bssid_len [IN] Type #unsinged int the length of mac address 1896 * 1897 * @retval #EXT_WIFI_OK Execute successfully. 1898 * @retval #EXT_WIFI_FAIL Execute failed. 1899 * @par Dependency: 1900 * @li soc_wifi_api.h: WiFi API 1901 * @see NULL 1902 * @since 1903 */ 1904 int uapi_wifi_sta_wps_pin(const char *pin, unsigned int pin_len, const unsigned char *bssid, unsigned int bssid_len); 1905 1906 /** 1907 * @ingroup soc_wifi_basic 1908 * @brief Get pin code.CNcomment:WPS获取pin码.CNend 1909 * 1910 * @par Description: 1911 * Get pin code.CNcomment:WPS获取pin码.CNend 1912 * 1913 * @attention Decimal only WPS pin code length is 8 Bytes.CNcomment:WPS中pin码仅限十进制,长度为8 Bytes.CNend 1914 * @param pin [IN/OUT] Type #char *, pin code buffer, should be obtained, length is 9 Bytes. 1915 * The memory is requested by the caller.\n 1916 * CNcomment:待获取pin码,长度为9 Bytes。由调用者申请内存.CNend 1917 * @param len [IN] Type #unsigned int, length of pin code。CNcomment:pin码的长度.CNend 1918 * 1919 * @retval #EXT_WIFI_OK Execute successfully. 1920 * @retval #EXT_WIFI_FAIL Execute failed. 1921 * @par Dependency: 1922 * @li soc_wifi_api.h: WiFi API 1923 * @see NULL 1924 * @since 1925 */ 1926 int uapi_wifi_sta_wps_pin_get(char *pin, unsigned int len); 1927 1928 /** 1929 * @ingroup soc_wifi_basic 1930 * @brief Get rssi value.CNcomment:获取rssi值.CNend 1931 * 1932 * @par Description: 1933 * Get current rssi of ap which sta connected to.CNcomment:获取sta当前关联的ap的rssi值.CNend 1934 * 1935 * @attention NULL 1936 * @param NULL 1937 * 1938 * @retval #0x7F Invalid value. 1939 * @retval #Other rssi 1940 * @par Dependency: 1941 * @li soc_wifi_api.h: WiFi API 1942 * @see NULL 1943 * @since 1944 */ 1945 int uapi_wifi_sta_get_ap_rssi(void); 1946 1947 /** 1948 * @ingroup soc_wifi_basic 1949 * @brief Get snr value.CNcomment:获取snr值.CNend 1950 * 1951 * @par Description: 1952 * Get current snr of ap which sta connected to.CNcomment:获取sta当前关联的ap的snr值.CNend 1953 * 1954 * @attention NULL 1955 * @param NULL 1956 * 1957 * @retval #Other snr 1958 * @par Dependency: 1959 * @li soc_wifi_api.h: WiFi API 1960 * @see NULL 1961 * @since 1962 */ 1963 int uapi_wifi_sta_get_ap_snr(void); 1964 1965 /** 1966 * @ingroup soc_wifi_basic 1967 * @brief Get info of sta which ap connected to.CNcomment:获取ap连接的sta信息.CNend 1968 * 1969 * @par Description: 1970 * Get current rssi and rate of ap sta which ap connected to.CNcomment:获取ap当前关联的sta的rssi和rate值.CNend 1971 * 1972 * @attention NULL 1973 * @param mac_addr [IN] Type #char, mac address of connected sta. CNcomment:ap连接的sta的mac地址.CNend 1974 * @param rssi [OUT] Type #signed char, signal strength of last packet. CNcomment: ap上一次接收相连的station报文的rssi.CNend 1975 * @param best_rate [OUT] Type #unsigned int, best sending rate. CNcomment: ap与相连的station报文的最佳发送速率.CNend 1976 * 1977 * @retval #EXT_WIFI_OK Execute successfully. 1978 * @retval #EXT_WIFI_FAIL Execute failed. 1979 * @par Dependency: 1980 * @li soc_wifi_api.h: WiFi API 1981 * @see NULL 1982 * @since 1983 */ 1984 td_s32 uapi_wifi_ap_get_sta_info(td_char *mac_addr, td_s8 *rssi, td_u32 *best_rate); 1985 1986 /** 1987 * @ingroup soc_wifi_basic 1988 * @brief Set sta powersave configuration.CNcomment:设置STA的低功耗参数.CNend 1989 * 1990 * @par Description: 1991 * Set sta powersave configuration.CNcomment:设置STA的低功耗参数.CNend 1992 * 1993 * @attention CNcomment:1.参数值越小,功耗越低但性能表现和抗干扰会越差,建议使用默认值或根据流量动态配置.CNend\n 1994 * CNcomment:2.所有参数配置0,表示该参数使用默认值.CNend\n 1995 * CNcomment:3.仅支持设置STA的低功耗参数.CNend\n 1996 * CNcomment:4.需要在关联成功后配置,支持动态配置.CNend\n 1997 * CNcomment:5.定时器首次启动不计数,故实际睡眠时间为配置的重启次数+1乘以周期.CNend\n 1998 * @param timer [IN] Type #unsigned char CNcomment:低功耗定时器周期,默认50ms,取值[0-100]ms.CNend 1999 * @param time_cnt [IN] Type #unsigned char CNcomment:低功耗定时器重启次数,达到该次数后wifi无数据收发则进入休眠, 2000 默认为4,取值[0-10].CNend 2001 * @param bcn_timeout [IN] Type #unsigned char CNcomment:等待接收beacon的超时时间,默认10ms,取值[0-100]ms.CNend 2002 * @param mcast_timeout [IN] Type #unsigned char CNcomment:等待接收组播/广播帧的超时时间,默认30ms,取值[0-100]ms.CNend 2003 * 2004 * @retval #EXT_WIFI_OK Excute successfully 2005 * @retval #Other Error code 2006 * @par Dependency: 2007 * @li soc_wifi_api.h: WiFi API 2008 * @see NULL 2009 * @since 2010 */ 2011 td_s32 uapi_wifi_sta_set_pm_param(td_u8 pm_timeout, td_u8 pm_timer_cnt, td_u8 bcn_timeout, 2012 td_u8 mcast_timeout, td_u16 sleep_time); 2013 2014 /** 2015 * @ingroup soc_wifi_basic 2016 * @brief WPA PSK Calculate.CNcomment:计算WPA PSK.CNend 2017 * 2018 * @par Description: 2019 * PSK Calculate.CNcomment:计算psk.CNend 2020 * 2021 * @attention 1. support only WPA/WPA2 PSK. CNcomment:1. 只支持WPA/WPA2 PSK计算.CNend \n 2022 * 2. SSID only supports ASCII characters. CNcomment:2. SSID 只支持ASCII字符.CNend 2023 * @param psk_config [IN] Type #ext_wifi_sta_psk_config 2024 * @param get_psk [IN/OUT] Type #unsigned char *,Psk to be obtained, length is 32 Bytes. 2025 * The memory is requested by the caller. 2026 * CNcomment:待获取psk,长度为32 Bytes。由调用者申请内存.CNend 2027 * @param psk_len [IN] Type #unsigned int 2028 * @retval #EXT_WIFI_OK Execute successfully. 2029 * @retval #EXT_WIFI_FAIL Execute failed. 2030 * @par Dependency: 2031 * @li soc_wifi_api.h: WiFi API 2032 * @see NULL 2033 * @since 2034 */ 2035 int uapi_wifi_psk_calc(ext_wifi_sta_psk_config psk_config, unsigned char *get_psk, unsigned int psk_len); 2036 2037 /** 2038 * @ingroup soc_wifi_basic 2039 * @brief WPA PSK Calculate,then keep it inside .CNcomment:计算WPA PSK, 并做内部保存.CNend 2040 * 2041 * @par Description: 2042 * psk Calculate.CNcomment:计算psk.CNend 2043 * 2044 * @attention 1. support only WPA/WPA2 PSK. CNcomment:1. 只支持WPA/WPA2 PSK计算.CNend \n 2045 * 2. SSID only supports ASCII characters. CNcomment:2. SSID 只支持ASCII字符.CNend \n 2046 * 3. The cached PSK will be cleared after the first quick connection. \n 2047 * CNcomment:3. PSK缓存将在第一次执行快速连接后清除.CNend 2048 * @param psk_config [IN] Type #ext_wifi_sta_psk_config 2049 * @retval #EXT_WIFI_OK Execute successfully. 2050 * @retval #EXT_WIFI_FAIL Execute failed. 2051 * @par Dependency: 2052 * @li soc_wifi_api.h: WiFi API 2053 * @see NULL 2054 * @since 2055 */ 2056 int uapi_wifi_psk_calc_and_store(ext_wifi_sta_psk_config psk_config); 2057 2058 /** 2059 * @ingroup soc_wifi_basic 2060 * @brief config calling mode of user's callback interface.CNcomment:配置用户回调接口的调用方式.CNend 2061 * 2062 * @par Description: 2063 * config calling mode of user's callback interface.CNcomment:配置用户回调接口的调用方式.CNend 2064 * 2065 * @attention 1. Wpa's task has high priority and call wifi's api directly may be cause error. 2066 CNcomment:1. wpa线程优先级高,直接调用方式下在该回调接口内再次调用某些api会导致线程卡死.CNend 2067 2. If you have create a task in your app, you should use mode:0, or mode:1 is adervised. 2068 CNcomment:2. 上层应用已创建task来处理事件回调建议使用直接调用方式,否则建议使用线程调用方式.CNend 2069 3. Configuration will keep till system reboot, set again when you start a new station. 2070 CNcomment:3. 参数会保持上一次设置值直到系统重启,重新启动station后建议再配置一次.CNend 2071 4. Configuration will work immediately whenever you set. 2072 CNcomment:4. 可随时配置该参数,配置成功即生效.CNend 2073 * @param mode [IN] Type #unsigned char , call mode, 1:direct and 0:create task[default]. 2074 CNcomment:回调调用方式,1:wpa线程直接调用,0:新建一个低优先级线程调用,默认.CNend 2075 * @param task_prio [IN] Type #unsigned char , task priority, range(10-50) . 2076 CNcomment:新建线程优先级,取值范围(10-50).CNend 2077 * @param stack_size [IN] Type #unsigned short , task stack size, more than 1K bytes, default: 2k. 2078 CNcomment:新建线程栈空间,需大于宏LOS_TASK_MIN_STACK_SIZE的大小,默认2k.CNend 2079 * 2080 * @retval #EXT_WIFI_OK Execute successfully. 2081 * @retval #EXT_WIFI_FAIL Execute failed. 2082 * @par Dependency: 2083 * @li soc_wifi_api.h: WiFi API 2084 * @see NULL 2085 * @since 2086 */ 2087 int uapi_wifi_config_callback(unsigned char mode, unsigned char task_prio, unsigned short stack_size); 2088 2089 /** 2090 * @ingroup soc_wifi_basic 2091 * @brief register user callback interface.CNcomment:注册回调函数接口.CNend 2092 * 2093 * @par Description: 2094 * register user callback interface.CNcomment:注册回调函数接口.CNend 2095 * 2096 * @attention NULL 2097 * @param event_cb [OUT] Type #uapi_wifi_event_cb, event callback .CNcomment:回调函数.CNend 2098 * 2099 * @retval #EXT_WIFI_OK Execute successfully. 2100 * @retval #EXT_WIFI_FAIL Execute failed. 2101 * @par Dependency: 2102 * @li soc_wifi_api.h: WiFi API 2103 * @see NULL 2104 * @since 2105 */ 2106 int uapi_wifi_register_event_callback(uapi_wifi_event_cb event_cb); 2107 2108 /** 2109 * @ingroup soc_wifi_basic 2110 * @brief Set softap's beacon interval.CNcomment:设置softap的beacon周期.CNend 2111 * 2112 * @par Description: 2113 * Set softap's beacon interval.CNcomment:设置softap的beacon周期.CNend \n 2114 * Initialized config sets before interface starts.CNcomment:初始配置softap启动之前调用.CNend 2115 * 2116 * @attention NULL 2117 * @param beacon_period [IN] Type #int beacon period in milliseconds, range(33ms~1000ms), default(100ms) 2118 * 2119 * @retval #EXT_WIFI_OK Execute successfully. 2120 * @retval #EXT_WIFI_FAIL Execute failed. 2121 * @par Dependency: 2122 * @li soc_wifi_api.h: WiFi API 2123 * @see NULL 2124 * @since 2125 */ 2126 int uapi_wifi_softap_set_beacon_period(int beacon_period); 2127 2128 /** 2129 * @ingroup soc_wifi_basic 2130 * @brief Set softap's dtim count.CNcomment:设置softap的dtim周期.CNend 2131 * 2132 * @par Description: 2133 * Set softap's dtim count.CNcomment:设置softap的dtim周期.CNend \n 2134 * Initialized config sets before interface starts.CNcomment:初始配置softap启动之前调用.CNend 2135 * 2136 * @attention NULL 2137 * @param dtim_period [IN] Type #int, dtim period , range(1~30), default(2) 2138 * 2139 * @retval #EXT_WIFI_OK Execute successfully. 2140 * @retval #EXT_WIFI_FAIL Execute failed. 2141 * @par Dependency: 2142 * @li soc_wifi_api.h: WiFi API 2143 * @see NULL 2144 * @since 2145 */ 2146 int uapi_wifi_softap_set_dtim_period(int dtim_period); 2147 2148 /** 2149 * @ingroup soc_wifi_basic 2150 * @brief Set update time of softap's group key.CNcomment:配置softap组播秘钥更新时间.CNend 2151 * 2152 * @par Description: 2153 * Set update time of softap's group key.CNcomment:配置softap组播秘钥更新时间.CNend\n 2154 * Initialized config sets before interface starts.CNcomment:初始配置softap启动之前调用.CNend\n 2155 * 2156 * @param wifi_group_rekey [IN] Type #int, update time in seconds, range(30s-86400s), default(86400s) 2157 * CNcomment:更新时间以秒为单位,范围(30s-86400s),默认(86400s).CNend 2158 * 2159 * @retval #EXT_WIFI_OK Execute successfully. 2160 * @retval #EXT_WIFI_FAIL Execute failed. 2161 * @par Dependency: 2162 * @li soc_wifi_api.h: WiFi API 2163 * @see NULL 2164 * @since 2165 */ 2166 int uapi_wifi_softap_set_group_rekey(int wifi_group_rekey); 2167 2168 /** 2169 * @ingroup soc_wifi_basic 2170 * @brief Set short-gi of softap.CNcomment:设置softap的SHORT-GI功能.CNend 2171 * 2172 * @par Description: 2173 * Enable or disable short-gi of softap.CNcomment:开启或则关闭softap的SHORT-GI功能.CNend\n 2174 * Initialized config sets before interface starts.CNcomment:初始配置softap启动之前调用.CNend 2175 * @attention NULL 2176 * @param flag [IN] Type #int, enable(1) or disable(0). default enable(1). 2177 CNcomment:使能标志,默认使能(1).CNend 2178 * 2179 * @retval #EXT_WIFI_OK Execute successfully. 2180 * @retval #EXT_WIFI_FAIL Execute failed. 2181 * @par Dependency: 2182 * @li soc_wifi_api.h: WiFi API 2183 * @see NULL 2184 * @since 2185 */ 2186 int uapi_wifi_softap_set_shortgi(int flag); 2187 2188 /** 2189 * @ingroup soc_wifi_basic 2190 * @brief Start softap interface.CNcomment:开启SoftAP.CNend 2191 * 2192 * @par Description: 2193 * Start softap interface.CNcomment:开启SoftAP.CNend 2194 * 2195 * @attention 1. Multiple interfaces of the same type are not supported.CNcomment:不支持使用多个同类型接口.CNend\n 2196 * 2. Dual interface coexistence support: STA + AP. CNcomment:双接口共存支持:STA + AP.CNend \n 2197 * 3. Start timeout 5s.CNcomment:启动超时时间5s。CNend \n 2198 * 4. Softap key length range(8 Bytes - 64 Bytes).CNcomment:softap key长度范围(8 Bytes - 64 Bytes).CNend \n 2199 * 5. Only support auth mode as bellow: \n 2200 * EXT_WIFI_SECURITY_WPAPSK_WPA2PSK_MIX, \n 2201 * EXT_WIFI_SECURITY_WPA2PSK, \n 2202 * EXT_WIFI_SECURITY_OPEN, \n 2203 * EXT_WIFI_SECURITY_SAE, \n 2204 * EXT_WIFI_SECURITY_WPA3_WPA2_PSK_MIX \n 2205 * CNcomment:5. 只支持以下认证模式:\n 2206 * EXT_WIFI_SECURITY_WPAPSK_WPA2PSK_MIX, \n 2207 * EXT_WIFI_SECURITY_WPA2PSK, \n 2208 * EXT_WIFI_SECURITY_OPEN.CNend \n 2209 * EXT_WIFI_SECURITY_SAE.CNend \n 2210 * EXT_WIFI_SECURITY_WPA3_WPA2_PSK_MIX.CNend \n 2211 * 6. The memories of <ifname> and <len> should be requested by the caller, 2212 * the input value of len must be the same as the length of ifname 2213 * (The minimum length is 4 bytes and the recommended length is 17 bytes).\n 2214 * CNcomment:3. <ifname>和<len>由调用者申请内存,用户写入len的值必须与ifname长度一致。 2215 * (最小长度是4字节,建议长度为17Bytes).CNend\n 2216 * 7. SSID only supports ASCII characters. 2217 * CNcomment:7. SSID 只支持ASCII字符.CNend \n 2218 * 8. This is a blocking function.CNcomment:8.此函数为阻塞函数.CNend \n 2219 * 9. In WPA2 / WPA3 mode, the encryption method is CCMP.CNcomment:9.WPA2/WPA3混合模式下加密方式为CCMP.CNend\n 2220 * 10. The PMF of WPA3 is REQUIRE, and the PMF of WPA2/WPA3 is OPTIONAL. 2221 * CNcomment:10.WPA3的PMF为强制,WPA2/WPA3的PMF为可选.CNend \n 2222 * 11. The PMKID connection is supported. The PMKID is stored in the memory for 12 hours. 2223 * CNcomment:11.支持PMKID连接,PMKID保存时间为12小时CNend 2224 * @param conf [IN] Type #ext_wifi_softap_config *, softap's configuration.CNcomment:SoftAP配置.CNend 2225 * @param ifname [IN/OUT] Type #char *, interface name.CNcomment:接口名字.CNend 2226 * @param len [IN/OUT] Type #int *, interface name length.CNcomment:接口名字长度.CNend 2227 * 2228 * @retval #EXT_WIFI_OK Execute successfully. 2229 * @retval #EXT_WIFI_FAIL Execute failed. 2230 * @par Dependency: 2231 * @li soc_wifi_api.h: WiFi API 2232 * @see NULL 2233 * @since 2234 */ 2235 int uapi_wifi_softap_start(ext_wifi_softap_config *conf, char *ifname, int *len); 2236 2237 /** 2238 * @ingroup soc_wifi_basic 2239 * @brief Close softap interface.CNcomment:关闭SoftAP.CNend 2240 * 2241 * @par Description: 2242 * Close softap interface.CNcomment:关闭SoftAP.CNend 2243 * 2244 * @attention 1. This is a blocking function.CNcomment:1.此函数为阻塞函数.CNend 2245 * @param NULL 2246 * 2247 * @retval #EXT_WIFI_OK Execute successfully. 2248 * @retval #EXT_WIFI_FAIL Execute failed. 2249 * @par Dependency: 2250 * @li soc_wifi_api.h: WiFi API 2251 * @see NULL 2252 * @since 2253 */ 2254 int uapi_wifi_softap_stop(void); 2255 2256 /** 2257 * @ingroup soc_wifi_basic 2258 * @brief Get all user's information of softap.CNcomment:softap获取已连接的station的信息.CNend 2259 * 2260 * @par Description: 2261 * Get all user's information of softap.CNcomment:softap获取已连接的station的信息.CNend 2262 * 2263 * @attention 1.sta_list: malloc by user.CNcomment:1.扫描结果参数。由用户动态申请。CNend \n 2264 * 2.sta_list: max size is ext_wifi_ap_sta_info * 6. 2265 * CNcomment:2.sta_list 足够的结构体大小,最大为ext_wifi_ap_sta_info * 6。CNend \n 2266 * 3.sta_num:parameters can be passed in to specify the number of connected sta.The maximum is 6. 2267 * CNcomment:3.可以传入参数,指定获取已接入的sta个数,最大为6。CNend \n 2268 * 4.sta_num should be the same with number of ext_wifi_ap_sta_info structures applied, Otherwise, 2269 * it will cause memory overflow.\n 2270 * CNcomment:4.sta_num和申请的ext_wifi_ap_sta_info结构体数量一致,否则可能造成内存溢出。CNend \n 2271 * 5.Only the sta that are successfully associated are displayed. 2272 * CNcomment:5.只显示关联成功的sta。CNend 2273 * @param sta_list [IN/OUT] Type #ext_wifi_ap_sta_info *, station information.CNcomment:STA信息.CNend 2274 * @param sta_num [IN/OUT] Type #unsigned int *, station number.CNcomment:STA个数.CNend 2275 * 2276 * @retval #EXT_WIFI_OK Execute successfully. 2277 * @retval #EXT_WIFI_FAIL Execute failed. 2278 * @par Dependency: 2279 * @li soc_wifi_api.h: WiFi API 2280 * @see NULL 2281 * @since 2282 */ 2283 int uapi_wifi_softap_get_connected_sta(ext_wifi_ap_sta_info *sta_list, unsigned int *sta_num); 2284 2285 /** 2286 * @ingroup soc_wifi_basic 2287 * @brief Softap deauth user by mac address.CNcomment:softap指定断开连接的station网络.CNend 2288 * 2289 * @par Description: 2290 * Softap deauth user by mac address.CNcomment:softap指定断开连接的station网络.CNend 2291 * 2292 * @attention Address length must be 6 bytes.CNcomment:地址长度必须为6字节。CNend \n; 2293 * 2294 * @param addr [IN] Type #const unsigned char *, station mac address.CNcomment:MAC地址.CNend 2295 * @param addr_len [IN] Type #unsigned char, station mac address length, must be 6. 2296 * CNcomment:MAC地址长度,必须为6.CNend 2297 * 2298 * @retval #EXT_WIFI_OK Execute successfully. 2299 * @retval #EXT_WIFI_FAIL Execute failed. 2300 * @par Dependency: 2301 * @li soc_wifi_api.h: WiFi API 2302 * @see NULL 2303 * @since 2304 */ 2305 int uapi_wifi_softap_deauth_sta(const unsigned char *addr, unsigned char addr_len); 2306 2307 /** 2308 * @ingroup soc_wifi_basic 2309 * @brief Set softap pairwise.CNcomment:设置pairwise.CNend 2310 * 2311 * @par Description: 2312 * Set softap pairwise, from bit 1 to bit 14.CNcomment:设置pairwise,取值为bit 1到bit 14.CNend 2313 * 2314 * @attention NULL 2315 * 2316 * @param pairwise [IN] Type #int, softap pairwise.CNcomment:softap pairwise.CNend 2317 * 2318 * @retval #EXT_WIFI_OK Execute successfully. 2319 * @retval #EXT_WIFI_FAIL Execute failed. 2320 * @par Dependency: 2321 * @li soc_wifi_api.h: WiFi API 2322 * @see NULL 2323 * @since 2324 */ 2325 int uapi_wifi_softap_set_pairwise(int pairwise); 2326 2327 /** 2328 * @ingroup soc_wifi_basic 2329 * @brief Set country code.CNcomment:设置国家码.CNend 2330 * 2331 * @par Description: 2332 * Set country code(two uppercases).CNcomment:设置国家码,由两个大写字符组成.CNend 2333 * 2334 * @attention 1.Before setting the country code, you must call uapi_wifi_init to complete the initialization. 2335 * CNcomment:设置国家码之前,必须调用uapi_wifi_init初始化完成.CNend\n 2336 * 2.cc_len should be greater than or equal to 3.CNcomment:cc_len应大于等于3.CNend 2337 * @param cc [IN] Type #const char *, country code.CNcomment:国家码.CNend 2338 * @param cc_len [IN] Type #unsigned char, country code length.CNcomment:国家码长度.CNend 2339 * 2340 * @retval #EXT_WIFI_OK Excute successfully 2341 * @retval #Other Error code 2342 * @par Dependency: 2343 * @li soc_wifi_api.h: WiFi API 2344 * @see NULL 2345 * @since 2346 */ 2347 td_s32 uapi_wifi_set_country(const td_char *cc, td_u8 cc_len); 2348 2349 /** 2350 * @ingroup soc_wifi_basic 2351 * @brief Get country code.CNcomment:获取国家码.CNend 2352 * 2353 * @par Description: 2354 * Get country code.CNcomment:获取国家码,由两个大写字符组成.CNend 2355 * 2356 * @attention 1.Before getting the country code, you must call uapi_wifi_init to complete the initialization. 2357 * CNcomment:获取国家码之前,必须调用uapi_wifi_init初始化完成.CNend 2358 * @param cc [OUT] Type #char *, country code.CNcomment:国家码.CNend 2359 * @param len [IN/OUT] Type #int *, country code length.CNcomment:国家码长度.CNend 2360 * 2361 * @retval #EXT_WIFI_OK Excute successfully 2362 * @retval #Other Error code 2363 * @par Dependency: 2364 * @li soc_wifi_api.h: WiFi API 2365 * @see NULL 2366 * @since 2367 */ 2368 td_s32 uapi_wifi_get_country(td_char *cc, td_u8 *len); 2369 2370 /** 2371 * @ingroup soc_wifi_basic 2372 * @brief Set bandwidth.CNcomment:设置带宽.CNend 2373 * 2374 * @par Description: 2375 * Set bandwidth, support 5M/10M/20M.CNcomment:设置接口的工作带宽,支持5M 10M 20M带宽的设置.CNend 2376 * 2377 * @attention NULL 2378 * @param ifname [IN] Type #const char *, interface name.CNcomment:接口名.CNend 2379 * @param ifname_len [IN] Type #unsigned char, interface name length.CNcomment:接口名长度.CNend 2380 * @param bw [IN] Type #ext_wifi_bw, bandwidth enum.CNcomment:带宽.CNend 2381 * 2382 * @retval #EXT_WIFI_OK Excute successfully 2383 * @retval #Other Error code 2384 * @par Dependency: 2385 * @li soc_wifi_api.h: WiFi API 2386 * @see NULL 2387 * @since 2388 */ 2389 td_s32 uapi_wifi_set_bandwidth(const td_char *ifname, td_u8 ifname_len, ext_wifi_bw bw); 2390 2391 /** 2392 * @ingroup soc_wifi_basic 2393 * @brief Get bandwidth.CNcomment:获取带宽.CNend 2394 * 2395 * @par Description: 2396 * Get bandwidth.CNcomment:获取带宽.CNend 2397 * 2398 * @attention NULL 2399 * @param ifname [IN] Type #const char *, interface name.CNcomment:接口名.CNend 2400 * @param ifname_len [IN] Type #unsigned char, interface name length.CNcomment:接口名长度.CNend 2401 * 2402 * @retval #bandwidth enum.CNcomment:带宽的枚举值.CNend 2403 * @par Dependency: 2404 * @li soc_wifi_api.h: WiFi API 2405 * @see NULL 2406 * @since 2407 */ 2408 ext_wifi_bw uapi_wifi_get_bandwidth(const td_char *ifname, td_u8 ifname_len); 2409 2410 /** 2411 * @ingroup soc_wifi_basic 2412 * @brief Set channel.CNcomment:设置信道.CNend 2413 * 2414 * @par Description: 2415 * Set channel.CNcomment:设置信道.CNend 2416 * 2417 * @attention NULL 2418 * @param ifname [IN] Type #const char *, interface name.CNcomment:接口名.CNend 2419 * @param ifname_len [IN] Type #unsigned char, interface name length.CNcomment:接口名长度.CNend 2420 * @param channel [IN] Type #int , listen channel.CNcomment:信道号.CNend 2421 * 2422 * @retval #EXT_WIFI_OK Excute successfully 2423 * @retval #Other Error code 2424 * @par Dependency: 2425 * @li soc_wifi_api.h: WiFi API 2426 * @see NULL 2427 * @since 2428 */ 2429 td_s32 uapi_wifi_set_channel(const td_char *ifname, td_u8 ifname_len, td_s32 channel); 2430 2431 /** 2432 * @ingroup soc_wifi_basic 2433 * @brief Get channel.CNcomment:获取信道.CNend 2434 * 2435 * @par Description: 2436 * Get channel.CNcomment:获取信道.CNend 2437 * 2438 * @attention NULL 2439 * @param ifname [IN] Type #const char *, interface name.CNcomment:接口名.CNend 2440 * @param ifname_len [IN] Type #unsigned char, interface name length.CNcomment:接口名长度.CNend 2441 * 2442 * @retval #EXT_WIFI_INVALID_CHANNEL 2443 * @retval #Other chanel value. 2444 * @par Dependency: 2445 * @li soc_wifi_api.h: WiFi API 2446 * @see NULL 2447 * @since 2448 */ 2449 td_s32 uapi_wifi_get_channel(const td_char *ifname, td_u8 ifname_len); 2450 2451 /** 2452 * @ingroup soc_wifi_basic 2453 * @brief Set scan.param.CNcomment:设置扫描参数.CNend 2454 * 2455 * @par Description: 2456 * Set scan_param, support the largest scan_cnt is 10, support the largest scan_time is 120, 2457 * support the largest scan_channel_interval is 6, support the largest work_time_on_home_channel is 120. 2458 * CNcomment:设置扫描参数,支持最大扫描次数为10,支持最长驻留时间为120, 2459 * 支持最多间隔6信道返回工作信道工作,支持背景扫描时,返回工作信道工作的最长时间为120.CNend 2460 * 2461 * @attention 1.Set scan_param before starting the scan. 2462 * CNcomment:扫描参数需在扫描之前设置. 2463 * 2.Restart can restore default scan_param. 2464 * CNcomment:关闭STA/AP命令再启动STA/AP可以恢复默认值. 2465 * 3.Valid default_enable:0B0000~0B1111. 2466 * WIFI_SCAN_CNT_DEFAULT_ENABLE: enable scan_cnt default. 2467 * WIFI_SCAN_TIME_DEFAULT_ENABLE: enable scan_time default. 2468 * WIFI_SCAN_CHANNEL_INTERVAL_DEFAULT_ENABLE: enable scan_channel_interval default. 2469 * WIFI_WORK_TIME_ON_HOME_CHANNEL_DEFAULT_ENABLE: enable work_time_on_home_channel default. 2470 * CNcomment:表示使用默认值使能. 2471 * WIFI_SCAN_CNT_DEFAULT_ENABLE: 表示使能scan_cnt的默认值. 2472 * WIFI_SCAN_TIME_DEFAULT_ENABLE: 表示使能scan_time的默认值. 2473 * WIFI_SCAN_CHANNEL_INTERVAL_DEFAULT_ENABLE: 表示使能scan_channel_interval的默认值. 2474 * WIFI_WORK_TIME_ON_HOME_CHANNEL_DEFAULT_ENABLE: 表示使能work_time_on_home_channel的默认值. 2475 * 4.Valid scan_cnt:0,1~10. Default scan_cnt is 2. 0 indicates default value. 2476 * CNcomment:有效扫描次数为1~10.默认扫描次数为2,0表示默认值. 2477 * 5.Valid scan_time:0,20~120. Default scan_time is 20. 0 indicates default value. 2478 * CNcomment:有效驻留时间为20~120.默认扫描驻留时间为20,0表示默认值. 2479 * 6.Valid scan_channel_interval:0,1~6. Default scan_channel_interval is 6.0 indicates default value. 2480 * CNcomment:设置间隔n个信道返回工作信道工作一段时间,有效范围为1~6,默认为6,0表示默认值. 2481 * 7.Valid work_time_on_home_channel:0,30~120. 2482 * Default work_time_on_home_channel is 110.0 indicates default value. 2483 * CNcomment:设置背景扫描时,返回工作信道工作的时间,有效范围为30~120,默认为110,0表示默认值. 2484 * 8.If scan_cnt does not enable the default value, and scan_cnt is equal to 0, 2485 * it means that scan_cnt uses the most recently set value. Same for other scan parameters. 2486 * CNcomment:如果scan cnt不使能默认值,同时scan cnt等于0,则表示scan_cnt使用最近设置的值. 其他扫描参数同理. 2487 * 9.If scan_cnt enables the default value, and scan_cnt is equal to 0, 2488 * it means that scan_cnt uses default value. Same for other scan parameters. 2489 * CNcomment:如果scan cnt使能默认值,同时scan cnt等于0,则表示scan_cnt使用默认值. 其他扫描参数同理. 2490 * 10.If the value of scan_cnt is set to a non-zero value,regardless of whether the default value is enabled, 2491 * it is set to a non-zero value. Same for other scan parameters. 2492 * CNcomment:如果scan_cnt的值设置为非零值,无论是否启用默认值,都设置为非零值. 其他扫描参数同理. 2493 * 11.Total scan time: foreground scan time = scan_cnt * scan_time * scan_channel_num, 2494 * background scan time = foreground scan time + (scan_channel_num / scan_channel_interval) * 2495 * work_time_on_home_channel 2496 * CNcomment:扫描时间:前景扫描时间 = 扫描次数 * 扫描驻留时间 * 扫描信道个数, 2497 * 背景扫描时间 = 前景扫描时间 + (扫描信道个数 / n信道间隔) * 工作信道工作时间 2498 * 12.Total scan time must less than 4.5s. 2499 * CNcomment:扫描时间需要小于4.5s 2500 * 2501 * 2502 * @param ifname [IN] Type #const char *, interface name.CNcomment:接口名.CNend 2503 * @param scan_param [IN] Type #ext_wifi_scan_param_stru *scan_param:扫描参数结构体.CNend 2504 * 2505 * @retval #EXT_WIFI_OK Excute successfully 2506 * @retval #Other Error code 2507 * @par Dependency: 2508 * @li soc_wifi_api.h: WiFi API 2509 * @see NULL 2510 */ 2511 int uapi_wifi_set_scan_param(const td_char *ifname, ext_wifi_scan_param_stru *scan_param); 2512 2513 /** 2514 * @ingroup soc_wifi_basic 2515 * @brief Set monitor mode.CNcomment:设置混杂模式.CNend 2516 * 2517 * @par Description: 2518 * Enable/disable monitor mode of interface.CNcomment:设置指定接口的混杂模式使能.CNend 2519 * 2520 * @attention NULL 2521 * @param ifname [IN] Type #const char * interface name.CNcomment:接口名.CNend 2522 * @param enable [IN] Type #int enable(1) or disable(0).CNcomment:开启/关闭.CNend 2523 * @param filter [IN] Type #const wifi_ptype_filter_stru * filtered frame type enum.CNcomment:过滤列表.CNend 2524 * 2525 * @retval #EXT_WIFI_OK Excute successfully 2526 * @retval #Other Error code 2527 * @par Dependency: 2528 * @li soc_wifi_api.h: WiFi API 2529 * @see NULL 2530 * @since 2531 */ 2532 osal_s32 uapi_wifi_promis_enable(const osal_char *ifname, osal_s32 enable, const ext_wifi_ptype_filter_stru *filter); 2533 2534 /** 2535 * @ingroup soc_wifi_basic 2536 * @brief Set wifi aware enable.CNcomment:设置wifi aware使能.CNend 2537 * 2538 * @par Description: 2539 * Enable/disable wifi aware of interface.CNcomment:设置指定接口的wifi aware使能.CNend 2540 * 2541 * @attention NULL 2542 * @param ifname [IN] Type #const char * interface name.CNcomment:接口名.CNend 2543 * @param enable [IN] Type #int enable(1) or disable(2).CNcomment:开启/关闭.CNend 2544 * @param ratio [IN] Type #int ratio(1-9) channel switching percentage.CNcomment:信道切换百分比.CNend 2545 * 2546 * @retval #EXT_WIFI_OK Excute successfully 2547 * @retval #Other Error code 2548 * @par Dependency: 2549 * @li soc_wifi_api.h: WiFi API 2550 * @see NULL 2551 * @since 2552 */ 2553 int uapi_wifi_sdp_enable(const osal_char *ifname, osal_s32 enable, osal_s32 ratio); 2554 2555 /** 2556 * @ingroup soc_wifi_basic 2557 * @brief Set wifi aware subscribe.CNcomment:设置wifi aware订阅.CNend 2558 * 2559 * @par Description: 2560 * Enable/disable wifi aware subscribe of interface.CNcomment:设置指定接口的wifi aware订阅.CNend 2561 * 2562 * @attention NULL 2563 * @param ifname [IN] Type #const char * interface name.CNcomment:接口名.CNend 2564 * @param sdp_subscribe [IN] Type #char * Subscription Service Account.CNcomment:订阅服务号.CNend 2565 * @param local_handle [IN] Type #int local_handle local service number.CNcomment:本机服务号.CNend 2566 * 2567 * @retval #EXT_WIFI_OK Excute successfully 2568 * @retval #Other Error code 2569 * @par Dependency: 2570 * @li soc_wifi_api.h: WiFi API 2571 * @see NULL 2572 * @since 2573 */ 2574 int uapi_wifi_sdp_subscribe(const osal_char *ifname, osal_char *sdp_subscribe, osal_s32 local_handle); 2575 2576 /** 2577 * @ingroup soc_wifi_basic 2578 * @brief Register receive callback in monitor mode.CNcomment:注册混杂模式的收包回调函数.CNend 2579 * 2580 * @par Description: 2581 * 1.Register receive callback in monitor mode.CNcomment:1.注册混杂模式的收包回调函数.CNend\n 2582 * 2.Wifi driver will put the receive frames to this callback. 2583 * CNcomment:2.驱动将混杂模式的收到的报文递交到注册的回调函数处理.CNend 2584 * 2585 * @attention NULL 2586 * @param data_cb [IN] Type #wifi_promis_cb callback function pointer.CNcomment:混杂模式回调函数.CNend 2587 * 2588 * @retval #EXT_WIFI_OK Excute successfully 2589 * @retval #Other Error code 2590 * @par Dependency: 2591 * @li soc_wifi_api.h: WiFi API 2592 * @see NULL 2593 * @since 2594 */ 2595 int uapi_wifi_promis_set_rx_callback(wifi_promis_cb data_cb); 2596 2597 /** 2598 * @ingroup soc_wifi_basic 2599 * @brief Open/close system power save.CNcomment:开启/关闭WiFi低功耗模式并配置预期休眠时间.CNend 2600 * 2601 * @par Description: 2602 * Open/close system power save.CNcomment:开启/关闭WiFi低功耗模式并配置预期休眠时间.CNend 2603 * 2604 * @attention NULL 2605 * @param enable [IN] Type #unsigned char, enable(1) or disable(0).CNcomment:开启/关闭WiFi低功耗.CNend 2606 * @param sleep_time [IN] Type #unsigned int, expected sleep time(uint: ms). CNcomment:预期休眠时间(单位: 毫秒), 2607 * 参考有效范围33ms~4000ms, 准确的时间根据dtim*beacon和sleep_time值计算, 2608 * 关闭低功耗或者不配置有效休眠时间时需要将sleep_time配置为0(休眠时间由关联的ap决定).CNend 2609 * 2610 * @retval #EXT_WIFI_OK Excute successfully 2611 * @retval #Other Error code 2612 * @par Dependency: 2613 * @li soc_wifi_api.h: WiFi API 2614 * @see NULL 2615 * @since 2616 */ 2617 td_s32 uapi_wifi_set_pm_switch(td_u8 enable, td_u32 sleep_time); 2618 2619 /** 2620 * @ingroup hi_wifi_basic 2621 * @brief Set Linkloss paras.CNcomment:设置Linkloss的参数.CNend 2622 * 2623 * @par Description: 2624 * Set Linkloss paras.CNcomment:设置Linkloss的参数.CNend 2625 * 2626 * @attention NULL 2627 * @param probe_request_ratio [IN] Type #unsigned char, 1~10 linkloss cnt reach N/10 to send probe requeset. 2628 * CNcomment:开始发送probe request帧时的linkloss时间比例(N/10), 2629 * 如5,即在一半linkloss时间时开始发送单播probe request帧保活.CNend 2630 * @param linkloss_threshold [IN] Type #unsigned int, 100~1000 linkloss time(uint: 100ms). 2631 * CNcomment:linkloss老化基础时间(单位: 100毫秒,100), 2632 * 参考有效范围100~1000, 对应实际基础老化时间为10s~100s,会根据当前运行状态 2633 * (是否低功耗,是否DBAC等等)进行调整,所设置时间不一定是最终老化时间.CNend 2634 * 2635 * @retval #EXT_ERR_SUCCESS Excute successfully 2636 * @retval #Other Error code 2637 * @par Dependency: 2638 * @li hi_wifi_api.h: WiFi API 2639 * @see NULL 2640 * @since 2641 */ 2642 osal_s32 uapi_wifi_set_linkloss_paras(osal_u8 probe_request_ratio, osal_u16 linkloss_threshold); 2643 2644 2645 /** 2646 * @ingroup soc_wifi_basic 2647 * @brief Set arp offload on/off.CNcomment:设置arp offload 打开/关闭.CNend 2648 * 2649 * @par Description: 2650 * Set arp offload on with ip address, or set arp offload off. 2651 * CNcomment:设置arp offload打开、并且设置相应ip地址,或者设置arp offload关闭.CNend 2652 * 2653 * @attention NULL 2654 * @param ifname [IN] Type #const char *, device name. 2655 * @param en [IN] Type #unsigned char, arp offload type, 1-on, 0-off. 2656 * @param ip [IN] Type #unsigned int, ip address in network byte order, eg:192.168.50.4 -> 0x0432A8C0. 2657 * 2658 * @retval #EXT_WIFI_OK Excute successfully 2659 * @retval #Other Error code 2660 * @par Dependency: 2661 * @li soc_wifi_api.h: WiFi API 2662 * @see NULL 2663 * @since 2664 */ 2665 unsigned char uapi_wifi_arp_offload_setting(const char *ifname, unsigned char en, unsigned int ip); 2666 2667 /** 2668 * @ingroup soc_wifi_basic 2669 * @brief Set nd offload on/off.CNcomment:设置nd offload 打开/关闭.CNend 2670 * 2671 * @par Description: 2672 * Set nd offload on with ipv6 address, or set nd offload off. 2673 * CNcomment:设置nd offload打开、设置正确的解析后的ipv6地址,或设置nd offload关闭.CNend 2674 * 2675 * @attention NULL 2676 * @param ifname [IN] Type #const char *, device name. 2677 * @param en [IN] Type #unsigned char, nd offload type, 1-on, 0-off. 2678 * @param ip6 [IN] Type #unsigned char *, ipv6 address after parsing. 2679 * eg:FE80::F011:31FF:FEE8:DB6E -> 0xfe80000000f01131fffee8db6e 2680 * 2681 * @retval #EXT_WIFI_OK Excute successfully 2682 * @retval #Other Error code 2683 * @par Dependency: 2684 * @li soc_wifi_api.h: WiFi API 2685 * @see NULL 2686 * @since 2687 */ 2688 unsigned int uapi_wifi_nd_offload_setting(const char *ifname, unsigned char en, unsigned char *ip6); 2689 2690 /** 2691 * @ingroup soc_wifi_basic 2692 * @brief Set tx power.CNcomment:设置发送功率上限.CNend 2693 * 2694 * @par Description: 2695 * Set maximum tx power.CNcomment:设置指定接口的发送功率上限.CNend 2696 * 2697 * @attention 1/only softAP can set maximum tx power.CNcomment:只有AP可以设置最大发送功率.CNend 2698 * 2/should start softAP before set tx power.CNcomment:只有在AP start之后才可以设置.CNend 2699 * @param ifname [IN] Type #const char * interface name. 2700 * @param power [IN] Type #int maximum tx power value, range (0-23]dBm. 2701 * 2702 * @retval #EXT_WIFI_OK Excute successfully 2703 * @retval #Other Error code 2704 * @par Dependency: 2705 * @li soc_wifi_api.h: WiFi API 2706 * @see NULL 2707 * @since 2708 */ 2709 td_s32 uapi_wifi_set_txpower_up_limit(const td_char *ifname, td_s32 power); 2710 2711 /** 2712 * @ingroup soc_wifi_basic 2713 * @brief Get tx power.CNcomment:获取发送功率上限.CNend 2714 * 2715 * @par Description: 2716 * Get maximum tx power setting.CNcomment:获取接口的最大发送功率限制值.CNend 2717 * 2718 * @attention NULL 2719 * @param ifname [IN] Type #const char * interface name. 2720 * 2721 * @retval #tx power value. 2722 * @par Dependency: 2723 * @li soc_wifi_api.h: WiFi API 2724 * @see NULL 2725 * @since 2726 */ 2727 td_s32 uapi_wifi_get_txpower_up_limit(const td_char *ifname); 2728 2729 /** 2730 * @ingroup soc_wifi_basic 2731 * @brief Set retry params.CNcomment:设置软件重传策略.CNend 2732 * 2733 * @par Description: 2734 * Set retry params.CNcomment:设置指定接口的软件重传策略.CNend 2735 * 2736 * @attention 1.Need call befora start sta or softap.CNcomment:1.本API需要在STA或AP start之后调用.CNend 2737 * @param ifname [IN] Type #const char * interface name.CNcomment:接口名.CNend 2738 * @param type [IN] Type #unsigned char retry type. 2739 * CNcomment:0:次数重传(数据帧); 1:次数重传(管理帧); 2:时间重传.CNend 2740 * @param limit [IN] Type #unsigned char limit value. 2741 * CNcomment:重传次数(0~15次)/重传时间(0~200个时间粒度,时间粒度10ms).CNend 2742 * 2743 * @retval #EXT_WIFI_OK Excute successfully 2744 * @retval #Other Error code 2745 * @par Dependency: 2746 * @li soc_wifi_api.h: WiFi API 2747 * @see NULL 2748 * @since 2749 */ 2750 td_u32 uapi_wifi_set_retry_params(const td_char *ifname, td_u8 type, td_u8 limit); 2751 2752 /** 2753 * @ingroup soc_wifi_basic 2754 * @brief Set cca threshold.CNcomment:设置CCA门限.CNend 2755 * 2756 * @par Description: 2757 * Set cca threshold.CNcomment:设置CCA门限.CNend 2758 * 2759 * @attention CNcomment:1.threshold设置范围是-128~126时,阈值固定为设置值.CNend\n 2760 * CNcomment:2.threshold设置值为127时,恢复默认阈值-62dBm,并使能动态调整.CNend 2761 * @param ifname [IN] Type #const char *, device name. CNcomment:接口名.CNend 2762 * @param threshold [IN] Type #char, threshold. CNcomment:门限值.CNend 2763 * 2764 * @retval #EXT_WIFI_OK Excute successfully 2765 * @retval #Other Error code 2766 * 2767 * @par Dependency: 2768 * @li soc_wifi_api.h: WiFi API 2769 * @see NULL 2770 * @since 2771 */ 2772 td_u32 uapi_wifi_set_cca_threshold(td_u8 mode, td_s8 threshold); 2773 2774 /** 2775 * @ingroup soc_wifi_basic 2776 * @brief Set tx power offset.CNcomment:设置发送功率偏移.CNend 2777 * 2778 * @par Description: 2779 * Set tx power offset.CNcomment:设置发送功率偏移.CNend 2780 * 2781 * @attention CNcomment:1.offset设置范围是-100~40,单位0.1dB.参数超出范围按最接近的边界值设置CNend\n 2782 * CNcomment:2.offset设置,可能会影响信道功率平坦度和evm.CNend 2783 * @param ifname [IN] Type #const char *, device name. CNcomment:接口名.CNend 2784 * @param offset [IN] Type #signed short, offset. CNcomment:门限值.CNend 2785 * 2786 * @retval #EXT_WIFI_OK Excute successfully 2787 * @retval #Other Error code 2788 * 2789 * @par Dependency: 2790 * @li soc_wifi_api.h: WiFi API 2791 * @see NULL 2792 * @since 2793 */ 2794 td_u32 uapi_wifi_set_tx_pwr_offset(const td_char *ifname, td_s16 offset); 2795 2796 /** 2797 * @ingroup soc_wifi_basic 2798 * @brief Send a custom frame.CNcomment:发送用户定制报文.CNend 2799 * 2800 * @par Description: 2801 * Send a custom frame.CNcomment:发送用户定制报文.CNend 2802 * 2803 * @attention 1.Maximum length is 1400 bytes.CNcomment:1.最大支持发送1400字节的报文.CNend\n 2804 * 2.Require to 802.11 prcotocol.CNcomment:2.报文须按照802.11协议格式封装.CNend\n 2805 * 3.Send by management rate.CNcomment:3.采用管理帧速率发送,发送长包效率较低.CNend\n 2806 * 4.Return status only specify the data has injected to send queue, isn't real send status. 2807 * CNcomment:4.返回值仅表示数据是否成功进入发送队列,不表示空口发送状态.CNend\n 2808 * 5.The chip is in a low-power state and does not support sending. 2809 * CNcomment:5.芯片工作在低功耗状态下,不能调用该接口发送报文.CNend\n 2810 * @param ifname [IN] Type #const char *, device name. CNcomment:接口名.CNend 2811 * @param data [IN] Type #const unsigned char *, frame. CNcomment:帧内容.CNend 2812 * @param len [IN] Type #unsigned int, frame length. CNcomment:帧长度.CNend 2813 * 2814 * @retval #EXT_WIFI_OK Excute successfully 2815 * @retval #Other Error code 2816 * 2817 * @par Dependency: 2818 * @li soc_wifi_api.h: WiFi API 2819 * @see NULL 2820 * @since 2821 */ 2822 int uapi_wifi_send_custom_pkt(const char* ifname, const unsigned char *data, unsigned int len); 2823 2824 /** 2825 * @ingroup soc_wifi_basic 2826 * @brief Add user IEs to management frame.CNcomment:在管理帧中添加用户IE字段。CNend 2827 * 2828 * @par Description: 2829 * Add user IEs to management frame.CNcomment:在管理帧中添加用户IE字段。CNend 2830 * 2831 * @attention 1.Input ie_len must be the same as the len of ie.CNcomment:1.输入的ie_len的长度必须和ie的长度保持一致.CNend 2832 * @param iftype [IN] Type #ext_wifi_iftype, interface type. CNcomment:接口类型。CNend 2833 * ie_index [IN] Type #ext_wifi_extend_ie_index, Ie index, there are four indexes to choose。 2834 * CNcomment:ie索引,有四个索引可供选择。CNend 2835 * frame_type_bitmap [IN] Type #const unsigned char, frame type bitmap,bit0 is beacon,bit1 is probe request, 2836 * bit2 is probe response. 2837 * CNcomment:帧类型,bit0代表beacon,bit1代表probe request,bit2代表probe response。CNend 2838 * ie [IN] Type #const unsigned char *, user IE value.CNcomment:用户IE字段内容。CNend 2839 * ie_len [IN] Type #unsigned short, user IE length.CNcomment:用户IE字段内容长度。CNend 2840 * @retval #EXT_WIFI_OK Execute successfully. 2841 * @retval #EXT_WIFI_FAIL Execute failed. 2842 * @par Dependency: 2843 * @li soc_wifi_api.h: WiFi API 2844 * @see NULL 2845 * @since 2846 */ 2847 int uapi_wifi_add_usr_app_ie(ext_wifi_iftype iftype, ext_wifi_extend_ie_index ie_index, 2848 const unsigned char frame_type_bitmap, const unsigned char *ie, unsigned short ie_len); 2849 2850 2851 /** 2852 * @ingroup soc_wifi_basic 2853 * @brief Delete user IEs from management frame.CNcomment:在管理帧中删除用户IE字段。CNend 2854 * 2855 * @par Description: 2856 * Delete user IEs from management frame.CNcomment:在管理帧中删除用户IE字段。CNend 2857 * 2858 * @attention NULL 2859 * @param iftype [IN] Type #ext_wifi_iftype, interface type. CNcomment:接口类型。CNend 2860 * ie_index [IN] Type #ext_wifi_extend_ie_index, Ie index, there are four indexes to choose。 2861 * CNcomment:ie索引,有四个索引可供选择。CNend 2862 * frame_type_bitmap [IN] Type #const unsigned char, frame type bitmap,bit0 is beacon,bit1 is probe request, 2863 * bit2 is probe response. 2864 * CNcomment:帧类型,bit0代表beacon,bit1代表probe request,bit2代表probe response。CNend 2865 * @retval #EXT_WIFI_OK Execute successfully. 2866 * @retval #EXT_WIFI_FAIL Execute failed. 2867 * @par Dependency: 2868 * @li soc_wifi_api.h: WiFi API 2869 * @see NULL 2870 * @since 2871 */ 2872 int uapi_wifi_delete_usr_app_ie(ext_wifi_iftype iftype, ext_wifi_extend_ie_index ie_index, 2873 const unsigned char frame_type_bitmap); 2874 2875 2876 /** 2877 * @ingroup soc_wifi_basic 2878 * @brief Set tcp mode.CNcomment:设置tpc开关.CNend 2879 * 2880 * @par Description: 2881 * Set tpc mode.CNcomment:设置tpc开关.CNend 2882 * 2883 * @attention 1.Mode set to 1, enable auto power control. set to 0, disbale it. 2884 * CNcomment:1.mode范围是0~1,1:打开发送功率自动控制,0:关闭发送功率自动控制.CNend 2885 * @param ifname [IN] Type #const char *, device name. CNcomment:接口名.CNend 2886 * @param ifname_len [IN] Type #unsigned char, interface name length.CNcomment:接口名长度.CNend 2887 * @param tpc_value [IN] Type #unsigned int, tpc_value. CNcomment:tpc开关.CNend 2888 * 2889 * @retval #EXT_WIFI_OK Excute successfully 2890 * @retval #Other Error code 2891 * 2892 * @par Dependency: 2893 * @li soc_wifi_api.h: WiFi API 2894 * @see NULL 2895 * @since 2896 */ 2897 td_u32 uapi_wifi_set_tpc(td_u32 tpc_value); 2898 2899 /** 2900 * @ingroup soc_wifi_basic 2901 * @brief Get Status Codes for Authentication and Association Frames. 2902 * CNcomment:查询Authentication与Association帧status code.CNend 2903 * 2904 * @par Description: 2905 * Get Status Codes for Authentication and Association Frames. 2906 * CNcomment:查询Authentication与Association帧status code.CNend 2907 * @attention 1.the return value is Status Codes for Authentication and Association Frames in 802.11. 2908 * 2.used when STA connect AP fail. 2909 * 3.the -1 return value means no status code, then if you want to get the reason of connect fail, use 2910 * event_wifi_disconnected.reason_code. 2911 * CNcomment: 2912 * 1.返回值为802.11协议中Authentication reponse与Association reponse帧的status code 2913 * 2.网卡类型为STA时使用,在STA发起路由器连接并失败时调用 2914 * 3.如果返回值为-1,表示无status code信息,此时获取连接失败的原因请使用event_wifi_disconnected结构体中的 2915 * reason_code值.CNend 2916 * @param NULL 2917 * 2918 * @retval #Status Codes value 2919 * 2920 * 2921 * @par Dependency: 2922 * @li soc_wifi_api.h: WiFi API 2923 * @see NULL 2924 * @since 2925 */ 2926 short uapi_wifi_get_mac_status_code(void); 2927 2928 /** 2929 * @ingroup soc_wifi_basic 2930 * @brief Set evm para.CNcomment:设置evm参数.CNend 2931 * 2932 * @par Description: 2933 * Set evm para.CNcomment:设置evm参数.CNend 2934 * 2935 * @attention 1.Should be called before uapi_wifi_init(). 2936 * CNcomment:只能在uapi_wifi_init()函数前调用.CNend 2937 * @param pa_bias [IN] Type #unsigned char, PA bias setting.0:0xfe83,default value.1:0xfcc3.Others:invalid. 2938 * CNcomment:PA偏置,0:0xfe83,默认值;1:0xfcc3;其它值:不支持.CNend 2939 * @param osc_drv_vals [IN] Type #ext_wifi_xldo_voltage *, OSC driver values ch1~14. 2940 * CNcomment:信道1~14的OSC驱动强度值.CNend 2941 * @param size [IN] Type #unsigned char, OSC driver values' size.Should be 14. 2942 * CNcomment:OSC驱动强度值数组大小,只能为14.CNend 2943 * 2944 * @retval #EXT_WIFI_OK Excute successfully 2945 * @retval #Other Error code 2946 * 2947 * @par Dependency: 2948 * @li soc_wifi_api.h: WiFi API 2949 * @see NULL 2950 * @since 2951 */ 2952 td_u32 uapi_wifi_set_evm_para(td_u8 pa_bias, const ext_wifi_xldo_voltage *osc_drv_vals, td_u8 size); 2953 2954 /** 2955 * @ingroup soc_wifi_basic 2956 * @brief Set wpa-enterprise eap method.CNcomment:设置企业级方法.CNend 2957 * 2958 * @par Description: 2959 * Set wpa-enterprise eap method:设置企业级方法.CNend 2960 * 2961 * @attention NULL 2962 * @param method [IN] Type #ext_wifi_eap_method, eap method type.CNcomment:eap方法类型.CNend 2963 * 2964 * @retval #EXT_WIFI_OK Excute successfully 2965 * @retval #Other Error code 2966 * 2967 * @par Dependency: 2968 * @li soc_wifi_api.h: WiFi API 2969 * @see NULL 2970 * @since 2971 */ 2972 int uapi_wifi_sta_ent_set_eap_method(ext_wifi_eap_method method); 2973 2974 /** 2975 * @ingroup soc_wifi_basic 2976 * @brief Set wpa-enterprise identity.CNcomment:设置企业级身份信息.CNend 2977 * 2978 * @par Description: 2979 * Set wpa-enterprise identity.CNcomment:设置企业级身份信息.CNend 2980 * 2981 * @attention 1. strlen(identity) == len.CNcomment:1.strlen(identity)等于len.CNend 2982 * 2. len <= EXT_WIFI_IDENTITY_LEN.CNcomment:2.len不大于EXT_WIFI_IDENTITY_LEN_MAX.CNend 2983 * 2984 * @param identity [IN] Type #const char *, identity string.CNcomment:身份字符串.CNend 2985 * @param len [IN] Type #unsigned int, identity string length.CNcomment:身份字符串长度.CNend 2986 * 2987 * @retval #EXT_WIFI_OK Excute successfully 2988 * @retval #Other Error code 2989 * 2990 * @par Dependency: 2991 * @li soc_wifi_api.h: WiFi API 2992 * @see NULL 2993 * @since 2994 */ 2995 int uapi_wifi_sta_ent_set_identity(const char *identity, unsigned int len); 2996 2997 /** 2998 * @ingroup soc_wifi_basic 2999 * @brief Set wpa-enterprise read callback.CNcomment:设置企业级证书/密钥读取的回调接口.CNend 3000 * 3001 * @par Description: 3002 * Set wpa-enterprise read callback.CNcomment:设置企业级证书/密钥读取的回调接口.CNend 3003 * 3004 * @attention NULL 3005 * @param cb [IN] Type #ext_wifi_ent_import_callback *, read callback.CNcomment:回调接口.CNend 3006 * 3007 * @retval #EXT_WIFI_OK Excute successfully 3008 * @retval #Other Error code 3009 * 3010 * @par Dependency: 3011 * @li soc_wifi_api.h: WiFi API 3012 * @see NULL 3013 * @since 3014 */ 3015 int uapi_wifi_sta_ent_set_import_callback(ext_wifi_ent_import_callback *cb); 3016 3017 /** 3018 * @ingroup soc_wifi_basic 3019 * 3020 * callback function definition of management frame report.CNcommment:管理帧收包回调接口定义.CNend 3021 */ 3022 typedef int32_t (*wifi_rx_mgmt_cb)(void *recv_buf, int32_t frame_len, int8_t rssi); 3023 3024 /** 3025 * @ingroup soc_wifi_basic 3026 * @brief Register receive callback for management frame.CNcomment:注册管理帧收包回调函数.CNend 3027 * 3028 * @par Description: 3029 * 1.Register receive callback for management frame.CNcomment:1.注册管理帧收包回调函数.CNend\n 3030 * 2.Wifi driver will put the management frames received to this callback,except for beacon frame. 3031 * CNcomment:2.驱动将收到的管理帧报文递交到注册的回调函数处理,收到的beacon帧不会递交到该回调函数.CNend 3032 * 3.The buffer of the frame reacived will be alloc and free by the wifi driver. 3033 * CNcomment:3.报文的buffer内存由驱动申请和释放,回调函数中不应释放,回调函数运行于驱动任务,不应在回调函数中执行耗时操作.CNend 3034 * 3035 * @attention 1.need to invoke uapi_wifi_set_mgmt_report(NULL) before enable low power mode. 3036 * CNcomment:开启低功耗睡眠之前需要调用uapi_wifi_set_mgmt_report(NULL)关闭管理帧上报,不然会引起功耗偏高。 3037 * @param data_cb [IN] Type #wifi_rx_mgmt_cb callback function pointer.CNcomment:管理帧上报回调函数.CNend 3038 * @param mode [IN] Mode of receiving management frame:上报管理帧模式.CNend 3039 * 3040 * @retval #EXT_OK Excute successfully 3041 * @retval #Other Error code 3042 * 3043 * @par Dependency: 3044 * @li soc_wifi_api.h: WiFi API 3045 * @see NULL 3046 * @since 3047 */ 3048 int uapi_wifi_set_mgmt_report(wifi_rx_mgmt_cb data_cb, uint8_t mode); 3049 3050 3051 /** 3052 * @ingroup soc_wifi_basic 3053 * @brief Set wpa-enterprise read callback.CNcomment:autorate配置速率模式函数接口.CNend 3054 * 3055 * @par Description: 3056 * Set wpa-enterprise read callback.CNcomment:autorate配置速率模式函数接口.CNend 3057 * 3058 * @attention NULL 3059 * @param value [IN] Type #unsigned int, switch value.CNcomment:autorate配置速率模式函数接口.CNend 3060 * 3061 * @retval #EXT_WIFI_OK Excute successfully 3062 * @retval #Other Error code 3063 * 3064 * @par Dependency: 3065 * @li soc_wifi_api.h: WiFi API 3066 * @see NULL 3067 * @since 3068 */ 3069 osal_u32 uapi_alg_ar_fix_cfg_etc(osal_u32 value); 3070 3071 /** 3072 * @ingroup soc_wifi_basic 3073 * @brief Set psd enable mode.CNcomment:配置PSD状态函数接口.CNend 3074 * 3075 * @par Description: 3076 * Set psd enable mode.CNcomment:配置PSD状态函数接口.CNend 3077 * 3078 * @attention NULL 3079 * @param psd_option [IN] Type #ext_psd_option_param CNcomment:配置PSD状态函数接口.CNend 3080 * 3081 * @retval #EXT_WIFI_OK Excute successfully 3082 * @retval #Other Error code 3083 * 3084 * @par Dependency: 3085 * @li soc_wifi_api.h: WiFi API 3086 * @see NULL 3087 * @since 3088 */ 3089 int uapi_wifi_set_psd_enable(psd_option_param *psd_option); 3090 3091 /** 3092 * @ingroup soc_wifi_basic 3093 * @brief Set psd callback.CNcomment:配置PSD回调.CNend 3094 * 3095 * @par Description: 3096 * Set psd callback.CNcomment:配置PSD回调.CNend 3097 * 3098 * @attention NULL 3099 * @param data_cb [IN] Type #wifi_psd_cb CNcomment:配置PSD回调.CNend 3100 * 3101 * @retval #EXT_WIFI_OK Excute successfully 3102 * @retval #Other Error code 3103 * 3104 * @par Dependency: 3105 * @li soc_wifi_api.h: WiFi API 3106 * @see NULL 3107 * @since 3108 */ 3109 int uapi_wifi_set_psd_cb(wifi_psd_cb data_cb); 3110 3111 /** 3112 * @if Eng 3113 * @brief Struct of eth data config. 3114 * @else 3115 * @brief 设置eth data相关参数。 3116 * @endif 3117 */ 3118 typedef struct data_segment { 3119 uint8_t* data; /* 数据指针 */ 3120 size_t len; /* 数据长度 */ 3121 } data_segment_t; 3122 3123 /** 3124 * @ingroup soc_wifi_basic 3125 * @brief 获取数据发包.CNcomment:配置发包接口.CNend 3126 * 3127 * @par Description: 3128 * Send data packet.CNcomment:配置发包接口.CNend 3129 * 3130 * @attention NULL 3131 * @param data_segment_t [IN] Type #eth_data 3132 * seg_len [IN] Type #length 3133 * 3134 * @retval #EXT_WIFI_OK Excute successfully 3135 * @retval #Other Error code 3136 * 3137 * @par Dependency: 3138 * @li soc_wifi_api.h: WiFi API 3139 * @see NULL 3140 * @since 3141 */ 3142 int uapi_wifi_send_pkt(osal_void *dev, const data_segment_t *seg, uint8_t seg_len); 3143 3144 /** 3145 * @ingroup soc_wifi_basic 3146 * @brief 配置Repeater开关及接口.CNcomment:配置Repeater开关及接口.CNend 3147 * 3148 * @par Description: 3149 * Set Repeater switch and interface.CNcomment:配置Repeater开关及接口.CNend 3150 * 3151 * @attention NULL 3152 * @param oper [IN] Type #const char *, identity string.CNcomment:配置操作.CNend 3153 * if_name [IN] Type #const char *, identity string.CNcomment:接口名.CNend 3154 * 3155 * @retval #EXT_WIFI_OK Excute successfully 3156 * @retval #Other Error code 3157 * 3158 * @par Dependency: 3159 * @li soc_wifi_api.h: WiFi API 3160 * @see NULL 3161 * @since 3162 */ 3163 int uapi_wifi_set_brctl(const char *oper, const char *if_name); 3164 3165 #ifdef __cplusplus 3166 #if __cplusplus 3167 } 3168 #endif 3169 #endif 3170 3171 #endif /* end of soc_wifi_api.h */ 3172