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”.

备注

  • Called by default in wifi_init.c.

  • For WHC host mode: Call whc_host_init() first to initialize the host-device interface.

  • For WHC device mode: Automatically called by host’s wifi_on(); no user action required.

  • 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 : The API executed successfully.

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).

返回:

  • 1: The interface is running.

  • 0: The interface is not running.

s32 wifi_connect(struct rtw_network_info *connect_param, u8 block)

Join a Wi-Fi network by scanning, authenticating, and associating.

备注

  • Ensure Wi-Fi is enabled (wifi_on()) before calling this function.

  • If connect_param->bssid is set, it takes precedence over connect_param->ssid for connection.

  • Asynchronous Wi-Fi connect results are obtained through the event handler registered for RTW_EVENT_JOIN_STATUS (see example_wifi_event.c).

参数:
  • connect_param[in] Pointer to a struct containing connection info (SSID, BSSID, password, etc.). See struct rtw_network_info in wifi_api_types.h for details.

  • block[in]

    • 1: Synchronous Wi-Fi connect (function returns after connection attempt completes).

    • 0: Asynchronous Wi-Fi connect (function returns immediately after initiating connection).

返回:

s32 wifi_disconnect(void)

Disassociates from current Wi-Fi network.

备注

The return value RTK_SUCCESS indicates that the disconnection request was successfully initiated, not that the disconnection has completed. The actual disconnection time may vary depending on the current Wi-Fi connection status. If this function is called while a Wi-Fi connection is in progress, the disconnection will occur after the ongoing connection attempt is completed.

返回:

s32 wifi_get_join_status(u8 *join_status)

Get join status during Wi-Fi connectection.

参数:

join_status[out] the join status during Wi-Fi connectection.

返回:

RTK_SUCCESS : The API executed successfully.

s32 wifi_scan_networks(struct rtw_scan_param *scan_param, u8 block)

Initiate a scan to search for 802.11 networks.

备注

  1. Scan Types:

    • Synchronous scan: Calling thread waits until scan done;

    • Asynchronous scan: Function returns immediately after parameter check.

  2. Scan Result Reporting:

    1. Bulk Report:

      • Total number of scanned APs reported via scan_param->scan_user_callback (async) or return value (sync).

      • Detailed APs info gotten by calling wifi_get_scan_records().

      • For async scan, need to register scan_param->scan_user_callback.

    2. Individual Report:

      • Each scanned AP reported via scan_param->scan_report_each_mode_user_callback.

      • Scan completion indicated by NULL pointer in scan_report_each_mode_user_callback.

      • Need to register scan_param->scan_user_callback and set scan_param->options to RTW_SCAN_REPORT_EACH.

  3. Memory Management:

    • Scanned APs info stored in driver’s dynamic allocated memory.

    • For bulk report, memory freed when wifi_get_scan_records() is called.

参数:
  • scan_param[in] Scan parameters. See struct rtw_scan_param in wifi_api_types.h for details.

  • block[in]

    • 1: Synchronous scan (function returns after scan completes).

    • 0: Asynchronous scan (function returns immediately).

返回:

Number of scanned APs if successful (≥ 0), or an error code:

  • RTK_FAIL : Driver internal error.

  • -RTK_ERR_BUSY : Wi-Fi connect or scan is ongoing.

  • -RTK_ERR_BADARG : Invalid input parameters, such as set block to 1 but simultaneously register scan_param->scan_user_callback.

s32 wifi_get_scan_records(u32 *ap_num, struct rtw_scan_result *ap_list)

Get scan results.

备注

  • For scan which not config RTW_SCAN_REPORT_EACH : If wifi_scan_networks() is called but this API is not used to get scanned results, driver memory for scanned APs will be retained until the next wifi_scan_networks() call.

  • For scan which config RTW_SCAN_REPORT_EACH : Every time a AP is scanned, the AP info will be directly reported via scan_report_each_mode_user_callback and freed after callback execution, thus this function is not needed to get scan results.

参数:
  • ap_num[inout] Pointer to the number of AP records:

    • Input: Desired number of AP records;

    • Output: Actual number of AP records retrieved.

  • ap_list[in] A buffer stores scanned AP list, each entry as struct rtw_scan_result.

返回:

s32 wifi_start_ap(struct rtw_softap_info *softap_config)

Start an infrastructure Wi-Fi network (SoftAP).

备注

  • If a STA interface already connected or connecting to an AP, the SoftAP will start on the same channel as the STA, not using the channel specified in the configuration.

  • Setting softap_config->hidden_ssid to 1 will start a hidden SSID SoftAP.

  • Ensure Wi-Fi is enabled (wifi_on()) before calling this function.

参数:

softap_config[in] Pointer to a struct containing SoftAP configuration parameters. See struct rtw_softap_info in wifi_api_types.h for details.

返回:

s32 wifi_stop_ap(void)

Disable SoftAP (i.e. Wi-Fi interface-1).

返回:

RTK_SUCCESS : The API executed successfully.

s32 wifi_get_setting(u8 wlan_idx, struct rtw_wifi_setting *psetting)

Get current Wi-Fi settings from driver.

备注

The mode in struct rtw_wifi_setting corresponding to the Wi-Fi mode of the specified wlan_idx:

  • In station mode: Information corresponds to the connected AP.

  • In AP mode: Information corresponds to the SoftAP itself.

参数:
返回:

s32 wifi_scan_abort(void)

Abort onoging Wi-Fi scan.

备注

  • This 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 Wi-Fi scan in progress, this function will just return RTK_SUCCESS and user callback won’t be executed.

返回:

RTK_SUCCESS or RTK_FAIL.

s32 wifi_set_lps_enable(u8 enable)

Enable or disable Legacy Power Save (LPS) mode. In LPS mode, Wi-Fi automatically turns the RF off when the traffic between the STA and the connected AP is low and periodically turns it on to listen to the beacons from the associated AP.

备注

  • This function does not work if a SoftAP interface is active.

  • STA does not immediately enter LPS; entry depends on current traffic status.

  • This function temporarily overrides the default LPS setting in ameba_wificfg.c (wifi_user_config.lps_enable).

参数:

enable[in] 1 to enable LPS, 0 to disable LPS.

返回:

RTK_SUCCESS : The API executed successfully.

s32 wifi_set_lps_listen_interval(u8 interval)

Set the listen interval for Legacy Power Save (LPS) mode. The listen interval dictates how frequently the STA wakes up to listen to AP beacons when in LPS mode.

备注

  • If interval is not a multiple of the beacon interval, it’s rounded down to the largest multiple <= specified value.

  • If interval < beacon interval, it’s set to one beacon interval.

  • For example, if the beacon interval is 2 * 102.4 ms:

    • wifi_set_lps_listen_interval(5) sets interval to 4 * 102.4 ms

    • wifi_set_lps_listen_interval(1) sets interval to 2 * 102.4 ms

参数:

interval[in] The listen interval for LPS, in units of 102.4 ms.

返回:

RTK_SUCCESS : The API executed successfully.

s32 wifi_set_autoreconnect(u8 enable)

Set the auto-reconnect mode for Wi-Fi connection. This function allows temporarily enabling or disabling auto-reconnect mode, overriding the default setting in ameba_wificfg.c.

参数:

enable[in]

  • 1: Enable auto-reconnect mode.

  • 0: Disable auto-reconnect mode.

返回:

  • RTK_SUCCESS : The API executed successfully.

  • RTK_FAIL : CONFIG_AUTO_RECONNECT in not defined or creating reconnect timer failed.

s32 wifi_get_autoreconnect(u8 *enable)

Get current auto-reconnect setting which can be used to backup the setting before temporarily changing it.

参数:

enable[out] Pointer to store auto-reconnect mode.

  • 1: Enable auto-reconnect mode.

  • 0: Disable auto-reconnect mode.

返回:

s32 wifi_ap_get_connected_clients(struct rtw_client_list *client_list_buffer)

Get the list of clients connected to the SoftAP.

参数:

client_list_buffer[out] Pointer to store the number of connected clients and their MAC addresses.

返回:

s32 wifi_ap_del_client(u8 *hwaddr)

Disconnect a client from the SoftAP.

参数:

hwaddr[in] Pointer to the MAC address of the client to be disconnected.

返回:

  • RTK_SUCCESS : The API executed successfully.

  • RTK_FAIL : SoftAP is not enabled or no clients are currently connected to SoftAP.

  • -RTK_ERR_BADARG :

    • hwaddr is brodcast MAC address (ff:ff:ff:ff:ff:ff).

    • The client with the specified MAC address hwaddr not connected to the SoftAP.

s32 wifi_ap_switch_chl_and_inform(struct rtw_csa_parm *csa_param)

Change the operating channel in AP mode and notify connected clients using CSA (Channel Switch Announcement).

参数:

csa_param[in] Pointer to the CSA configuration structure rtw_csa_parm.

返回:

void wifi_ap_set_invisible(u8 enable)

Toggle whether SoftAP can be discovered.

备注

SoftAP becomes invisible by pausing tx beacon and not responsing to probe request.

参数:

enable[in] 1-invisible, 0-visible.

返回:

None

s32 wifi_set_channel(u8 wlan_idx, u8 channel)

Set the operating channel for a Wi-Fi interface.

备注

  • There are two channel concepts, generally consistent:

    1. The actual operating channel of the interface.

    2. The channel declared in the beacon of the connected AP on interface(0) or SoftAP on interface(1).

  • Recommended to call this function before the STA is connected or the SoftAP is started, beacuse:

    • Changing STA channel during/after connection may cause connection failure or disconnection due to channel inconsistencies with the AP.

    • Changing SoftAP channel after start may disrupt client connections due to beacon channel mismatch. For SoftAP channel switching, use wifi_ap_switch_chl_and_inform() instead.

  • When MCC (Multi-Channel Concurrent) feature is not enabled, both SoftAP (if enabled) and STA use the same operating channel:

    • Changing SoftAP channel while the STA is connected will have no effect.

    • Changing STA channel will also change SoftAP channel.

参数:
返回:

s32 wifi_set_countrycode(u8 *cntcode)

Set the country code for Wi-Fi regulation.

参数:

cntcode[in] Pointer to the country code to be set.

返回:

  • RTK_SUCCESS : The API executed successfully.

  • -RTK_ERR_BADARG : Invalid country code. Refer to ameba_wifi_country_code_table_usrcfg.c for valid codes.

s32 wifi_get_countrycode(struct rtw_country_code_table *table)

Retrieve current country code information.

参数:

table[in] Pointer to store the country code table containing country code, channel plan code, and TX power limit index.

返回:

RTK_SUCCESS : The API executed successfully.

s32 wifi_get_channel_list(struct rtw_channel_list *ch_list)

Get the list of available WiFi channels for the current regulatory domain.

参数:

ch_list[in] Pointer to store the 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.

备注

Reading the runtime MAC address from RAM (efuse = 0) is recommended for most use cases.

参数:
  • idx[in] Index to specify STA or SoftAP MAC address (ignored if efuse = 1).

  • mac[in] Pointer to store the obtained MAC address.

  • efuse[in] 1 to read from EFUSE, 0 to read from RAM (RECOMMENDED).

返回:

s32 wifi_get_wireless_mode(u8 *wmode)

Get the current Wi-Fi wireless mode for station mode when connected to an AP.

参数:

wmode[out] Pointer to store the wireless mode (e.g., RTW_80211_B, RTW_80211_A, etc.).

返回:

s32 wifi_set_wireless_mode(u32 wmode)

Set the wireless mode.

备注

  • Default mode after driver initialization:

  • Use this function to change wireless mode for station mode before connecting to AP.

  • Avoid using 2.4GHz modes without 11b or 5GHz modes without 11a to prevent compatibility issues.

参数:

wmode[in] Wireless mode to set. Valid values include:

返回:

Event Functions

void wifi_reg_event_handler(u32 event_id, void (*handler_func)(u8 *buf, s32 len, s32 flag, void *user_data), void *handler_user_data)

Registers an event listener for specific Wi-Fi events.

备注

Re-registering an event_id with a NULL handler_func will unregister that event command.

参数:
  • event_id[in] : The events from the Wi-Fi driver to listen for:

  • handler_func[in] : The callback function to process the events. It has the following parameters:

    • buf: Event data passed from the driver to the application layer.

    • len: Length of the buf.

    • flag: Flag set by Wi-Fi driver, used in conjunction with buf. The content of buf and meaning of flag depend on the event_id:

      event id

      buf

      flag

      RTW_EVENT_JOIN_STATUS

      rtw_event_info_joinstatus_joinfail

      RTW_JOINSTATUS_FAIL

      RTW_EVENT_JOIN_STATUS

      rtw_event_info_joinstatus_disconn

      RTW_JOINSTATUS_DISCONNECT

      RTW_EVENT_JOIN_STATUS

      NULL

      Other join status in rtw_join_status

      RTW_EVENT_CSI_DONE

      NULL

      CSI header and raw data length

      RTW_EVENT_STA_ASSOC

      Association request frame

      0

      RTW_EVENT_STA_DISASSOC

      STA’s MAC SoftAP will disassoc

      0

      RTW_EVENT_WPA_STA_WPS_START

      Source MAC of assoc response

      0

      RTW_EVENT_WPA_WPS_FINISH

      NULL

      0

      RTW_EVENT_WPA_EAPOL_START

      Source MAC of assoc response

      0

      RTW_EVENT_WPA_EAPOL_RECVD

      EAPOL message

      0

    • user_data: User-provided data (see handler_user_data).

  • handler_user_data[in] : Optional user-defined data passed to the callback function. Can be NULL.

返回:

None.

void wifi_unreg_event_handler(u32 event_id, void (*handler_func)(u8 *buf, s32 len, s32 flag, void *user_data))

Unregisters an event listener for specific Wi-Fi events.

参数:
返回:

None.

Extended Functions

void wifi_promisc_enable(u32 enable, struct rtw_promisc_para *para)

Enable or disable promisc mode.

备注

  • Do not support calling APIs in callback.

  • Enabling promisc mode temporarily disables LPS(Legacy Power Save) and IPS(Inactive Power Save).

  • Original power save settings are restored when promisc mode is disabled.

参数:
  • enable[in] 1 to enable, 0 to disable promisc mode.

  • para[in] Pointer to a struct containing filter mode and callback if enable promisc mode.

    • Filter mode: Receive all packets unconditionally or only packets from the connected AP.

    • Callback: Provides details of the received packets. The return value of the callback determines whether the driver should continue processing the packet.

返回:

None.

u8 wifi_driver_is_mp(void)

Check if the Wi-Fi driver is in Mass Production (MP) mode.

备注

MP mode is used for Wi-Fi & Bluetooth performance verification and parameter calibration during mass production.

返回:

  • 1: Driver is MP mode.

  • 0: Driver is not in MP mode.

s32 wifi_get_ccmp_key(u8 wlan_idx, u8 *mac_addr, u8 *uncst_key, u8 *group_key)

Get CCMP unicast and group keys.

参数:
  • wlan_idx[in] STA_WLAN_INDEX or SOFTAP_WLAN_INDEX.

  • mac_addr[in] Pointer to client MAC address for SoftAP mode, NULL for STA mdoe.

  • uncst_key[out] Buffer to store CCMP unicast key.

  • group_key[out] Buffer to store CCMP group key.

返回:

  • RTK_SUCCESS : The API executed successfully.

  • RTK_FAIL : Pairwise encryption cipher is not CCMP between STA and connected AP or SoftAP.

  • -RTK_ERR_BADARG :

    • NULL pointer passed for uncst_key or group_key.

    • wlan_idx set to SOFTAP_WLAN_INDEX but NULL pointer passed for mac_addr.

    • wlan_idx set to STA_WLAN_INDEX but STA not connected to AP.

s32 wifi_get_traffic_stats(u8 wlan_idx, union rtw_traffic_stats *traffic_stats)

Fetch the traffic statistics for the specified Wi-Fi interface.

参数:
返回:

s32 wifi_get_phy_stats(u8 wlan_idx, u8 *mac_addr, union rtw_phy_stats *phy_stats)

Fetch Wi-Fi related physical layer information.

备注

For STA mode, all fields in phy_stats->sta will be 0 if the STA is not successfully connected to an AP.

参数:
  • wlan_idx[in] The Wi-Fi interface:

  • mac_addr[in] Client MAC address for SoftAP mode, NULL for STA and NONE mode.

  • phy_stats[out] Pointer to union rtw_phy_stats to store the information.

返回:

s32 wifi_get_txbuf_pkt_num(s32 *pkt_num)

Get the number of packets remaining in the hardware TX buffer.

备注

Supported only by RTL8730E chip. Returns RTK_FAIL for other chips.

参数:

pkt_num[out] Pointer to store the number of packets.

返回:

s32 wifi_get_antdiv_info(u8 *antdiv_mode, u8 *curr_ant)

Get antenna diversity infomation.

参数:
  • antdiv_mode[out] Pointer to store the antenna diversity mode. Values: RTW_ANTDIV_AUTO, RTW_ANTDIV_FIX_MAIN, etc.

  • curr_ant[out] Pointer to store the current antenna in use. 0: Main antenna, 1: Auxiliary antenna.

返回:

s32 wifi_get_band_type(u8 *band_type)

Get the supported frequency band type.

参数:

band_type[out] Pointer to store the supported band type. Values:

返回:

RTK_SUCCESS : The API executed successfully.

s32 wifi_get_tsf(u8 wlan_idx, u64 *tsf)

Get Wi-Fi TSF register value (64-bit).

参数:
返回:

  • RTK_SUCCESS : The API executed successfully.

  • -RTK_ERR_WIFI_POWEROFF : Wi-Fi is powered off in IPS(Inactive Power Save) mode, unable to access Wi-Fi registers.

s32 wifi_add_custom_ie(struct rtw_custom_ie *ie_list, s32 ie_num)

Set up custom Information Element (IE) list.

备注

The Wi-Fi interface is determined by the sepecified frame type in ie_list->type:

警告

This API cannot be called twice without deleting the previous custom IE list.

参数:
  • ie_list[in] Buffer containing custom IE list. Each element should be of type struct rtw_custom_ie.

  • ie_num[in] Number of custom IEs in ie_list.

    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);
    

返回:

s32 wifi_update_custom_ie(struct rtw_custom_ie *cus_ie, s32 ie_index)

Update an item in Wi-Fi custom Information Element (IE) list.

备注

Ensure the IE is added by wifi_add_custom_ie() before calling this function.

参数:
  • cus_ie[in] Pointer to the struct containing details of the IE to be updated.

  • ie_index[in] Index of the IE to be updated in the custom IE list.

    u8 ie[] = {221, 2, 1, 3} ;
    struct rtw_custom_ie ie_update = {ie, RTW_CUS_IE_PROBERSP};
    wifi_update_custom_ie(&ie_update, 2);
    

返回:

s32 wifi_del_custom_ie(u8 wlan_idx)

Delete Wi-Fi custom Information Element (IE) list.

参数:

wlan_idx[in] STA_WLAN_INDEX or SOFTAP_WLAN_INDEX.

返回:

s32 wifi_send_raw_frame(struct rtw_raw_frame_desc *raw_frame_desc)

Send raw frame without upper layer protocol processing or encapsulation.

备注

For unassociated peer devices in RX mode, only unencrypted frames are currently supported.

参数:

raw_frame_desc[in] Pointer of struct rtw_raw_frame_desc, describing raw frame details such as raw data pointer and transmission rate.

返回:

s32 wifi_set_tx_rate_by_tos(u8 enable, u8 tos_precedence, u8 tx_rate)

Control initial tx rate based on ToS value in IP header.

备注

  • Only considers IP Precedence (bits 7~5 in ToS field).

  • Applies to both SoftAP (if enabled) and STA modes.

参数:
  • enable[in] Set to 1 to enable, 0 to disable initial rate control for this ToS value.

  • tos_precedence[in] IP precedence in TOS field (bits 7~5), range 0~7.

  • tx_rate[in] Initial tx rate for packets which with matching ToS. Values: RTW_RATE_1M, RTW_RATE_2M, etc.

返回:

RTK_SUCCESS : The API executed successfully.

s32 wifi_set_edca_param(u32 ac_param)

Set EDCA parameters for STA.

参数:

ac_param[in] EDCA parameters format (as per 802.11 spec):

BIT31~16

BIT15~8

BIT7~0

TXOP Limit

ECWmin/ECWmax

ACI/AIFSN

返回:

  • RTK_SUCCESS : The API executed successfully.

  • -RTK_ERR_WIFI_POWEROFF : Wi-Fi is powered off in IPS(Inactive Power Save) mode, unable to access Wi-Fi registers.

s32 wifi_set_tx_cca_enable(u8 enable)

Enable or disable CCA/EDCCA for TX.

备注

  • Both CCA and EDCCA will be simultaneously enabled or disabled.

  • Applies to both SoftAP (if enabled) and STA modes.

参数:

enable[in] 1 to enable, 0 to disable.

返回:

  • RTK_SUCCESS : The API executed successfully.

  • -RTK_ERR_WIFI_POWEROFF : Wi-Fi is powered off in IPS(Inactive Power Save) mode, unable to access Wi-Fi registers.

s32 wifi_set_cts2self_duration_and_send(u8 wlan_idx, u16 duration)

Set duration by sending a CTS2SELF frame.

参数:
返回:

s32 wifi_csi_config(struct rtw_csi_action_parm *act_param)

Configure and control the CSI (Channel State Information) functionality for STA or SoftAP.

备注

  • If the SoftAP is enabled, Wi-Fi CSI function will only be initiated by the SoftAP.

  • 40MHz bandwidth (act_param->data_bw = 1) is supported only on RTL8721Dx chip.

参数:

act_param[in] Pointer to the configuration parameters.

  • Set act_param->act to RTW_CSI_ACT_CFG to configure CSI parameters.

  • Set act_param->act to RTW_CSI_ACT_EN to enable/disable CSI. If disabled, reconfigure parameters before re-enabling.

    // config csi parameters and enable wifi csi
    struct rtw_csi_action_parm act_param = {0};
    act_param.mode = RTW_CSI_MODE_RX_RESP;
    // ... (set other parameters)
    act_param.act = RTW_CSI_ACT_CFG;  //csi cfg
    wifi_csi_config(&act_param);
    act_param.act = RTW_CSI_ACT_EN;  //csi en
    act_param.enable = 1;
    wifi_csi_config(&act_param);
    

返回:

  • RTK_SUCCESS : The API executed successfully.

  • RTK_FAIL : CONFIG_CSI is not defined or driver internal error.

  • -RTK_ERR_BADARG :

    • Invalid act_param->mac_addr, such as not set mac_addr when not use active CSI broadcast mode or the specified STA with mac_addr not connected the SoftAP when SoftAP enabled.

    • Invalid act_param->data_rate, such as use non-OFDM/HT rate or set act_param->data_bw = 1(i.e. 40M) while use OFDM rate.

    • SoftAP is not enabled, nor is the STA connected to an AP.

void wifi_speaker_setting(u8 set_type, union rtw_speaker_set *settings)

Configure Wi-Fi speaker settings for audio module.

参数:
返回:

None.

s32 wifi_set_tx_power(struct rtw_tx_power_ctl_info *txpwr_ctrl_info)

Set Wi-Fi tx power.

备注

  • Recommended power ranges:

    • For Amebadplus, actual power range varies by channel and specific hardware (slight hardware differences between boards can affect the tx power), the recommended range is approximately -2 to 23 dBm.

    • For Amebasmart & Amebalite, the recommended range is -24 to 24 dBm.

  • Values outside these ranges may be inaccurate and will be adjusted to the nearest boundary value.

  • Not advised to exceed the tx power values defined in the rate table in ameba_wifi_power_table_usrcfg.c.

  • This setting overrides power by rate and power by limit for all rates.

参数:

txpwr_ctrl_info[in] Pointer to rtw_tx_power_ctl_info:

  • b_tx_pwr_force_enbale: 1 to enable, 0 to disable.

  • tx_pwr_force: Tx power to set (unit: 0.25 dBm).

返回:

RTK_SUCCESS : The API executed successfully.

s32 wifi_get_tx_power(u8 rate, s8 *txpwr)

Get current Wi-Fi tx power for a specific rate.

备注

Retrieved the power set by wifi_set_tx_power() or the minimum of power by rate and regulatory power limit.

参数:
  • rate[in] The PHY rate (e.g., RTW_RATE_1M, RTW_RATE_2M, etc.):

    • CCK rates: 1M, 2M, 5.5M, 11M

    • OFDM rates: 6M, 9M, 12M, 18M, 24M, 36M, 48M, 54M

    • HT rates: MCS0 to MCS7

    • VHT rates: MCS0 to MCS8

    • HE rates: MCS0 to MCS9

  • txpwr[out] Current tx power (unit: 0.25 dBm).

返回:

RTK_SUCCESS : The API executed successfully.

void wifi_set_conn_step_try_limit(struct rtw_conn_step_retries *conn_step_retries)

Configure retry limits for different stages of Wi-Fi connection process.

备注

  • Configures retry limits for authentication, association, and key exchange.

  • The retry limits for each stage are constrained to a maximum of 10 attempts.

参数:

conn_step_retries[in] Pointer to rtw_conn_step_retries.

返回:

None.

s32 wifi_acs_find_ideal_channel(struct rtw_acs_config *acs_config, u8 *ideal_ch)

Automatically select a better channel based on environmental conditions.

参数:
  • acs_config[in] configure acs parameters

  • ideal_ch[out]

返回:

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
RTK_ERR_WIFI_POWEROFF

Wi-Fi is powered off in IPS(Inactive Power Save) mode, unable to access Wi-Fi registers.

STA_WLAN_INDEX
SOFTAP_WLAN_INDEX
NAN_WLAN_INDEX
NONE_WLAN_INDEX
RTW_PSCAN_FAST_SURVEY

When set to this value, a fast survey is conducted with a scan time of 25 ms on the specified channel. Otherwise, a normal scan is performed with a duration of 110 ms on the specified channel.

RTW_MAX_CHANNEL_NUM

Maximum number of channels in each channel plan. Defined as 14 for 2.4GHz only, or 42 when 5GHz is supported.

RTW_RFK_DIS_DPK

When set to this value, disables DPK (Digital Pre-Distortion Calibration) during RF calibration.

RTW_ESSID_MAX_SIZE

Maximum length of SSID is 32 bytes as per 802.11 specification.

RTW_WPA2_MAX_PSK_LEN

Maximum pre-shared key (PSK) length for WPA2.

RTW_WPA3_MAX_PSK_LEN

Maximum PSK length for WPA3.

RTW_MAX_PSK_LEN

Maximum PSK length used.

RTW_MIN_PSK_LEN

Minimum PSK length.

MAC_ARG(x)

Formats MAC address for printing. Usage Example: RTK_LOGS(NOTAG, RTK_LOG_INFO, “MAC addr=”MAC_FMT”\n”, MAC_ARG(mac_addr));

MAC_FMT

Format string for printing MAC address.

Wi-Fi Exported Types

Enumeration Type

enum rtw_join_status

Join status flags for RTW_EVENT_JOIN_STATUS.

Values:

enumerator RTW_JOINSTATUS_UNKNOWN
enumerator RTW_JOINSTATUS_STARTING

Connection initiation.

enumerator RTW_JOINSTATUS_SCANNING

Network scanning.

enumerator RTW_JOINSTATUS_AUTHENTICATING

Authentication in progress.

enumerator RTW_JOINSTATUS_AUTHENTICATED

Authentication completed.

enumerator RTW_JOINSTATUS_ASSOCIATING

Association in progress.

enumerator RTW_JOINSTATUS_ASSOCIATED

Association completed.

enumerator RTW_JOINSTATUS_4WAY_HANDSHAKING

4-way handshake in progress.

enumerator RTW_JOINSTATUS_4WAY_HANDSHAKE_DONE

4-way handshake completed.

enumerator RTW_JOINSTATUS_SUCCESS

Connection successful.

enumerator RTW_JOINSTATUS_FAIL

Connection failed.

enumerator RTW_JOINSTATUS_DISCONNECT

Disconnected after successful connection.

enum rtw_event_id

Wi-Fi event identifiers.

Values:

enumerator RTW_EVENT_STA_ASSOC

SoftAP mode: Station associated

enumerator RTW_EVENT_STA_DISASSOC

SoftAP mode: Station disassociated

enumerator RTW_EVENT_JOIN_STATUS

STA mode: Connection status change (see example_wifi_event.c)

enumerator RTW_EVENT_CSI_DONE

CSI data ready (see example_wifi_csi.c)

enumerator RTW_EVENT_WPA_STA_WPS_START

STA mode: WPS procedure started

enumerator RTW_EVENT_WPA_WPS_FINISH

STA mode: WPS procedure completed

enumerator RTW_EVENT_WPA_EAPOL_START

STA mode: WPA enterprise authentication started

enumerator RTW_EVENT_WPA_EAPOL_RECVD

STA mode: EAPOL packet received during WPA enterprise authentication

enumerator RTW_EVENT_MAX
enum rtw_security_flag

Security flags for rtw_security (size: u32).

Values:

enumerator WEP_ENABLED

WEP encryption

enumerator TKIP_ENABLED

TKIP encryption

enumerator AES_ENABLED

AES (CCMP) encryption

enumerator AES_CMAC_ENABLED

AES-CMAC for Management Frame Protection

enumerator ENTERPRISE_ENABLED

Enterprise (802.1X) authentication

enumerator OWE_ENABLED

Opportunistic Wireless Encryption

enumerator SHARED_ENABLED

Shared Key authentication

enumerator WPA_SECURITY

WPA protocol

enumerator WPA2_SECURITY

WPA2 protocol

enumerator WPA3_SECURITY

WPA3 protocol

enum rtw_disconn_reason

Enumerates the disconnect reasons used in rtw_event_info_joinstatus_disconn when a disconnect event (RTW_JOINSTATUS_DISCONNECT) occurs (size: u16). The reasons include both standard 802.11 specification-based reasons and custom-defined reasons by the driver and application layers.

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
enum rtw_support_band

Supported Wi-Fi frequency bands (size: u8).

Values:

enumerator RTW_SUPPORT_BAND_2_4G

2.4 GHz band.

enumerator RTW_SUPPORT_BAND_5G

5 GHz band.

enumerator RTW_SUPPORT_BAND_2_4G_5G_BOTH

Both 2.4 GHz and 5 GHz bands.

enumerator RTW_SUPPORT_BAND_MAX

Maximum band type (for bounds checking).

enum rtw_speaker_set_type

Speaker-related setting types (size: u8).

Values:

enumerator RTW_SPEAKER_SET_INIT
enumerator RTW_SPEAKER_SET_LATCH_I2S_COUNT
enumerator RTW_SPEAKER_SET_TSF_TIMER
enum rtw_cus_ie_frame_type

Transmission frame types for Wi-Fi custom IE (size: u8).

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.

enum rtw_promisc_filter_mode

Promisc mode filter options (size: u8).

Values:

enumerator RTW_PROMISC_FILTER_ALL_PKT

Receive all packets in the air.

enumerator RTW_PROMISC_FILTER_AP_ALL

Receive all packtets sent by connected AP.

enum rtw_promisc_drv_hdl

Promisc callback return values (size: u8).

Values:

enumerator RTW_PROMISC_NEED_DRV_HDL

Driver will continue processing this packet.

enumerator RTW_PROMISC_BYPASS_DRV_HDL

Driver will bypass this packet.

enum rtw_band_type

Wi-Fi frequency bands for STA/AP operation (size: u8).

Values:

enumerator RTW_BAND_ON_24G

Operating on the 2.4 GHz band.

enumerator RTW_BAND_ON_5G

Operating on the 5 GHz band.

enumerator RTW_BAND_ON_6G

Operating on the 6 GHz band.

enumerator RTW_BAND_MAX

Maximum band type (for bounds checking).

enum rtw_wpa_mode

Enumeration of WPA (Wi-Fi Protected Access) modes (size: u8), specifying different security protocol version.

Values:

enumerator RTW_WPA_AUTO_MODE

Auto-select WPA versions based on network configuration. (default mode after driver initialization)

enumerator RTW_WPA_ONLY_MODE

WPA only

enumerator RTW_WPA2_ONLY_MODE

WPA2 only

enumerator RTW_WPA3_ONLY_MODE

WPA3 only

enumerator RTW_WPA_WPA2_MIXED_MODE

Mixed mode supporting both WPA and WPA2

enumerator RTW_WPA2_WPA3_MIXED_MODE

Mixed mode supporting both WPA2 and WPA3

enum rtw_security

Security types for Wi-Fi connections (size: u32).

备注

Default Authentication and Key Management (AKM) is PSK for WPA/WPA2 and SAE for WPA3. For Enterprise mode in WPA/WPA2/WPA3, use the ENTERPRISE_ENABLED flag, e.g., WPA3_SECURITY | ENTERPRISE_ENABLED.

Values:

enumerator RTW_SECURITY_OPEN

Open (no 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 encryption

enumerator RTW_SECURITY_WPA_AES_PSK

WPA security with AES (CCMP) encryption

enumerator RTW_SECURITY_WPA_MIXED_PSK

WPA security allowing both AES and TKIP

enumerator RTW_SECURITY_WPA2_TKIP_PSK

WPA2 security with TKIP encryption

enumerator RTW_SECURITY_WPA2_AES_PSK

WPA2 security with AES (CCMP) encryption

enumerator RTW_SECURITY_WPA2_MIXED_PSK

WPA2 security with allowing both AES and TKIP

enumerator RTW_SECURITY_WPA_WPA2_TKIP_PSK

WPA/WPA2 security with TKIP encryption

enumerator RTW_SECURITY_WPA_WPA2_AES_PSK

WPA/WPA2 security with AES (CCMP) encryption

enumerator RTW_SECURITY_WPA_WPA2_MIXED_PSK

WPA/WPA2 security allowing both AES and TKIP

enumerator RTW_SECURITY_WPA3_AES_PSK

WPA3-SAE security with AES (CCMP) encryption

enumerator RTW_SECURITY_WPA3_OWE

WPA3-OWE (Wi-Fi Enhanced Open) security with AES (CCMP) encryption

enumerator RTW_SECURITY_WPA2_WPA3_MIXED

WPA3-SAE/WPA2 with AES (CCMP) encryption

enumerator RTW_SECURITY_WPA2_AES_CMAC

WPA2 security with AES and Management Frame Protection

enum rtw_rate

Supported PHY rates (size: u8):

  • CCK rates: 1M, 2M, 5.5M, 11M

  • OFDM rates: 6M, 9M, 12M, 18M, 24M, 36M, 48M, 54M

  • HT rates: MCS0 to MCS7

  • VHT rates: MCS0 to MCS8

  • HE rates: MCS0 to MCS9

备注

For HT/VHT/HE PHY, only single spatial stream is supported.

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

enum rtw_csi_trig_frame_mgnt

CSI triggering management frame subtypes (size: u16).

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
enum rtw_csi_trig_frame_ctrl

CSI triggering control frame subtypes (size: u16).

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
enum rtw_csi_trig_frame_data

CSI triggering data frame subtypes (size: u16).

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

CF-Ack (no data)

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
enum rtw_csi_action_type

CSI action types for wifi_csi_config() (size: u8).

Values:

enumerator RTW_CSI_ACT_EN

enable or disable csi func

enumerator RTW_CSI_ACT_CFG

config csi parameters

enumerator RTW_CSI_ACT_MAX
enum rtw_csi_group_num

CSI info subcarrier decimation for reducing data volume (size: u8).

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
enum rtw_csi_mode

CSI mode for fetching CSI info (size: u8).

Values:

enumerator RTW_CSI_MODE_NORMAL

Rx normal mode (estimating CSI by the currently received packet).

enumerator RTW_CSI_MODE_NDP

Rx ndp mode: not support

enumerator RTW_CSI_MODE_RX_RESP

Rx response mode (estimating CSI by receiving ACK for the previous transmission).

enumerator RTW_CSI_MODE_MAX
enum rtw_csi_accuracy

CSI accuracy specifies the format of CSI raw data represented as complex numbers (size: u8).

备注

  • Each CSI data point consists of an I (In-phase, real part) and Q (Quadrature, imaginary part) value. Both I and Q use the same format for a given accuracy setting.

  • For example, the format S(8,3) means a signed 8-bit number with 3 fractional bits.

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
enum rtw_csi_alg

CSI algorithm options (size: u8).

Values:

enumerator RTW_CSI_ALG_LS

Least Squares algorithm

enumerator RTW_CSI_ALG_SMOTHING

Smoothing algorithm

enumerator RTW_CSI_ALG_MAX

Other algorithm

enum rtw_csi_ch

CSI acquisition from leagcy or non-legacy LTF (size: u8).

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
enum rtw_csi_role

CSI operation role (size: u8).

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
enum rtw_trp_tis_mode

Total Radiated Power (TRP) and Total Isotropic Sensitivity (TIS) certification modes (size: u8).

Values:

enumerator RTW_TRP_TIS_DISABLE

Disable TRP/TIS certification (default)

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

enum rtw_edcca_mode

EDCCA modes (size: u8).

Values:

enumerator RTW_EDCCA_NORM

Dynamic threshold adjustment based on real-time RSSI measurements (default).

enumerator RTW_EDCCA_ADAPT

Fixed threshold to comply with ETSI Adaptivity Test requirements.

enumerator RTW_EDCCA_CS

Carrier Sense for Japan’s interference avoidance regulations.

enumerator RTW_EDCCA_DISABLE

Disables EDCCA, allowing MAC transmission without signal verification.

enum rtw_antdiv_mode

Antenna diversity mode types (size: u8).

Values:

enumerator RTW_ANTDIV_AUTO

Automatic antenna diversity selection.

enumerator RTW_ANTDIV_FIX_MAIN

Fixed main antenna.

enumerator RTW_ANTDIV_FIX_AUX

Fixed auxiliary antenna.

enumerator RTW_ANTDIV_DISABLE

Disable antenna diversity.

enum rtw_bss_type

BSS types (size: u8).

Values:

enumerator RTW_BSS_TYPE_INFRASTRUCTURE

Infrastructure network

enumerator RTW_BSS_TYPE_WTN_HELPER

WTN helper network

enumerator RTW_BSS_TYPE_UNKNOWN
enum rtw_scan_type

Wi-Fi scan options (size: u8).

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 out hidden SSID APs

enumerator RTW_SCAN_REPORT_EACH

Report each found AP immediately

enumerator RTW_SCAN_WITH_P2P

For P2P usage

enum rtw_wps_type

WPS (Wi-Fi Protected Setup) types (size: u8).

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

Wi-Fi Simple Configuration (WSC) type

enum rtw_drv_op_mode

Supported operation mode by the Wi-Fi driver (size: u8).

Values:

enumerator RTW_MODE_NONE

None

enumerator RTW_MODE_STA

STA mode

enumerator RTW_MODE_AP

SoftAP mode

enumerator RTW_MODE_NAN

NAN mode

enumerator RTW_MODE_MAX
enum rtw_ips_level

Power save levels for Inactive Power Save (IPS) mode (size: u8).

Values:

enumerator RTW_IPS_WIFI_OFF

The Wi-Fi is fully powered off during IPS to maximize power savings.

enumerator RTW_IPS_WIFI_PG

The Wi-Fi module enters Power Gating, partially turning off RF/BB/MAC, allowing quicker exit from IPS. Only supported by Amebadplus.

enumerator RTW_IPS_LEVEL_MAX
enum rtw_uapsd_max_sp

The maximum service period lengths for U-APSD (Unscheduled Automatic Power Save Delivery) operations (size: u8).

Values:

enumerator RTW_UAPSD_NO_LIMIT

No limit on service period length

enumerator RTW_UAPSD_TWO_MSDU

Two MSDUs per service period

enumerator RTW_UAPSD_FOUR_MSDU

Four MSDUs per service period

enumerator RTW_UAPSD_SIX_MSDU

Six MSDUs per service period

enum rtw_wireless_mode

Enumeration of supported Wi-Fi network modes (size: u8).

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
enum rtw_txpwr_lmt

TX power limit regulatory domains (size: u8).

Values:

enumerator TXPWR_LMT_FCC

Federal Communications Commission (USA).

enumerator TXPWR_LMT_MKK

Japan

enumerator TXPWR_LMT_ETSI

European Telecommunications Standards Institute (CE).

enumerator TXPWR_LMT_IC

Canada

enumerator TXPWR_LMT_KCC

South Korea

enumerator TXPWR_LMT_ACMA

Australia

enumerator TXPWR_LMT_CHILE

Chile

enumerator TXPWR_LMT_MEXICO

Mexico

enumerator TXPWR_LMT_WW

Worldwide, The mininum of all

enumerator TXPWR_LMT_GL

Global

enumerator TXPWR_LMT_UKRAINE

Ukraine

enumerator TXPWR_LMT_CN

China

enumerator TXPWR_LMT_QATAR

Qatar

enumerator TXPWR_LMT_UK

Great Britain (United Kingdom; England)

enumerator TXPWR_LMT_NCC

Taiwan

enumerator TXPWR_LMT_EXT

Customer Customization

enumerator TXPWR_LMT_CONST_MAX

unchanging part define max

enum rtw_frame_type

Wi-Fi frame types (size: u8).

Values:

enumerator RTW_MGT_TYPE

Management frame

enumerator RTW_CTRL_TYPE

Control frame

enumerator RTW_DATA_TYPE

Data frame

enumerator RTW_QOS_DATA_TYPE

QoS data frame

enum rtw_frame_type_subtype

Wi-Fi frame subtypes (size: u8).

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

Structure Type

struct wifi_user_conf

The structure is used to describe the wifi user configuration, can be configured in ameba_wificfg.c.

Public Members

u8 rtw_edcca_mode

This effects EDCCA threshold, wifi won’t TX if detected energy exceeds threshold.

  • RTW_EDCCA_NORM: Adjust EDCCA threshold dynamically;

  • RTW_EDCCA_ADAPT: For ESTI or SRRC;

  • RTW_EDCCA_CS: For japan;

  • RTW_EDCCA_DISABLE: Ingore EDCCA.

u8 tx_pwr_table_selection

For power by rate and power by limit table selection, refer to Ameba Wi-Fi TX Power and Country Code Setup Guideline.pdf.

  • 0: Disable power by limit, enable power by rate;

  • 1: Enable both power by limit and power by rate;

  • 2: Depend on efuse (flash).

u8 rtw_trp_tis_cert_en

Enabled during TRP TIS certification.

u8 wifi_wpa_mode_force

Force wpa mode:

  • RTW_WPA_AUTO_MODE: Auto mode, follow AP;

  • RTW_WPA_ONLY_MODE: Wpa only;

  • RTW_WPA2_ONLY_MODE: Wpa2 only;

  • RTW_WPA3_ONLY_MODE: Wpa3 only;

  • RTW_WPA_WPA2_MIXED_MODE: Wpa and wpa2 mixed;

  • RTW_WPA2_WPA3_MIXED_MODE: Wpa2 and wpa3 mixed.

u8 tdma_dig_enable

TDMA DIG affects the range of RX, when enabled, both near and distant devices can be received.

0: TDMA DIG off, 1: TDMA DIG on.

u8 antdiv_mode

Antdiv mode:

  • RTW_ANTDIV_AUTO: Auto antdiv;

  • RTW_ANTDIV_FIX_MAIN: Fix main ant;

  • RTW_ANTDIV_FIX_AUX: Fix aux ant;

  • RTW_ANTDIV_DISABLE: Antdiv disable.

u8 ap_sta_num

The maximum number of STAs connected to the softap should not exceed the num specified in notes of func wifi_set_user_config().

u8 ips_enable

IPS(Inactive power save), If disconnected for more than 2 seconds, WIFI will be powered off.

u8 ips_level

Power save status:

  • RTW_IPS_WIFI_OFF: The WIFI is powered off during the IPS;

  • RTW_IPS_WIFI_PG: The WIFI enters the PG state during the IPS, and therefore it exits the IPS faster. Only dplus support this status.

u8 ips_ctrl_by_usr

The driver does not enter the IPS due to 2s disconnection. Instead, API wifi_set_ips_internal() controls the IPS.

0: API wifi_set_ips_internal() control ips enable/disable, 1: Control ips enter/leave.

u8 lps_enable

LPS(Legacy power save). After connection, with low traffic, part of WIFI can be powered off and woken up upon packet interaction.

There are two power save modes: legacy power save and uapsd mode. Can only enable one of them.

0: Disable legacy power save, 1: Enable.

u8 lps_listen_interval

In LPS, the sta wakes up every lps_listen_interval * 102.4ms to receive beacon.

u8 wowlan_rx_bcmc_dis

Enable or disable rx broadcast of LPS. LPS is the abbreviation of Leisure Power Save mode. 1 means disable rx broadcast of LPS, 0 means enable(default) rx broadcast of LPS.

u8 uapsd_enable

U-APSD WMM power save mode. After connection, with low traffic, part of WIFI can be powered off and woken up upon packet interaction.

There are two power save modes: legacy power save and uapsd mode. Can only enable one of them. 0: Disable uapsd mode, 1: Enable.

u8 uapsd_max_sp_len

0: RTW_UAPSD_NO_LIMIT, 1: RTW_UAPSD_TWO_MSDU, 2: RTW_UAPSD_FOUR_MSDU, 3: RTW_UAPSD_SIX_MSDU.

u8 uapsd_ac_enable

BIT0: AC_VO UAPSD, BIT1: AC_VI UAPSD, BIT2: AC_BK UAPSD, BIT3: AC_BE UAPSD.

u8 ampdu_rx_enable

0: Disable ampdu rx, 1: Enable ampdu rx.

u8 ampdu_tx_enable

0: Disable ampdu tx, 1: Enable ampdu tx.

u8 check_dest_address_en

0: If the pkt’s destination address doesn’t match, it won’t be dropped, 1: If the pkt’s destination address doesn’t match, it will be dropped.

u8 ap_compatibilty_enabled

The ap_compatibilty_enabled is used to configure the wlan settings, each bit controls one aspect.

  • bit 0: 0: follow 802.11 spec, do not issue deauth, 1(default): issue deauth in 1st REAUTH_TO to be compatible with ap;

  • bit 1: 0: do not check beacon info to connect with AP with multiple SSID, 1(default): check beacon info;

  • bit 2: 0(default): do not issue deauth at start of auth, 1: issue deauth at start of auth;

  • bit 3: 0: do not switch WEP auth algo unless WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG, 1(default): switch WEP auth algo from shared key to open system in 1st REAUTH_TO;

  • other bits: reserved

u8 set_channel_api_do_rfk

0: API wifi_set_channel() does not trigger RFK; 1: API wifi_set_channel() triggers RFK.

u8 dpk_peak_limit

0: Do not limit the peak current of DPD; 1: Limit the peak current of DPD.

u16 rf_calibration_disable

RF calibration is triggered during WIFI initialization and channel switch to calibrate TRX to optimal performance,

but it takes a long time (around 100ms), so some applications can sacrifice performance so that WIFI initializes and switches faster.

  • Bit0: RTW_RFK_DIS_DPK;

  • Other bits: reserved.

u8 max_roaming_times

The maximum number of roaming attempts triggered by BTM.

u8 ap_polling_sta

AP periodically sends null pkt to check whether the STA is offline, not support right now.

u8 country_code[2]

Refer to ameba_wifi_country_code_table_usrcfg.c, e.g. China: country_code[0] = ‘C’, country_code[1] = ‘N’.

Specical value: country_code[0]~[1] = 0x0000: follow efuse; country_code[0]=’0’, country_code[1]=’0’ : WORLDWIDE.

u8 bw_40_enable

Bandwidth 40MHz, some IC hardware does not support.

u8 rtw_802_11d_en

Refe to 802.11d spec, obtain the country code information from beacon, and set the pwr limit and channel plan.

u8 fast_reconnect_en

When booting the STA, it automatically reconnects to previously connected AP

u8 auto_reconnect_en

When disconnection, STA automatically reconnects.

u8 auto_reconnect_count

When disconnection, STA automatically reconnects, and auto_reconnect_count is the number of attempts. Specical value: 0xff means infinite retry count

u8 auto_reconnect_interval

auto_reconnect_interval is Automatic reconnection interval, unit s.

u8 no_beacon_disconnect_time

no_beacon_disconnect_time is the disconnect time when no beacon occurs, unit 2s.

s32 skb_num_np

skb_num_np is wifi driver’s trx buffer number, each buffer occupies about 1.8K bytes of heap, a little difference between different chips.

These buffer are used for all traffics except tx data in INIC mode, and all traffics in single core mode.

For higher throughput or a large number of STAs connected to softap, skb_num_np can be increased.

Minimum: 7 (3 for Ameba lite). Default: 10.

s32 skb_num_ap

These buffer are used for tx data packtes in INIC mode, not used in single core mode.

For higher throughput or a large number of STAs connected to softap, skb_num_ap can be increased.

u32 skb_buf_size

Specify the trx buffer size of each skb.

Cache size(32 for amebadplus&amebalite and 64 for amebasmart)alignment will be applied to the input size.

Considering the length field of L-SIG is 12 bits, the max PSDU size is 4095 bytes, so skb_buf_size is suggested not exceed 4k.

ps1:.If the trx buffer is specified through skb_buf_size, the actual rx_pkt_size <= skb_buf_size - WLAN_HW_INFO_LEN.

ps2:.If the skb_buf_size is a larger value, it is necessary to consider whether the heap of cores is sufficient?(amebaxxx_layout.ld may need to be modified).

0: use default size.

u8 force_cts2self

Every data tx is forced to start with cts2self.

u8 en_mcc

Multi Channel Concurrent mode, STA and Softap can work on different channels via TDMA.

备注

Mcc performance has limitations, please contact Realtek before use to clarify your requirements.

unsigned char mcc_force_p1_slot_ratio

Used for configuring mcc port1 slot ratio by user: optional values:[12,80]

u8 tx_shortcut_enable

Simplify transmit pathway for faster data frame handling.

u8 rx_shortcut_enable

Simplify receive pathway for faster data frame handling.

u8 probe_hidden_ap_on_passive_ch

0: No probe request will be sent on passive channel; 1: A unicast probe request will be sent when a null-SSID beacon is received on passive channel to obtain the ssid of the AP

u8 concurrent_enabled

For concurrent mode:

  • 0: STA or SoftAP only at any time, The MAC address of TA or Softap is the MAC address of chip;

  • 1: STA and SoftAP may run at the same time, Softap’s mac address depends on softap_addr_offset_idx.

u8 softap_addr_offset_idx

It is valid only when concurrent_enabled =1. The range is 0~5.The lowest bit of mac[0] is 1, which represents the multicast address, therefore, the mac[0] of softap is incremented by 2, others is incremented by 1.

  • e.g. softap_addr_offset_idx = 0, chip’s mac = 00:e0:4c:01:02:03, softap’s mac = 02:e0:4c:01:02:03;

  • e.g. softap_addr_offset_idx = 1, chip’s mac = 00:e0:4c:01:02:03, softap’s mac = 00:e1:4c:01:02:03;

  • e.g. softap_addr_offset_idx = 5, chip’s mac = 00:e0:4c:01:02:03, softap’s mac = 00:e0:4c:01:02:04.

u8 rx_ampdu_num

The number of ampdu that Recipient claims to Originator for RX, it can be any value less than 64.

skb_num_np needs to be adjusted simultaneously.

u8 cfg80211

Linux Fullmac architecture, ignore in RTOS.

u8 wps_retry_count

WPS.

u32 wps_retry_interval

Unit: ms.

u8 wifi_speaker_feature

For wifi speaker configuration.

BIT0: Main switch, BIT1: Enable tsf interrupt, BIT2: Enable audio tsf.

u8 keepalive_interval

STA mode will periodically send null packet to AP to keepalive, unit: second.

u8 wtn_en

0: Disable R-mesh function, 1: Enable R-mesh function.

s8 wtn_strong_rssi_thresh

R-mesh AP strong RSSI thresh, when AP rssi larger than this thresh, will try to switch to AP.

u16 wtn_father_refresh_timeout

R-mesh father refresh timeout, when not receive beacon from father for this timeout, will switch to other node, unit: millisecond.

u16 wtn_child_refresh_timeout

R-mesh child refresh timeout, when not receive beacon from child for this timeout, will delete this child, unit: millisecond.

u8 wtn_rnat_en

0: Disable R-mesh NAT feature, 1: Enable R-mesh NAT feature.

u8 wtn_fixed_rnat_node

0: Determine whether to become RNAT node based on the rssi to AP, 1: Become RNAT node regardless of the rssi to AP.

u8 wtn_connect_only_to_rnat

0: This device can connect to R-Mesh group or R-NAT group, 1: this device will only connect to R-NAT group.

u16 wtn_max_node_num

Max node number in R-mesh network, this is used for decide each node’s beacon window.

struct rtw_event_info_joinstatus_disconn

Data structure for RTW_EVENT_JOIN_STATUS when flag is RTW_JOINSTATUS_DISCONNECT.

Public Members

u16 disconn_reason

Disconnect reason, refer to rtw_disconn_reason.

u8 bssid[6]

MAC address of the AP.

struct rtw_event_info_joinstatus_joinfail

Data structure for RTW_EVENT_JOIN_STATUS when flag is RTW_JOINSTATUS_FAIL.

Public Members

s32 fail_reason

Failure reason, refer to RTK_FAIL, -RTK_ERR_WIFI_CONN_INVALID_KEY, etc.

u16 reason_or_status_code

802.11 reason code or status code from AP.

u8 bssid[6]

MAC address of the AP.

struct rtw_ssid

Describes the SSID (Service Set Identification), which is the network name of an Access Point.

Public Members

u8 len

SSID length. Should not > RTW_ESSID_MAX_SIZE.

u8 val[RTW_ESSID_MAX_SIZE + 1]

SSID value, terminated with a null character.

struct rtw_mac

Represents a unique 6-byte MAC address.

Public Members

u8 octet[6]

Unique 6-byte MAC address.

struct rtw_acs_mntr_rpt

Describes channel busyness for Automatic Channel Selection (ACS).

Public Members

u16 meas_time

Measurements duration on this channel, unit: ms.

u16 busy_time

Time the primary channel was sensed busy, unit: ms.

u16 tx_time

Time spent transmitting frame on this channel, unit: ms.

s8 noise

Measured noise power on this channel, unit: dbm.

u8 channel

Scanned channel number.

struct rtw_scan_result

Contains details of a scanned AP.

Public Members

struct rtw_ssid ssid

SSID of the AP.

struct rtw_mac bssid

BSSID (MAC address) of the AP.

s16 signal_strength

Receive Signal Strength Indication (RSSI) in dBm: <-90 Very poor, >-30 Excellent.

u8 bss_type

BSS type. Common value: RTW_BSS_TYPE_INFRASTRUCTURE.

u32 security

Security type of the AP: RTW_SECURITY_OPEN, RTW_SECURITY_WEP_PSK, etc.

u8 wps_type

WPS types supported by the AP: RTW_WPS_TYPE_DEFAULT, RTW_WPS_TYPE_USER_SPECIFIED, etc.

u32 channel

Radio channel where the AP beacon was detected.

u8 band

Frequency band used by the AP: RTW_BAND_ON_5G, RTW_BAND_ON_24G.

u8 country_code[2]

The wireless spectrum management regulations followed by the AP. Coded according to ISO 3166 standard.

Reference: ameba_wifi_country_code_table_usrcfg.c for specific values.

Example: For China, country_code[0] = ‘C’, country_code[1] = ‘N’.

u8 wireless_mode

Wireless mode: RTW_80211_B, RTW_80211_A, etc.

u8 rom_rsvd[3]
struct rtw_channel_scan_time

Specifies the scan duration per channel.

Public Members

u16 active_scan_time

Active scan duration per channel (ms, default: 110).

u16 passive_scan_time

Passive scan duration per channel (ms, default: 110).

struct rtw_scan_param

Describes the scan parameters used for Wi-Fi scanning.

Public Members

u8 options

Scan option: RTW_SCAN_ACTIVE, RTW_SCAN_PASSIVE, etc.

u8 *ssid

Target SSID to scan for. Length should not exceed RTW_ESSID_MAX_SIZE.

u8 *channel_list

List of specific channels to scan.

u8 channel_list_num

Number of channels in channel_list.

struct rtw_channel_scan_time chan_scan_time

Scan duration for each channel.

u16 max_ap_record_num

Maximum number of APs to record. When set to 0, use default value 64. APs with the lowest RSSI are discarded if scanned APs exceed this number.

void *scan_user_data

User-defined data passed to callback functions for handling scan results.

s32 (*scan_user_callback)(u32 ap_num, void *user_data)

Callback for normal asynchronous mode.

Param ap_num:

[in] Total number of scanned APs.

Param user_data:

[in] Pointer to user data (see scan_user_data).

Return:

RTK_SUCCESS or RTK_FAIL.

s32 (*scan_report_each_mode_user_callback)(struct rtw_scan_result *scanned_ap_info, void *user_data)

Callback for RTW_SCAN_REPORT_EACH mode.

Param scanned_ap_info:

[in] Pointer to details of a scanned AP.

Param user_data:

[in] Pointer to user data (see scan_user_data).

Return:

RTK_SUCCESS or RTK_FAIL.

s32 (*scan_report_acs_user_callback)(struct rtw_acs_mntr_rpt *acs_mntr_rpt)

Callback for reporting ACS (Automatic Channel Selection) info.

Param scanned_ap_info:

[in] Pointer to channel busyness information.

Return:

RTK_SUCCESS or RTK_FAIL.

struct rtw_wpa_supp_connect

Stores wpa_supplicant info for STA connection (Linux host only, not needed for RTOS).

Public Members

u8 rsnxe_ie[RSNXE_MAX_LEN]

The RSNXE IE from beacon of the AP which STA is trying to connect.

struct rtw_network_info

Describes connection settings for connecting to an AP.

备注

  1. If used for Wi-Fi connect, setting channel to 0 means full channel scan; setting channel to a specific value means do active scan on that channel.

  2. Set pscan_option to RTW_PSCAN_FAST_SURVEY for fast survey (active scan on specified channel, 25ms each, up to 7 attempts); 0 for normal scan.

Public Members

struct rtw_ssid ssid

AP’s SSID (max length: RTW_ESSID_MAX_SIZE).

struct rtw_mac bssid

AP’s MAC address.

u32 security_type

Necessarily set for WEP (RTW_SECURITY_WEP_PSK, RTW_SECURITY_WEP_SHARED). Auto-adjusted for others.

u8 *password

AP’s password.

s32 password_len

Password length (max: RTW_MAX_PSK_LEN).

s32 key_id

WEP key ID (0-3). Only for WEP.

u8 channel

0 for full scan, other values to scan specific channel.

u8 pscan_option

RTW_PSCAN_FAST_SURVEY for fast survey, 0 for normal scan.

u8 is_wps_trigger

Indicates if connection is triggered by WPS.

struct rtw_wpa_supp_connect wpa_supp

Used by Linux host for STA connect details (not used by RTOS).

struct rtw_mac prev_bssid

BSSID of the AP before roaming.

u8 by_reconn

Indicates if connection is triggered by auto-reconnect.

u8 rom_rsvd[4]
struct rtw_conn_step_retries

Defines retry limits for different connection steps: authentication, association, and key exchange.

备注

All retry limits are capped at 10.

Public Members

u8 reauth_limit

Retry limit for authentication (open/shared key).

u8 sae_reauth_limit

Retry limit for SAE authentication.

u8 reassoc_limit

Retry limit for association.

u8 eapol_key_rsend_limit

Retry limit for the 4-way handshake process.

struct rtw_wifi_setting

Stores Wi-Fi settings retrieved from the Wi-Fi driver.

备注

Structure size must remain unchanged for compatibility.

Public Members

u8 mode

Current WLAN interface mode: RTW_MODE_STA, RTW_MODE_AP, RTW_MODE_NAN.

u8 ssid[33]

SSID of connected AP or SoftAP (null-terminated string).

u8 bssid[6]

BSSID (MAC address) of connected AP or SoftAP.

u8 channel

Operating channel of connected AP or SoftAP.

u32 security_type

Security type of connected AP or SoftAP: RTW_SECURITY_OPEN, RTW_SECURITY_WEP_PSK, etc.

u8 password[RTW_MAX_PSK_LEN]

Password of connected AP or SoftAP.

u8 key_idx

WEP key index (only valid when security type is WEP).

u8 alg

Reserved for internal driver compatibility; users can ignore.

u32 auth_type

Reserved for internal driver use; users can ignore.

u8 is_wps_trigger

Indicates if connection was triggered by WPS process.

u32 rom_rsvd
union rtw_traffic_stats
#include <wifi_api_types.h>

Traffic statistics for Wi-Fi interfaces.

Public Members

struct rtw_traffic_stats::rtw_sta_traffic_stats sta

Statistic for STA mode.

struct rtw_traffic_stats::rtw_ap_traffic_stats ap

Statistic for SoftAP mode.

struct rtw_ap_traffic_stats
#include <wifi_api_types.h>

Public Members

u32 rx_packets

Total packets received (excluding custom packets).

u32 tx_packets

Total packets transmitted.

struct rtw_sta_traffic_stats
#include <wifi_api_types.h>

Public Members

u32 rx_packets

Total packets received (excluding custom packets).

u32 tx_packets

Total packets transmitted .

u8 cur_rx_data_rate

Current rx data rate. Values: RTW_RATE_1M, RTW_RATE_2M, etc.

u8 cur_tx_data_rate

Current tx data rate. Values: RTW_RATE_1M, RTW_RATE_2M, etc.

union rtw_phy_stats
#include <wifi_api_types.h>

Wi-Fi related physical layer statistics.

Public Members

struct rtw_phy_stats::rtw_sta_phy_stats sta

Statistics for STA mode

struct rtw_phy_stats::rtw_ap_phy_stats ap

Statistics for SoftAP mode

struct rtw_phy_stats::rtw_cmn_phy_stats cmn

Common statistic.

struct rtw_ap_phy_stats
#include <wifi_api_types.h>

Public Members

s8 data_rssi

Average data rssi in last 1 sec.

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.

struct rtw_sta_phy_stats
#include <wifi_api_types.h>

Public Members

s8 rssi

Average mixed rssi in last 1 sec.

s8 data_rssi

Average data rssi in last 1 sec.

s8 beacon_rssi

Average beacon rssi in last 1 sec.

s8 snr

Average snr in 1 sec (excluding CCK rate).

struct rtw_softap_info

Describes the configuration for starting AP mode. security type, password and default channel, used to start AP mode.

备注

SSID length should not exceed RTW_ESSID_MAX_SIZE. Password length should not exceed RTW_MAX_PSK_LEN.

Public Members

struct rtw_ssid ssid

SoftAP SSID and its length.

u8 hidden_ssid

Set to 1 to hide SSID in SoftAP beacon.

u32 security_type

Security type: RTW_SECURITY_OPEN, RTW_SECURITY_WEP_PSK, etc.

u8 *password

Pointer to SoftAP password.

u8 password_len

The length of password.

u8 channel

Desired operating channel for the SoftAP.

struct rtw_client_list

Stores information about clients associated with the SoftAP.

Public Members

u32 count

Number of associated clients.

struct rtw_mac mac_list[MACID_HW_MAX_NUM - 2]

Array of client MAC addresses.

struct rtw_csa_parm

Configuration parameters for Channel Switch Announcement (CSA).

Public Members

u8 new_chl

Target channel to switch to.

u8 chl_switch_cnt

Countdown to channel switch, in units of 102ms (chl_switch_cnt*102ms).

u8 action_type

CSA action frame type: 0 - unicast, 1 - broadcast, other - disable CSA action frame.

u8 bc_action_cnt

Number of broadcast CSA actions sent per beacon interval. Only valid when action_type = 1.

u8 chl_switch_mode

Restrictions on connected STAs transmission until a channel switch: 1 - disable STAs from transmitting any frames; 0 - no restrictions.

void (*callback)(u8 channel, s8 ret)

Callback function invoked after channel switch completion.

Param channel:

[in] New channel number.

Param ret:

[in] Result of channel switch: RTK_FAIL or RTK_SUCCESS.

struct rtw_rx_pkt_info

Provides detailed information about a received packet.

Public Members

s8 recv_signal_power

Received signal strength indicator (RSSI) in dBm.

u8 data_rate

Data rate of the received packet. Values: RTW_RATE_1M, RTW_RATE_2M, etc.

u8 channel

Channel on which the packet was received.

u8 *buf

Pointer to the buffer containing the received packet data.

u32 len

Length of the data in the buffer.

struct rtw_promisc_para

Describes the chosen promisc mode and its associated callback function.

Public Members

u8 filter_mode

Specify which packets to receive by setting filtering conditions.

u8 (*callback)(struct rtw_rx_pkt_info *pkt_info)

Callback function to handle received packets.

Param pkt_info:

[in] Pointer to struct rtw_rx_pkt_info containing packet details.

Return:

Determines whether the driver should continue processing the packet after user handling:

union rtw_speaker_set
#include <wifi_api_types.h>

Union for different Wi-Fi speaker configuration settings.

Public Members

struct rtw_speaker_set::rtw_speaker_init init

For Wi-Fi speaker setting case RTW_SPEAKER_SET_INIT.

struct rtw_speaker_set::rtw_speaker_i2s latch_i2s_count

For Wi-Fi speaker setting case RTW_SPEAKER_SET_LATCH_I2S_COUNT.

struct rtw_speaker_set::rtw_speaker_tsf_timer tsf_timer

For Wi-Fi speaker setting case RTW_SPEAKER_SET_TSF_TIMER.

struct rtw_speaker_i2s
#include <wifi_api_types.h>

Public Members

u8 port

Port selection for TSFT trigger: 0 for port 0, 1 for port 1.

u8 latch_period

Audio latch period: 0 for 4.096ms, 1 for 8.192ms.

struct rtw_speaker_init
#include <wifi_api_types.h>

Public Members

u8 mode

0 for slave, 1 for master.

u8 nav_thresh

NAV (Network Allocation Vector) threshold in units of 128us.

u8 relay_en

Relay control.

struct rtw_speaker_tsf_timer
#include <wifi_api_types.h>

Public Members

u8 enable

1 for enable, 0 for disable.

u64 tsft

Unit us.

u8 port

Port selection for TSFT trigger: 0 for port 0, 1 for port 1.

struct rtw_csi_header

Layout of CSI report header.

Public Members

u16 csi_signature

Unique pattern (0xABCD) to detect a new CSI packet.

u8 hdr_len

Length of CSI header excluding csi_signature and hdr_len (i.e., 3 bytes).

u8 mac_addr[6]

MAC address of transmitter (Active CSI) or receiver (Passive CSI) for CSI triggering frame.

u8 trig_addr[6]

MAC address of destination (Active CSI) or source (Passive CSI) for CSI triggering frame (Reserved in METHOD4).

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 if current CSI raw data is valid.

u8 channel

Operation channel.

u8 bandwidth

Operating bandwidth (0: 20MHz, 1: 40MHz).

u8 rx_rate

RX packet rate used to obtain CSI info.

u8 protocol_mode

Protocol mode of response packet (0: OFDM, 1: HT, 2: VHT, 3: HE).

u16 num_sub_carrier

Number of subcarriers in CSI raw data

u8 num_bit_per_tone

CSI data word length (sum of I and Q). E.g., if using RTW_CSI_ACCU_1BYTE accuracy (S(8,X)), num_bit_per_tone = 16.

s8 rssi[2]

rssi[0]: dBm, rssi[1]: reserved

s8 evm[2]

Error Vector Magnitude in dB (Reserved).

u8 rxsc

Sub-20MHz channel used for packet transmission.

u8 n_rx

Reserved.

u8 n_sts

Reserved.

u8 trig_flag

CSI trigger source indicator (valid only in METHOD4, 0 if trig_addr valid)

u8 rsvd[5]
struct rtw_csi_action_parm

Configuration parameters used for csi report.

备注

The mac_addr if not specified, the default value must be 0.

Public Members

u8 group_num

CSI info subcarrier decimation. val: RTW_CSI_GROUP_NUM_1, RTW_CSI_GROUP_NUM_2

u8 accuracy

The format (bit length) of CSI raw data for both I and Q components. val: RTW_CSI_ACCU_1BYTE, RTW_CSI_ACCU_2BYTES

u8 alg_opt

Reserved.

u8 ch_opt

CSI acquisition from leagcy or non-legacy LTF. val: RTW_CSI_CH_LEGACY, RTW_CSI_CH_NON_LEGACY.

u8 csi_role

The CSI operation role, val: RTW_CSI_OP_ROLE_TRX, RTW_CSI_OP_ROLE_TX, RTW_CSI_OP_ROLE_RX.

u8 mode

Mode for fetching CSI. val: RTW_CSI_MODE_NORMAL, RTW_CSI_MODE_RX_RESP

u8 act

Enable CSI or configure CSI parameters. val: RTW_CSI_ACT_EN, RTW_CSI_ACT_CFG.

u16 trig_frame_mgnt

Management frame type(s) of rx CSI triggering frame. Used for RTW_CSI_MODE_NORMAL. val: RTW_CSI_TRIG_ASSOCREQ

u16 trig_frame_ctrl

Control frame type(s) of rx CSI triggering frame. Used for RTW_CSI_MODE_NORMAL. val: RTW_CSI_TRIG_TRIGGER

u16 trig_frame_data

Data frame type(s) of rx CSI triggering frame. Used for RTW_CSI_MODE_NORMAL. val: RTW_CSI_TRIG_DATA

u8 enable

0: disable Wi-Fi CSI function; 1: enable Wi-Fi CSI function.

u8 trig_period

CSI sounding rate, unit: 320us (recommended value: 15~255).

u8 data_rate

Tx data rate of CSI triggering frame, invalid in RTW_CSI_MODE_RX_RESP mode. val: only support OFDM/HT rate.

u8 data_bw

The bandwidth of CSI triggering frame, invalid in RTW_CSI_MODE_RX_RESP mode. val: 0 for 20MHz, 1 for 40MHz (only supported by dplus).

u8 mac_addr[6]

Destination address (MAC address) for CSI triggering frame, invalid when set multi_type = 1.

u8 multi_type

0: unicast csi triggering frame; 1: broadcast csi triggering frame. Valid in Active CSI.

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)

struct _pwr_lmt_regu_remap

Power limit regulation map.

Public Members

u8 domain_code
u8 PwrLmtRegu_2g

Not distinguish 2.4G and 5G; just set PwrLmtRegu_2g.

u8 PwrLmtRegu_5g
struct rtw_raw_frame_desc

Describes a raw frame to be transmitted.

Public Members

u8 wlan_idx

Index of the Wi-Fi interface for transmission.

u8 device_id

Reserved for internal driver use; users can ignore.

u8 *buf

Poninter of buf where raw data is stored.

u16 buf_len

Length of raw data (including MAC header and frame body).

u8 tx_rate

Tx rate of tx_raw packets. Val: RTW_RATE_1M, RTW_RATE_2M, etc.

u8 retry_limit

Number of tx retry if sending the raw packet fails.

u8 ac_queue

Access Category Queue: 0/3 for BE, 1/2 for BK, 4/5 for VI, 6/7 for VO.

u8 sgi

Short Guard Interval: 1 to enable, 0 to disable.

u8 agg_en

Frame Aggregation: 1 to enable, 0 to disable for tx raw frames.

struct rtw_custom_ie

Sets the custom Information Element (IE) for Wi-Fi frames.

Public Members

u8 *ie

IE Format:

1byte

1byte

length bytes

element ID

length

content

u8 type

The type of TX frame to attach the custom IE: RTW_CUS_IE_PROBEREQ, RTW_CUS_IE_PROBERSP, etc.

struct rtw_channel_info

Describes a single WiFi channel’s information.

Public Members

u8 channel

Channel number

u8 scan_type

Scan type: 0 for active, 1 for passive

struct rtw_channel_list

Contains a list of available WiFi channels.

Public Members

u8 ch_num

Number of available channel in the list.

struct rtw_channel_info ch_info[RTW_MAX_CHANNEL_NUM]

Array of channel information

struct rtw_country_code_table

Describes channel plan and country code.

Public Members

u8 char2[2]

Country code.

u8 channel_plan

Channel plan code.

u8 pwr_lmt

Tx power limit index.

struct rtw_tx_power_ctl_info

Controls transmit power settings.

Public Members

s8 tx_pwr_force

User-specified TX power for all rates, in units of 0.25 dBm.

u8 b_tx_pwr_force_enbale

1 for enable, 0 for disable.

struct rtw_acs_config

Configuration for Automatic Channel Selection (ACS).

Public Members

u8 band

Frequency band: RTW_SUPPORT_BAND_2_4G, etc.