Wi-Fi APIs
WIFI_API module
Wi-Fi Exported Functions
Basic Functions
-
s32 wifi_on(u8 mode)
Enable Wi-Fi, i.e., bring the Wireless interface 0 “Up”.
备注
It is called by default in wifi_init.c.
In WHC mode as a host, first call whc_host_init to initialize the interface between host and device.
In WHC mode as a device, this API is automatically called by the host’s wifi_on, so users don’t need to call it again.
This API performs general initialization and sets interface 0 to STA mode. To start AP mode, call wifi_start_ap after this API.
- 参数:
mode – [in] Should always set to RTW_MODE_STA.
- 返回:
RTK_SUCCESS : If the WiFi chip initialized successfully.
RTK_FAIL : If the WiFi chip initialization failed.
-
s32 wifi_is_running(u8 wlan_idx)
Check if the specified wlan interface is running.
- 参数:
wlan_idx – [in] Can be set as STA_WLAN_INDEX (for STA mode) or SOFTAP_WLAN_INDEX (for AP mode).
- 返回:
If the function succeeds, the return value is 1. Otherwise, return 0.
-
s32 wifi_connect(struct rtw_network_info *connect_param, u8 block)
Join a Wi-Fi network. Scan for, associate and authenticate with a Wi-Fi network.
备注
Please make sure the Wi-Fi is enabled (wifi_on()) before invoking this function.
If
connect_param->bssid
is set, then bssid will be used for connect, otherwise ssid is used for connect.
- 参数:
connect_param – [in] The pointer of a struct which store the connection info, including ssid, bssid, password, etc, for details, please refer to struct rtw_network_info in wifi_api_types.h.
block – [in]
If block is set to 1, it means synchronized wifi connect, and this API will return until connect is finished;
If block is set to 0, it means asynchronized wifi connect, and this API will return immediately.
- 返回:
RTK_SUCCESS : Join successfully for synchronized wifi connect, or connect cmd is set successfully for asynchronized wifi connect.
RTK_FAIL : An error occurred.
-RTK_ERR_BUSY : Wifi connect or scan is ongoing.
-RTK_ERR_NOMEM : Malloc fail during wifi connect.
-RTK_ERR_TIMEOUT : More than ~70s without successful connection.
-RTK_ERR_WIFI_CONN_INVALID_KEY : Password format wrong.
-RTK_ERR_WIFI_CONN_SCAN_FAIL : Scan fail.
-RTK_ERR_WIFI_CONN_AUTH_FAIL : Auth fail.
-RTK_ERR_WIFI_CONN_AUTH_PASSWORD_WRONG : Password error causing auth failure, not entirely accurate.
-RTK_ERR_WIFI_CONN_ASSOC_FAIL : Assoc fail.
-RTK_ERR_WIFI_CONN_4WAY_HANDSHAKE_FAIL : 4 way handshake fail.
-RTK_ERR_WIFI_CONN_4WAY_PASSWORD_WRONG : Password error causing 4 way handshake failure,not entirely accurate.
-
s32 wifi_disconnect(void)
Disassociates from current Wi-Fi network.
- 返回:
RTK_SUCCESS : On successful disassociation from the AP.
RTK_FAIL : If an error occurred.
-
s32 wifi_get_join_status(u8 *join_status)
Get join status during wifi connectection.
- 参数:
join_status – [out] the join status during wifi connectection.
RTW_JOINSTATUS_UNKNOWN : Unknown.
RTW_JOINSTATUS_STARTING : Starting phase.
RTW_JOINSTATUS_SCANNING : Scanning phase.
RTW_JOINSTATUS_AUTHENTICATING : Authenticating phase.
RTW_JOINSTATUS_AUTHENTICATED : Authenticated phase.
RTW_JOINSTATUS_ASSOCIATING : Associating phase.
RTW_JOINSTATUS_ASSOCIATED : Associated phase.
RTW_JOINSTATUS_4WAY_HANDSHAKING : 4 way handshaking phase.
RTW_JOINSTATUS_4WAY_HANDSHAKE_DONE : 4 way handshake done phase.
RTW_JOINSTATUS_SUCCESS : Join success.
RTW_JOINSTATUS_FAIL : Join fail.
RTW_JOINSTATUS_DISCONNECT : Disconnect.
- 返回:
RTK_SUCCESS : If the join_status is successfully get.
RTK_FAIL : If the join_status is not successfully get.
-
s32 wifi_scan_networks(struct rtw_scan_param *scan_param, u8 block)
Initiate a scan to search for 802.11 networks. There are two different scan type can be confgiured by the input param block:
Synchronized scan.
Asynchronized scan. There are two different ways about how the scan result will be reported:
The first way is that when scan is done ,the total number of scanned APs will be reported through
scan_param->scan_user_callback
, and the detailed scanned AP infos can be get by calling wifi_get_scan_records(), so in this way, rtw_scan_param::scan_user_callback need to be registered inscan_param
.The second way is that every time a AP is scanned, this AP info will be directly reported by
scan_param->scan_report_each_mode_user_callback
, and when scan is done,scan_report_each_mode_user_callback
will report a NULL pointer for notification. So in this way, rtw_scan_param::scan_report_each_mode_user_callback need to be registered inscan_param
, and rtw_scan_param::options need to be set to RTW_SCAN_REPORT_EACH inscan_param
. Also in this mode, rtw_scan_param::scan_user_callback is no need to be registered.
备注
If this API is called, the scanned APs are stored in WiFi driver dynamic allocated memory, for synchronized scan or asynchronized scan which not use RTW_SCAN_REPORT_EACH, these memory will be freed when wifi_get_scan_records() is called.
- 参数:
scan_param – [in] Refer to struct rtw_scan_param in wifi_api_types.h.
block – [in]
If set to 1, it’s synchronized scan and this API will return after scan is done.
If set to 0, it’s asynchronized scan and this API will return immediately.
- 返回:
RTK_SUCCESS or RTK_FAIL for asynchronized scan, return RTK_FAIL or scanned AP number for Synchronized scan.
-
s32 wifi_get_scan_records(u32 *ap_num, struct rtw_scan_result *ap_list)
Get scan results.
备注
For synchronized scan or asynchronized scan which do not config RTW_SCAN_REPORT_EACH, if once called wifi_scan_networks() but not use this API to get scanned AP info, driver memory for these scanned AP will not be freed until next time wifi_scan_networks() is called.
For asynchronized scan which config RTW_SCAN_REPORT_EACH, every time a AP is scanned, the AP info will be directly reported through
scan_report_each_mode_user_callback
and freed after user callback executed, thus there is no need to use this function to get scan result.
- 参数:
ap_num – [inout] Input the pointer to the number of scanned ap info which want to get, output the number of scanned ap info whicn can actually get.
ap_list – [in] A buffer stores scanned ap list, the scanned AP info will be stored one by one in form of struct rtw_scan_result.
- 返回:
RTK_SUCCESS or RTK_FAIL.
-
s32 wifi_start_ap(struct rtw_softap_info *softap_config)
Trigger Wi-Fi driver to start an infrastructure Wi-Fi network.
备注
If
softap_config->hidden_ssid
is set to 1, then this softAP will start with hidden ssid.Please make sure the Wi-Fi is enabled (wifi_on()) before invoking this function.
警告
If a STA interface is active when this function is called, the softAP will start on the same channel as the STA. It will NOT use the channel provided!
- 参数:
softap_config – [in] The pointer of a struct which store the softAP configuration, please refer to struct rtw_softap_info in wifi_api_types.h.
- 返回:
RTK_SUCCESS : If successfully creates an AP.
RTK_FAIL : If an error occurred.
-
s32 wifi_stop_ap(void)
Disable Wi-Fi interface-2.
- 返回:
RTK_SUCCESS : Deinit success, wifi mode is changed to RTW_MODE_STA.
RTK_FAIL : Otherwise.
-
s32 wifi_get_setting(u8 wlan_idx, struct rtw_wifi_setting *psetting)
Get current Wi-Fi setting from driver.
备注
The mode in struct rtw_wifi_setting corresponding to the wifi mode of current
wlan_idx
:If in station mode, the info in struct rtw_wifi_setting except mode will correspond to the AP it connected,
If in AP mode, the info in struct rtw_wifi_setting will correspond to the softAP itself.
- 参数:
wlan_idx – [in] STA_WLAN_INDEX or SOFTAP_WLAN_INDEX.
psetting – [out] Points to the struct rtw_wifi_setting structure which information is gotten.
- 返回:
RTK_SUCCESS : The result is successfully got.
RTK_FAIL : The result is not successfully got.
-
s32 wifi_scan_abort(u8 block)
Abort onoging wifi scan.
备注
If
block
set to 0, this will be an asynchronized function and will return immediately, return value only indicates whether the scan abort cmd is successfully notified to driver or not.If
block
set to 1, this will be a synchronized function and will return when scan is actually aborted. When scan is actually aborted, the user callback registered in wifi_scan_networks() will be executed. If there is no wifi scan in progress, this function will just return RTK_SUCCESS and user callback won’t be executed.
- 参数:
block – [in] Set 1 for wait scan actually aborted.
- 返回:
RTK_SUCCESS or RTK_FAIL.
-
s32 wifi_set_lps_enable(u8 enable)
Enable or disable LPS. LPS is the abbreviation of Leisure Power Save mode. Wi-Fi automatically turns RF off during the association to AP if traffic is not busy, while it also automatically turns RF on to listen to the beacon of the associated AP.
- 参数:
enable – [in] It could be TRUE(1) (means enable LPS) or FALSE(0) (means disable LPS).
- 返回:
RTK_SUCCESS : If setting LPS successful.
RTK_FAIL : Otherwise.
-
s32 wifi_set_lps_listen_interval(u8 interval)
Set the listen interval of LPS. LPS is the abbreviation of Leisure Power Save mode. Wi-Fi automatically turns RF off during the association to AP if traffic is not busy, while it also automatically turns RF on to listen to the beacon of the associated AP. The listen interval is used to indicate how often the STA wakes to listen to beacons of AP.
备注
If the specified interval is not a multiple of beacon interval, the actual listen interval will be rounded to the largest multiple that <= the specified value. It will not be rounded to 0 when the specified value < beacon interval. In this case, use 1 instead. e.g. Given that beacon interval = 2:
Calling wifi_set_lps_listen_interval(5) will make actual listen interval = 4.
Calling wifi_set_lps_listen_interval(1) will make actual listen interval = 1.
- 参数:
interval – [in] The listen interval of LPS (unit: 102.4 ms).
- 返回:
RTK_SUCCESS : If setting LPS listen interval successful.
RTK_FAIL : Otherwise.
-
s32 wifi_set_autoreconnect(u8 enable)
Usually, user can set auto-reconnect in ameba_wificfg.c, If you need to temporarily turn auto-reconnect on or off, this API can help.
- 参数:
enable – [in]
1: enable auto reconnect mode.
0: disable auto reconnect mode.
- 返回:
RTK_FAIL : CONFIG_AUTO_RECONNECT in not defined or creating reconnect timer failed.
-
s32 wifi_get_autoreconnect(u8 *enable)
Get the current auto-reconnect settings as a backup so you can restore the previous state after temporarily disabling it.
- 参数:
enable – [out] Point to the result of setting reconnection mode.
1: enable the reconnection mode.
0: disable the reconnection mode.
- 返回:
RTK_FAIL : CONFIG_AUTO_RECONNECT in not defined.
-
s32 wifi_ap_get_connected_clients(struct rtw_client_list *client_list_buffer)
Get the connected clients with SoftAP.
- 参数:
client_list_buffer – [out] The location where the client list will be stored.
- 返回:
RTK_SUCCESS : The result is successfully got.
RTK_FAIL : The result is not successfully got.
-
s32 wifi_ap_del_client(u8 *hwaddr)
Delete a STA for softap.
备注
This function should be used when operating as AP.
- 参数:
hwaddr – [in] The pointer to the MAC address of the STA which will be deleted.
- 返回:
RTK_SUCCESS or RTK_FAIL.
-
s32 wifi_ap_switch_chl_and_inform(struct rtw_csa_parm *csa_param)
Switch to a new channel in AP mode and using CSA to inform sta.
备注
This function should be used when operating as AP.
- 参数:
csa_param – [in] Pointer to the csa config structure rtw_csa_parm.
- 返回:
RTK_SUCCESS or RTK_FAIL, only indicate whether channel switch cmd is successfully set to wifi driver.
-
void wifi_ap_set_invisible(u8 enable)
For user to toggle softap whether can be discovered.
- 参数:
enable – [in] 1-invisible, 0-visible.
- 返回:
None.
-
s32 wifi_set_channel(u8 wlan_idx, u8 channel)
Set channel.
备注
There are two concepts of channels and they are generally consistent:
Interafce(x) operating channel;
Network channel: realAP’s channel for interafce(0); softap channel for interface(1).
If you use a wifi_set_channel() to switch interafce(0) operating channel during or after wifi_connect(), the sta will connect fail or disconnect from realAP due to inconsistency with realAP channel caused by interface(0) operating channel change;
If you use a wifi_set_channel() to switch interafce(1) operating channel after softap start, other devices may not be able to connect to or disconnect from the softap because the interafce(1) operating channel has changed, resulting in inconsistency with the channel claimed by BCN. Softap channel switching recommendation: call wifi_ap_switch_chl_and_inform().
- 参数:
wlan_idx – [in] The wlan interface index, should be SOFTAP_WLAN_INDEX or STA_WLAN_INDEX.
channel – [in] The current operating RF channel which will be switch to.
- 返回:
RTK_SUCCESS or RTK_FAIL.
-
s32 wifi_set_countrycode(u8 *cntcode)
Set country code.
- 参数:
cntcode – [in] Pointer to the country code which want to be set.
- 返回:
RTK_SUCCESS or RTK_FAIL.
-
s32 wifi_get_countrycode(struct rtw_country_code_table *table)
get country code info
- 参数:
table – [in] Pointer to the currently obtained country code table
- 返回:
-
s32 wifi_get_channel_list(struct rtw_channel_list *ch_list)
get channel list
- 参数:
ch_list – [in] Pointer to the currently obtained available channel list
- 返回:
-
s32 wifi_get_mac_address(s32 idx, struct rtw_mac *mac, u8 efuse)
Retrieves the current Media Access Control (MAC) address (or Ethernet hardware address) of the 802.11 device.
备注
Get mac address inside EFUSE(efuse = 1).
Get runtime mac address(efuse = 0). (RECOMMENDED)
- 参数:
idx – [in] Get STA or SoftAP mac address. Invalid parameter while setting efuse = 1.
mac – [in] Pointer to the struct rtw_mac which contain obtained mac address.
efuse – [in] Get mac address from efuse or get from RAM.
- 返回:
RTK_SUCCESS or RTK_FAIL.
-
s32 wifi_get_wireless_mode(u8 *wmode)
This function is used to get wifi wireless mode for station mode when connecting to AP.
- 参数:
wmode – [out] the wireless mode, Val: RTW_80211_B, RTW_80211_A…
- 返回:
RTK_SUCCESS : The result is successfully got.
RTK_FAIL : The result is not successfully got.
-
s32 wifi_set_wireless_mode(u32 wmode)
Set the wireless mode according to the data rate its supported. Driver works in RTW_80211_24G_MIX (BGNAX) mode in default after driver initialization. This function is used to change wireless mode for station mode before connecting to AP.
备注
We do not recommend 2G without 11b mode and 5G without 11a mode, as this may lead to compatibility issues.
- 参数:
wmode – [in] wireless mode to set. The value can be
- 返回:
RTK_SUCCESS or RTK_FAIL.
Event Functions
-
void wifi_reg_event_handler(u32 event_cmds, void (*handler_func)(u8 *buf, s32 len, s32 flag, void *user_data), void *handler_user_data)
Register the event listener.
备注
Set the same
event_cmds
with emptyhandler_func
will unregister theevent_cmds
.- 参数:
event_cmds – [in] : Events indicated by wifi driver.
handler_func – [in] : The callback function which will receive and process the event.
buf: Event data transmitted from the driver layer to the application layer.
len: Length of buf.
flag: Flag set by wifi driver.
user_data: Equal to
handler_user_data
.
handler_user_data – [in] : User specific data that will be passed directly to the callback function, can set to NULL.
- 返回:
RTK_SUCCESS : If successfully registers the event.
RTK_FAIL : If an error occurred.
-
void wifi_unreg_event_handler(u32 event_cmds, void (*handler_func)(u8 *buf, s32 len, s32 flag, void *user_data))
Un-register the event listener.
- 参数:
event_cmds – [in] : Events indicated by wifi driver.
handler_func – [in] : The callback function which will receive and process the event.
- 返回:
RTK_SUCCESS : If successfully un-registers the event.
RTK_FAIL : If an error occurred.
Extended Functions
-
void wifi_promisc_enable(u32 enable, struct rtw_promisc_para *para)
Enable promisc mode and set promisc mode.
备注
Callback return value will decide whether driver need continue process this packet.
- 参数:
enable – [in] Enable or disable promisc mode.
para – [in] Promisc mode and callback if enable promisc mode.
- 返回:
None.
-
u8 wifi_driver_is_mp(void)
Check whether current wifi driver is MP(mass production) mode or not.
备注
MP mode is used for Wi-Fi & BT performance verification and Wi-Fi & BT parameters calibration in mass production.
- 返回:
1: drv_mode is mass production (MP) mode.
0: drv_mode is not MP.
-
s32 wifi_get_ccmp_key(u8 wlan_idx, u8 *mac_addr, u8 *uncst_key, u8 *group_key)
Get ccmp unicast key and group key.
- 参数:
wlan_idx – [in] STA_WLAN_INDEX or SOFTAP_WLAN_INDEX.
mac_addr – [in] Client mac addr for softap mode, set to NULL for sta mdoe.
uncst_key – [out] CCMP unicast key.
group_key – [out] CCMP group key.
- 返回:
RTK_SUCCESS : If get key successfully.
RTK_FAIL : Otherwise.
-
s32 wifi_get_traffic_stats(u8 wlan_idx, union rtw_traffic_stats *traffic_stats)
Fetch the traffic statistic about wifi.
- 参数:
wlan_idx – [in] STA_WLAN_INDEX or SOFTAP_WLAN_INDEX.
traffic_stats – [in] The location where the statistic info will be stored, for detail info, please refer to union rtw_traffic_stats .
- 返回:
RTK_SUCCESS : If the statistic info is successfully get.
RTK_FAIL : If the statistic info is not successfully get.
-
s32 wifi_get_phy_stats(u8 wlan_idx, u8 *mac_addr, union rtw_phy_stats *phy_stats)
Fetch the phy statistic info about wifi.
备注
The
phy_stats->sta.rssi
andphy_stats->sta.snr
info will only be valid after connected to AP successfully.- 参数:
wlan_idx – [in] STA_WLAN_INDEX or SOFTAP_WLAN_INDEX or NONE_WLAN_INDEX.
mac_addr – [in] Client mac addr for softap mode, set to NULL for sta mode and none mode.
phy_stats – [out] The location where the statistic info will be stored, for detail info, please refer to union rtw_phy_stats .
- 返回:
RTK_SUCCESS : If the statistic info is successfully get.
RTK_FAIL : If the statistic info is not successfully get.
-
s32 wifi_get_txbuf_pkt_num(s32 *pkt_num)
Get current remaining number of packets in HW TX buffer.
- 参数:
pkt_num – [out] The location where the number of packets will be stored.
- 返回:
RTK_SUCCESS : If the number of packets is successfully get.
RTK_FAIL : If the number of packets is not successfully get.
-
s32 wifi_get_antdiv_info(u8 *antdiv_mode, u8 *curr_ant)
Get antdiv infomation.
- 参数:
antdiv_mode – [in] Point to the antdiv_mode value obtained from driver.
curr_ant – [in] Point to the antenna value obtained from driver, 0 means main antenna, 1 means aux antenna.
- 返回:
0 if get successfully, otherwise return -1.
-
s32 wifi_get_band_type(u8 *band_type)
Get band type.
- 参数:
band_type – [out] The location where the support band type info will be stored. The support band type:
RTW_SUPPORT_BAND_2_4G : Only support 2.4G.
RTW_SUPPORT_BAND_5G : Only support 5G.
RTW_SUPPORT_BAND_2_4G_5G_BOTH : Support both 2.4G and 5G.
- 返回:
RTK_SUCCESS : If the band type info is successfully get.
RTK_FAIL : If the band type info is not successfully get.
-
s32 wifi_get_tsf(u8 wlan_idx, u64 *tsf)
Get wifi TSF register[63:32]&[31:0].
- 参数:
wlan_idx – [in] STA_WLAN_INDEX or SOFTAP_WLAN_INDEX.
tsf – [out] The location where the tsf[63:0] will be stored.
- 返回:
RTK_SUCCESS : If the tsf is successfully get.
RTK_FAIL : If the tsf is not successfully get.
-
s32 wifi_add_custom_ie(struct rtw_custom_ie *ie_list, s32 ie_num)
Setup custom IE(Information Element) list.
警告
This API can’t be executed twice before deleting the previous custom ie list.
- 参数:
ie_list – [in] A buffer stores custom IE list, format of custom ie is struct rtw_custom_ie. e.g.
u8 ie1[] = {221, 2, 2, 2}; u8 ie2[] = {221, 2, 1, 1}; struct rtw_custom_ie ie_list[2] = {{ie1, RTW_CUS_IE_BEACON|RTW_CUS_IE_PROBERSP}, {ie2, RTW_CUS_IE_PROBERSP}}; wifi_add_custom_ie(ie_list, 2);
ie_num – [in] The number of custom IEs in
ie_list
.
- 返回:
0 if success, otherwise return -1.
-
s32 wifi_update_custom_ie(struct rtw_custom_ie *cus_ie, s32 ie_index)
Update the item in WIFI CUSTOM IE(Information Element) list.
- 参数:
cus_ie – [in] Pointer to WIFI CUSTOM IE address.
u8 ie[] = {221, 2, 1, 3} ; struct rtw_custom_ie ie_update = {ie, RTW_CUS_IE_PROBERSP}; wifi_update_custom_ie(&ie_update, 2);
ie_index – [in] Index of WIFI CUSTOM IE list.
- 返回:
0 if success, otherwise return -1.
-
s32 wifi_del_custom_ie(u8 wlan_idx)
Delete WIFI CUSTOM IE(Information Element) list.
- 参数:
wlan_idx – [in] Should be STA_WLAN_INDEX or SOFTAP_WLAN_INDEX.
- 返回:
0 if success, otherwise return -1.
-
s32 wifi_send_raw_frame(struct rtw_raw_frame_desc *raw_frame_desc)
Send raw frame.
- 参数:
raw_frame_desc – [in] The pointer of struct rtw_raw_frame_desc, which describe related information, include the pointer of raw frame and so on.
- 返回:
RTK_FAIL or RTK_SUCCESS.
-
s32 wifi_set_tx_rate_by_tos(u8 enable, u8 tos_precedence, u8 tx_rate)
Control initial tx rate by different ToS value in IP header.
备注
This function only take IP Precedence(BIT 7~5 in ToS field) into consideration.
- 参数:
enable – [in] Set 1 to add control for specified tx_rate for corresponding ToS_value, set 0 to disable initial rate control for this ToS_value.
tos_precedence – [in] Range from 0 to 7, corresponding to IP precedence in TOS field of IP header(BIT7~5).
tx_rate – [in] Initial tx rate for packet which has the same ToS value as setted. val: RTW_RATE_1M, RTW_RATE_2M…
- 返回:
RTK_SUCCESS or RTK_FAIL.
-
s32 wifi_set_edca_param(u32 ac_param)
Set EDCA parameter.
- 参数:
ac_param – [in] Format is shown as:
BIT31~16
BIT15~8
BIT7~0
TXOP Limit
ECWmin/ECWmax
ACI/AIFSN
- 返回:
-
s32 wifi_set_tx_cca_enable(u8 enable)
Enable or disable CCA/EDCCA for TX.
备注
Both CCA and EDCCA will be enabled or disabled.
- 参数:
enable – [in] 1 for enable, 0 for disable.
- 返回:
RTK_SUCCESS or RTK_FAIL.
-
s32 wifi_set_cts2self_duration_and_send(u8 wlan_idx, u16 duration)
Set duration and send a CTS2SELF frame.
- 参数:
wlan_idx – [in] The wlan interface index, can be STA_WLAN_INDEX or SOFTAP_WLAN_INDEX.
duration – [in] The duration value for the CTS2SELF frame.
- 返回:
RTK_SUCCESS or RTK_FAIL.
-
s32 wifi_csi_config(struct rtw_csi_action_parm *act_param)
Set the csi parameters and enable or disable csi func(sta or softap).
- 参数:
act_param – [in] A pointer to the param.
struct rtw_csi_action_parm act_param = {0}; act_param.mode = 2; ... wifi_csi_config(&act_param);
- 返回:
-
s32 wifi_csi_report(u32 buf_len, u8 *csi_buf, u32 *len)
Get csi raw data and csi hdr info.
- 参数:
buf_len – [in] Buffer size for getting csi info.
csi_buf – [in] The pointer to csi data buffer.
len – [in] The size of csi raw data.
u8 *csi_buf = NULL; u32 len; csi_buf = rtos_mem_zmalloc(buf_len); wifi_csi_report(buf_len,csi_buf,&len);
- 返回:
RTK_SUCCESS or RTK_FAIL.
-
void wifi_speaker_setting(u8 set_type, union rtw_speaker_set *settings)
For wifi speaker setting.
- 参数:
set_type – [in] Wifi speaker setting type:
settings – [in] A pointer to the params:
When
set_type
== RTW_SPEAKER_SET_INITsettings->init.mode
: 0 for slave, 1 for master.settings->init.thresh
: Unit 128us.settings->init.relay_en
: Relay control.
When
set_type
== RTW_SPEAKER_SET_LATCH_I2S_COUNTsettings->latch_i2s_count.port
: 0 for select port 0’s TSFT to trigger audio latch count, 1 for port 1.settings->latch_i2s_count.latch_period
: 0 for trigger audio latch period is 4.096ms, 1 for 8.192ms.
When
set_type
== RTW_SPEAKER_SET_TSF_TIMERsettings->tsf_timer.enable
: 1 for enable twt timer, 0 for disable.settings->tsf_timer.tsft
: Absolute value for twt timer, unit ms.settings->tsf_timer.port
: 0 for select port 0’s TSFT to trigger twt timer interrupt, 1 for port 1.
- 返回:
None.
-
s32 wifi_set_tx_power(struct rtw_tx_power_ctl_info *txpwr_ctrl_info)
For user to set tx power.
Currently will TX with the set power, regardless of power by rate and power by limit.
Afterwards, it can be extended to specify rate, or power by limit needs to be considered.
备注
For amebadplus, the power range varies for different channels or IC, the recommended power range is -2 ~ 23 dBm, if exceeds the power range, the power may be inaccurate, and will be changed to the boundary value.
For amebasmart&amebalite, the recommended power range is -24 ~ 24 dBm.
For both, we suggest setting the power not to exceed the power by rate table.
- 参数:
txpwr_ctrl_info – [in] The pointer of rtw_tx_power_ctl_info:
b_tx_pwr_force_enbale: 1 for enable, 0 for disable.
tx_pwr_force: Unit 0.25dBm.
- 返回:
-
s32 wifi_get_tx_power(u8 rate, s8 *txpwr)
For user to get tx power.
- 参数:
rate – [in] Phy rate, val: RTW_RATE_1M, RTW_RATE_2M…
CCK rate 1M,2M,5.5M,11M
OFDM rate 6M,9M,12M,18M,24M,36M,48M,54M
HT rate MCS0~MCS7
VHT rate MCS0~MCS8
HE rate MCS0~MCS9
txpwr – [out] The current tx power, unit 0.25dBm.
- 返回:
-
void wifi_set_conn_step_try_limit(struct rtw_conn_step_retries *conn_step_retries)
For user to config retry limit for different stages of join.
- 参数:
conn_step_retries – [in] The pointer of rtw_conn_step_retries.
- 返回:
None.
Wi-Fi Exported Constants
-
RTK_SUCCESS
-
RTK_FAIL
-
RTK_ERR_BADARG
Bad Argument.
-
RTK_ERR_BUSY
Busy.
-
RTK_ERR_NOMEM
No Memory.
-
RTK_ERR_TIMEOUT
Timeout.
-
RTK_ERR_WIFI_BASE
-
RTK_ERR_WIFI_CONN_INVALID_KEY
Invalid key.
-
RTK_ERR_WIFI_CONN_SCAN_FAIL
-
RTK_ERR_WIFI_CONN_AUTH_FAIL
-
RTK_ERR_WIFI_CONN_AUTH_PASSWORD_WRONG
-
RTK_ERR_WIFI_CONN_ASSOC_FAIL
-
RTK_ERR_WIFI_CONN_4WAY_HANDSHAKE_FAIL
-
RTK_ERR_WIFI_CONN_4WAY_PASSWORD_WRONG
-
STA_WLAN_INDEX
-
SOFTAP_WLAN_INDEX
-
NAN_WLAN_INDEX
-
NONE_WLAN_INDEX
-
RTW_PSCAN_FAST_SURVEY
Set to this means do fast survey on the specified channel with scan time set to 25ms, otherwise do normal scan on the specified channel with scan time set to 110ms.
-
RTW_MAX_CHANNEL_NUM
Max channel num in each channel plan
-
RTW_RFK_DIS_DPK
Set to this means disable DPK(Digital Pre-Distortion Calibration) of rf calibration.
-
RTW_ESSID_MAX_SIZE
Refer to 802.11 spec, the max length of ssid is 32 bytes.
-
RTW_WPA2_MAX_PSK_LEN
-
RTW_WPA3_MAX_PSK_LEN
maxmum psk length
-
RTW_MAX_PSK_LEN
-
RTW_MIN_PSK_LEN
minimum psk length
-
MAC_ARG(x)
mac address format.
-
MAC_FMT
Wi-Fi Exported Types
Enumeration Type
-
enum rtw_join_status
Flags of RTW_EVENT_JOIN_STATUS.
Values:
-
enumerator RTW_JOINSTATUS_UNKNOWN
-
enumerator RTW_JOINSTATUS_STARTING
Starting phase.
-
enumerator RTW_JOINSTATUS_SCANNING
Scanning phase.
-
enumerator RTW_JOINSTATUS_AUTHENTICATING
Authenticating phase.
-
enumerator RTW_JOINSTATUS_AUTHENTICATED
Authenticated phase.
-
enumerator RTW_JOINSTATUS_ASSOCIATING
Associating phase.
-
enumerator RTW_JOINSTATUS_ASSOCIATED
Associated phase.
-
enumerator RTW_JOINSTATUS_4WAY_HANDSHAKING
4 way handshaking phase.
-
enumerator RTW_JOINSTATUS_4WAY_HANDSHAKE_DONE
4 way handshake done phase.
-
enumerator RTW_JOINSTATUS_SUCCESS
Join success.
-
enumerator RTW_JOINSTATUS_FAIL
Join fail during wifi connect.
-
enumerator RTW_JOINSTATUS_DISCONNECT
Disconnect after wifi connected.
-
enumerator RTW_JOINSTATUS_UNKNOWN
-
enum rtw_event_id
event_cmds
Values:
-
enumerator RTW_EVENT_STA_ASSOC
A station associate to softAP.
-
enumerator RTW_EVENT_STA_DISASSOC
A station disassociate to softAP.
-
enumerator RTW_EVENT_JOIN_STATUS
Status change during STA connect to AP, see exampe_wifi_event.c.
-
enumerator RTW_EVENT_CSI_DONE
Indicate CSI data is ready, see exampe_wifi_csi.c.
-
enumerator RTW_EVENT_WPA_STA_WPS_START
STA WPS start.
-
enumerator RTW_EVENT_WPA_WPS_FINISH
STA WPS finish.
-
enumerator RTW_EVENT_WPA_EAPOL_START
STA WPA enterprise start.
-
enumerator RTW_EVENT_WPA_EAPOL_RECVD
STA WPA enterprise receive a eapol packet.
-
enumerator RTW_EVENT_MAX
-
enumerator RTW_EVENT_STA_ASSOC
-
enum rtw_security_flag
Values:
-
enumerator WEP_ENABLED
wep enable
-
enumerator TKIP_ENABLED
tkip enable
-
enumerator AES_ENABLED
aes enable
-
enumerator AES_CMAC_ENABLED
aes cmac enable
-
enumerator ENTERPRISE_ENABLED
enterprise enable
-
enumerator OWE_ENABLED
owe enable
-
enumerator SHARED_ENABLED
shared enable
-
enumerator WPA_SECURITY
wpa
-
enumerator WPA2_SECURITY
wpa2
-
enumerator WPA3_SECURITY
wpa3
-
enumerator WEP_ENABLED
-
enum rtw_disconn_reason
The enumeration lists the disconnet reasons in rtw_event_info_joinstatus_disconn when RTW_JOINSTATUS_DISCONNECT happenned.
Values:
-
enumerator RTW_DISCONN_RSN_80211_UNSPECIFIED
-
enumerator RTW_DISCONN_RSN_80211_PREV_AUTH_NOT_VALID
-
enumerator RTW_DISCONN_RSN_80211_DEAUTH_LEAVING
-
enumerator RTW_DISCONN_RSN_80211_DISASSOC_DUE_TO_INACTIVITY
-
enumerator RTW_DISCONN_RSN_80211_DISASSOC_AP_BUSY
-
enumerator RTW_DISCONN_RSN_80211_CLASS2_FRAME_FROM_NONAUTH_STA
-
enumerator RTW_DISCONN_RSN_80211_CLASS3_FRAME_FROM_NONASSOC_STA
-
enumerator RTW_DISCONN_RSN_80211_DISASSOC_STA_HAS_LEFT
-
enumerator RTW_DISCONN_RSN_80211_STA_REQ_ASSOC_WITHOUT_AUTH
-
enumerator RTW_DISCONN_RSN_80211_PWR_CAPABILITY_NOT_VALID
-
enumerator RTW_DISCONN_RSN_80211_SUPPORTED_CHANNEL_NOT_VALID
-
enumerator RTW_DISCONN_RSN_80211_INVALID_IE
-
enumerator RTW_DISCONN_RSN_80211_MICHAEL_MIC_FAILURE
-
enumerator RTW_DISCONN_RSN_80211_4WAY_HANDSHAKE_TIMEOUT
-
enumerator RTW_DISCONN_RSN_80211_GROUP_KEY_UPDATE_TIMEOUT
-
enumerator RTW_DISCONN_RSN_80211_IE_IN_4WAY_DIFFERS
-
enumerator RTW_DISCONN_RSN_80211_GROUP_CIPHER_NOT_VALID
-
enumerator RTW_DISCONN_RSN_80211_PAIRWISE_CIPHER_NOT_VALID
-
enumerator RTW_DISCONN_RSN_80211_AKMP_NOT_VALID
-
enumerator RTW_DISCONN_RSN_80211_UNSUPPORTED_RSN_IE_VERSION
-
enumerator RTW_DISCONN_RSN_80211_INVALID_RSN_IE_CAPAB
-
enumerator RTW_DISCONN_RSN_80211_IEEE_802_1X_AUTH_FAILED
-
enumerator RTW_DISCONN_RSN_80211_CIPHER_SUITE_REJECTED
-
enumerator RTW_DISCONN_RSN_DRV_BASE
-
enumerator RTW_DISCONN_RSN_DRV_AP_LOSS
-
enumerator RTW_DISCONN_RSN_DRV_AP_CHANGE
-
enumerator RTW_DISCONN_RSN_DRV_BASE_END
-
enumerator RTW_DISCONN_RSN_APP_BASE
-
enumerator RTW_DISCONN_RSN_APP_DISCONN
-
enumerator RTW_DISCONN_RSN_APP_CONN_WITHOUT_DISCONN
-
enumerator RTW_DISCONN_RSN_APP_BASE_END
-
enumerator RTW_DISCONN_RSN_MAX
-
enumerator RTW_DISCONN_RSN_80211_UNSPECIFIED
-
enum rtw_support_band
The enumeration lists supported band type.
Values:
-
enumerator RTW_SUPPORT_BAND_2_4G
2.4g band.
-
enumerator RTW_SUPPORT_BAND_5G
5g band.
-
enumerator RTW_SUPPORT_BAND_2_4G_5G_BOTH
2.4g&5g band.
-
enumerator RTW_SUPPORT_BAND_MAX
Max band.
-
enumerator RTW_SUPPORT_BAND_2_4G
-
enum rtw_speaker_set_type
The enumeration lists the type of speaker related settings.
Values:
-
enumerator RTW_SPEAKER_SET_INIT
-
enumerator RTW_SPEAKER_SET_LATCH_I2S_COUNT
-
enumerator RTW_SPEAKER_SET_TSF_TIMER
-
enumerator RTW_SPEAKER_SET_INIT
-
enum rtw_cus_ie_frame_type
The enumeration lists transmission frame type for wifi custom ie.
Values:
-
enumerator RTW_CUS_IE_PROBEREQ
Probe request.
-
enumerator RTW_CUS_IE_PROBERSP
Probe response.
-
enumerator RTW_CUS_IE_BEACON
Beacon.
-
enumerator RTW_CUS_IE_ASSOCREQ
Assocation request.
-
enumerator RTW_CUS_IE_PROBEREQ
-
enum rtw_promisc_filter_mode
The enumeration lists rcr mode under promisc.
Values:
-
enumerator RTW_PROMISC_FILTER_ALL_PKT
Receive all packets.
-
enumerator RTW_PROMISC_FILTER_AP_ALL
Receive all packtets send by connected ap.
-
enumerator RTW_PROMISC_FILTER_ALL_PKT
-
enum rtw_promisc_drv_hdl
The enumeration lists promisc callback return value.
Values:
-
enumerator RTW_PROMISC_NEED_DRV_HDL
Driver will continue process this pkt.
-
enumerator RTW_PROMISC_BYPASS_DRV_HDL
Driver will bypass this pkt.
-
enumerator RTW_PROMISC_NEED_DRV_HDL
-
enum rtw_band_type
The enumeration lists band type where the sta/ap is located.
Values:
-
enumerator RTW_BAND_ON_24G
band is on 2.4G
-
enumerator RTW_BAND_ON_5G
band is on 5G
-
enumerator RTW_BAND_ON_6G
band is on 6G
-
enumerator RTW_BAND_MAX
max band
-
enumerator RTW_BAND_ON_24G
-
enum rtw_wpa_mode
The enumeration lists wpa mode, size u8.
Values:
-
enumerator RTW_WPA_AUTO_MODE
wpa auto mode
-
enumerator RTW_WPA_ONLY_MODE
wpa only mode
-
enumerator RTW_WPA2_ONLY_MODE
wpa2 only mode
-
enumerator RTW_WPA3_ONLY_MODE
wpa3 only mode
-
enumerator RTW_WPA_WPA2_MIXED_MODE
wpa and wpa2 mixed mode
-
enumerator RTW_WPA2_WPA3_MIXED_MODE
wpa2 and wpa3 mixed mode
-
enumerator RTW_WPA_AUTO_MODE
-
enum rtw_security
The enumeration lists the possible security types to set when connection.
Station mode supports OPEN, WEP, and WPA2.
AP mode support OPEN and WPA2.Values:
-
enumerator RTW_SECURITY_OPEN
Open security
-
enumerator RTW_SECURITY_WEP_PSK
WEP Security with open authentication
-
enumerator RTW_SECURITY_WEP_SHARED
WEP Security with shared authentication
-
enumerator RTW_SECURITY_WPA_TKIP_PSK
WPA Security with TKIP
-
enumerator RTW_SECURITY_WPA_AES_PSK
WPA Security with AES
-
enumerator RTW_SECURITY_WPA_MIXED_PSK
WPA Security with AES & TKIP
-
enumerator RTW_SECURITY_WPA2_TKIP_PSK
WPA2 Security with TKIP
-
enumerator RTW_SECURITY_WPA2_AES_PSK
WPA2 Security with AES
-
enumerator RTW_SECURITY_WPA2_MIXED_PSK
WPA2 Security with AES & TKIP
-
enumerator RTW_SECURITY_WPA_WPA2_TKIP_PSK
WPA/WPA2 Security with TKIP
-
enumerator RTW_SECURITY_WPA_WPA2_AES_PSK
WPA/WPA2 Security with AES
-
enumerator RTW_SECURITY_WPA_WPA2_MIXED_PSK
WPA/WPA2 Security with AES & TKIP
-
enumerator RTW_SECURITY_WPA3_AES_PSK
WPA3-SAE with AES security
-
enumerator RTW_SECURITY_WPA3_OWE
WPA3-OWE with AES security
-
enumerator RTW_SECURITY_WPA2_WPA3_MIXED
WPA3-SAE/WPA2 with AES security
-
enumerator RTW_SECURITY_WPA2_AES_CMAC
WPA2 Security with AES and Management Frame Protection
-
enumerator RTW_SECURITY_OPEN
-
enum rtw_rate
The enumeration lists the BIT 7 HT Rate.
Values:
-
enumerator RTW_RATE_1M
0x02
-
enumerator RTW_RATE_2M
0x04
-
enumerator RTW_RATE_5_5M
0x0B
-
enumerator RTW_RATE_6M
0x0C
-
enumerator RTW_RATE_9M
0x12
-
enumerator RTW_RATE_11M
0x16
-
enumerator RTW_RATE_12M
0x18
-
enumerator RTW_RATE_18M
0x24
-
enumerator RTW_RATE_24M
0x30
-
enumerator RTW_RATE_36M
0x48
-
enumerator RTW_RATE_48M
0x60
-
enumerator RTW_RATE_54M
0x6C
-
enumerator RTW_RATE_MCS32
0x7f
-
enumerator RTW_RATE_MCS0
0x80
-
enumerator RTW_RATE_MCS1
0x81
-
enumerator RTW_RATE_MCS2
0x82
-
enumerator RTW_RATE_MCS3
0x83
-
enumerator RTW_RATE_MCS4
0x84
-
enumerator RTW_RATE_MCS5
0x85
-
enumerator RTW_RATE_MCS6
-
enumerator RTW_RATE_MCS7
-
enumerator RTW_RATE_VHT1SS_MCS0
-
enumerator RTW_RATE_VHT1SS_MCS1
-
enumerator RTW_RATE_VHT1SS_MCS2
-
enumerator RTW_RATE_VHT1SS_MCS3
-
enumerator RTW_RATE_VHT1SS_MCS4
-
enumerator RTW_RATE_VHT1SS_MCS5
-
enumerator RTW_RATE_VHT1SS_MCS6
-
enumerator RTW_RATE_VHT1SS_MCS7
-
enumerator RTW_RATE_VHT1SS_MCS8
-
enumerator RTW_RATE_VHT1SS_MCS9
-
enumerator RTW_RATE_HE1SS_MCS0
0xd0
-
enumerator RTW_RATE_HE1SS_MCS1
-
enumerator RTW_RATE_HE1SS_MCS2
-
enumerator RTW_RATE_HE1SS_MCS3
-
enumerator RTW_RATE_HE1SS_MCS4
-
enumerator RTW_RATE_HE1SS_MCS5
-
enumerator RTW_RATE_HE1SS_MCS6
-
enumerator RTW_RATE_HE1SS_MCS7
-
enumerator RTW_RATE_HE1SS_MCS8
-
enumerator RTW_RATE_HE1SS_MCS9
-
enumerator RTW_RATE_HE1SS_MCS10
-
enumerator RTW_RATE_HE1SS_MCS11
-
enumerator RTW_RATE_UNKNOWN
0xff
-
enumerator RTW_RATE_1M
-
enum rtw_csi_trig_frame_mgnt
csi trig management frame subtype.
Values:
-
enumerator RTW_CSI_TRIG_ASSOCREQ
-
enumerator RTW_CSI_TRIG_ASSOCRSP
-
enumerator RTW_CSI_TRIG_REASSOCREQ
-
enumerator RTW_CSI_TRIG_REASSOCRSP
-
enumerator RTW_CSI_TRIG_PROBEREQ
-
enumerator RTW_CSI_TRIG_PROBERSP
-
enumerator RTW_CSI_TRIG_BEACON
-
enumerator RTW_CSI_TRIG_ATIM
-
enumerator RTW_CSI_TRIG_DISASSOC
-
enumerator RTW_CSI_TRIG_AUTH
-
enumerator RTW_CSI_TRIG_DEAUTH
-
enumerator RTW_CSI_TRIG_ACTION
-
enumerator RTW_CSI_TRIG_ASSOCREQ
-
enum rtw_csi_trig_frame_ctrl
csi trig control frame subtype.
Values:
-
enumerator RTW_CSI_TRIG_TRIGGER
-
enumerator RTW_CSI_TRIG_BA
-
enumerator RTW_CSI_TRIG_PSPOLL
-
enumerator RTW_CSI_TRIG_RTS
-
enumerator RTW_CSI_TRIG_CTS
-
enumerator RTW_CSI_TRIG_ACK
-
enumerator RTW_CSI_TRIG_CFEND
-
enumerator RTW_CSI_TRIG_CFEND_CFACK
-
enumerator RTW_CSI_TRIG_TRIGGER
-
enum rtw_csi_trig_frame_data
csi trig data frame subtype.
Values:
-
enumerator RTW_CSI_TRIG_DATA
-
enumerator RTW_CSI_TRIG_DATA_CFACK
-
enumerator RTW_CSI_TRIG_DATA_CFPOLL
-
enumerator RTW_CSI_TRIG_DATA_CFACKPOLL
-
enumerator RTW_CSI_TRIG_DATA_NULL
-
enumerator RTW_CSI_TRIG_CF_ACK
-
enumerator RTW_CSI_TRIG_CF_POLL
-
enumerator RTW_CSI_TRIG_CF_ACKPOLL
-
enumerator RTW_CSI_TRIG_QOS_DATA
-
enumerator RTW_CSI_TRIG_QOS_DATA_NULL
-
enumerator RTW_CSI_TRIG_DATA
-
enum rtw_csi_action_type
csi enable or config.
Values:
-
enumerator RTW_CSI_ACT_EN
enable or disable csi func
-
enumerator RTW_CSI_ACT_CFG
config csi parameters
-
enumerator RTW_CSI_ACT_MAX
-
enumerator RTW_CSI_ACT_EN
-
enum rtw_csi_group_num
csi group num.
Values:
-
enumerator RTW_CSI_GROUP_NUM_1
per tone
-
enumerator RTW_CSI_GROUP_NUM_2
per 2tone
-
enumerator RTW_CSI_GROUP_NUM_4
per 4tone
-
enumerator RTW_CSI_GROUP_NUM_8_16
per 8tone for dplus; per 16tone for others
-
enumerator RTW_CSI_GROUP_NUM_MAX
-
enumerator RTW_CSI_GROUP_NUM_1
-
enum rtw_csi_mode
csi mode.
Values:
-
enumerator RTW_CSI_MODE_NORMAL
rx normal mode
-
enumerator RTW_CSI_MODE_NDP
rx ndp mode: not support
-
enumerator RTW_CSI_MODE_RX_RESP
rx response mode
-
enumerator RTW_CSI_MODE_MAX
-
enumerator RTW_CSI_MODE_NORMAL
-
enum rtw_csi_accuracy
csi accuracy.
Values:
-
enumerator RTW_CSI_ACCU_1BYTE
S(8,3) for dplus and S(8,4) for others
-
enumerator RTW_CSI_ACCU_2BYTES
S(16,11) for dplus and S(16,12) for others
-
enumerator RTW_CSI_ACCU_MAX
-
enumerator RTW_CSI_ACCU_1BYTE
-
enum rtw_csi_alg
csi alg_opt.
Values:
-
enumerator RTW_CSI_ALG_LS
ls algo
-
enumerator RTW_CSI_ALG_SMOTHING
smothing algo
-
enumerator RTW_CSI_ALG_MAX
other algo
-
enumerator RTW_CSI_ALG_LS
-
enum rtw_csi_ch
csi ch_opt.
Values:
-
enumerator RTW_CSI_CH_LEGACY
legacy part(L-LTF) channel estmation result
-
enumerator RTW_CSI_CH_NON_LEGACY
non-legacy(HT-LTF) part
-
enumerator RTW_CSI_CH_MAX
-
enumerator RTW_CSI_CH_LEGACY
-
enum rtw_csi_role
csi csi_role.
Values:
-
enumerator RTW_CSI_OP_ROLE_TRX
both trx
-
enumerator RTW_CSI_OP_ROLE_TX
only tx csi triggering frame
-
enumerator RTW_CSI_OP_ROLE_RX
only rx csi triggering frame for fetching csi report
-
enumerator RTW_CSI_OP_ROLE_MAX
-
enumerator RTW_CSI_OP_ROLE_TRX
-
enum rtw_power_mgnt_mode
Power Mgnt.
Values:
-
enumerator RTW_PS_MODE_ACTIVE
active mode
-
enumerator RTW_PS_MODE_LEGACY
legacy mode
-
enumerator RTW_PS_MODE_UAPSD_WMM
uapsd wmm mode
-
enumerator RTW_PS_MODE_WTNPS
wtn ps mode
-
enumerator RTW_PS_MODE_ACTIVE
-
enum rtw_trp_tis_mode
The enumeration lists the trp tis types.
Values:
-
enumerator RTW_TRP_TIS_DISABLE
-
enumerator RTW_TRP_TIS_NORMAL
-
enumerator RTW_TRP_TIS_DYNAMIC
enable dynamic mechanism
-
enumerator RTW_TRP_TIS_FIX_ACK_RATE
fix ack rate to 6M
-
enumerator RTW_TRP_TIS_FIX_PHY_ACK_HIGH_RATE
fix phy ack rate to RATE_54M | RATE_48M | RATE_36M | RATE_24M | RATE_18M | RATE_12M | RATE_9M | RATE_6M
-
enumerator RTW_TRP_TIS_DISABLE
-
enum rtw_edcca_mode
The enumeration lists the edcca mode types.
Values:
-
enumerator RTW_EDCCA_NORM
-
enumerator RTW_EDCCA_ADAPT
-
enumerator RTW_EDCCA_CS
-
enumerator RTW_EDCCA_DISABLE
-
enumerator RTW_EDCCA_NORM
-
enum rtw_antdiv_mode
The enumeration lists the antdiv mode types.
Values:
-
enumerator RTW_ANTDIV_AUTO
-
enumerator RTW_ANTDIV_FIX_MAIN
-
enumerator RTW_ANTDIV_FIX_AUX
-
enumerator RTW_ANTDIV_DISABLE
-
enumerator RTW_ANTDIV_AUTO
-
enum rtw_bss_type
The enumeration lists the bss types. size u8.
Values:
-
enumerator RTW_BSS_TYPE_INFRASTRUCTURE
Denotes infrastructure network
-
enumerator RTW_BSS_TYPE_WTN_HELPER
Denotes an wtn helper network
-
enumerator RTW_BSS_TYPE_UNKNOWN
-
enumerator RTW_BSS_TYPE_INFRASTRUCTURE
-
enum rtw_scan_type
The enumeration lists the scan options.
Values:
-
enumerator RTW_SCAN_NOUSE
default value
-
enumerator RTW_SCAN_ACTIVE
active scan
-
enumerator RTW_SCAN_PASSIVE
passive scan
-
enumerator RTW_SCAN_NO_HIDDEN_SSID
Filter hidden ssid APs
-
enumerator RTW_SCAN_REPORT_EACH
report each
-
enumerator RTW_SCAN_WITH_P2P
for P2P usage
-
enumerator RTW_SCAN_NOUSE
-
enum rtw_wps_type
The enumeration lists the WPS types.
Values:
-
enumerator RTW_WPS_TYPE_DEFAULT
default type
-
enumerator RTW_WPS_TYPE_USER_SPECIFIED
user specified type
-
enumerator RTW_WPS_TYPE_MACHINE_SPECIFIED
machine specified type
-
enumerator RTW_WPS_TYPE_REKEY
retry key type
-
enumerator RTW_WPS_TYPE_PUSHBUTTON
push button type
-
enumerator RTW_WPS_TYPE_REGISTRAR_SPECIFIED
register specified type
-
enumerator RTW_WPS_TYPE_NONE
none
-
enumerator RTW_WPS_TYPE_WSC
wsc type
-
enumerator RTW_WPS_TYPE_DEFAULT
-
enum rtw_drv_op_mode
The enumeration lists the supported operation mode by WIFI driver, including station and AP mode.
Values:
-
enumerator RTW_MODE_NONE
none
-
enumerator RTW_MODE_STA
sta mode
-
enumerator RTW_MODE_AP
ap mode
-
enumerator RTW_MODE_NAN
nan mode
-
enumerator RTW_MODE_MAX
-
enumerator RTW_MODE_NONE
-
enum rtw_ips_level
The enumeration lists the power save status.
Values:
-
enumerator RTW_IPS_WIFI_OFF
-
enumerator RTW_IPS_WIFI_PG
-
enumerator RTW_IPS_LEVEL_MAX
-
enumerator RTW_IPS_WIFI_OFF
-
enum rtw_uapsd_max_sp
Values:
-
enumerator RTW_UAPSD_NO_LIMIT
-
enumerator RTW_UAPSD_TWO_MSDU
-
enumerator RTW_UAPSD_FOUR_MSDU
-
enumerator RTW_UAPSD_SIX_MSDU
-
enumerator RTW_UAPSD_NO_LIMIT
-
enum rtw_wireless_mode
The enumeration lists all the network mode.
Values:
-
enumerator RTW_80211_INVALID
-
enumerator RTW_80211_B
-
enumerator RTW_80211_A
-
enumerator RTW_80211_G
-
enumerator RTW_80211_N
-
enumerator RTW_80211_AC
-
enumerator RTW_80211_AX
-
enumerator RTW_80211_BG
-
enumerator RTW_80211_GN
-
enumerator RTW_80211_AN
-
enumerator RTW_80211_BN
-
enumerator RTW_80211_BGN
-
enumerator RTW_80211_BGAX
-
enumerator RTW_80211_GAX
-
enumerator RTW_80211_A_AC
-
enumerator RTW_80211_A_AX
-
enumerator RTW_80211_AGN
-
enumerator RTW_80211_ABGN
-
enumerator RTW_80211_ANAC
-
enumerator RTW_80211_24G_MIX
-
enumerator RTW_80211_5G_MIX
-
enumerator RTW_80211_MAX
-
enumerator RTW_80211_INVALID
-
enum rtw_txpwr_lmt
Values:
-
enumerator TXPWR_LMT_FCC
-
enumerator TXPWR_LMT_MKK
-
enumerator TXPWR_LMT_ETSI
-
enumerator TXPWR_LMT_IC
-
enumerator TXPWR_LMT_KCC
-
enumerator TXPWR_LMT_ACMA
-
enumerator TXPWR_LMT_CHILE
-
enumerator TXPWR_LMT_MEXICO
-
enumerator TXPWR_LMT_WW
-
enumerator TXPWR_LMT_GL
-
enumerator TXPWR_LMT_UKRAINE
-
enumerator TXPWR_LMT_CN
-
enumerator TXPWR_LMT_QATAR
-
enumerator TXPWR_LMT_UK
-
enumerator TXPWR_LMT_NCC
-
enumerator TXPWR_LMT_EXT
-
enumerator TXPWR_LMT_CONST_MAX
-
enumerator TXPWR_LMT_FCC
-
enum rtw_frame_type
Values:
-
enumerator RTW_MGT_TYPE
-
enumerator RTW_CTRL_TYPE
-
enumerator RTW_DATA_TYPE
-
enumerator RTW_QOS_DATA_TYPE
QoS Data.
-
enumerator RTW_MGT_TYPE
-
enum rtw_frame_type_subtype
Values:
-
enumerator RTW_ASSOCREQ
-
enumerator RTW_ASSOCRSP
-
enumerator RTW_REASSOCREQ
-
enumerator RTW_REASSOCRSP
-
enumerator RTW_PROBEREQ
-
enumerator RTW_PROBERSP
-
enumerator RTW_BEACON
-
enumerator RTW_ATIM
-
enumerator RTW_DISASSOC
-
enumerator RTW_AUTH
-
enumerator RTW_DEAUTH
-
enumerator RTW_ACTION
-
enumerator RTW_PSPOLL
-
enumerator RTW_RTS
-
enumerator RTW_CTS
-
enumerator RTW_ACK
-
enumerator RTW_BA
-
enumerator RTW_CFEND
-
enumerator RTW_CFEND_CFACK
-
enumerator RTW_TRIGGER
-
enumerator RTW_DATA
-
enumerator RTW_DATA_CFACK
-
enumerator RTW_DATA_CFPOLL
-
enumerator RTW_DATA_CFACKPOLL
-
enumerator RTW_DATA_NULL
-
enumerator RTW_CF_ACK
-
enumerator RTW_CF_POLL
-
enumerator RTW_CF_ACKPOLL
-
enumerator RTW_QOS_DATA_NULL
-
enumerator RTW_ASSOCREQ
Structure Type
-
struct rtw_event_info_joinstatus_disconn
Buf of RTW_EVENT_JOIN_STATUS when flag is RTW_JOINSTATUS_DISCONNECT.
Public Members
-
u16 disconn_reason
Val: RTW_DISCONN_RSN_80211_UNSPECIFIED, RTW_DISCONN_RSN_80211_PREV_AUTH_NOT_VALID…
-
u8 bssid[6]
AP’s MAC address.
-
u16 disconn_reason
-
struct rtw_event_info_joinstatus_joinfail
Buf of RTW_EVENT_JOIN_STATUS when flag is RTW_JOINSTATUS_FAIL.
Public Members
-
s32 fail_reason
Value: RTK_FAIL, -RTK_ERR_WIFI_CONN_INVALID_KEY…
-
u16 reason_or_status_code
From AP, define in 802.11 spec.
-
u8 bssid[6]
AP’s MAC address.
-
s32 fail_reason
-
struct rtw_ssid
The structure is used to describe the SSID (Service Set Identification), i.e., the name of Access Point.
Public Members
-
u8 len
SSID length, i.e., equal to the length of
val
. The length of ssid should not > RTW_ESSID_MAX_SIZE.
-
u8 val[RTW_ESSID_MAX_SIZE + 1]
SSID name (AP name).
-
u8 len
-
struct rtw_mac
The structure is used to describe the unique 6-byte MAC address.
Public Members
-
u8 octet[6]
Unique 6-byte MAC address.
-
u8 octet[6]
-
struct rtw_acs_mntr_rpt
The structure is used to describe the busyness of a channel for ACS(Automatic Channel Selection).
Public Members
-
u16 meas_time
Measurements time on this channel, unit:ms.
-
u16 busy_time
Time that the primary channel was sensed busy, unit:ms.
-
u16 tx_time
Time spent transmitting frame on this channel, unit:ms.
-
s8 noise
Noise power measured on this channel, unit: dbm.
-
u8 channel
The scanned channel number.
-
u16 meas_time
-
struct rtw_scan_result
The structure is used to describe the details of a scanned AP.
Public Members
-
s16 signal_strength
Receive Signal Strength Indication in dBm. <-90=Very poor, >-30=Excellent.
-
u8 bss_type
The bss type. The noraml type is infrastructure BSS. Val: RTW_BSS_TYPE_INFRASTRUCTURE, RTW_BSS_TYPE_WTN_HELPER.
-
u32 security
The security type of this AP. Val: RTW_SECURITY_OPEN, RTW_SECURITY_WEP_PSK…
-
u8 wps_type
The WPS(Wi-Fi Protected Setup) types supported by this AP. Val: RTW_WPS_TYPE_DEFAULT, RTW_WPS_TYPE_USER_SPECIFIED…
-
u32 channel
Radio channel that the AP beacon was received on.
-
u8 band
The frequency ranges used by this AP. Val: RTW_BAND_ON_5G, RTW_BAND_ON_24G.
-
u8 country_code[2]
The wireless spectrum management regulations of which region followed by the AP.
country_code
is coded according to ISO 3166 standard. Specific values can refer to ameba_wifi_country_code_table_usrcfg.c.
e.g. China: country_code[0] = ‘C’, country_code[1] = ‘N’.
-
u8 wireless_mode
The wireless mode of this AP. Val: RTW_80211_B, RTW_80211_A…
-
u8 rom_rsvd[3]
-
s16 signal_strength
-
struct rtw_channel_scan_time
The structure is used to describe the scan time per channel.
-
struct rtw_scan_param
The structure is used to describe the scan parameters used for scan.
Public Members
-
u8 options
The scan option, such as active scan. Val: RTW_SCAN_ACTIVE, RTW_SCAN_PASSIVE…
-
u8 *ssid
The data length of string pointed by ssid should not exceed RTW_ESSID_MAX_SIZE.
-
u8 *channel_list
The list of specified channels to be scanned.
-
u8 channel_list_num
The total number in
channel_list
.
-
struct rtw_channel_scan_time chan_scan_time
The scan time per channel.
-
u16 max_ap_record_num
Config the max number of recorded AP. When set to 0, use default value 64. When the number of scanned APs exceed
max_ap_record_num
, the AP(s) with smallest rssi will be discarded.
-
void *scan_user_data
-
s32 (*scan_user_callback)(u32 ap_num, void *user_data)
Used for normal asynchronized mode.
-
s32 (*scan_report_each_mode_user_callback)(struct rtw_scan_result *scanned_ap_info, void *user_data)
Used for RTW_SCAN_REPORT_EACH mode.
-
s32 (*scan_report_acs_user_callback)(struct rtw_acs_mntr_rpt *acs_mntr_rpt)
Used for report acs info.
-
u8 options
-
struct rtw_wpa_supp_connect
The structure is used for Linux host to get wpa_supplicant’s info for STA connect, which RTOS not need.
Public Members
-
u8 rsnxe_ie[RSNXE_MAX_LEN]
The RSNXE IE in beacon of AP which STA is trying to connect.
-
u8 rsnxe_ie[RSNXE_MAX_LEN]
-
struct rtw_network_info
The structure is used to describe the connection setting about SSID, security type and password,etc., used when trying to connect an AP.
备注
If this struct is used for wifi connect, the channel is used to config whether it is a full channel scan(when channel is set to 0), or it will only scan one channel(do active scan on the configured channel).
pscan_option
set to RTW_PSCAN_FAST_SURVEY means do fast survey on the specified channel set to 0 means do normal scan on the specified channel or full channel.
Public Members
-
struct rtw_ssid ssid
The AP’s name and the length of name (should not exceed RTW_ESSID_MAX_SIZE).
-
u32 security_type
Only need to be set when use WEP (RTW_SECURITY_WEP_PSK RTW_SECURITY_WEP_SHARED), Other case will automatically adjust according to the AP.
-
u8 *password
The password of AP which sta is trying to connect.
-
s32 password_len
The data length of string pointed by password should not exceed RTW_MAX_PSK_LEN. Equal to length of
password
.
-
s32 key_id
Only need to be set when use WEP. Val: 0~3.
-
u8 channel
Set to 0 means full channel scan, set to other value means only scan on the specified channel.
-
u8 pscan_option
Can set to RTW_PSCAN_FAST_SURVEY for fast survey, which means quick scan, involves using an active scan on a specified channel, scanning for 25ms each time, and attempting up to 7 times until the target AP is found..
-
u8 is_wps_trigger
Connection triggered by WPS process.
-
struct rtw_wpa_supp_connect wpa_supp
Only used by Linux host to specific some details required for STA connect, which RTOS do not use.
-
u8 by_reconn
Connection triggered by RTK auto reconnect process.
-
u8 rom_rsvd[4]
-
struct rtw_conn_step_retries
The structure is retry_limit for auth/assoc/key exchange.
备注
All re_limits are limited to within 10.
-
struct rtw_wifi_setting
The structure is used to store the WIFI setting gotten from WIFI driver.
备注
Size can’t be changed.
Public Members
-
u8 mode
The mode of current wlan interface, val: RTW_MODE_STA, RTW_MODE_AP, RTW_MODE_NAN.
-
u8 ssid[33]
The ssid of connected AP or softAP.
-
u8 bssid[6]
The bssid of connected AP or softAP.
-
u8 channel
-
u32 security_type
The security type of connected AP or softAP, val: RTW_SECURITY_OPEN, RTW_SECURITY_WEP_PSK…
-
u8 password[RTW_MAX_PSK_LEN]
The password of connected AP or softAP.
-
u8 key_idx
-
u8 alg
Encryption algorithm.
-
u32 auth_type
-
u8 is_wps_trigger
Connection triggered by WPS process.
-
u32 rom_rsvd
-
u8 mode
-
union rtw_traffic_stats
- #include <wifi_api_types.h>
The structure is used to describe the traffic statistics.
Public Members
-
struct rtw_traffic_stats::rtw_sta_traffic_stats sta
For STA mode statistic.
-
struct rtw_traffic_stats::rtw_ap_traffic_stats ap
For SOFTAP mode statistic.
-
struct rtw_ap_traffic_stats
- #include <wifi_api_types.h>
-
struct rtw_sta_traffic_stats
- #include <wifi_api_types.h>
Public Members
-
u32 rx_packets
total packets received on the interface(exclude custom pkts).
-
u32 tx_packets
total packets transmitted on the interface.
-
u8 cur_rx_data_rate
Current rx data rate, val: RTW_RATE_1M, RTW_RATE_2M…
-
u8 cur_tx_data_rate
Current tx data rate, val: RTW_RATE_1M, RTW_RATE_2M…
-
u32 rx_packets
-
struct rtw_traffic_stats::rtw_sta_traffic_stats sta
-
union rtw_phy_stats
- #include <wifi_api_types.h>
The structure is used to describe the phy statistics.
Public Members
-
struct rtw_phy_stats::rtw_sta_phy_stats sta
For STA mode statistic.
-
struct rtw_phy_stats::rtw_ap_phy_stats ap
For SOFTAP mode statistic.
-
struct rtw_phy_stats::rtw_cmn_phy_stats cmn
For common statistic.
-
struct rtw_ap_phy_stats
- #include <wifi_api_types.h>
Public Members
-
s8 data_rssi
Average data rssi in 1 sec.
-
s8 data_rssi
-
struct rtw_cmn_phy_stats
- #include <wifi_api_types.h>
Public Members
-
u8 cca_clm
Channel loading measurement ratio by cca (the ratio of CCA = 1 in number of samples). driver do clm every 2 seconds, the value is the lastest result.
-
u8 edcca_clm
Channel loading measurement ratio by edcca (the ratio of EDCCA = 1 in number of samples). The value is also the lastest result.
-
u8 clm_channel
Channel corresponding to the latest clm result.
-
u8 cca_clm
-
struct rtw_sta_phy_stats
- #include <wifi_api_types.h>
-
struct rtw_phy_stats::rtw_sta_phy_stats sta
-
struct rtw_softap_info
The structure is used to describe the setting about SSID, security type, password and default channel, used to start AP mode.
备注
The data length of string pointed by ssid should not exceed RTW_ESSID_MAX_SIZE, and the data length of string pointed by password should not exceed RTW_MAX_PSK_LEN.
-
struct rtw_client_list
The structure is used to describe the associated clients of SoftAP.
-
struct rtw_csa_parm
The structure is used to describe the cfg parameters used for channel switch announcement.
Public Members
-
u8 new_chl
The new channel will be switched to.
-
u8 chl_switch_cnt
The channel switch cnt, after chl_switch_cnt*102ms, ap will switch to new channel.
-
u8 action_type
0: unicast csa action, 1: broadcast csa action, other values: disable transmit csa action.
-
u8 bc_action_cnt
Indicate the number of broadcast csa actions to send for each beacon interval. only valid when action_type = 1.
-
void (*callback)(u8 channel, s8 ret)
User handle when softap switch channel by csa function. This callback will be called after channel switch is done, and will return the new channel number and channel switch result.
- Param channel:
[in] New channel.
- Param ret:
[in] Val: RTK_FAIL, RTK_SUCCESS.
-
u8 new_chl
-
struct rtw_rx_pkt_info
The structure is used to describe the rx packet’s detail information.
Public Members
-
s8 recv_signal_power
-
u8 data_rate
Val: RTW_RATE_1M, RTW_RATE_2M…
-
u8 channel
-
u8 *buf
-
u32 len
-
s8 recv_signal_power
-
struct rtw_promisc_para
The structure is used to describe the selected promisc mode and callback function.
Public Members
-
u8 filter_mode
Receive all packets in the air or set some filtering conditions.
RTW_PROMISC_FILTER_ALL_PKT : Receive all packets in the air.
RTW_PROMISC_FILTER_AP_ALL : Receive all packtets send by connected AP.
-
u8 (*callback)(struct rtw_rx_pkt_info *pkt_info)
User handle a packet.
- Param pkt_info:
[in] The pointer of a struct rtw_rx_pkt_info which store the packet’s detail information.
- Return:
Should the driver continue processing this packet after user has processed.
RTW_PROMISC_NEED_DRV_HDL : Driver continue processing this packet, This setting is usually required when the STA remains connected.
RTW_PROMISC_BYPASS_DRV_HDL : Driver drop this packet, This setting is usually used when STA does not need connect.
-
u8 filter_mode
-
union rtw_speaker_set
- #include <wifi_api_types.h>
Public Members
-
struct rtw_speaker_set::rtw_speaker_init init
For wifi speaker setting case RTW_SPEAKER_SET_INIT.
-
struct rtw_speaker_set::rtw_speaker_i2s latch_i2s_count
For wifi speaker setting case RTW_SPEAKER_SET_LATCH_I2S_COUNT.
-
struct rtw_speaker_set::rtw_speaker_tsf_timer tsf_timer
For wifi speaker setting case RTW_SPEAKER_SET_TSF_TIMER.
-
struct rtw_speaker_i2s
- #include <wifi_api_types.h>
-
struct rtw_speaker_init
- #include <wifi_api_types.h>
-
struct rtw_speaker_tsf_timer
- #include <wifi_api_types.h>
-
struct rtw_speaker_set::rtw_speaker_init init
-
struct rtw_csi_header
The structure for layout of csi report header.
Public Members
-
u16 csi_signature
pattern that be used to detect a new CSI packet
-
u8 hdr_len
client MAC address, specifies transmitter address (MAC address) for CSI triggering frame in Active CSI and receiver address for CSI triggering frame in Passive CSI.
-
u8 mac_addr[6]
client MAC address, specifies destination address (MAC address) for CSI triggering frame in Active CSI and source address for CSI triggering frame in Passive CSI (purpose to fetch CSI information from response packet)
-
u8 trig_addr[6]
-
u32 hw_assigned_timestamp
csi timestamp,unit:us
-
u32 csi_sequence
csi data sequence number
-
u32 csi_data_length
csi raw data length, unit: byte
-
u8 csi_valid
indicates the current csi raw data whether valid
-
u8 channel
operation channel
-
u8 bandwidth
operation bandwidth
-
u8 rx_rate
the rate of rx packet which used to obtain csi info
-
u8 protocol_mode
protocol mode of the response packet, ofdm(0)/ht(1)/vht(2)/he(3)
-
u16 num_sub_carrier
number of subcarriers contain in csi raw data
-
u8 num_bit_per_tone
csi data wordlength(sum of I and Q)
-
s8 rssi[2]
rssi[0]: dbm, rssi[1] is reserved
-
s8 evm[2]
reserved, db
-
u8 rxsc
indicate which sub 20M channel is used to transmit packet
-
u8 n_rx
reserved
-
u8 n_sts
reserved
-
u8 trig_flag
indicate source of role for triggering csi in sta-sta csi mode, trig_addr is invalid if zero
-
u8 rsvd[5]
-
u16 csi_signature
-
struct rtw_csi_action_parm
The structure is used to describe the cfg parameters used for csi report.
备注
The mac_addr if not specified, the default value must be 0.
Public Members
-
u8 group_num
-
u8 accuracy
-
u8 alg_opt
-
u8 ch_opt
-
u8 csi_role
indicate csi operation role, val: RTW_CSI_OP_ROLE_TRX, RTW_CSI_OP_ROLE_TX, RTW_CSI_OP_ROLE_RX
-
u8 mode
val: RTW_CSI_MODE_NORMAL, RTW_CSI_MODE_NDP, RTW_CSI_MODE_RX_RESP
-
u8 act
-
u16 trig_frame_mgnt
indicate management frame subtype of rx csi triggering frame for fetching csi, val: RTW_CSI_TRIG_ASSOCREQ…
-
u16 trig_frame_ctrl
indicate control frame subtype of rx csi triggering frame for fetching csi, val: RTW_CSI_TRIG_TRIGGER…
-
u16 trig_frame_data
indicate data frame subtype of rx csi triggering frame for fetching csi, val: RTW_CSI_TRIG_DATA…
-
u8 enable
-
u8 trig_period
-
u8 data_rate
-
u8 data_bw
-
u8 mac_addr[6]
-
u8 multi_type
0-uc csi triggering frame; 1-bc csi triggering frame
-
u8 trig_flag
indicate role for transmitting CSI triggering frame in METHOD4 and role for transmitting response ACK for CSI triggering frame in METHOD1_Variant, others are reserved.
Value=1 ~ 15 (0 is reserved)
-
u8 group_num
-
struct _pwr_lmt_regu_remap
The structure is power limit regu map.
-
struct rtw_raw_frame_desc
The structure is used to describe the raw frame.
Public Members
-
u8 wlan_idx
Index of wlan interface which will transmit.
-
u8 device_id
Index of peer device which as a rx role for receiving this pkt, and will be update when linked peer.
-
u8 *buf
Poninter of buf where raw data is stored.
-
u16 buf_len
The length of raw data.
-
u8 tx_rate
Val: RTW_RATE_1M, RTW_RATE_2M…
-
u8 retry_limit
-
u8 ac_queue
0/3 for BE, 1/2 for BK, 4/5 for VI, 6/7 for VO.
-
u8 sgi
1 for enable data short.
-
u8 agg_en
Aggregation of tx_raw frames. 1:enable; 0-disable.
-
u8 wlan_idx
-
struct rtw_custom_ie
The structure is used to set WIFI custom ie list.
-
struct rtw_channel_info
The structure is used to describe channel info.
-
struct rtw_channel_list
The structure is used to describe channel list.
Public Members
-
u8 ch_num
Number of available channel in the list.
-
struct rtw_channel_info ch_info[RTW_MAX_CHANNEL_NUM]
-
u8 ch_num
-
struct rtw_country_code_table
The structure is used to describe channel plan and country code.
-
struct rtw_tx_power_ctl_info