Wi-Fi APIs#

This section describes the Wi-Fi APIs

Modules#

BSD Sockets

rsi_wlan_req_radio

rsi_wlan_add_mfi_ie

Functions#

int32_t
rsi_driver_send_data(uint32_t sockID, uint8_t *buffer, uint32_t length, struct rsi_sockaddr *destAddr)

Send data packet. This is a blocking API.

int32_t

Process received data packet. This is a non-blocking API.

int16_t
rsi_nwk_register_callbacks(uint32_t callback_id, void(*callback_handler_ptr)(uint8_t command_type, uint32_t status, const uint8_t *buffer, const uint32_t length))

Register the callback. This is a non-blocking API.

int32_t

Initializes WLAN radio and supplicant parameters.

int32_t
rsi_wlan_filter_broadcast(uint16_t beacon_drop_threshold, uint8_t filter_bcast_in_tim, uint8_t filter_bcast_tim_till_next_cmd)

Program the ignore threshold levels of the broadcast packet when station is in power save and is used to achieve low current consumption in standby associated mode. This is blocking API.

int32_t
rsi_check_state(int32_t type)

Check if the WLAN is in IP Config state.

void
rsi_sort_scan_results_array_based_on_rssi(struct wpa_scan_results_arr *scan_results_array)

Sort the scan results in the order of RSSI.

int32_t
rsi_config_timeout(uint32_t timeout_type, uint16_t timeout_value)

This API is used to set timeouts.
This is a blocking API.

int32_t
send_timeout(uint32_t timeout_bitmap, uint16_t timeout_value)

This API is used to set timeouts.
This is a blocking API.

int32_t
rsi_wlan_scan_with_bitmap_options(int8_t *ssid, uint8_t chno, rsi_rsp_scan_t *result, uint32_t length, uint32_t scan_bitmap)

Scan surrounding access points and post scan response. You can call this API to get the scan results. This is a blocking API.

int32_t
rsi_wlan_scan_async_with_bitmap_options(int8_t *ssid, uint8_t chno, uint32_t bitmap, void(*scan_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length))

Scan available access points and post scan response to application. Application must call this API to get the scan results. This is a non-blocking API.

int32_t
rsi_wlan_scan(int8_t *ssid, uint8_t chno, rsi_rsp_scan_t *result, uint32_t length)

Scan the surrounding access points. Invokes rsi_wlan_scan_async() API, which is an asynchronous call. This is a blocking API.

int32_t
rsi_wlan_scan_async(int8_t *ssid, uint8_t chno, void(*scan_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length))

Scan the surrounding access points. A scan response handler is registered with it to get the response for scan. This is a non-blocking API.

int32_t
rsi_wlan_connect(int8_t *ssid, rsi_security_mode_t sec_type, void *secret_key)

Connect to the specified Wi-Fi network. This is a blocking API.

int
rsi_wlan_set_non_pref_chan(char *non_pref_chan)

Configure the non-preferred channels. This list is not related to the channels used for Wi-Fi scanning. Instead, it is used to inform the serving or candidate AP about the channels in which the STA does not want to operate or prefers not to operate. The AP uses this information when requesting a BSS transition for that specific STA.
This API should be called after rsi_wlan_scan API once it has returned Success.This is a blocking API.

int32_t
rsi_wlan_connect_async(int8_t *ssid, rsi_security_mode_t sec_type, void *secret_key, void(*join_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length))

Connect to the specified Wi-Fi network.A join response handler is registered to get the response for join.. This is a non-blocking API.

int32_t
rsi_wlan_bgscan_profile(uint8_t cmd, rsi_rsp_scan_t *result, uint32_t length)

Enable background scan and get the results or disable background scan. This is a blocking API.

int32_t

Enable scan and roaming after connecting the module to the access point. This is a blocking API.

int32_t

Start the WPS Push button in AP mode. This is a blocking API.

int32_t
rsi_send_freq_offset(int32_t freq_offset_in_khz)

Application to provide feedback of frequency error in KHz. This is a blocking API.

int32_t
rsi_calib_write(uint8_t target, uint32_t flags, int8_t gain_offset_low, int8_t gain_offset_mid, int8_t gain_offset_high, uint8_t xo_ctune)

RF calibration process. This API will command the firmware to update the existing Flash/EFuse calibration data. This is a blocking API.

int32_t
rsi_calib_read(uint8_t target, rsi_calib_read_t *calib_data)

RF calibration process. This API reads the calibration data from the Flash/EFuse storage. This is a blocking API.

int32_t
rsi_calibrate_dpd(uint8_t dpd_power_inx)

RF calibration process. This API will command the firmware to update the existing Flash/EFuse calibration data. This is a blocking API.

int16_t
rsi_parse(void *address, uint16_t length, uint8_t *value)

Parse and convert the given value in ASCII to the datatype of a given length.. This is a non-blocking API.

int32_t
rsi_wlan_wps_generate_pin(uint8_t *wps_pin, uint16_t length)

Generate WPS pin. This is a blocking API.

int32_t
rsi_wlan_wps_enter_pin(int8_t *wps_pin)

Validate WPS pin entered. This is a blocking API.

int32_t
rsi_wlan_beacon_stop(uint8_t beacon_stop)

Configure whether the module in AP mode transmits beacons or not when no station is connected.
The AP will beacon regardless of this configuration when stations are connected. This is a blocking API.
.

int32_t
rsi_get_random_bytes(uint8_t *result, uint32_t length)

Get random bytes from the device. This is a blocking API.

int32_t

Disconnect the module from the connected access point. This is a blocking API.

int32_t

Disconnect the module from the connected access point. This is a blocking API.

int32_t
rsi_wlan_disconnect_stations(uint8_t *mac_address)

Disconnect a connected station from the module in AP mode. This is a blocking API.

int32_t
rsi_config_ipaddress(rsi_ip_version_t version, uint8_t mode, uint8_t *ip_addr, uint8_t *mask, uint8_t *gw, uint8_t *ipconfig_rsp, uint16_t length, uint8_t vap_id)

Configure the IP address to the module. This is a blocking API.

int32_t
rsi_wlan_set_certificate_index(uint8_t certificate_type, uint8_t cert_inx, uint8_t *buffer, uint32_t certificate_length)

Write or erase certificate into module. This is a blocking API.

int32_t
rsi_wlan_set_certificate(uint8_t certificate_type, uint8_t *buffer, uint32_t certificate_length)

Load SSL/EAP certificate in the module. This is a blocking API.

int32_t

Check the error code encountered during a call to a WLAN API or BSD sockets functions. This is a non-blocking API.

int32_t
rsi_wlan_get(rsi_wlan_query_cmd_t cmd_type, uint8_t *response, uint16_t length)

Get the required information based on the type of command. This is a blocking API.

int32_t
rsi_wlan_set(rsi_wlan_set_cmd_t cmd_type, uint8_t *request, uint16_t length)

Request configuration based on the command type. This is a blocking API.

int32_t

Configure the TX and RX global buffers ratio. This is a blocking API.

int32_t
rsi_wlan_ap_start(int8_t *ssid, uint8_t channel, rsi_security_mode_t security_type, rsi_encryption_mode_t encryption_mode, uint8_t *password, uint16_t beacon_interval, uint8_t dtim_period)

Start the module in access point mode with the given configuration. This is a blocking API.

int32_t
rsi_wlan_power_save_with_listen_interval(uint8_t psp_mode, uint8_t psp_type, uint16_t listen_interval)

Set the power save profile in WLAN mode with listen interval-based wakeup. This is a blocking API.

int32_t
rsi_wlan_power_save_profile(uint8_t psp_mode, uint8_t psp_type)

Set the power save profile in WLAN mode. This is a blocking API.

int32_t
rsi_wlan_power_save_disable_and_enable(uint8_t psp_mode, uint8_t psp_type)

Disable or enable the power save feature. This is a blocking API.

int32_t
rsi_transmit_test_start(uint16_t power, uint32_t rate, uint16_t length, uint16_t mode, uint16_t channel)

Start the transmit test. This is a blocking API.
This API is relevant in PER mode.

int32_t

Stops the transmit test. This is a blocking API.
This API is relevant in PER mode.

int32_t

Get the Transmit (TX) and Receive (RX) packets statistics. When this API is called by the host with valid channel number, the module gives the statistics to the host for every 1 second asynchronously. If wlan_receive_stats_response_handler() is registered through rsi_wlan_register_callbacks(), it's a non blocking API, otherwise, a blocking API.

int32_t

Stop the Transmit (TX) & Receive(RX) packets statistics.
If wlan_receive_stats_response_handler() is registered through rsi_wlan_register_callbacks(), it's non blocking API, otherwise, a blocking API.

int32_t
rsi_wlan_send_data(uint8_t *buffer, uint32_t length)

Send the raw data in TCP/IP bypass mode. This is a blocking API.

int32_t
rsi_wlan_twt_auto_selection(uint8_t twt_enable, uint32_t rx_latency, uint32_t tx_latency, uint16_t avg_tx_throughput)

Calculates and configures TWT parameters based on the given inputs. Enables or disables a TWT session. This is blocking API.

int32_t
rsi_wlan_twt_config(uint8_t twt_enable, uint8_t twt_flow_id, twt_user_params_t *twt_req_params)

Configures TWT parameters. Enables or disables a TWT session. This is blocking API.

int32_t
rsi_wlan_ping_async(uint8_t flags, uint8_t *ip_address, uint16_t size, void(*wlan_ping_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length))

Send a ping request to the target IP address.
If wlan_ping_response_handler() is registered through rsi_wlan_register_callbacks(), it's non blocking API, otherwise, a blocking API.

void
rsi_register_auto_config_rsp_handler(void(*rsi_auto_config_rsp_handler)(uint16_t status, uint8_t state))

Register auto-configuration response handler.. This is a non-blocking API.

int32_t
rsi_wlan_add_profile(uint32_t type, uint8_t *profile)

Add profile for auto configuration. This is a blocking API.

uint8_t

Get the current WLAN state.. This is a non-blocking API.

int32_t
rsi_wlan_get_profile(uint32_t type, rsi_config_profile_t *profile_rsp, uint16_t length)

Get the stored config profile. This is a blocking API.

uint8_t *
rsi_fill_config_profile(uint32_t type, uint8_t *profile_buffer)

Fill the config profile based on the profile type.. This is a non-blocking API.

int32_t

Delete stored configuration based on profile type. This is a blocking API.

int32_t
rsi_wlan_enable_auto_config(uint8_t enable, uint32_t type)

Enable or disable auto-config with respect to profile. This is a blocking API.

int32_t
rsi_wlan_pmk_generate(int8_t type, int8_t *psk, int8_t *ssid, uint8_t *pmk, uint16_t length)

Generate and configure PMK if PSK and SSID are provided. This is a blocking API.

int16_t
rsi_wlan_set_sleep_timer(uint16_t sleep_time)

Configure the sleep timer mode of the module to go into sleep during power save operation. This is a blocking API.

uint16_t
rsi_wlan_register_callbacks(uint32_t callback_id, void(*callback_handler_ptr)(uint16_t status, uint8_t *buffer, const uint32_t length))

Register the WLAN callback functions. This is a non-blocking API.

int32_t
rsi_wlan_update_gain_table(uint8_t band, uint8_t bandwidth, uint8_t *payload, uint16_t payload_len)

Assign the user configurable channel gain values in different regions to the module from user.This method is used for overwriting default gain tables that are present in firmware.
Customer can load all the three gain tables (i.e., 2.4GHz-20Mhz, 5GHz-20Mhz, 5GHz-40Mhz) one after other by changing band and bandwidth values. This is a blocking API.

int32_t
rsi_wlan_csi_config_async(uint8_t enable, uint32_t periodicity, uint8_t num_of_mac_addr, uint8_t(*mac_addr)[6], void(*wlan_csi_data_response_handler)(uint16_t status, uint8_t *buffer, const uint32_t length))

Enable or disable CSI data retrieval with configured periodicity.

int32_t
rsi_send_evm_offset(uint8_t index, int8_t evm_offset_val)

Application to provide feedback of evm_offset error. This is a blocking API.

int32_t
rsi_evm_write(uint8_t target, uint32_t flags, int8_t evm_offset_11B, int8_t evm_offset_11G_6M_24M_11N_MCS0_MCS2, int8_t evm_offset_11G_36M_54M_11N_MCS3_MCS7, int8_t evm_offset_11N_MCS0, int8_t evm_offset_11N_MCS7)

RF calibration process. This API will command the firmware to update the existing Flash/EFuse calibration data. This is a blocking API.

Function Documentation#

rsi_driver_send_data#

int32_t rsi_driver_send_data (uint32_t sockID, uint8_t * buffer, uint32_t length, struct rsi_sockaddr * destAddr)

Send data packet. This is a blocking API.

Parameters
[in]sockID

- Socket descriptor on which data needs to be send

[in]buffer

- Pointer to data

[in]length

- Data length

[in]destAddr

- Pointer to destination socket details

Returns

  • 0 - Success

  • Negative Value - Failure


Definition at line 43 of file driver/rsi_nwk.c

rsi_driver_process_recv_data#

int32_t rsi_driver_process_recv_data (rsi_pkt_t * pkt)

Process received data packet. This is a non-blocking API.

Parameters
[in]pkt

- Pointer to data packet

Returns

  • 0 - Success

  • Negative Value - Failure


Definition at line 57 of file driver/rsi_nwk.c

rsi_nwk_register_callbacks#

int16_t rsi_nwk_register_callbacks (uint32_t callback_id, void(*)(uint8_t command_type, uint32_t status, const uint8_t *buffer, const uint32_t length) callback_handler_ptr, status, buffer, length)

Register the callback. This is a non-blocking API.

Parameters
[in]callback_id

- This is the Id of the callback function.
Following ids are supported:
0-RSI_NWK_ERROR_CB,
1-RSI_WLAN_NWK_URL_REQ_CB,
2-RSI_WLAN_NWK_JSON_UPDATE_CB,
3-RSI_WLAN_NWK_FW_UPGRADE_CB,
4-RSI_WLAN_NWK_JSON_EVENT_CB

[in]callback_handler_ptr

- Callback handler which needs to be registered for a given callback

[out]status

- Response status.

[out]buffer

- Response buffer.

[out]length

- Length of the response buffer.

Returns

  • 0 - Success
    Non-Zero Value - Failure (Possible Error Codes - 0xfffffffd)
    1 - If call_back_id is greater than the maximum callbacks to register

prototypes of the callback functions#

callback id

Prototype

Description

Parameters

RSI_NWK_ERROR_CB

void (*nwk_error_call_back_handler)(uint8_t command_type, uint32_t status, const uint8_t *buffer, const uint32_t length);

This callback is used to Register join fail

command_type => command_type of the response
status => status of the response
buffer => payload of the response
length => length of the payload

RSI_WLAN_NWK_URL_REQ_CB

void (*rsi_webpage_request_handler)(uint8_t type, uint8_t *url_name,uint8_t *post_content_buffer, uint32_t post_content_length, uint32_t status);

This callback is used to Register webpage request

type => type of the handler
url_name =>url name
post_content_buffer => Webpage content
post_content_lenght => length of webpage content
status => status of the response

RSI_WLAN_NWK_JSON_UPDATE_CB

void (*rsi_json_object_update_handler)(uint8_t *file_name, uint8_t *json_object, uint32_t length, uint32_t status);

This callback is used to Register json update

file_name => File name
json_object => Json object
length: length of the json object
status => status of the response

RSI_WLAN_NWK_FW_UPGRADE_CB

void (*rsi_wireless_fw_upgrade_handler)(uint8_t type, uint32_t status);

This callback is used to Register wireless firmware upgrade

type => type of the handler
status => status of the response

RSI_WLAN_NWK_JSON_EVENT_CB

void (*rsi_json_object_event_handler)(uint32_t status, uint8_t *json_object_str, uint32_t length);

This callback is used to Register json update

status => status of the response
json_object_str => json object string
length => length of the string

Note

  • Refer to Error Codes for the description of above error codes.


Definition at line 92 of file driver/rsi_nwk.c

rsi_wlan_radio_init#

int32_t rsi_wlan_radio_init (void )

Initializes WLAN radio and supplicant parameters.

Parameters
[in]


Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0x0021)

Note


Definition at line 2485 of file driver/rsi_wlan.c

rsi_wlan_filter_broadcast#

int32_t rsi_wlan_filter_broadcast (uint16_t beacon_drop_threshold, uint8_t filter_bcast_in_tim, uint8_t filter_bcast_tim_till_next_cmd)

Program the ignore threshold levels of the broadcast packet when station is in power save and is used to achieve low current consumption in standby associated mode. This is blocking API.

Parameters
[in]beacon_drop_threshold

- LMAC beacon drop threshold(ms):LMAC beacon drop threshold (ms): This is the time the firmware waits to receive the complete beacon. For optimal power performance, use the default value of 5000 ms.

[in]filter_bcast_in_tim

- If this bit is set, then from the next dtim any broadcast data pending bit in TIM indicated will be ignored valid values: 0 - 1
Validity of this bit is dependent on the filter_bcast_tim_till_next_cmd.

[in]filter_bcast_tim_till_next_cmd

- 0 - filter_bcast_in_tim is valid till disconnect of the STA.
1 - filter_bcast_in_tim is valid till next update by giving the same command.

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0x0021)


Definition at line 2760 of file driver/rsi_wlan.c

rsi_check_state#

int32_t rsi_check_state (int32_t type)

Check if the WLAN is in IP Config state.

Parameters
[in]type

- Socket family type

Returns

  • 0 - Success: IP config state

  • Negative value - Failure: -20 (0xffffffec) - Not in IP config state


Definition at line 1304 of file network/socket/rsi_socket.c

rsi_sort_scan_results_array_based_on_rssi#

void rsi_sort_scan_results_array_based_on_rssi (struct wpa_scan_results_arr * scan_results_array)

Sort the scan results in the order of RSSI.

Parameters
[in]scan_results_array

- Contains the array of scan results that need to be sorted.

Returns

  • Void

Note


Definition at line 36 of file wlan/rsi_wlan_apis.c

rsi_config_timeout#

int32_t rsi_config_timeout (uint32_t timeout_type, uint16_t timeout_value)

This API is used to set timeouts.
This is a blocking API.

Parameters
[in]timeout_type

- It is used to identify which timeout to be set.
if timeout_type is 1 - set for association and authentication timeout request in ms. 2 - set for the each channel active scan time in ms 3 - is set for the WLAN keep alive time in seconds

[in]timeout_value

- timeout value to be set.

Note

Returns

  • 0 - Success
    Non-Zero Value - Failure


Definition at line 77 of file wlan/rsi_wlan_apis.c

send_timeout#

int32_t send_timeout (uint32_t timeout_bitmap, uint16_t timeout_value)

This API is used to set timeouts.
This is a blocking API.

Parameters
[in]timeout_bitmap

- It is used to identify which timeout to be set.
if timeout_bitmap is RSI_ASSOCIATION_AND_AUTHENTICATION_TIMEOUT_MSEC - set for association and authentication timeout request in ms. RSI_CHANNEL_SCAN_TIME_MSEC - set for the each channel active scan time in ms RSI_WLAN_KEEP_ALIVE_TIMEOUT_SEC - is set for the WLAN keep alive time in seconds

[in]timeout_value

- timeout value to be set.

Note

Returns

  • 0 - Success
    Non-Zero Value - Failure


Definition at line 134 of file wlan/rsi_wlan_apis.c

rsi_wlan_scan_with_bitmap_options#

int32_t rsi_wlan_scan_with_bitmap_options (int8_t * ssid, uint8_t chno, rsi_rsp_scan_t * result, uint32_t length, uint32_t scan_bitmap)

Scan surrounding access points and post scan response. You can call this API to get the scan results. This is a blocking API.

Parameters
[in]ssid

- SSID of an access point to connect.
SSID should be less than or equal to 32 bytes.
Note: SSID is a null terminated string.

[in]chno

- Channel number of the access point.

[out]result

- Buffer address provided by the application to fill the scan response.

[in]length

- Length of the resulting buffer measured in bytes to hold scan results.
Size of structure rsi_rsp_scan_t is 54 bytes.
Length for storing one scan result is sizeof( rsi_scan_info_t), which is 44 bytes.
Maximum of 11 scan results will be returned by the module,
in this case, length should be configured as 8 + 11*sizeof( rsi_scan_info_t).

[in]scan_bitmap

- Scan bitmap options.
BIT[0] (QUICK SCAN feature) - It is valid only if channel number and ssid is given.
BIT[1] (SCAN RESULTS TO HOST) - When it is enabled additional scan results are given to host.
After getting scan results, host has to issue another scan request by disabling this bit in scan feature bitmap in same API
or call rsi_wlan_scan API before issuing join command.

Returns

  • 0 - Success

  • Non-Zero Value - Failure

Note


Definition at line 201 of file wlan/rsi_wlan_apis.c

rsi_wlan_scan_async_with_bitmap_options#

int32_t rsi_wlan_scan_async_with_bitmap_options (int8_t * ssid, uint8_t chno, uint32_t bitmap, void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length) scan_response_handler, buffer, length)

Scan available access points and post scan response to application. Application must call this API to get the scan results. This is a non-blocking API.

Parameters
[in]ssid

- SSID of an access point to connect.
SSID should be less than or equal to 32 bytes.

[in]chno

- Channel number of the access point.

[in]bitmap

- Scan feature bitmap
BIT[0] (QUICK SCAN feature) - It is valid only if channel number and ssid is given.
BIT[1] (SCAN RESULTS TO HOST) - When it is enabled additional scan results are given to host.
After getting scan results, host has to issue another scan request by disabling this bit in scan feature bitmap in same api or call rsi_wlan_scan api
before issuing join command.

[out]scan_response_handler

- Response status

[out]buffer

- Buffer address provided by the application to fill the scan response.

[out]length

- Length of the response buffer measured in bytes to hold scan results.
Size of structure rsi_rsp_scan_t is 54 bytes. Length for storing one scan result is sizeof( rsi_scan_info_t), which is 46 bytes.
Maximum of 11 scan results will be returned by the module,
in this case, length should be configured as 8 + 11*sizeof( rsi_scan_info_t).

Returns

  • 0 - Success
    Non-Zero Value - Failure


Definition at line 283 of file wlan/rsi_wlan_apis.c

rsi_wlan_scan#

int32_t rsi_wlan_scan (int8_t * ssid, uint8_t chno, rsi_rsp_scan_t * result, uint32_t length)

Scan the surrounding access points. Invokes rsi_wlan_scan_async() API, which is an asynchronous call. This is a blocking API.

Parameters
[in]ssid

- SSID size should be less than or equal to 32 bytes. Note: SSID is a null terminated string.

[in]chno

- Channel number to perform scan. If 0, then the module will scan all the channels.

[out]result

- Scanned Wi-Fi networks information.
This output contains a maximum of 11 scan results
The structure rsi_rsp_scan_t contains members scan_count, which specifies the number of scan
results followed by an array of structure type rsi_scan_info_t, where each array element contains
information about each network scanned.

[in]length

- Size that should be allocated to buffer that will store scan results.

Channels supported in 2.4 GHz Band#

Channel numbers

chno

All Channels

0

1

1

2

2

3

3

4

4

5

5

6

6

7

7

8

8

9

9

10

10

11

11

12

12

13

13

Channels supported in 5 GHz Band#

Channel numbers

chno

All Channels

0

36

36

40

40

44

44

48

48

149

149

153

153

157

157

161

161

165

165

DFS Channels supported in 5 GHz Band#

Channel numbers

chno

52(DFS)

52

56(DFS)

56

60(DFS)

60

64(DFS)

64

100(DFS)

100

104(DFS)

104

108(DFS)

108

112(DFS)

112

116(DFS)

116

120(DFS)

120

124(DFS)

124

128(DFS)

128

132(DFS)

132

136(DFS)

136

140(DFS)

140

144(DFS)

144

Channels supported in 4.9 GHz Band#

Channel numbers

chno

All Channels

0

184

184

188

188

192

192

196

196

8

8

12

12

16

16

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe,0xfffffffd,0xfffffffa,0x0002, 0x0003, 0x0005, 0x000A, 0x0014, 0x0015, 0x001A, 0x0021,0x0024,0x0025,0x0026,0x002C,0x003c)

Scan Info structure#

Structure Fields

Description

rf_channel

Access point channel number

security_mode

Security modes
0 : Open
1 : WPA
2 : WPA2
3 : WEP
4 : WPA Enterprise
5 : WPA2 Enterprise
6 : WPA/WPA2 Mixed mode
7 : WPA3 Personal
8 : WPA3 Personal Transition Mode

rssi_val

RSSI value of the Access Point

network_type

This is the type of the network
1 : Infrastructure mode

ssid

SSID of the access point

bssid

MAC address of the access point

Note

  • Precondition - rsi_wireless_init() API needs to be called before this API.

  • Refer to Error Codes for the description of above error codes.

  • To set various timeouts, user should change the following macros in rsi_wlan_config.h
    #define RSI_TIMEOUT_SUPPORT RSI_ENABLE
    #define RSI_TIMEOUT_BIT_MAP 2
    #define RSI_TIMEOUT_VALUE 150 (This macro can be configured based on user requirement)

    timeout_bitmap

    Description

    timeout_bitmap[0]

    Set timeout for association and authentication request.timeout_value : timeout value in ms(default 300ms).

    timeout_bitmap[1]

    Sets each channel active scan time in ms (default 100ms)

    timeout_bitmap[2]

    Used for WLAN keep alive timeout(default value is 30s)

    timeout_bitmap[31-3]

    Reserved


Definition at line 727 of file wlan/rsi_wlan_apis.c

rsi_wlan_scan_async#

int32_t rsi_wlan_scan_async (int8_t * ssid, uint8_t chno, void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length) scan_response_handler, Status, Buffer, Length)

Scan the surrounding access points. A scan response handler is registered with it to get the response for scan. This is a non-blocking API.

Parameters
[in]ssid

- SSID to scan. If this input parameter is present, module will scan for that particular SSID only. SSID size should be less than or equal to 32 bytes
Note: SSID is a null terminated string.

[in]chno

- Channel number to perform scan, if 0, then module will scan in all channels.

[in]scan_response_handler

- Callback tht is called when the response for scan is received from the module.
The parameters involved are status, buffer, & length.

[out]Status

- Response status.

[out]Buffer

- Response buffer

[out]Length

- Length of the response buffer measured in bytes to hold scan results.
Size of structure rsi_rsp_scan_t is 54 bytes.
Length for storing one scan result is sizeof(rsi_scan_info_t) which is 44 bytes.
Maximum of 11 scan results will be returned by the module, in this case, length must be configured as 8 + 11*sizeof(rsi_scan_info_t).

Channels supported in 2.4 GHz Band#

Channel numbers

chno

All Channels

0

1

1

2

2

3

3

4

4

5

5

6

6

7

7

8

8

9

9

10

10

11

11

12

12

13

13

Channels supported in 5 GHz Band#

Channel numbers

chno

All Channels

0

36

36

40

40

44

44

48

48

100

100

104

104

108

108

116

116

132

132

136

136

140

140

149

149

153

153

157

157

161

161

165

165

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe,0xfffffffd,0xfffffffa,0x0002, 0x0003, 0x0005, 0x000A, 0x0014, 0x0015, 0x001A, 0x0021,0x0024,0x0025,0x0026,0x002C,0x003c)

Scan Response structure format#

Structure Fields

Description

scan_count

Number of access points scanned.

^ scan_count[0] Contains the scan count. ^ scan_count[3-1] are reserved. scan_info | Information about scanned Access points in rsi_scan_info_t structure.

Scan Info - rsi_scan_info_t structure#

Structure Fields

Description

rf_channel

Access point channel number

security_mode

Security mode
0 : Open
1 : WPA
2 : WPA2
3 : WEP
4 : WPA Enterprise
5 : WPA2 Enterprise
6 : WPA/WPA2 Mixed mode
7 : WPA3 Personal
8 : WPA3 Personal Transition Mode

rssi_val

RSSI value of the Access Point

network_type

Type of network
1 . Infrastructure mode

ssid

SSID of the access point

bssid

MAC address of the access point

Note

  • Precondition - rsi_wireless_init() API needs to be called before this API.

  • If status is Success , the argument buffer passed to scan_response_handler
    holds scan results in rsi_rsp_scan_t structure format.

  • To set various timeouts, user should change the following macros in rsi_wlan_config.h
    #define RSI_TIMEOUT_SUPPORT RSI_ENABLE
    #define RSI_TIMEOUT_BIT_MAP 4
    #define RSI_TIMEOUT_VALUE 300

timeout_bitmap

Description

timeout_bitmap[0]

Set timeout for association and authentication request.timeout_value : timeout value in ms(default 300ms).

timeout_bitmap[1]

Sets each channel active scan time in ms (default 100ms)

timeout_bitmap[2]

Used for WLAN keep alive timeout(default value is 30s)

timeout_bitmap[31-3]

Reserved


Definition at line 862 of file wlan/rsi_wlan_apis.c

rsi_wlan_connect#

int32_t rsi_wlan_connect (int8_t * ssid, rsi_security_mode_t sec_type, void * secret_key)

Connect to the specified Wi-Fi network. This is a blocking API.

Parameters
[in]ssid

- SSID of an access point to connect. SSID should be less than or equal to 32 bytes.

[in]sec_type

- Security type of the access point to connect.

Value

Security Type

0

RSI_OPEN

1

RSI_WPA

2

RSI_WPA2

3

RSI_WEP

4

RSI_WPA_EAP

5

RSI_WPA2_EAP

6

RSI_WPA_WPA2_MIXED

7

RSI_WPA_PMK

8

RSI_WPA2_PMK

9

RSI_WPS_PIN

10

RSI_USE_GENERATED_WPSPIN

11

RSI_WPS_PUSH_BUTTON

12

RSI_WPA_WPA2_MIXED_PMK

13

RSI_WPA3

[in]secret_key

- Pointer to a buffer that contains security information based on sec_type.

Security type(sec_type)

Secret key structure format (secret_key)

RSI_OPEN

No secret key in open security mode.

RSI_WPA

PSK string terminated with NULL. Length of PSK should be at least 8 and less than 64 bytes.

RSI_WPA2

PSK string terminated with NULL. Length of PSK should be at least 8 and less than 64 bytes.

RSI_WEP

WEP keys should be in the following format:

^ typedef struct rsi_wep_keys_s ^ { ^ uint8_t index[2]; ^ uint8_t key[4][32]; ^ } rsi_wep_keys_t; ^ index: WEP key index to use for TX packet encryption. ^ key: 4 WEP keys, last three WEP keys are optional. If only first WEP key is valid then index should be 0. RSI_WPA_EAP | Enterprise credentials should be in the following format: ^ typedef struct rsi_eap_credentials_s ^ { ^ uint8_t username[64]; ^ uint8_t password[128]; ^ } rsi_eap_credentials_t; ^ username: username to be used in enterprise ^ password: password for the given username RSI_WPA2_EAP | Enterprise credentials should be in the following format: ^ typedef struct rsi_eap_credentials_s ^ { ^ uint8_t username[64]; ^ uint8_t password[128]; ^ } rsi_eap_credentials_t; ^ username: username to be used in enterprise ^ password: password for a given username. RSI_WPA_WPA2_MIXED | PSK string terminated with NULL. Length of PSK should be at least 8 and less than 64 bytes RSI_WPA_PMK | PMK string, should be 32 bytes in length RSI_WPA2_PMK | PMK string, should be 32 bytes in length RSI_WPS_PIN | 8-byte WPS PIN RSI_USE_GENERATED_WPSPIN| NULL string indicate to use PIN generated using rsi_wps_generate_pin API RSI_WPS_PUSH_BUTTON | NULL string indicate to generate push button event RSI_WPA3 | PSK string terminated with NULL. Length of PSK should be at least 8 and less than 64 bytes.

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe,0xfffffffd,0xfffffffa,0x0002,0x0003,0x0005,0x0008,0x0009,0x000A,0x000E,0x0014,
    0x0015,0x0016,0x0019,0x001A,0x001E,0x0020,0x0021,0x0024,0x0025,0x0026,0x0028,0x0039,0x003C,
    0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0xFFF8)

Note

  • Precondition - rsi_wireless_init() API needs to be called before this API.

  • Refer to Error Codes for the description of above error codes.

  • To set various timeouts, user should change the following macros in rsi_wlan_config.h
    #define RSI_TIMEOUT_SUPPORT RSI_ENABLE.
    #define RSI_TIMEOUT_BIT_MAP 4.
    #define RSI_TIMEOUT_VALUE 300.

    timeout_bitmap

    Description

    timeout_bitmap[0]

    Set timeout for association and authentication request.timeout_value : timeout value in ms(default 300ms).

    timeout_bitmap[1]

    Sets each channel active scan time in ms (default 100ms)

    timeout_bitmap[2]

    Used for WLAN keep alive timeout(default value is 30s)

    timeout_bitmap[31-3]

    Reserved

  • To set Rejoin parameters, user should configure the following macros in rsi_wlan_config.h

    Macro

    Description

    RSI_REJOIN_PARAMS_SUPPORT

    Enable to send rejoin parameters command during Wi-Fi client connection

    RSI_REJOIN_MAX_RETRY

    Number of maximum rejoin retries by module

    note

    If Max retries is 0 , retries infinity times

    RSI_REJOIN_SCAN_INTERVAL

    Periodicity of rejoin attempt

    RSI_REJOIN_BEACON_MISSED_COUNT

    Number of consecutive beacon misses after which modules goes to unconnected state

    RSI_REJOIN_FIRST_TIME_RETRY

    ENABLE - Try to rejoin in the first attempt after join failure.

    DISABLE - Try to rejoin based on maximum rejoin retries configured.

  • When RSI_REJOIN_PARAMS_SUPPORT is enabled in the rsi_wlan_config.h, the rejoin frame will be sent to the firmware after the scan is done.

  • Rejoin scan interval is in seconds.

  • Default beacon missed count is 40, A unicast probe request will be sent from the midpoint of the given beacon missed count.

  • For example,
    If the beacon count is 40, the unicast probe request will be sent from the module to the AP at the midpoint, which is the 21st beacon. This will also occur at the 31st beacon count.

  • Recommended to enable RSI_REJOIN_FIRST_TIME_RETRY to minimize join failures, especially in scenarios such as abnormal connection termination caused by a module reset.

  • This API internally handles following commands based on wlan_cb state and sends the next command and finally sends the join command.
    Set MAC address, Band, Timeout, Init, Set region, WMM parameters, Scan, EAP config, WMM PS parameters, WPS method, Set WEP keys, Host PSK, Rejoin params, Join

  • For example,
    after calling rsi_wireless_init(), wlan_cb state is updated to OPERMODE_DONE state. So when we call this API, it will execute band, init, scan and join commands.

  • For example,
    after calling rsi_wlan_disconnect() or else after rejoin failure, wlan_cb state is updated to BAND_DONE state. So when we call this API, it will execute init, scan and join commands.

  • For example,
    after calling rsi_wlan_scan()/ rsi_wlan_scan_with_bitmap_options() API, wlan_cb state is updated to SCAN_DONE state. So when we call this API, it will execute join command directly.

EAP configuration#

For EAP configuration below arguments are required and are congifured in rsi_wlan_config.h in enterprise_client applicaiton.
• eap_method, inner_method, user_identity, password, okc, private_key_password
• eap_method is 32 bytes and it can be any one of the following methods: TLS, TTLS, FAST, PEAP or LEAP, should be given as string in RSI_EAP_METHOD.
• inner_method is 32 bytes, this field is valid only in TTLS/PEAP. In case of TTLS/PEAP supported inner methods are MSCHAP/MSCHAPV2. In case of TLS/FAST/LEAP this field is not valid and it should be fixed to MSCHAPV2. Here MSCHAP/MSCHAPV2 are given in RSI_EAP_INNER_METHOD.
• user_identity is 64 bytes, this can be configured in USER_IDENTITY of rsi_eap_connectivity.c of enterprise_client application and this should be a string.
• password is 128 bytes, this can be configured in PASSWORD of rsi_eap_connectivity.c of enterprise_client application and this should be a string.
• okc is 4 bytes, This argument is used to enable or disable or select multiple features from user this value can be modified by OKC_VALUE macro.

  • BIT[0] of OKC is used to enable or disable opportunistic key caching (OKC),
    0 – disable
    1 – enable
    – When this is enabled, module will use cached PMKID to get MSK(Master Session Key) which is need for generating PMK which is needed for 4-way handshake.

  • BIT[1] of OKC is used to enable or disable CA certification for PEAP connection.
    0 – CA certificate is not required.
    1 – CA certificate is required.

  • BIT[2-12] of OKC argument are used for Cipher list selection for EAP connection. All possible ciphers are listed below

    BIT position

    Cipher selected

    2

    DHE-RSA-AES256-SHA256

    3

    DHE-RSA-AES128-SHA256

    4

    DHE-RSA-AES256-SHA

    5

    DHE-RSA-AES128-SHA

    6

    AES256-SHA256

    7

    AES128-SHA256

    8

    AES256-SHA

    9

    AES128-SHA

    10

    RC4-SHA

    11

    DES-CBC3-SHA

    12

    RC4-MD5

  • BIT[13-31] of OKC argument is reserved.

  • When user sets BIT[1] and does not provide the CA certificate for PEAP connection then error is thrown. If user provides invalid CA certificate then also error is thrown. User can set either one or multiple bits from BIT[2-12] to provide the cipher's list. When user does not provide any value in OKC's BIT[2-12] then by default all the ciphers are selected.
    • private_key_password is 82 bytes,This is password for encrypted private key given to the module. Module will use this password during decryption of encrypted private key. password length must be 80 bytes or less. Should be configured in RSI_PRIVATE_KEY_PASSWORD.

Returns

  • Success - RSI_SUCCESS
    Failure - Non-Zero Value

        `if return value is less than zero :\n
    

RSI_ERROR_INVALID_PARAM - Invalid parameters
RSI_ERROR_COMMAND_GIVEN_IN_WRONG_STATE - Command given in wrong state
RSI_ERROR_PKT_ALLOCATION_FAILURE - Buffer not available to serve the command
`Other expected error code are :
0x0002,0x0003,0x0005,0x0008,0x0009,0x000A,0x000E,0x0014,
0x0015,0x0016,0x0019,0x001A,0x001E,0x0020,0x0021,0x0024,
0x0025,0x0026,0x0028,0x0039,0x003C,0x0044,0x0045,0x0046,
0x0047,0x0048,0x0049,0xFFF8Note

  • WPA3 STA supports both H2E and Hunting-and-pecking for WPA3 authentication. It picks authentication algorithm based on AP's capability.
    WPA3 STA supports PMKSA caching. If STA has valid PMKID (generated after first connection) with an AP it will trigger OPEN authentication for successive connection attempts. By default the lifetime for PMKSA entry is 12 hours.
    In WPA3 Personal Transition Mode if both WPA2 and WPA3 APs are available in scan results, STA will pick the AP which has strongest RSSI (it could be either WPA2 or WPA3).
    If connected WPA3 AP enables Transition Disable Indication, from that moment onwards STA in transistion mode will not try connections to WPA2 APs. This behavior will persist until reset of the STA.

  • Refer to Error Codes section for the description of the above error codes Error Codes.


Definition at line 1351 of file wlan/rsi_wlan_apis.c

rsi_wlan_set_non_pref_chan#

int rsi_wlan_set_non_pref_chan (char * non_pref_chan)

Configure the non-preferred channels. This list is not related to the channels used for Wi-Fi scanning. Instead, it is used to inform the serving or candidate AP about the channels in which the STA does not want to operate or prefers not to operate. The AP uses this information when requesting a BSS transition for that specific STA.
This API should be called after rsi_wlan_scan API once it has returned Success.This is a blocking API.

Parameters
[in]non_pref_chan

- This parameter is a list of channels that indicates the operating preference of a Wi-Fi Agile Multiband Station (STA) to a Wi-Fi Agile Multiband Access Point (AP).
This list is space-delimited and each channel is represented by a colon-delimited set of values.
Format : non_pref_chan=<oper_class>:<chan>:<preference>:<reason>
Example : non_pref_chan="81:5:1:2 81:1:0:2 81:9:0:2"

Returns

  • 0 - Success
    Non-Zero Value - Failure


Definition at line 1411 of file wlan/rsi_wlan_apis.c

rsi_wlan_connect_async#

int32_t rsi_wlan_connect_async (int8_t * ssid, rsi_security_mode_t sec_type, void * secret_key, void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length) join_response_handler, Status, Buffer, length)

Connect to the specified Wi-Fi network.A join response handler is registered to get the response for join.. This is a non-blocking API.

Parameters
[in]ssid

- SSID of an access point to connect. SSID should be less than or equal to 32 bytes.

[in]sec_type

- Security type of the access point to connect.

Value

Security Type

0

RSI_OPEN

1

RSI_WPA

2

RSI_WPA2

3

RSI_WEP

4

RSI_WPA_EAP

5

RSI_WPA2_EAP

6

RSI_WPA_WPA2_MIXED

7

RSI_WPA_PMK

8

RSI_WPA2_PMK

9

RSI_WPS_PIN

10

RSI_USE_GENERATED_WPSPIN

11

RSI_WPS_PUSH_BUTTON

12

RSI_WPA_WPA2_MIXED_PMK

13

RSI_WPA3

[in]secret_key

- Pointer to a buffer that contains security information based on sec_type.

Security type(sec_type)

Secret key structure format (secret_key)

RSI_OPEN

No secret key in open security mode.

RSI_WPA

PSK string terminated with NULL. Length of PSK should be at least 8 and less than 64 bytes.

RSI_WPA2

PSK string terminated with NULL. Length of PSK should be at least 8 and less than 64 bytes.

RSI_WEP

WEP keys should be in the following format:

^ typedef struct rsi_wep_keys_s ^ { ^ uint8_t index[2]; ^ uint8_t key[4][32]; ^ } rsi_wep_keys_t; ^ index: WEP key index to use for TX packet encryption. ^ key: 4 WEP keys, last three WEP keys are optional. If only first WEP key is valid then index should be 0. RSI_WPA_EAP | Enterprise credentials should be in the following format: ^ typedef struct rsi_eap_credentials_s ^ { ^ uint8_t username[64]; ^ uint8_t password[128]; ^ } rsi_eap_credentials_t; ^ username: username to be used in enterprise ^ password: password for the given username RSI_WPA2_EAP | Enterprise credentials should be in the following format: ^ typedef struct rsi_eap_credentials_s ^ { ^ uint8_t username[64]; ^ uint8_t password[128]; ^ } rsi_eap_credentials_t; ^ username: username to be used in enterprise ^ password: password for a given username. RSI_WPA_WPA2_MIXED | PSK string terminated with NULL. Length of PSK should be at least 8 and less than 64 bytes RSI_WPA_PMK | PMK string, should be 32 bytes in length RSI_WPA2_PMK | PMK string, should be 32 bytes in length RSI_WPS_PIN | 8-byte WPS PIN RSI_USE_GENERATED_WPSPIN| NULL string indicate to use PIN generated using rsi_wps_generate_pin API RSI_WPS_PUSH_BUTTON | NULL string indicate to generate push button event RSI_WPA3 | PSK string terminated with NULL. Length of PSK should be at least 8 and less than 64 bytes.

[in]join_response_handler

- Called when the response for join has been received from the module.
Parameters involved are status, buffer, & length

[out]Status

- Response status.

[out]Buffer

- Response buffer. On successful execution of the command.
GO_Status (1 byte, hex): 0x47 (ASCII "G") - If the module becomes a Group Owner (GO) after the GO negotiation stage or becomes an Access Point.
0x43 (ASCII "C") - If the module does not become a GO after the GO negotiation stage or becomes a client (or station).

[out]length

- Length of the response buffer.

Note

  • Precondition - rsi_wireless_init() API needs to be called before this API.

  • Refer to Error Codes for the description of above error codes.

  • The module gets a default IP of 192.168.100.76, if it becomes a Group Owner or Access Point in case of IPv4 and gets a default IP of 2001:db8:0:1:0:0:0:120 in case of IPv6.

  • To set various timeouts, user should change the following macros in rsi_wlan_config.h
    #define RSI_TIMEOUT_SUPPORT RSI_ENABLE.
    #define RSI_TIMEOUT_BIT_MAP 4.
    #define RSI_TIMEOUT_VALUE 300.

    timeout_bitmap

    Description

    timeout_bitmap[0]

    Set timeout for association and authentication request.timeout_value : timeout value in ms(default 300ms).

    timeout_bitmap[1]

    Sets each channel active scan time in ms (default 100ms)

    timeout_bitmap[2]

    Used for WLAN keep alive timeout(default value is 30s)

    timeout_bitmap[31-3]

    Reserved

  • To set Rejoin parameters, user should configure the following macros in rsi_wlan_config.h

    Macro

    Description

    RSI_REJOIN_PARAMS_SUPPORT

    Enable to send rejoin parameters command during Wi-Fi client connection

    RSI_REJOIN_MAX_RETRY

    Number of maximum rejoin retries by module

    note

    If Max retries is 0 , retries infinity times

    RSI_REJOIN_SCAN_INTERVAL

    Periodicity of rejoin attempt

    RSI_REJOIN_BEACON_MISSED_COUNT

    Number of consecutive beacon misses after which modules goes to unconnected state

    RSI_REJOIN_FIRST_TIME_RETRY

    ENABLE - Try to rejoin in the first attempt after join failure.

    DISABLE - Try to rejoin based on maximum rejoin retries configured.

  • When RSI_REJOIN_PARAMS_SUPPORT is enabled in the rsi_wlan_config.h, the rejoin frame will be sent to the firmware after the scan is done.

  • This API internally handles following commands based on wlan_cb state and sends the next command and finally sends the join command.
    Set MAC address, Band, Timeout, Init, Set region, WMM parameters, Scan, EAP config, WMM PS parameters, WPS method, Set WEP keys, Host PSK, Rejoin params, Join

  • For example,
    after calling rsi_wireless_init(), wlan_cb state is updated to OPERMODE_DONE state. So when we call this API, it will execute band, init, scan and join commands.

  • For example,
    after calling rsi_wlan_disconnect() or else after rejoin failure, wlan_cb state is updated to BAND_DONE state. So when we call this API, it will execute init, scan and join commands.

  • For example,
    after calling rsi_wlan_scan()/ rsi_wlan_scan_with_bitmap_options() API, wlan_cb state is updated to SCAN_DONE state. So when we call this API, it will execute join command directly.


Definition at line 1590 of file wlan/rsi_wlan_apis.c

rsi_wlan_bgscan_profile#

int32_t rsi_wlan_bgscan_profile (uint8_t cmd, rsi_rsp_scan_t * result, uint32_t length)

Enable background scan and get the results or disable background scan. This is a blocking API.

Parameters
[in]cmd

- Command given by user, to enable or disable bgscan.
0 - disable bgscan,
1 - enable bgscan

[out]result

- buffer to store bgscan results

[in]length

- Length of bgscan result buffer

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc)

Note


Definition at line 2286 of file wlan/rsi_wlan_apis.c

rsi_wlan_execute_post_connect_cmds#

int32_t rsi_wlan_execute_post_connect_cmds (void )

Enable scan and roaming after connecting the module to the access point. This is a blocking API.

Parameters
[in]

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffd,0xfffffffc,0x0006,0x0021,0x002C,0x004A,0x0025,0x0026)

Note


Definition at line 2367 of file wlan/rsi_wlan_apis.c

rsi_wlan_wps_push_button_event#

int32_t rsi_wlan_wps_push_button_event (int8_t * ssid)

Start the WPS Push button in AP mode. This is a blocking API.

Parameters
[in]ssid

- SSID of the Access Point. SSID should be same as that of given in AP start API. Length of the SSID should be less than or equal to 32 bytes.

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffc,0x0021)

Note


Definition at line 2476 of file wlan/rsi_wlan_apis.c

rsi_send_freq_offset#

int32_t rsi_send_freq_offset (int32_t freq_offset_in_khz)

Application to provide feedback of frequency error in KHz. This is a blocking API.

Parameters
[in]freq_offset_in_khz

- Frequency deviation observed in KHz

Returns

  • 0 - Success

Note

  • Refer to Error Codes for the description of above error codes.


Definition at line 2561 of file wlan/rsi_wlan_apis.c

rsi_calib_write#

int32_t rsi_calib_write (uint8_t target, uint32_t flags, int8_t gain_offset_low, int8_t gain_offset_mid, int8_t gain_offset_high, uint8_t xo_ctune)

RF calibration process. This API will command the firmware to update the existing Flash/EFuse calibration data. This is a blocking API.

Parameters
[in]target

- 0 - BURN_INTO_EFUSE (Burns calibration data to EFuse)
1 - BURN_INTO_FLASH (Burns calibration data to Flash)

[in]flags

- Validate information

Bit

MACRO

Description

0

RESERVED_0

Reserved

1

BURN_FREQ_OFFSET

1 - Update XO Ctune to calibration data
0 - Skip XO Ctune update

2

SW_XO_CTUNE_VALID

1 - Use XO Ctune provided as argument to update calibration data
0 - Use XO Ctune value as read from hardware register

3

BURN_XO_FAST_DISABLE

Used to apply patch for cold temperature issue(host interface detection) observed on CC0/CC1 modules. appendix

4

BURN_GAIN_OFFSET_LOW

1 - Update gain offset for low sub-band (2 GHz)
0 - Skip low sub-band gain-offset update

5

BURN_GAIN_OFFSET_MID

1 - Update gain offset for mid sub-band (2 GHz)
0 - Skip mid sub-band gain-offset update

6

BURN_GAIN_OFFSET_HIGH

1 - Update gain offset for high sub-band (2 GHz)
0 - Skip high sub-band gain-offset update

8

ENABLE_DPD_CALIB

1 - Collect dpd coefficients data
0 - Skip dpd coefficients calibration

9

BURN_DPD_COEFFICIENTS

1 - Burn dpd coefficients data
0 - Skip dpd coefficients calibration

31-4

Reserved

[in]gain_offset_low

- gain_offset as observed in dBm in channel-1

[in]gain_offset_mid

- gain_offset as observed in dBm in channel-6

[in]gain_offset_high

- gain_offset as observed in dBm in channel-11

[in]xo_ctune

- Allow user to directly update xo_ctune value to calibration data bypassing the freq offset loop, valid only when BURN_FREQ_OFFSET & SW_XO_CTUNE_VALID of flags is set. The range of xo_ctune is [0, 255], and the typical value is 80.

Returns

  • 0 - Success

  • Non-Zero Value - Failure

Note

  • The gain offset values present in the NVM will be incremented by the values sent from the host.

  • Precondition - rsi_transmit_test_start(), rsi_send_freq_offset() API needs to be called before this API. This API is relevant in PER mode only.

  • For RS9116 Rev 1.5, the user needs to calibrate gain-offset for low sub-band (channel-1), mid sub-band (channel-6), and high sub-band (channel-11) and input the three gain-offsets to this API and set the corresponding flags to validate it. However, for RS9116 Rev 1.4, the user needs to calibrate gain-offset for low sub-band (channel-1) only and input the three gain-offsets to this API with dummy values for mid and high gain offsets and set the flag for low gain offset only to validate it.

  • Recalibration is not possible if EFuse is being used instead of flash as calibration data storage


Definition at line 2651 of file wlan/rsi_wlan_apis.c

rsi_calib_read#

int32_t rsi_calib_read (uint8_t target, rsi_calib_read_t * calib_data, gain_offset_mid, gain_offset_high, xo_ctune)

RF calibration process. This API reads the calibration data from the Flash/EFuse storage. This is a blocking API.

Parameters
[in]target


0 - READ_FROM_EFUSE (read calibration data from the EFuse)
1 - READ_FROM_FLASH (read calibration data from the Flash)

[out]calib_data

- gain_offset in dBm that will be applied for transmissions in channel-1.

[out]gain_offset_mid

- gain_offset in dBm that will be applied for transmissions in channel-6.

[out]gain_offset_high

-gain_offset in dBm that will be applied for transmissions in channel-11.

[out]xo_ctune

- xo_ctune value as read from the target memory.

Returns

  • 0 - Success
    Non-Zero Value - Failure


Definition at line 2742 of file wlan/rsi_wlan_apis.c

rsi_calibrate_dpd#

int32_t rsi_calibrate_dpd (uint8_t dpd_power_inx)

RF calibration process. This API will command the firmware to update the existing Flash/EFuse calibration data. This is a blocking API.

Parameters
[in]dpd_power_inx


Returns

  • 0 - Success
    Non-Zero Value - Failure


Definition at line 2813 of file wlan/rsi_wlan_apis.c

rsi_parse#

int16_t rsi_parse (void * address, uint16_t length, uint8_t * value)

Parse and convert the given value in ASCII to the datatype of a given length.. This is a non-blocking API.

Parameters
[in]address

- Address

[in]length

- Length

[in]value

- Value

Returns

  • 0 - Success

  • Non-Zero Value - Failure


Definition at line 2878 of file wlan/rsi_wlan_apis.c

rsi_wlan_wps_generate_pin#

int32_t rsi_wlan_wps_generate_pin (uint8_t * wps_pin, uint16_t length)

Generate WPS pin. This is a blocking API.

Parameters
[out]wps_pin

- 8-byte WPS pin generated by the device.

[in]length

- This is the length of the resulted buffer measured in bytes to hold WPS pin.

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffc,0x0021,0x002C,0x0025,0x0037,0x0038)

Note

  • Precondition - rsi_wireless_init() API needs to be called before this API.

  • Refer to Error Codes section for the description of the above error codes Error Codes.


Definition at line 2919 of file wlan/rsi_wlan_apis.c

rsi_wlan_wps_enter_pin#

int32_t rsi_wlan_wps_enter_pin (int8_t * wps_pin, Same)

Validate WPS pin entered. This is a blocking API.

Parameters
[in]wps_pin

- 8-byte valid wps pin

[out]Same

WPS pin if command is successful

Returns

  • 0 - Success

  • Non-Zero Value - Failure

Note


Definition at line 2999 of file wlan/rsi_wlan_apis.c

rsi_wlan_beacon_stop#

int32_t rsi_wlan_beacon_stop (uint8_t beacon_stop)

Configure whether the module in AP mode transmits beacons or not when no station is connected.
The AP will beacon regardless of this configuration when stations are connected. This is a blocking API.
.

Parameters
[in]beacon_stop

- 1 - Do not beacon when there are no clients; 0 - Always transmit beacons.

Returns

  • 0 - Success
    Non-Zero Value - Failure


Definition at line 3076 of file wlan/rsi_wlan_apis.c

rsi_get_random_bytes#

int32_t rsi_get_random_bytes (uint8_t * result, uint32_t length)

Get random bytes from the device. This is a blocking API.

Parameters
[in]result

- Pointer to the buffer in which random data are copied from.

[in]length

- Length of the random data required

Returns

  • 0 - Success

  • Non-Zero Value - Failure


Definition at line 3142 of file wlan/rsi_wlan_apis.c

rsi_wlan_ap_stop#

int32_t rsi_wlan_ap_stop (void )

Disconnect the module from the connected access point. This is a blocking API.

Parameters
N/A

Note

Returns

  • 0 - Success
    Non-Zero Value - Failure (Possible Error Codes - 0xfffffffd,0xfffffffc,0x0006,0x0021,0x002C,0x004A,0x0025,0x0026)

Note

  • Refer to Error Codes for the description of above error codes.


Definition at line 3213 of file wlan/rsi_wlan_apis.c

rsi_wlan_disconnect#

int32_t rsi_wlan_disconnect (void )

Disconnect the module from the connected access point. This is a blocking API.

Parameters
N/A

Returns

  • 0 - Success
    Non-Zero Value - Failure (Possible Error Codes - 0xfffffffd,0xfffffffc,0x0006,0x0021,0x002C,0x004A,0x0025,0x0026)

Note


Definition at line 3286 of file wlan/rsi_wlan_apis.c

rsi_wlan_disconnect_stations#

int32_t rsi_wlan_disconnect_stations (uint8_t * mac_address)

Disconnect a connected station from the module in AP mode. This is a blocking API.

Parameters
[in]mac_address

- Mac address (6 bytes) of the station to be disconnected.

Returns

  • 0 - Success
    Non-Zero Value - Failure (Possible Error Codes - 0xfffffffc,0x0013,0x0021,0x002C,0x0015)

Note


Definition at line 3353 of file wlan/rsi_wlan_apis.c

rsi_config_ipaddress#

int32_t rsi_config_ipaddress (rsi_ip_version_t version, uint8_t mode, uint8_t * ip_addr, uint8_t * mask, uint8_t * gw, uint8_t * ipconfig_rsp, uint16_t length, uint8_t vap_id)

Configure the IP address to the module. This is a blocking API.

Parameters
[in]version

- IP version to be used. RSI_IP_VERSION_4 (4) – to select IPv4, RSI_IP_VERSION_6 (6) – to select IPv6

[in]mode

- 1 - DHCP mode ; 0 - static mode

[in]ip_addr

- Pointer to IP address

IPv6 Address Description

Indices in the ip_addr

Prefix Length

ip_addr[0]

Link Local Address (128 bits)

ip_addr[1] to ip_addr[4]

Global Address (128 bits)

ip_addr[5] to ip_addr[8]

Gateway Address (128 bits)

ip_addr[9] to ip_addr[12]

[in]mask

- Pointer to network mask

[in]gw

- Pointer to gateway address

[in]ipconfig_rsp

- Hold the IP configuration received using DHCP.

[in]length

- Length of ipconfig_rsp buffer

[in]vap_id

- VAP id to differentiate between AP and station in concurrent mode. 0 – for station, 1 – for Access point

Returns

  • 0 - Success
    Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe,0xfffffffd,0xfffffffa)

Note


Definition at line 3450 of file wlan/rsi_wlan_apis.c

rsi_wlan_set_certificate_index#

int32_t rsi_wlan_set_certificate_index (uint8_t certificate_type, uint8_t cert_inx, uint8_t * buffer, uint32_t certificate_length)

Write or erase certificate into module. This is a blocking API.

Parameters
[in]certificate_type

- Type of certificate

[in]cert_inx

- Index of certificate

[in]buffer

- Certificate content

[in]certificate_length

- Certificate length

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe,0xfffffffd,0xfffffffa,0x0015,0x0021,0x0025,0x0026,0x002C)

Note

  • Precondition - rsi_wireless_init() API must be called before this API.

  • Index-based certificate loading is valid only for storing certificates on to RAM or flash but not both at the same time.

  • Enable bit[27] in tcp_ip_feature_bit_map to load SSl certificate into RAM.

  • Enable bit[31] in tcp_ip_feature_bit_map and bit[29] in ext_tcp_ip_feature_bit_map to open 3 SSL client sockets.
    Three SSL client sockets feature is supported only in WLAN mode.


Definition at line 3614 of file wlan/rsi_wlan_apis.c

rsi_wlan_set_certificate#

int32_t rsi_wlan_set_certificate (uint8_t certificate_type, uint8_t * buffer, uint32_t certificate_length)

Load SSL/EAP certificate in the module. This is a blocking API.

Parameters
[in]certificate_type

- Type of certificate
These are the certificate types:

Value

Certificate type

1

TLS client certificate

2

FAST PAC file

3

SSL Client Certificate

4

SSL Client Private Key

5

SSL CA Certificate

6

SSL Server Certificate

7

SSL Server Private Key

17

EAP Private Key

33

EAP Public Key

49

EAP CA Certificate

[in]buffer

- Pointer to a buffer which contains the certificate

[in]certificate_length

- Certificate length

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe,0xfffffffd,0xfffffffa,0x0015,0x0021,0x0025,0x0026,0x002C)

Note

  • Precondition - rsi_wireless_init() API must be called before this API.

  • Refer to Error Codes for the description of above error codes.

  • For TLS Certificates, the max length is 12280 bytes and for the Private Keys, it is 4088 bytes.
    Module shares same TLS certificates for all supported SSL sockets.

  • For enterprise, user can load certificates in two ways:

    • User can load a single certificate, for this user need to generate a single certificate which contains a combination of 4 certificates
      in a given fixed order(3 actual and 1 dummy)- one Private Key, one Public Key, one dummy, and one CA certificate. The CA certificate can
      include a chain of certificates. Make sure each certificate has their respective header and footer of --—BEGIN CERTIFICATE--—
      and --—END CERTIFICATE--—. The dummy certificate can be a copy of one of the certificates for convenience(but must have header and footer).
      The dummy certificate is not used for the authentication but is expected by the firmware.
      The single certificate can be loaded with CertType as 1. The maximum allowed single certificate length is 12280 bytes if webpages feature
      (TCP_IP_FEAT_HTTP_SERVER in tcp_ip_feature_bit_map) is enabled, otherwise it is 20472 bytes.

    • User can load individual EAP certificates private key, public key, and CA certificates with CertType as 17,33 and 49 respectively.
      The maximum certificate length for private key and public key is 4088 bytes. The maximum allowed CA certificate length is 4088 bytes if webpages
      feature (TCP_IP_FEAT_HTTP_SERVER in tcp_ip_feature_bit_map) is enabled, otherwise it is 12280 bytes.


Definition at line 3873 of file wlan/rsi_wlan_apis.c

rsi_wlan_get_status#

int32_t rsi_wlan_get_status (void )

Check the error code encountered during a call to a WLAN API or BSD sockets functions. This is a non-blocking API.

Parameters
[in]

Returns

  • Returns the error code that previously occurred. If no error occurred, returns 0.

Note

  • Refer to Error Codes for the description of above error codes.


Definition at line 3890 of file wlan/rsi_wlan_apis.c

rsi_wlan_get#

int32_t rsi_wlan_get (rsi_wlan_query_cmd_t cmd_type, uint8_t * response, uint16_t length)

Get the required information based on the type of command. This is a blocking API.

Parameters
[in]cmd_type

- Query command type:

Value

Command Type

1

RSI_FW_VERSION

2

RSI_MAC_ADDRESS

3

RSI_RSSI

4

RSI_WLAN_INFO

5

RSI_CONNECTION_STATUS

6

RSI_STATIONS_INFO

7

RSI_SOCKETS_INFO

8

RSI_CFG_GET

9

RSI_GET_WLAN_STAT

10

RSI_WLAN_EXT_STATS

11

RSI_WMM_PARAMS

12

RSI_GET_DEVICE_ID

[out]response

- Response of the requested command.

[in]length

- Length of the response buffer in bytes to hold result.

cmd_type

Request Structure

RSI_FW_VERSION

uint8_t response[20]

RSI_MAC_ADDRESS

uint8_t response[6]

RSI_RSSI

uint8_t response[2]

RSI_WLAN_INFO

struct rsi_rsp_wireless_info_s

RSI_CONNECTION_STATUS

It returns 0x0001 if the WLAN is connected else 0x0000.

RSI_STATIONS_INFO

struct rsi_rsp_stations_info_s

RSI_SOCKETS_INFO

struct rsi_rsp_sockets_info_s

RSI_CFG_GET

struct rsi_cfgGetFrameRcv

RSI_GET_WLAN_STAT

struct rsi_rsp_wlan_stats_s

RSI_WLAN_EXT_STATS

struct rsi_wlan_ext_stats_s

RSI_WMM_PARAMS

struct rsi_wmm_ps_parms_s

RSI_GET_DEVICE_ID

uint8_t response[2]
0x9116 for 9116 chipsets
0x917 for 917 chipsets

Note

  • RSI_WLAN_INFO is relevant in both station and AP mode.

  • RSI_SOCKETS_INFO is relevant in both station mode and AP mode.

  • RSI_STATIONS_INFO is relevant in AP mode

  • RSI_GET_WLAN_STATS is relevant in AP and Station mode

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffd,0xfffffffc,0xfffffffa)

Note


Definition at line 3941 of file wlan/rsi_wlan_apis.c

rsi_wlan_set#

int32_t rsi_wlan_set (rsi_wlan_set_cmd_t cmd_type, uint8_t * request, uint16_t length)

Request configuration based on the command type. This is a blocking API.

Parameters
[in]cmd_type

- Set command type: :

Value

Command Type

1

RSI_SET_MAC_ADDRESS

2

RSI_MULTICAST_FILTER

3

RSI_JOIN_BSSID

4

RSI_CFG_SAVE

5

RSI_CFG_STORE

[in]request

- Request buffer

[in]length

- Length of the request buffer in bytes

cmd type

Request structure

RSI_SET_MAC_ADDRESS

uint8_t mac_address[6]

RSI_MULTICAST_FILTER

typedef struct rsi_req_multicast_filter_info_s

^ { uint8_t cmd_type; ^ uint8_t mac_address[6]; ^ }rsi_req_multicast_filter_info_t; ^ cmd_type are :
^ 1 . RSI_ MULTICAST_MAC_ADD_BIT (To set particular bit in multicast bitmap) ^ 2 . RSI_MULTICAST_MAC_CLEAR_BIT (To reset particular bit in multicast bitmap ^ 3 . RSI_MULTICAST_MAC_CLEAR_ALL (To clear all the bits in multicast bitmap)
^ 4 . RSI_MULTICAST_MAC_SET_ALL (To set all the bits in multicast bitmap)
RSI_JOIN_BSSID | uint8_t join_bssid[6] RSI_CFG_SAVE | This cmd_type is used to save the parameters into non-volatile memory which are used either to join to an Access point (auto-join mode) or to create an Access point(auto-create mode). RSI_CFG_STORE | This cmd_type is used to give the configuration values which are supposed to be stored in the module's non-volatile memory and that are used in auto-join or auto-create modes. ^ User configurations are stored in rsi_user_store_config_t structure.

Returns

  • 0 - Success
    Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe,0xfffffffd,0xfffffffc,0x0002, 0x0003, 0x0005, 0x000A, 0x0014, 0x0015, 0x001A, 0x0021,0x0024,0x0025,0x0026,0x002C,0x003c)

Note


Definition at line 4376 of file wlan/rsi_wlan_apis.c

rsi_wlan_buffer_config#

int32_t rsi_wlan_buffer_config (void , dynamic_rx_pool, dynamic_global_pool)

Configure the TX and RX global buffers ratio. This is a blocking API.

Parameters
[in]

- Configure the dynamic tx ratio

[in]dynamic_rx_pool

- Configure the dynamic rx ratio

[in]dynamic_global_pool

- Configure the dynamic global ratio

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe,0xfffffffd,0xfffffffa,0x0021)

Note


Definition at line 4537 of file wlan/rsi_wlan_apis.c

rsi_wlan_ap_start#

int32_t rsi_wlan_ap_start (int8_t * ssid, uint8_t channel, rsi_security_mode_t security_type, rsi_encryption_mode_t encryption_mode, uint8_t * password, uint16_t beacon_interval, uint8_t dtim_period)

Start the module in access point mode with the given configuration. This is a blocking API.

Parameters
[in]ssid

- SSID of the access point. Length of the SSID should be less than or equal to 32 bytes.

[in]channel

- Channel number. Refer the following channels for the valid channel numbers supported:
2.4GHz Band Channel Mapping, 5GHz Band Channel Mapping
Channel number 0 is to enable ACS feature.
The following table maps the channel number to the actual radio frequency in the 2.4 GHz spectrum.

Channel numbers (2.4GHz)

Center frequencies for 20MHz channel width

1

2412

2

2417

3

2422

4

2427

5

2432

6

2437

7

2442

8

2447

9

2452

10

2457

11

2462

12

2467

13

2472

14

2484

The following table maps the channel number to the actual radio frequency in the 5 GHz spectrum.

Channel Numbers(5GHz)

Center frequencies for 20MHz channel width

36

5180

40

5200

44

5220

48

5240

144

5700

149

5745

153

5765

157

5785

161

5805

165

5825

[in]security_type

- Type of the security modes on which an access point needs to be operated:

Value

Security type

1

RSI_OPEN

2

RSI_WPA

3

RSI_WPA2

4

RSI_WPA_WPA2_MIXED

5

RSI_WPS_PUSH_BUTTON

7

RSI_WPA3_PERSONAL

8

RSI_WPA3_PERSONAL_TRANSITION

[in]encryption_mode

- Type of the encryption mode:

Value

Encryption mode

0

RSI_NONE

1

RSI_TKIP

2

RSI_CCMP

[in]password

- PSK to be used in security mode.
Minimum and maximum length of PSK is 8 bytes and 63 bytes respectively

[in]beacon_interval

- Beacon interval in ms. Allowed values are integers from 100 to 1000 which are multiples of 100.

[in]dtim_period

- DTIM period. Allowed values are integers between 1 and 255.

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe,0xfffffffd,0xfffffffa)

Note

  • Precondition - rsi_wireless_init() API needs to be called before this API.

  • The module gets a default IP of 192.168.100.76 if it becomes Access Point in case of IPv4. and gets a default IP of 2001:db8:0:1:0:0:0:120 in case of IPv6. If user wants to override the default IP configurations for the AP then rsi_config_ipaddress() should be called before this API.

  • DFS channels are not supported in AP mode.

  • For AP mode with WPA3 security, only SAE-H2E method is supported. SAE Hunting-and-Pecking method is not supported.

  • In WPA3(Personal or Personal transition) security mode, TKIP encryption mode is not supported. Encryption mode is automatically configured to RSI_CCMP.

  • Transition Disable Indication(TDI) is supported in WPA3 (Personal or Personal Transition) security in AP mode. In order to enable TDI, bit 4 of encryption_mode should be set.

  • Refer to Error Codes for the description of above error codes.


Definition at line 4674 of file wlan/rsi_wlan_apis.c

rsi_wlan_power_save_with_listen_interval#

int32_t rsi_wlan_power_save_with_listen_interval (uint8_t psp_mode, uint8_t psp_type, uint16_t listen_interval)

Set the power save profile in WLAN mode with listen interval-based wakeup. This is a blocking API.

Parameters
[in]psp_mode

- PSP modes available are mentioned below

Parameter

Description

Active(0)

In this mode, module is active and power save is disabled.

RSI_SLEEP_MODE_1 (1)

Connected sleep mode.

^ In this sleep mode, SoC will never turn off, therefore no handshake is required before sending data to the module.
RSI_SLEEP_MODE_2 (2) | In this sleep mode, SoC will go to LP/ULP (with/without RAM RETENTION) sleep based on the selected value set for RSI_SELECT_LP_OR_ULP_MODE in rsi_wlan_config.h.
^ Therefore handshake is required before sending data to the module.
RSI_SLEEP_MODE_8 (8) | Deep sleep mode with ULP RAM RETENTION. In deep sleep mode, module will turn off the SoC and a GPIO or Message based handshake is required before sending commands to the module.
RSI_SLEEP_MODE_10 (10) | Deep sleep mode without ULP RAM RETENTION.

[in]psp_type

- PSP types available are mentioned below

Parameter

Description

RSI_MAX_PSP (0)

This psp_type will be used for max power saving.

RSI_FAST_PSP (1)

This psp_type allows module to disable power save for any Tx / Rx packet for monitor interval of time

^ (monitor interval can be set by RSI_MONITOR_INTERVAL in rsi_wlan_config.h file, default value is 50 ms).
^ If there is no data for monitor interval of time then module will again enable power save.
RSI_UAPSD (2) | This psp_type is used to enable WMM power save.

[in]listen_interval

- Used to configure sleep duration in power save and should be less than the listen interval configured by RSI_LISTEN_INTERVAL Macro in join command parameters in rsi_wlan_config.h file.
Valid only if BIT (7) in join_feature_bit_map is set. This value is given in time units (1024 microsecond).

Note

  • Precondition - rsi_wireless_init() and rsi_wlan_radio_init() (is mandatory for power mode RSI_SLEEP_MODE_8 and RSI_SLEEP_MODE_10) APIs needs to be called in the same order as mentioned before this API.

  • RSI_SLEEP_MODE_2 can be used after calling the rsi_radio_init() or rsi_wlan_connect() API. If you use it before rsi_wlan_connect(), be sure to disable power save mode by switching to RSI_ACTIVE to prevent interop protocol issues. However, it's recommended to enable RSI_SLEEP_MODE_2 after calling rsi_wlan_connect() to avoid potential problems.

  • psp_type is only valid in psp_mode 1 and 2.

  • psp_type: RSI_UAPSD is applicable only, if WMM_PS is enabled in rsi_wlan_config.h file.

  • In RSI_MAX_PSP mode, Few access points will not aggregate the packets, when power save is enabled from STA. This may cause the drop in throughputs.

  • For the power save mode 3, select RSI_SLEEP_MODE_2 in psp_mode and RSI_HAND_SHAKE_TYPE as MSG_BASED in rsi_wlan_config.h file.

  • For the power save mode 9, select RSI_SLEEP_MODE_8 in psp_mode and RSI_HAND_SHAKE_TYPE as MSG_BASED in rsi_wlan_config.h file.

  • For the deep sleep without ram retention case, select RSI_SLEEP_MODE_10 in psp_mode and RSI_HAND_SHAKE_TYPE as MSG_BASED for msg_based or GPIO_BASED for gpio_based.

  • For LP sleep, select RSI_SLEEP_MODE_2 in psp_mode, select RSI_SELECT_LP_OR_ULP_MODE as RSI_LP_MODE and RSI_HAND_SHAKE_TYPE as MSG_BASED/GPIO_BASED in rsi_wlan_config.h file.

Returns

  • 0 - Success
    Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe,0xfffffffd,0xfffffffa)

Note

  • Refer to Error Codes for the description of above error codes.


Definition at line 5102 of file wlan/rsi_wlan_apis.c

rsi_wlan_power_save_profile#

int32_t rsi_wlan_power_save_profile (uint8_t psp_mode, uint8_t psp_type)

Set the power save profile in WLAN mode. This is a blocking API.

Parameters
[in]psp_mode

- PSP modes available are mentioned below

Parameter

Description

Active(0)

In this mode, module is active and power save is disabled.

RSI_SLEEP_MODE_1 (1)

Connected sleep mode.

^ In this sleep mode, SoC will never turn off, therefore no handshake is required before sending data to the module.
RSI_SLEEP_MODE_2 (2) | In this sleep mode, SoC will go to LP/ULP (with/without RAM RETENTION) sleep based on the selected value set for RSI_SELECT_LP_OR_ULP_MODE in rsi_wlan_config.h.
^ Therefore handshake is required before sending data to the module.
RSI_SLEEP_MODE_8 (8) | Deep sleep mode with ULP RAM RETENTION. In deep sleep mode, module will turn off the SoC and a GPIO or Message based handshake is required before sending commands to the module.
RSI_SLEEP_MODE_10 (10) | Deep sleep mode without ULP RAM RETENTION.

[in]psp_type

- PSP types available are mentioned below

Parameter

Description

RSI_MAX_PSP (0)

This psp_type will be used for max power saving.

RSI_FAST_PSP (1)

This psp_type allows module to disable power save for any Tx / Rx packet for monitor interval of time

^ (monitor interval can be set by RSI_MONITOR_INTERVAL in rsi_wlan_config.h file, default value is 50 ms).
^ If there is no data for monitor interval of time then module will again enable power save.
RSI_UAPSD (2) | This psp_type is used to enable WMM power save.

Enhanced max psp#

Enhanced max PSP is recommended. This is essentially a RSI_MAX_PSP but switches to RSI_FAST_PSP, if AP does not deliver data within 20ms for PS-Poll.
To enable this mode, follow this procedure:
Add ENABLE_ENHANCED_MAX_PSP (BIT[26]) in RSI_CONFIG_FEATURE_BITMAP,
Set psp_type to RSI_FAST_PSP (1)
Note

  • Precondition - rsi_wireless_init() and rsi_wlan_radio_init() (is mandatory for power mode RSI_SLEEP_MODE_8 and RSI_SLEEP_MODE_10) APIs needs to be called in the same order as mentioned before this API.

  • RSI_SLEEP_MODE_2 can be used after calling the rsi_radio_init() or rsi_wlan_connect() API. If you use it before rsi_wlan_connect(), be sure to disable power save mode by switching to RSI_ACTIVE to prevent interop protocol issues. However, it's recommended to enable RSI_SLEEP_MODE_2 after calling rsi_wlan_connect() to avoid potential problems.

  • Configure the monitor interval using the RSI_MONITOR_INTERVAL macro in rsi_wlan_config.h file. (default value is 50 ms)

  • psp_type is only valid in psp_mode 1 and 2.

  • psp_type - UAPSD is applicable only if WMM_PS is enabled in rsi_wlan_config.h file.

  • In RSI_MAX_PSP mode, Few Access points won't aggregate the packets, when power save is enabled from STA. This may cause the drop in throughputs.

  • For the power save mode 3, select RSI_SLEEP_MODE_2 in psp_mode and RSI_HAND_SHAKE_TYPE as MSG_BASED in rsi_wlan_config.h file.

  • For the power save mode 9, select RSI_SLEEP_MODE_8 in psp_mode and RSI_HAND_SHAKE_TYPE as MSG_BASED in rsi_wlan_config.h file.

  • For the deep sleep without ram retention case, select RSI_SLEEP_MODE_10 in psp_mode and RSI_HAND_SHAKE_TYPE as MSG_BASED for msg_based or GPIO_BASED for gpio_based.

  • For LP sleep, select RSI_SLEEP_MODE_2 in psp_mode, select RSI_SELECT_LP_OR_ULP_MODE as RSI_LP_MODE and RSI_HAND_SHAKE_TYPE as MSG_BASED/GPIO_BASED in rsi_wlan_config.h file.

  • Powersave handshake option:

    • When sleep clock source is configured to '32KHz bypass clock on UULP_VBAT_GPIO_3',
      use UULP_VBAT_GPIO_0 for SLEEP_IND_FROM_DEV
      set RS9116_SILICON_CHIP_VER in 'RS9116.NB0.WC.GENR.OSI.X.X.X\host\sapis.h' to 'CHIP_VER_1P4_AND_ABOVE'

    • If not using external clock on UULP_VBAT_GPIO_3' as sleep clock source,
      use UULP_VBAT_GPIO_3 for SLEEP_IND_FROM_DEV
      set RS9116_SILICON_CHIP_VER in 'RS9116.NB0.WC.GENR.OSI.X.X.X\host\sapis.h' to 'CHIP_VER_1P3'.
      EXT_FEAT_LOW_POWER_MODE is not supported for 1.3 version chipset(CHIP_VER_1P3).

Power save modes description#

  • Power Save Mode 0

    • In this mode, module is active and power save is disabled. It can be configured any time, while the module is configured in Power Save mode 2 or 8.

  • Power save Mode 1

    • Once the module is configured to power save mode 1, it wakes up periodically based upon the DTIM interval configured in connected AP.
      In power mode 1, only the RF of the module is in power save while SOC continues to work normally.
      This command has to be given only when module is in connected state (with the AP). After having configured the module to power save mode, the Host can issue subsequent commands.
      In power save mode 1 the module can receive data from host at any point of time but it can send/receive the data to/from remote terminal only when it is awake at DTIM intervals.

  • Power Save Mode 2

    • Once the module is configured to power save mode 2, it can be woken up either by the Host or periodically during its sleep-wakeup cycle.
      Power Save mode 2 is GPIO based.
      In case of GPIO based mode, whenever host wants to send data to module, it gives wakeup request by asserting UULP GPIO #2.
      After wakeup, if the module is ready for data transfer, it sends wakeup indication to host by asserting UULP GPIO #3 or UULP GPIO #0.
      Host is required to wait until module gives wakeup indication before sending any data to the module.
      After the completion of data transfer, host can give sleep permission to module by de-asserting UULP GPIO #2. After recognizing sleep permission from host,
      module gives confirmation to host by de-asserting UULP GPIO #3 or UULP GPIO #0 and again goes back to its sleep-wakeup cycle.
      Module can send received packets or responses to host at any instant of time. No handshake is required on Rx path.

  • Power Save mode 3

    • Power Mode 3 is message based power save. In Power Mode 3, both radio and SOC of RS9116-WiSeConnect are in power save mode.
      This mode is significant when module is in associated state with AP. Module wakes up periodically upon every DTIM and gives wakeup message ("WKP") to host.
      Module can not be woken up asynchronously. Every time module intends to go to sleep it sends a sleep request message ("SLP") to the host and expects host to send the acknowledgement message ("ACK").
      Host either send acknowledgement ("ACK") or any other pending message. But once ACK is sent, Host should not send any other message unless next wakeup message from module is received.
      Module shall not go into complete power-save state, if ACK is not received from host for given sleep message. Module can send received packets or responses to host at any instant of time.
      No handshake is required on Rx path.

  • Power Save mode 8

    • In Power save mode 8, both RF and SOC of the module are in complete power save mode. This mode is significant only when module is in un-connected state.
      Power Save mode 8 can be GPIO based.
      In case of GPIO based, host can wakeup the module from power save by asserting UULP GPIO #2.
      After wakeup, if the module is ready for data transfer, it sends wakeup indication to host by asserting UULP GPIO #3 or UULP GPIO #0.
      Host is required to wait until module gives wakeup indication before sending any data to the module.
      After the completion of data transfer, host can give sleep permission to module by de-asserting UULP GPIO #2. After recognizing sleep permission from host, module gives confirmation to host by de-asserting UULP GPIO #3 or UULP GPIO #0 and again goes back to its sleep-wakeup cycle.
      Module can send received packets or responses to host at any instant of time. No handshake is required on Rx path.

  • Power save mode 9

    • In Power Mode 9 both Radio and SOC of RS9116-WiSeConnect are in complete power save mode. This mode is significant when module is not connected with any AP.
      Once power mode 9 command is given, the module sends ("SLP") request to host and wait for the ("ACK") from host and goes to sleep when ACK is given by host. Timer starts when power save command is issued and it can be configured by host using rsi_wlan_set_sleep_timer API.
      If host does not set any sleep time, then the timer is configured for 3sec by default. Upon wakeup module sends a wakeup message to the host and expects host to give ACK before
      it goes into next sleep cycle. Host either send ACK or any other messages but once ACK is sent no other packet should be sent before receiving next wakeup message.
      When ulp_mode_enable is set to '2', after waking up from sleep, the module sends WKP FRM SLEEP message to host when RAM retention is not enabled.
      After receiving WKP FRM SLEEP message, host needs to start giving commands from beginning as module's state is not retained.
      Returns

      • 0 - Success
        Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe,0xfffffffd,0xfffffffa,0x0021,0x0025,0x002C,0xFFF8,0x0015,0x0026,0x0052)

      Note

      • If the user wants to enable power save in CoEx mode (WLAN + BT LE) mode - It is mandatory to enable WLAN power save along with BT power save.

      • In CoEx mode, the device will enter into power save only if both protocol (WLAN, BLE) power save modes are enabled.

      • Refer to Error Codes for the description of above error codes.


Definition at line 5214 of file wlan/rsi_wlan_apis.c

rsi_wlan_power_save_disable_and_enable#

int32_t rsi_wlan_power_save_disable_and_enable (uint8_t psp_mode, uint8_t psp_type)

Disable or enable the power save feature. This is a blocking API.

Parameters
[in]psp_mode

- Power save mode

[in]psp_type

- Power save type

Returns

  • 0 - Success

  • Non-Zero Value - Failure

Note

  • Precondition - rsi_wireless_init() API needs to be called before this API.

  • If RSI_SLEEP_MODE_10 is chosen as the sleep mode, commands should be recalled from driver_init() as this is without RAM retention.


Definition at line 5233 of file wlan/rsi_wlan_apis.c

rsi_transmit_test_start#

int32_t rsi_transmit_test_start (uint16_t power, uint32_t rate, uint16_t length, uint16_t mode, uint16_t channel)

Start the transmit test. This is a blocking API.
This API is relevant in PER mode.

Parameters
[in]power

- Set TX power in dbm. The valid values are from 2dBm to 18dBm.

[in]rate

- Set transmit data rate.

[in]length

- Configure length of the TX packet.
The valid values are in the range of 24 to 1500 bytes in the burst mode and range of 24 to 260 bytes in the continuous mode.

[in]mode

- Below mentioned are the available modes

Value

Parameter

Description

0

Burst Mode

DUT transmits a burst of packets with the given power, rate, length in the channel configured.

^ The burst size will be determined by the <number of packets> and if its zero, then DUT keeps transmitting till a rsi_transmit_test_stop API is called. 1 | Continuous Mode | The DUT transmits a unmodulated waveform continuously 2 | Continuous wave Mode (non modulation) in DC mode | The DUT transmits a spectrum only at the center frequency of the channel. ^ A basic signal with no modulation is that of a sine wave and is usually referred to as a continuous wave (CW) signal. ^ A basic signal source produces sine waves. Ideally, the sine wave is perfect. In the frequency domain, it is viewed as a single line at some specified frequency. 3 | Continuous wave Mode (non modulation) in single tone mode (center frequency -2.5MHz) | The DUT transmits a spectrum that is generated at -2.5MHz from the center frequency of the channel selected. ^ Some amount of carrier leakage will be seen at Center Frequency. Eg: for 2412MHz, the output will be seen at 2409.5MHz 4 | Continuous wave Mode (non modulation) in single tone mode (center frequency +5MHz) | The DUT transmits a spectrum that is generated at 5MHz from the center frequency of the channel selected. Some amount of carrier leakage will be seen at Center Frequency. Eg: for 2412MHz, the output will be seen at 2417MHz.

[in]channel

- Set the channel number in 2.4 GHz / 5GHz.

Note

  • User can configure the maximum power level allowed for the given frequncey in the configured region by providing 127 as power level

  • User should configure a minimum delay (approx. 10 milliseconds) before and after rsi_transmit_test_start API to observe a stable output at requested dBm level.

Data Rates#

Data rate(Mbps)

Value of rate

1

0

2

2

5.5

4

11

6

6

139

9

143

12

138

18

142

24

137

36

141

48

136

54

140

MCS0

256

MCS1

257

MCS2

258

MCS3

259

MCS4

260

MCS5

261

MCS6

262

MCS7

263

The following table maps the channel number to the actual radio frequency in the 2.4 GHz spectrum.#

Channel numbers (2.4GHz)

Center frequencies for 20MHz channel width

1

2412

2

2417

3

2422

4

2427

5

2432

6

2437

7

2442

8

2447

9

2452

10

2457

11

2462

12

2467

13

2472

Note

  • To start transmit test in 12,13 channels, configure set region parameters in rsi_wlan_config.h

The following table maps the channel number to the actual radio frequency in the 5 GHz spectrum for 20MHz channel bandwidth. The channel numbers in 5 GHz range is from 36 to 165.#

Channel Numbers(5GHz)

Center frequencies for 20MHz channel width

36

5180

40

5200

44

5220

48

5240

52

5260

56

5280

60

5300

64

5320

149

5745

153

5765

157

5785

161

5805

165

5825

Note

  • Precondition - rsi_wlan_radio_init() API needs to be called before this API.

  • Rate flags can be added in rsi_wlan_common_config.h file.
    In rate flags, BIT(6) - Immediate Transfer, set this bit to transfer packets immediately ignoring energy/traffic in channel

  • Before starting Continuous Wave mode, user must start Continuous mode with power and channel values that are intended to be used in Continuous Wave mode i.e.

    • Start Continuous mode with intended power value and channel values - Pass any valid values for rate and length.

    • Stop Continuous mode

    • Start Continuous Wave mode

  • If user wants to switch continuous wave mode, first need to stop the transmit test and again need to give continous wave mode which user wants to switch.

  • In 2.4GHz, to start transmit test in 12,13,14 channels, configure set region parameters in rsi_wlan_config.h

Returns

  • 0 - Success
    Non-Zero Value - Failure (Possible Error Codes - 0xfffffffa,0x000A, 0x0021, 0x0025, 0x002C)

Note

  • Refer to Error Codes for the description of above error codes.


Definition at line 5348 of file wlan/rsi_wlan_apis.c

rsi_transmit_test_stop#

int32_t rsi_transmit_test_stop (void )

Stops the transmit test. This is a blocking API.
This API is relevant in PER mode.

Parameters
[in]


Returns

  • 0 - Success

  • Non Zero Value - Failure (Possible Error Codes - 0xfffffffa,0x0021, 0x0025, 0x002C)

Note

  • Precondition - rsi_wlan_radio_init() API needs to be called before this API.

  • User should configure a minimum delay (approx. 10 milliseconds) before and after rsi_transmit_test_start API to observe a stable output at requested dBm level.

  • Refer to Error Codes section for the description of the above error codes Error Codes.


Definition at line 5477 of file wlan/rsi_wlan_apis.c

rsi_wlan_receive_stats_start#

int32_t rsi_wlan_receive_stats_start (uint16_t channel)

Get the Transmit (TX) and Receive (RX) packets statistics. When this API is called by the host with valid channel number, the module gives the statistics to the host for every 1 second asynchronously. If wlan_receive_stats_response_handler() is registered through rsi_wlan_register_callbacks(), it's a non blocking API, otherwise, a blocking API.

Parameters
[in]channel

- Valid channel number: 2.4GHz or 5GHz

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffa,0x0021, 0x0025, 0x002c, 0x000A)

Note


Definition at line 5553 of file wlan/rsi_wlan_apis.c

rsi_wlan_receive_stats_stop#

int32_t rsi_wlan_receive_stats_stop (void )

Stop the Transmit (TX) & Receive(RX) packets statistics.
If wlan_receive_stats_response_handler() is registered through rsi_wlan_register_callbacks(), it's non blocking API, otherwise, a blocking API.

Parameters
[in]

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffa,0x0021, 0x0025, 0x002c)

Note


Definition at line 5632 of file wlan/rsi_wlan_apis.c

rsi_wlan_send_data#

int32_t rsi_wlan_send_data (uint8_t * buffer, uint32_t length)

Send the raw data in TCP/IP bypass mode. This is a blocking API.

Parameters
[in]buffer

- Pointer to the buffer to send

[in]length

- Length of the buffer to send

Returns

  • 0 - Success
    Non-Zero Value - Failure
    If return value is less than 0
    -2 - Invalid Parameters
    -4 - Buffer not available to serve the command
    If return value is greater than 0
    0x0021,0x002C,0x0025


Definition at line 5967 of file wlan/rsi_wlan_apis.c

rsi_wlan_twt_auto_selection#

int32_t rsi_wlan_twt_auto_selection (uint8_t twt_enable, uint32_t rx_latency, uint32_t tx_latency, uint16_t avg_tx_throughput)

Calculates and configures TWT parameters based on the given inputs. Enables or disables a TWT session. This is blocking API.

Parameters
[in]twt_enable

- TWT session setup or teardown
1 - To setup TWT session with given parameters
0 - To teardown existing TWT session.

[in]rx_latency

- The maximum allowed recieve latency, in milliseconds, when an Rx packet is buffered at the AP.
If rx_latency is less than <= 1sec (except 0), session creation is not possible. For default configuration, input 0.

[in]tx_latency

- The period, in milliseconds, within which the given Tx operation needs to completed. Valid values is either 0 or in the range of [200ms - 6hrs]

[in]avg_tx_throughput

- The expected average throughput, in Kilo Bytes per seconds, to be achieved within the Tx latency. Valid value is 0 to half of Device Throughput ( = 20MBPS / 2).

Returns

  • 0 - Success
    Non-Zero Value - Failure

Note


Definition at line 6051 of file wlan/rsi_wlan_apis.c

rsi_wlan_twt_config#

int32_t rsi_wlan_twt_config (uint8_t twt_enable, uint8_t twt_flow_id, twt_user_params_t * twt_req_params)

Configures TWT parameters. Enables or disables a TWT session. This is blocking API.

Parameters
[in]twt_enable

- TWT session setup or teardown
1 - To setup TWT session with given parameters
0 - To teardown TWT session with given flow ID.

[in]twt_flow_id

- TWT session flow ID.
0 - 7 are valid flow IDs.
0xFF value is used to teardown all active sessions.

[in]twt_req_params

Configurable TWT parameters. Refer twt_user_params_s.

Returns

  • 0 - Success
    Non-Zero Value - Failure

Note


Definition at line 6144 of file wlan/rsi_wlan_apis.c

rsi_wlan_ping_async#

int32_t rsi_wlan_ping_async (uint8_t flags, uint8_t * ip_address, uint16_t size, void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length) wlan_ping_response_handler, status, buffer, length)

Send a ping request to the target IP address.
If wlan_ping_response_handler() is registered through rsi_wlan_register_callbacks(), it's non blocking API, otherwise, a blocking API.

Parameters
[in]flags

- BIT(0): RSI_IPV6 Set this bit to enable IPv6; by default, it is configured to IPv4

[in]ip_address

- Target IP address.
IPv4 address: 4 Bytes hexa-decimal,
IPv6 address: 16 Bytes hexa-decimal

[in]size

- Ping data size to send. Maximum supported is 300 bytes.

[in]wlan_ping_response_handler

- Called when ping response has been received from the module.
Parameters involved are status, buffer, & length.

[out]status

- Response status

[out]buffer

- Response buffer

[out]length

- Length of the response buffer

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe,0xfffffffa,0x0015,0xBB21,0xBB4B,0xBB55)

Note

  • Precondition - rsi_config_ipaddress() API needs to be called before this API.

  • The module can't receive ping packets whose length is more than 308 bytes.

  • Refer to Error Codes for the description of above error codes.


Definition at line 6283 of file wlan/rsi_wlan_apis.c

rsi_register_auto_config_rsp_handler#

void rsi_register_auto_config_rsp_handler (void(*)(uint16_t status, uint8_t state) rsi_auto_config_rsp_handler, status, state)

Register auto-configuration response handler.. This is a non-blocking API.

Parameters
[in]rsi_auto_config_rsp_handler

- Pointer to rsi_auto_config_rsp_handler.

[out]status

- Response status, 0 if success else failure.

[out]state

- BIT(1) RSI_AUTO_CONFIG_FAILED.

  • BIT(2) RSI_AUTO_CONFIG_GOING_ON.

  • BIT(3) RSI_AUTO_CONFIG_DONE.

Note

  • *RSI_AUTO_CONFIG_FAILED - Auto_configuration failed.

  • *RSI_AUTO_CONFIG_GOING_ON - Auto_configuration in progress.

  • *RSI_AUTO_CONFIG_DONE - Auto_configuration succeed.

Returns

  • Void

Note

  • **rsi_auto_config_rsp_handler must be registered using the rsi_register_auto_config_rsp_handler API.

  • Precondition - rsi_driver_init() API needs to be called before this rsi_register_auto_config_rsp_handler API.

  • **The callback indicates the state of Auto configuration process asynchronously.

  • **User can proceed with the next commands only after either the RSI_AUTO_CONFIG_FAILED or RSI_AUTO_CONFIG_DONE status is recevied. Until then, commands are not accepted by the SAPI driver.


Definition at line 6400 of file wlan/rsi_wlan_apis.c

rsi_wlan_add_profile#

int32_t rsi_wlan_add_profile (uint32_t type, uint8_t * profile)

Add profile for auto configuration. This is a blocking API.

Parameters
[in]type

- profile type. Supported profile types are:
1.RSI_WLAN_PROFILE_AP,
2.RSI_WLAN_PROFILE_CLIENT,
3.RSI_WLAN_PROFILE_EAP,
4.RSI_WLAN_PROFILE_P2P,
5.RSI_WLAN_PROFILE_ALL

[in]profile

- Pointer to config profile and profile structure
ap_profile,
eap_client_profile_t,
client_profile_t,
p2p_profile_t,
rsi_config_profile_t

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffa)

Note

  • This API is not supported in current release.

  • Precondition - rsi_wireless_init() API needs to be called before this API.

  • Refer to Error Codes for the description of above error codes.


Definition at line 6431 of file wlan/rsi_wlan_apis.c

rsi_wlan_get_state#

uint8_t rsi_wlan_get_state (void )

Get the current WLAN state.. This is a non-blocking API.

Parameters
[in]

Returns

  • Current WLAN state.
    WLAN states are as follows:

  • RSI_WLAN_STATE_NONE = 0,

  • RSI_WLAN_STATE_OPERMODE_DONE,

  • RSI_WLAN_STATE_BAND_DONE,

  • RSI_WLAN_STATE_INIT_DONE,

  • RSI_WLAN_STATE_SCAN_DONE,

  • RSI_WLAN_STATE_CONNECTED,

  • RSI_WLAN_STATE_IP_CONFIG_DONE,

  • RSI_WLAN_STATE_IPV6_CONFIG_DONE,

  • RSI_WLAN_STATE_AUTO_CONFIG_GOING_ON,

  • RSI_WLAN_STATE_AUTO_CONFIG_DONE,

  • RSI_WLAN_STATE_AUTO_CONFIG_FAILED


Definition at line 6537 of file wlan/rsi_wlan_apis.c

rsi_wlan_get_profile#

int32_t rsi_wlan_get_profile (uint32_t type, rsi_config_profile_t * profile_rsp, uint16_t length)

Get the stored config profile. This is a blocking API.

Parameters
[in]type

- Config profile type.
Supported profile types are as follows:
RSI_WLAN_PROFILE_AP,
RSI_WLAN_PROFILE_CLIENT,
RSI_WLAN_PROFILE_EAP,
RSI_WLAN_PROFILE_P2P,
RSI_WLAN_PROFILE_ALL

[in]profile_rsp

- Config profile response in the form of below structure:
ap_profile,
eap_client_profile_t,
client_profile_t,

p2p_profile_t,
rsi_config_profile_t

[in]length

- Length of the config profile response

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffa)

Note

  • Precondition - rsi_wireless_init() API needs to be called before this API.

  • This API is not supported in current release.

  • Refer to Error Codes for the description of above error codes.


Definition at line 6568 of file wlan/rsi_wlan_apis.c

rsi_fill_config_profile#

uint8_t* rsi_fill_config_profile (uint32_t type, uint8_t * profile_buffer)

Fill the config profile based on the profile type.. This is a non-blocking API.

Parameters
[in]type

- Profile type

[in]profile_buffer

- Pointer to profile buffer

Returns

  • Profile buffer

Note


Definition at line 6646 of file wlan/rsi_wlan_apis.c

References SL_PRINTF , ap_profile::network_profile , ap_profile::feature_frame_params_s , rsi_uint32_to_4bytes , ap_profile::wlan_feature_bit_map , ap_profile::tcp_ip_feature_bit_map , ap_profile::custom_feature_bit_map , ap_profile::data_rate , ap_profile::tx_power , ap_profile::band , rsi_uint16_to_2bytes , ap_profile::channel , ap_profile::ssid , ap_profile::security_type , ap_profile::encryption_type , ap_profile::psk , ap_profile::beacon_interval , ap_profile::dtim_period , ap_profile::keep_alive_type , ap_profile::keep_alive_counter , ap_profile::max_no_sta , network_profile::tcp_stack_used , network_profile::dhcp_enable , memcpy , network_profile::ip_address , network_profile::sn_mask , network_profile::default_gw , feature_frame_params_s::pll_mode , feature_frame_params_s::rf_type , feature_frame_params_s::wireless_mode , feature_frame_params_s::enable_ppp , feature_frame_params_s::afe_type , feature_frame_params_s::feature_enables , client_profile::network_profile , client_profile::feature_frame_params_s , client_profile::wlan_feature_bit_map , client_profile::tcp_ip_feature_bit_map , client_profile::custom_feature_bit_map , client_profile::listen_interval , client_profile::data_rate , client_profile::tx_power , client_profile::band , client_profile::ssid , client_profile::ssid_len , client_profile::scan_feature_bitmap , client_profile::channel , client_profile::scan_chan_bitmap_magic_code , client_profile::scan_chan_bitmap_2_4_ghz , client_profile::scan_chan_bitmap_5_0_ghz , client_profile::security_type , client_profile::encryption_type , client_profile::psk , client_profile::pmk , convert_lower_case_to_upper_case , eap_client_profile::network_profile , eap_client_profile::feature_frame_params_s , eap_client_profile::wlan_feature_bit_map , eap_client_profile::tcp_ip_feature_bit_map , eap_client_profile::custom_feature_bit_map , eap_client_profile::data_rate , eap_client_profile::tx_power , eap_client_profile::band , eap_client_profile::ssid , eap_client_profile::ssid_len , eap_client_profile::scan_feature_bitmap , eap_client_profile::security_type , eap_client_profile::channel , eap_client_profile::scan_chan_bitmap_magic_code , eap_client_profile::scan_chan_bitmap_2_4_ghz , eap_client_profile::scan_chan_bitmap_5_0_ghz , eap_client_profile::eap_method , eap_client_profile::inner_method , eap_client_profile::user_identity , eap_client_profile::passwd , p2p_profile::network_profile , p2p_profile::feature_frame_params_s , p2p_profile::wlan_feature_bit_map , p2p_profile::tcp_ip_feature_bit_map , p2p_profile::custom_feature_bit_map , p2p_profile::join_ssid , p2p_profile::data_rate , p2p_profile::tx_power , p2p_profile::band , p2p_profile::go_intent , p2p_profile::device_name , p2p_profile::operating_channel , p2p_profile::ssid_postfix , and p2p_profile::psk_key

rsi_wlan_delete_profile#

int32_t rsi_wlan_delete_profile (uint32_t type)

Delete stored configuration based on profile type. This is a blocking API.

Parameters
[in]type

- Profile type

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffa)

Note

  • This API is not supported in current release.

  • Precondition - rsi_wireless_init() API needs to be called before this API.


Definition at line 7033 of file wlan/rsi_wlan_apis.c

rsi_wlan_enable_auto_config#

int32_t rsi_wlan_enable_auto_config (uint8_t enable, uint32_t type)

Enable or disable auto-config with respect to profile. This is a blocking API.

Parameters
[in]enable

- 0 - Disable the auto configuration feature.
1 - Enable the auto configuration feature on power up.
2 - Enable the auto configuration for profile based.

[in]type

- Profile type

Value

Parameter

Macro

0

Client profile

RSI_WLAN_PROFILE_CLIENT

1

P2P profile

RSI_WLAN_PROFILE_P2P

2

EAP profile

RSI_WLAN_PROFILE_EAP

6

AP profile

RSI_WLAN_PROFILE_AP

0xF

All profiles

RSI_WLAN_PROFILE_ALL

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffa)

Note


Definition at line 7123 of file wlan/rsi_wlan_apis.c

rsi_wlan_pmk_generate#

int32_t rsi_wlan_pmk_generate (int8_t type, int8_t * psk, int8_t * ssid, uint8_t * pmk, uint16_t length, 32-byte)

Generate and configure PMK if PSK and SSID are provided. This is a blocking API.

Parameters
[in]type

- Possible values of this field are 1, 2, and 3, but we only pass 3 for generation of PMK.

[in]psk

- Expected parameters are pre-shared key(PSK) of the access point

[in]ssid

- Contain the SSID of the access point, this field will be valid only if TYPE value is 3.

[in]pmk

- PMK array

[in]length

- Length of PMK array

[out]32-byte

PMK

Returns

  • 0 - Success (If type value is 3)

  • Non-Zero Value - Failure (Possible Error Codes - 0x0021,0x0025,0x0026,0x0028,0x002C,0x0039,0x003a,0x003b)

Note


Definition at line 7202 of file wlan/rsi_wlan_apis.c

rsi_wlan_set_sleep_timer#

int16_t rsi_wlan_set_sleep_timer (uint16_t sleep_time)

Configure the sleep timer mode of the module to go into sleep during power save operation. This is a blocking API.

Parameters
[in]sleep_time

- Sleep Time value in seconds. Minimum value is 1, and maximum value is 2100

Returns

  • 0 - Success

  • Non-Zero Value - Failure

Note

  • Can be issued any time in case of power save mode 8 with handshake type as MSG_BASED.


Definition at line 7364 of file wlan/rsi_wlan_apis.c

rsi_wlan_register_callbacks#

uint16_t rsi_wlan_register_callbacks (uint32_t callback_id, void(*)(uint16_t status, uint8_t *buffer, const uint32_t length) callback_handler_ptr, status, buffer, length)

Register the WLAN callback functions. This is a non-blocking API.

Parameters
N/Acallback_id

Assert Value

N/Acallback_handler_ptr

6

[out]status

- Status of the asynchronous response

[out]buffer

- Payload of the asynchronous response

[out]length

- Length of the payload

Prototypes of the callback functions with given callback id#

Callback id

Function Description

RSI_JOIN_FAIL_CB

Called when asynchronous rejoin failure is received from the firmware. Application should try to re-join to the AP. This is valid in both AP and STA mode This callback is triggered when module fails to connect to AP in STA mode or when AP creation fails.

Note

RSI_IP_FAIL_CB

Called when asynchronous DHCP renewal failure is received from the firmware. Application should retry IP configuration. This is valid in both AP and STA mode. This callback is triggered when module fails to renew the DHCP.

Note

RSI_REMOTE_SOCKET_TERMINATE_CB

Called when asynchronous remote TCP socket closed is received from the firmware. It is an indication given to application that the socket is terminated from remote. This is valid in both STA and AP mode. This callback is triggered when remote socket is terminated or closed

Note

  • Need to connect to socket.

RSI_IP_CHANGE_NOTIFY_CB

Called when asynchronous IP change notification is received from the firmware. It is an indication given to application that the IP has been modified. This is valid only in STA mode. This callback is triggered when AP changes the IP address.

Note

RSI_STATIONS_DISCONNECT_NOTIFY_CB

Called when asynchronous station disconnect notification is received from the firmware in AP mode. It is an indication that the AP is disconnect. Application should retry to connect to the AP. This is valid when module acts as AP. This callback is triggered when stations are disconnected.

Note

  • STA need to connect to the Accesspoint 9116.

RSI_STATIONS_CONNECT_NOTIFY_CB

Called when asynchronous station connect notification is received from the firmware in AP mode. It is an indication that the application is connected to the AP. This is valid when 9116 module acts as AP. This callback is triggered when stations are connected.

  • STA need to connect to the accesspoint 9116.

RSI_WLAN_DATA_RECEIVE_NOTIFY_CB

Called when asynchronous data is received from the firmware in TCP/IP bypass mode. This is valid in both AP and STA mode. This callback is triggered when data is received in TCP/IP bypass mode.

  • Need to connect to socket.

RSI_WLAN_WFD_DISCOVERY_NOTIFY_CB

Called when Wi-Fi direct device discovery notification received from the firmware. This is valid in Wi-Fi Direct Mode only. This callback is triggered when a peer is discovered by the device.

RSI_WLAN_RECEIVE_STATS_RESPONSE_CB

Called when asynchronous receive statistics from the firmware in PER mode. This is valid in PER Mode only. This callback is triggered when module wants to receive statistics.

RSI_WLAN_WFD_CONNECTION_REQUEST_NOTIFY_CB

Called when Wi-Fi direct connection request from the firmware. This is valid in Wi-Fi Direct Mode only. This call back is triggered when there is a connection request from other peer device.

RSI_WLAN_RAW_DATA_RECEIVE_HANDLER

Called when raw data packets are received from the firmware. This is valid in both AP and STA mode. This callback is triggered when raw data is received in TCP/IP bypass mode.

  • Need to connect to socket.

RSI_WLAN_SOCKET_CONNECT_NOTIFY_CB

Called when a socket connection response comes to the host. This is valid in both STA and AP mode. This callback is registered and triggered when socket connects.

  • Need to create socket.

RSI_WLAN_SERVER_CERT_RECEIVE_NOTIFY_CB

Reserved

RSI_WLAN_ASYNC_STATS

Called when asynchronous response comes from the firmware to the host. Host can register this callback to get all the information regarding AP connectivity.

RSI_WLAN_ASSERT_NOTIFY_CB

Called when WLAN assertion is triggered from firmware. It returns the assert value to the application.

RSI_WLAN_MAX_TCP_WINDOW_NOTIFY_CB

Reserved

RSI_WLAN_ASYNC_STATS#

• Asychronous messages are used to indicate module state to host. Asynchronous message are enabled by setting bit 10 of the custom feature bitmap in opermode.
• In async messages time_stamp, state_code, reason_code, rsi_channel, rsi_rssi and rsi_bssid are logged.

  • time_stamp (4 bytes)

    • This is the value of the time stamp counter at the time of message; timestamps increment at intervals of 100ms.

  • state_code (1 byte)

    • This field indicates the state of the module. state_code contains two parts, the upper nibble and lower nibble.

    • The upper nibble indicates the state of the rejoin process. The following table documents the possible values of the upper nibble of state_code.

      State

      Upper Nibble

      Indication

      Scan Trigger (State I)

      0x00

      Startup. Initial Roam

      0x10

      Beacon Loss. Failover Roam

      0x20

      De-authentication. AP induced roam / Disconnect from supplicant

      Scan Result/Decision (State II)

      0x50

      Current AP is best

      0x60

      Better AP found

      0x70

      No AP found

      Final Connection (State III)

      0x80

      Associated

      0x90

      Unassociated

    • The lower nibble of state_code indicates the reason for a state change. The following table documents the possible values of the lower nibble of state_code.

      Lower Nibble

      Reason for State Change

      0x00

      No reason specified

      0x01

      No response from AP for authentication request(Authentication denial)

      0x02

      Association denial

      0x03

      User configured AP is not present

      0x05

      EAPOL TX failure

      0x06

      Deauthentication from user

      0x07

      PSK not configured

      0x08

      key-handshake failure during rejoin/roaming/after connection(Disconnection from supplicant)

      0x09

      Roaming not enabled

  • reason_code (1 byte)

    • Indicates the reason for a failure.

    • These failures also include EAP connection errors for certificate parsing.

    • All supported reason codes are listed below

      reason_code

      Reason codes

      0x00

      No reason specified

      0x01

      No response from AP for authentication request(Authentication denial)

      0x02

      Association denial

      0x03

      User configured AP is not present

      0x05

      EAPOL TX failure

      0x06

      Deauthentication from user

      0x07

      PSK not configured

      0x08

      key-handshake failure during rejoin/roaming/after connection(Disconnection from supplicant)

      0x09

      Roaming not enabled

      0x10

      Beacon Loss (failover Roam)

      0x20

      De-authentication (AP induced Roam/Deauth from supplicant)

      0x28

      TLS CA Cert not present

      0x29

      TLS PRIVATE key not present

      0x2A

      TLS Client Cert not present

      0x2B

      TLS no Cert present

      0x2C

      PEAP CA Cert not present

      0x2D

      Server Cert Invalid Key Type

      0x2E

      Server Intermediate CA Invalid Key Type

      0x2F

      Server Root CA Invalid Key Type

      0x30

      Client Cert Invalid Key Type

      0x31

      Client Root CA Invalid Key Type

      0x32

      FIPS Server Cert Invalid Length

      0x33

      FIPS Server Intermediate CA Invalid Length

      0x34

      FIPS Server Root CA Invalid Length

      0x35

      FIPS Client Cert Invlaid Length

      0x36

      FIPS Client Root CA Invalid Length

      0x37

      Server Cert 4096-bit length support is not enabled

      * 0x38

      Server Intermediate CA 4096-bit length support is not enabled

      * 0x39

      Server Root CA 4096-bit length support is not enabled

      * 0x3A

      Client Cert 4096-bit length support is not enabled

      * 0x3B

      Client Root CA 4096-bit length support is not enabled

      0x3C

      Server Cert Invalid Sign Alg

      0x3D

      Server Intermediate CA Invalid Sign Alg

      0x3E

      Server Root CA Invalid Sign Length

      0x3F

      Client Cert Invalid Sign Alg

      0x40

      Client Root CA Invalid Sign Length

      0x41

      Server Intermediate CA not Present

      0x42

      Server Root CA Parse Error

      0x43

      Server Intermediate Root CA Parse Error

      0x44

      Sever Cert Parse Error

      0x45

      Client Cert Parse Error

      0x46

      Incorrect Private Key Password

      0x47

      EAP Failure Received

      0x48

      Client Cert Bad Date Error

      0x49

      Server Cert Bad Date Error

      0x4A

      Server Root CA Bad Date Error

      0x4B

      Client Root CA Bad Date Error

      0x4C

      Server Intermediate Root CA Bad Date Error

      0x4D

      Pem Header Error

      0x4E

      Pem Footer Error

      0x4F

      Client Intermediate CA Invalid Sign Length

      0x50

      Client Intermediate CA Invalid Length

      0x51

      FIPS Client Intermediate CA Invalid Length

      0x52

      Client Intermediate CA invalid Key Type

      0x53

      Pem Error

      0x54

      Pathlen certificate is Invalid

    • In addition to the above, reason code received in Deauthentication/Disassociation frame from AP is added. This will set the MSB bit of reason_code.

    • If MSB bit is set in reason code, then mask it with 0x7f to get the acutal reason code received in Deauthentication/Disassociation frame.

    • In RS9116 Rev 1.4, above reason codes will come only in TCP/IP bypass mode.

    • Pem Header Error(0x4D) or Pem Footer Error(0x4E) are only applicable if certificates are loaded individually. In case if certificates are loaded combinedly in a single file, only Pem Error(0x53) will be triggered for Header or Footer errors.


Definition at line 7615 of file wlan/rsi_wlan_apis.c

References SL_PRINTF , rsi_wlan_cb_non_rom_s::callback_list , rsi_callback_cb_s::join_fail_handler , rsi_callback_cb_s::ip_renewal_fail_handler , rsi_callback_cb_s::remote_socket_terminate_handler , rsi_callback_cb_s::ip_change_notify_handler , rsi_callback_cb_s::stations_connect_notify_handler , rsi_callback_cb_s::stations_disconnect_notify_handler , rsi_callback_cb_s::wlan_data_receive_handler , rsi_callback_cb_s::wlan_receive_stats_response_handler , rsi_callback_cb_s::wlan_wfd_discovery_notify_handler , rsi_callback_cb_s::wlan_wfd_connection_request_notify_handler , rsi_callback_cb_s::raw_data_receive_handler , rsi_callback_cb_s::wlan_receive_csi_data_response_handler , rsi_callback_cb_s::socket_connect_response_handler , rsi_callback_cb_s::certificate_response_handler , rsi_callback_cb_s::wlan_async_module_state , rsi_callback_cb_s::rsi_assertion_cb , rsi_callback_cb_s::rsi_max_available_rx_window , and rsi_callback_cb_s::twt_response_handler

rsi_wlan_update_gain_table#

int32_t rsi_wlan_update_gain_table (uint8_t band, uint8_t bandwidth, uint8_t * payload, uint16_t payload_len)

Assign the user configurable channel gain values in different regions to the module from user.This method is used for overwriting default gain tables that are present in firmware.
Customer can load all the three gain tables (i.e., 2.4GHz-20Mhz, 5GHz-20Mhz, 5GHz-40Mhz) one after other by changing band and bandwidth values. This is a blocking API.

Parameters
[in]band

- 1 ? 2.4GHz
2 ? 5GHz

[in]bandwidth

- 0 ? 20 MHz
1 ? Reserved

[in]payload

- Pass channel gain values for different regions in an given array format.

[in]payload_len

- Max payload length (table size) in 2.4GHz is 128 bytes.
Max payload length (table size) in 5GHz is 64 bytes

Note

  • 1. This frame has to be used by customers who has done FCC/ETSI/TELEC/KCC certification with their own antenna. All other customers should not use this. Inappropriate use of this frame may result in violation of FCC/ETSI/TELEC/KCC or any certifications and Silicon labs is not liable for that

  • Internally firmware maintains two tables : Worldwide table & Region based table. Worldwide table is populated by firmware with Max power values that chip can transmit that meets target specs like EVM. Region based table has default gain value set.

    1. When certifying with user antenna, Region has to be set to Worldwide and sweep the power from 0 to 21dBm. Arrive at max power level that is passing certification especially band-edge.

    2. These FCC/ETSI/TELEC/KCC Max power level should be loaded in end-to-end mode via WLAN User Gain table. This has to be called done every boot-up since this information is not saved inside flash. Region based user gain table sent by application is copied onto Region based table .SoC uses this table in FCC/ETSI/TELEC/KCC to limit power and not to violate allowed limits.
      For Worldwide region firmware uses Worldwide table for Tx. For other regions(FCC/ETSI/TELEC/KCC), Firmware uses min value out of Worldwide & Region based table for Tx. Also there will be part to part variation across chips and offsets are estimated during manufacturing flow which will be applied as correction factor during normal mode of operation.

  • rsi_radio_init() API needs to be called before this API

Gain Table Payload Format#

           1. Gain table Format for 2.4GHz Band: (Each entry of the table is 1 byte)
              In 2.4GHz, Max Gain/Power obtained from certification should be doubled and loaded.
           <TABLE NAME[]>= {
           <NO.of Regions>,
           <REGION NAME 1>, <CHANNEL_CODE_2G>,
           <CHANNEL NUMBER 1>, <2 * MAX POWER FOR b RATE>, <2 * MAX POWER FOR g RATE>, <2 * MAX POWER FOR n RATE>, 
           <CHANNEL NUMBER 2>, <2 * MAX POWER FOR b RATE>, <2 * MAX POWER FOR g RATE>, <2 * MAX POWER FOR n RATE>, 
           . 
           . 
           .
           .
           .       
           <CHANNEL NUMBER m-1>, <2 * MAX POWER FOR b RATE>, <2 * MAX POWER FOR g RATE>, <2 * MAX POWER FOR n RATE>,
           <CHANNEL NUMBER m>, <2 * MAX POWER FOR b RATE>, <2 * MAX POWER FOR g RATE>, <2 * MAX POWER FOR n RATE>, 
           <REGION NAME 2>, <CHANNEL_CODE_2G>,
           <CHANNEL NUMBER 1>, <2 * MAX POWER FOR b RATE>, <2 * MAX POWER FOR g RATE>, <2 * MAX POWER FOR n RATE>,
           <CHANNEL NUMBER 2>, <2 * MAX POWER FOR b RATE>, <2 * MAX POWER FOR g RATE>, <2 * MAX POWER FOR n RATE>,
           . 
           . 
           . 
           . 
           <CHANNEL NUMBER m-1>, <2 * MAX POWER FOR b RATE>, <2 * MAX POWER FOR g RATE>, <2 * MAX POWER FOR n RATE>,
           <CHANNEL NUMBER m>, <2 * MAX POWER FOR b RATE>, <2 * MAX POWER FOR g RATE>, <2 * MAX POWER FOR n RATE>, 
           }; 

           Gain table Format for 5GHz Band (Each entry of the table is 1 byte):
             In 5GHz, Max Gain/Power obtained from certification should be loaded.
            <TABLE NAME[]>= { 
                              <NO.of Regions>, 
                              <REGION NAME 1>, <CHANNEL_CODE_5G>, 
                              <CHANNEL NUMBER IN BAND 1 IF ANY>, <MAX POWER FOR 11a RATE>, <MAX POWER FOR n RATE>, 
                               <BAND_NUMBER 1>, <MAX POWER FOR 11a RATE>, <MAX POWER FOR n RATE>, 
                              <CHANNEL NUMBER IN BAND 2 IF ANY>, <MAX POWER FOR 11a RATE>, <MAX POWER FOR n RATE>, 
                              <BAND_NUMBER 2>, <MAX POWER FOR 11a RATE>, <MAX POWER FOR n RATE>, 
                              <CHANNEL NUMBER IN BAND 3 IF ANY>, <MAX POWER FOR 11a RATE>, <MAX POWER FOR n RATE>, 
                              <BAND_NUMBER 3>, <MAX POWER FOR 11a RATE>, <MAX POWER FOR n RATE>, 
                              <CHANNEL NUMBER IN BAND 4 IF ANY>, <MAX POWER FOR 11a RATE>, <MAX POWER FOR n RATE>, 
                              <BAND_NUMBER 4>, <MAX POWER FOR 11a RATE>, <MAX POWER FOR n RATE>, 
                              . 
                              . 
                              . 
                              . 
                              . 
                              <REGION NAME y>, <CHANNEL_CODE_5G>, 
                              }; 
           2. Supported Region names:
                                  FCC, RED,TELEC  
                                  The following are the regions and the values to be passed instead of macros in the example.
                                  Region      |          Macro Value
                                  ------------|--------------------
                                  FCC         |            0
                                  RED         |            1
                                  TELEC       |            2
           3. <CHANNEL_CODE_2G> is a 8 bit value which is encoded as:
              If TX powers of all the channels are same, then use CHANNEL_CODE_2G as 17. In this case, mention channel number as 255.
              Tf TX power is not same for all channels, then indicate CHANNEL_CODE_2G as no-of channels. And specify tx power values for all the channels indicated.
           4. <CHANNEL_CODE_5G> is a 8 bit value encoded as number of rows in a region for 5G band.
               a. 5G is divided into 4 sub bands: 
                     band 1: channel number <= 48 
                     band 2: channel number > 48 and channel number <= 64 
                     band 3: channel number > 64 and channel number <= 144 
                     band 4: channel number > 144 
               b. If any channel in a band has different set of power values, specify the channel number followed by power values. 
               c. If all the channels in a band 1 has same power values, specify the band number as 1 followed by power value. 
               d. If all the channels in a band 2 has same power values, specify the band number as 2 followed by power value. 
               e. If all the channels in a band 3 has same power values, specify the band number as 3 followed by power value. 
               f. If all the channels in a band 4 has same power values, specify the band number as 4 followed by power value.

Example payload formats#

                     Examples: 
                     For 2.4GHz Band in 20MHz bandwidth
                       {3, //NUM_OF_REGIONS 
                           FCC, 13, //NUM_OF_CHANNELS 
                       //   rate,  11b, 11g, 11n   
                               1,  34,  20,  20,  
                               2,  34,  28,  28,  
                               3,  34,  32,  32,  
                               4,  34,  36,  36,  
                               5,  34,  38,  38,  
                               6,  34,  40,  40,  
                               7,  34,  38,  38,  
                               8,  34,  36,  36,  
                               9,  34,  32,  32,  
                               10, 34,  32,  32,  
                               11, 34,  24,  24,  
                               12, 34,  16,  24,  
                               13, 34,  12,  12,  
                           TELEC, 17, 
                                255, 20,  16, 16, 
                       }; //}}} 

                     For 5GHz band in 20MHz bandwidth
                        {2, 
                        FCC, 6, 
                            1,  9, 10, //band 1 
                            2,  8,  9, //band 2 
                          100,  4,  4, //band 3 
                            3,  6,  8, //band 3 
                          149,  3,  3, //band 4 
                        TELEC, 4, 
                          1, 9, 10, //band 1 
                          2, 8, 10, //band 2   
                          3, 6,  8, //band 3   
                          4, 6,  7, //band 4 
                        };

Customers using Certified MARS antenna should use the gain table structures below:#

                     For 2.4GHz Band in 20MHz bandwidth
                      {3,//NUM_OF_REGIONS
                          FCC, 0xD,//NUM_OF_CHANNELS
                      //   rate,  11b, 11g, 11n
                              1,  28,  32,  30,
                              2,  28,  32,  30,
                              3,  28,  32,  30,
                              4,  30,  28,  34,
                              5,  30,  28,  34,
                              6,  30,  28,  34,
                              7,  30,  28,  34,
                              8,  30,  28,  34,
                              9,  28,  30,  30,
                              10, 28,  30,  30,
                              11, 28,  30,  30,
                              12, 28,  30,  30,
                              13, 28,  30,  30,
                          TELEC,0x11, //NA
                               255, 20,  16, 16,
                      };

                     For 5GHz band in 20MHz bandwidth
                      {2,
                      FCC, 0x6,
                          1, 12, 12, //band 1
                          2, 11, 11, //band 2   
                        100, 10, 12, //band 3   
                          3, 13, 13, //band 3   
                        140, 10, 11, //band 4   
                          4, 13, 13, //band 4   
                      TELEC, 0x4, //NA
                        1, 9, 10, //band 1
                        2, 8, 10, //band 2   
                        3, 6,  8, //band 3   
                        4, 6,  7, //band 4
                      };

Returns

  • 0 - Success

  • Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe,0xfffffffd,0x0021,0x003E)

Note

  • Precondition - rsi_radio_init() API needs to be called before this API

  • Length of the payload should match with payload_len parameter value.

  • 40MHz is not supported in both 2.4GHz and 5GHz

  • This API must be used by customers who has done FCC/RED/TELEC certification with their own antenna. Inappropriate use of this API may result in violation of FCC/RED/TELEC, or any certifications and Silicon labs is not liable for that.

  • Internally firmware maintains two gain tables: Worldwide table & Region based table. Worldwide table is populated by firmware with maximum power values that chip can transmit that meets target specifications like EVM. Region based table has default gain value set.

  • When certifying with your own antenna, region must be set to Worldwide and sweep the power from 0 to 21dBm. Arrive at maximum power level that is passing certification especially band-edge.

  • These FCC/RED/TELEC maximum power level should be loaded in end-to-end mode via WLAN User Gain table.

  • This API must be called after every boot-up since this information is not saved inside flash.

  • Region based user gain table sent by application is copied onto Region based table. SoC uses this table in FCC/RED/TELEC to limit power and not to violate allowed limits. For Worldwide region firmware uses Worldwide table for transmit.
    For other regions (FCC/RED/TELEC), firmware uses minimum value of Worldwide and Region based table for transmit.

  • There will be part to part variation across chips and offsets are estimated during manufacturing flow which will be applied as correction factor during normal mode of operation.

  • Refer to Error Codes for the description of above error codes.


Definition at line 8198 of file wlan/rsi_wlan_apis.c

rsi_wlan_csi_config_async#

int32_t rsi_wlan_csi_config_async (uint8_t enable, uint32_t periodicity, uint8_t num_of_mac_addr, uint8_t(*) mac_addr, void(*)(uint16_t status, uint8_t *buffer, const uint32_t length) wlan_csi_data_response_handler)

Enable or disable CSI data retrieval with configured periodicity.

Parameters
[out]enable

- Response status: 0 - Success, 0x21 - rsi_wlan_csi_config_async() called in wrong state

[out]periodicity

- Response buffer

[out]num_of_mac_addr

- Length of the response buffer. Payload length will be sizeof(rsi_rsp_csi_data_t) bytes.

[in]mac_addr

- Pointer to a 2-D matrix containing the list of MAC addresses.

[in]wlan_csi_data_response_handler

- Called when CSI data has been received from the module.

Note

  • Callback implementation example -
    void rsi_wlan_csi_data_response_handler(uint16_t status, rsi_rsp_csi_data_t *payload, const uint32_t payload_length)

Note

Returns

  • 0 - Success
    Non-Zero Value - Failure
    -1 - Callback not registered
    -4 - Buffer unavailable to serve the command

Note

  • Refer to Error Codes section for the description of the above error codes Error Codes


Definition at line 8295 of file wlan/rsi_wlan_apis.c

rsi_send_evm_offset#

int32_t rsi_send_evm_offset (uint8_t index, int8_t evm_offset_val)

Application to provide feedback of evm_offset error. This is a blocking API.

Parameters
[in]index

- index of EVM,range from[0 to 4]. index | description 0 | Update evm_offset_11B 1 | Update evm_offset_11G_6M_24M_11N_MCS0_MCS2 2 | Update evm_offset_11G_36M_54M_11N_MCS3_MCS7 3 | Update evm_offset_11N_MCS0 4 | Update evm_offset_11N_MCS7 > 4 | Reserved

[in]evm_offset_val

- emv_offset value observed.

Returns

  • 0 - Success
    Non zero Value - Failure
    If return value is less than 0
    RSI_ERROR_INVALID_PARAM - Invalid parameters

Note

  • Refer to Error Codes section for the description of the above error codes Error Codes.


Definition at line 8390 of file wlan/rsi_wlan_apis.c

rsi_evm_write#

int32_t rsi_evm_write (uint8_t target, uint32_t flags, int8_t evm_offset_11B, int8_t evm_offset_11G_6M_24M_11N_MCS0_MCS2, int8_t evm_offset_11G_36M_54M_11N_MCS3_MCS7, int8_t evm_offset_11N_MCS0, int8_t evm_offset_11N_MCS7)

RF calibration process. This API will command the firmware to update the existing Flash/EFuse calibration data. This is a blocking API.

Parameters
[in]target


0 - BURN_INTO_EFUSE (Burns calibration data to EFuse)(Not supported)
1 - BURN_INTO_FLASH (Burns calibration data to Flash)

[in]flags

- Validate information

Bit

MACRO

Description

0

EVM_OFFSET_CUST_0

1 - Update evm_offset_11B rate calibration data
0 - Skip evm_offset update

1

EVM_OFFSET_CUST_1

1 - Update evm_offset_11G_6M_24M_11N_MCS0_MCS2 rate calibration data
0 - Skip evm_offset update

2

EVM_OFFSET_CUST_2

1 - Update evm_offset_11G_36M_54M_11N_MCS3_MCS7 rate calibration data
0 - Skip evm_offset update

3

EVM_OFFSET_CUST_3

1 - Update evm_offset_11N_MCS0 rate calibration data
0 - Skip evm_offset update

4

EVM_OFFSET_CUST_4

1 - Update evm_offset_11N_MCS7 rate calibration data
0 - Skip evm_offset update

31-5| Reserved

[in]evm_offset_11B

- evm_offset for 11B rate

[in]evm_offset_11G_6M_24M_11N_MCS0_MCS2

- evm_offset for 11G_6M_24M_11N_MCS0_MCS2 rate

[in]evm_offset_11G_36M_54M_11N_MCS3_MCS7

- evm_offset for 11G_36M_54M_11N_MCS3_MCS7 rate

[in]evm_offset_11N_MCS0

- evm_offset for 11N_MCS0 rate

[in]evm_offset_11N_MCS7

- evm_offset for 11N_MCS7 rate Recalibration is not possible if EFuse is being used instead of flash as calibration data storage

Returns

  • 0 - Success
    Non-Zero Value - Failure


Definition at line 8479 of file wlan/rsi_wlan_apis.c