Wi-Fi APIs#

This section describes the Wi-Fi APIs

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

This API processes 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 call backs. This is a non-blocking API.

int32_t

Initialize wlan radio parameters and WLAN 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 ignoring broad cast packet threshold levels when station is in powersave mode and is used to achieve low currents in standby associated mode. This is blocking API.

int32_t
rsi_check_state(int32_t type)

Check the WLAN state.

void
rsi_sort_scan_results_array_based_on_rssi(struct wpa_scan_results_arr *scan_results_array)

Sort the scan results in 'scan_results_array' in the order of RSSI. Application should call this API to get the scan result in sorted order.

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 available access points and post scan response to application. Application must 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 Wi-Fi networks. This is a blocking API. Invoke rsi_wlan_scan_async(), which is an asynchronous call. Wait on WLAN command semaphore to get the status of the scan results. Return RSI_SUCCESS on success and optionally, a maximum of 11 scan results if rsi_rsp_scan_t parameter is configured. In case of failure, an appropriate error code is returned to the application.

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 Wi-Fi networks. 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. Call asynch connect to trigger connect call to AP and return RSI_SUCCESS or error in case of failure.

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)

Get background scan results or stop bgscan. This is a blocking API.

int32_t

Enable scan and roaming after connecting to the Access Point. This is a blocking API.

int32_t

Start the WPS Push button in AP mode. Must be called after rsi_wlan_ap_start API once it has returned Success. 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, int32_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.

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_get_random_bytes(uint8_t *result, uint32_t length)

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

int32_t

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

int32_t
rsi_wlan_disconnect_stations(uint8_t *mac_address)

Disconnect the connected stations 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. Send IPconfig command to configure IP address with input parameters (like ipversion, static mode/dhcp mode,vap_id)and return error in case of invalid parameters.

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

Check the status (specific error code) of errors encountered during a call to a WLAN API or BSD sockets functions. User can call this API to check the error code.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 ,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.

int32_t

Stops the transmit test. This is a blocking API.

int32_t

Get the Transmit (TX) & 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, otherwise, a blocking call.

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, otherwise, a blocking call.

int32_t
rsi_wlan_wfd_start_discovery(uint16_t go_intent, int8_t *device_name, uint16_t channel, int8_t *ssid_post_fix, uint8_t *psk, void(*wlan_wfd_discovery_notify_handler)(uint16_t status, uint8_t *buffer, const uint32_t length), void(*wlan_wfd_connection_request_notify_handler)(uint16_t status, uint8_t *buffer, const uint32_t length))

Start discovery in wi-fi direct mode.This is a non-blocking API. wlan_wfd_discovery_notify_handler() rsi_wlan_wfd_start_discovery() API is registered through rsi_wlan_register_callbacks(), its non blocking, otherwise blocking call.

int32_t
rsi_wlan_wfd_connect(int8_t *device_name, void(*join_response_handler)(uint16_t status, const uint8_t *buffer, const uint16_t length))

A join_response_handler() API that connects to the specified Wi-Fi-Direct device.This is a non-blocking API. if join_response_handler() is registered through rsi_wlan_register_callbacks(), it's non blocking, otherwise, a blocking call.

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_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, otherwise, a blocking call.

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

Send Boot_up parameters to the Firmware.

int32_t

Reset MAC.

uint8_t
translate_channel(uint8_t channelNum)

Channel translate.

int32_t
rsi_radio_caps(uint8_t operating_channel)

Radio capabilities of the operating channel.

int32_t

Program radio frequency.

int32_t
set_channel(uint8_t channel_num, uint8_t power_level)

Set the operating channel.

int32_t

Select internal or external RF type and clock frequency.

int32_t
rsi_send_per_packet(tx_per_params_t *per_params, uint32_t pkt_size)

Send packets.

int32_t
rsi_send_per_frame(tx_per_params_t *tx_per_params)

Send packets frame.

uint32_t
rsi_prepare_per_pkt(tx_per_params_t *per_params, uint16_t length)

Prepare PER packet.

int32_t
rsi_process_transmit(tx_per_params_t *per_params)

Transmit packets frame.

int32_t
rsi_efuse_write(rsi_efuse_write_t *efuse_write_p)

Write content to efuse.

int32_t
rsi_efuse_read(rsi_efuse_read_t *efuse_read_p, uint8_t *buf, uint32_t length)

Get efuse content.

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)

This API processes 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 call backs. This is a non-blocking API.

Parameters
[in]callback_id

- This is the Id of the call back 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

- call back handler which needs to be registered for a given call back

[out]status

- This is the response status. For success it returns 0 and for failure it returns negative value. For possible error codes from FW refer to Error Codes section for the description of the above error codes Error Codes.

[out]buffer

- This is the response buffer.

[out]length

- This is the length of the response buffer.

Returns

  • 0 - Success Non-Zero Value - Failure -3 Command given in wrong state If call_back_id is greater than the maximum callbacks to register, returns 1

prototypes of the call back 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


Definition at line 92 of file driver/rsi_nwk.c

rsi_wlan_radio_init#

int32_t rsi_wlan_radio_init (void )

Initialize wlan radio parameters and WLAN supplicant parameters.

Parameters
[in]

Returns

  • 0 - Success Non-Zero Value - Failure If return value is greater than 0 0x0021- Command given in wrong state


Definition at line 2319 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 ignoring broad cast packet threshold levels when station is in powersave mode and is used to achieve low currents in standby associated mode. This is blocking API.

Parameters
[in]beacon_drop_threshold

- LMAC beacon drop threshold(ms): The amount of time that FW waits to receive full beacon.Default value is 5000ms.

[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

[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

Note

  • Validity of this bit is dependent on the filter_bcast_tim_till_next_cmd

Returns

  • 0 - Success Non-Zero Value - If return value is less than 0 -2: Invalid parameters -3: Command given in wrong state -4: Buffer not available to serve the command return value is greater than 0 0x0021


Definition at line 2602 of file driver/rsi_wlan.c

rsi_check_state#

int32_t rsi_check_state (int32_t type)

Check the WLAN state.

Parameters
[in]type

- Socket family type

Returns

  • 0 - If in IP config state -20 - If not in IP config state


Definition at line 1098 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 'scan_results_array' in the order of RSSI. Application should call this API to get the scan result in sorted order.

Parameters
[in]scan_results_array

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

Returns

  • Void


Definition at line 41 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 available access points and post scan response to application. Application must 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.

[in]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

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 82 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_bitmap)

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

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

[in]scan_bitmap

- Scan feature bitmap

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 156 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 Wi-Fi networks. This is a blocking API. Invoke rsi_wlan_scan_async(), which is an asynchronous call. Wait on WLAN command semaphore to get the status of the scan results. Return RSI_SUCCESS on success and optionally, a maximum of 11 scan results if rsi_rsp_scan_t parameter is configured. In case of failure, an appropriate error code is returned to the application.

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.

[in]result

- Scanned Wi-Fi networks information. This is an output parameter. 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

Ch no

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

14

14

Channels supported in 5 GHz Band#

Channel numbers

Ch no

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

Note

  • 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]

    Reserved

    timeout_bitmap[2]

    Used for WLAN keep alive timeout

    timeout_bitmap[31-3]

    Reserved

Scan structure#

Structure Fields

Description

rf_channel

Access point channel number

security_mode

Security mode0 : Open

1 . WPA

2 . WPA2

3 . WEP

4 . WPA Enterprise

5 . WPA2 Enterprise

rssi_val

RSSI value of the Access Point

network_type

rsi_wlan_setThis is the type of the network

1 . Infrastructure mode

ssid

SSID of the access point

bssid

MAC address of the access point

Returns

  • Success - RSI_SUCCESSFailure - Non-Zero valuesIf return value is less than 0

        **RSI_ERROR_INVALID_PARAM**                 - Invalid parameters \n
    
    **RSI_ERROR_COMMAND_GIVEN_IN_WRONG_STATE**  - Command given in wrong state \n
    
    **RSI_ERROR_PKT_ALLOCATION_FAILURE**        - Buffer not available to serve the command \n
    
            `Other expected error codes are :` \n
    
        **0x0002, 0x0003, 0x0005, 0x000A, 0x0014, 0x0015, 0x001A, 0x0021,0x0024,0x0025,0x0026,0x002C,0x003c**
    

Note

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


Definition at line 567 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, Buffer, Length)

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

Parameters
[in]ssid

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

[in]chno

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

[out]scan_response_handler

- Response status. RSI_SUCCESS - Scan response is stated as Success Negative -Failure

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

Note

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

Note

  • SSID is a null terminated string.

Channels supported in 2.4 GHz Band#

Channel numbers

Ch no

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

14

14

Channels supported in 5 GHz Band#

Channel numbers

Ch no

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

Note

  • 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]

Reserved

timeout_bitmap[2]

Used for WLAN keep alive timeout

timeout_bitmap[31-3]

Reserved

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 structure#

Structure Fields

Description

rf_channel

Access point channel number

security_mode

Security mode0 : Open

1 . WPA

2 . WPA2

3 . WEP

4 . WPA Enterprise

5 . WPA2 Enterprise

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

Returns

  • 0 - Success Non-Zero Value - Failure If return value is less than 0 -2 - Invalid parameters -3 - Command given in wrong state -4 - Buffer not available to serve the command If return value is greater than 0 0x0002, 0x0003, 0x0005, 0x000A, 0x0014, 0x0015, 0x001A, 0x0021,0x0024,0x0025,0x0026,0x002C,0x003c

Note

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


Definition at line 714 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. Call asynch connect to trigger connect call to AP and return RSI_SUCCESS or error in case of failure.

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

[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

Note

  • 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[0] - Set timeout for association and authentication request. timeout_value : timeout value in ms(default 300ms). timeout_bitmap[1] - Reserved timeout_bitmap[2] - Used for WLAN keep alive timeout timeout_bitmap[31-3] - reserved

  • To set Rejoin params, user should configure the following macros in rsi_wlan_config.h 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, this rejoin frame will be sent to the firmware after scan done in the SAPI.

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

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

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


Definition at line 1131 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. 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

[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

[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. If status is zero, then the join response is stated as Success

[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

  • 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 Rejoin params, user should configure the following macros in rsi_wlan_config.h 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, this rejoin frame will be sent to the firmware after scan done in the SAPI.

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

Returns

  • 0 - Success Non-Zero - Failure -2 - Invalid parameters -3 - Command given in wrong state -4 - Buffer not availableto serve the command

Note

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


Definition at line 1268 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)

Get background scan results or stop bgscan. This is a blocking API.

Parameters
[in]cmd

- Command given by user

[out]result

- Result

[in]length

- Length

Returns

  • 0 - Success Non-Zero Value - Failure -3 - Command given in wrong state -4 - Buffer not availableto serve the command.

Note

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


Definition at line 1902 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 to the Access Point. This is a blocking API.

Parameters
[in]

Returns

  • 0 - Success Non-Zero Value - Failure If return value is less than 0 -3 - Command given in wrong state -4 - Buffer not available to serve the command If return value is greater than 0 0x0006,0x0021,0x002C,0x004A,0x0025,0x0026

Note

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


Definition at line 1984 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. Must be called after rsi_wlan_ap_start API once it has returned Success. 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 If return value is less than 0 -4 - Buffer not available to serve the command If return value is greater than 0 0x0021

Note

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


Definition at line 2091 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 Non zero Value - Failure


Definition at line 2164 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, int32_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

BURN_GAIN_OFFSET

1- Update gain offset to calibration data

0 - Skip gain offset update

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

7-4

Reserved

[in]gain_offset

offset as observed in dBm

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

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

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 2244 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 2318 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, 8-byte)

Generate WPS pin. This is a blocking API.

Parameters
[in]wps_pin

- 8-byte WPS pin generated by the device. This is the output parameter.

[in]length

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

[out]8-byte

WPS pin

Returns

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

Note

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


Definition at line 2364 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

  • rsi_wlan_init() API needs to be called before this API.

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 2440 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 2513 of file wlan/rsi_wlan_apis.c

rsi_wlan_disconnect#

int32_t rsi_wlan_disconnect (void )

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

Parameters
N/A

Returns

  • Non-Zero Value - Failure 0 - Success If return value is less than 0 -3 - Command given in wrong state -4 - Buffer not availableto serve the command If return value is greater than 0 0x0006,0x0021,0x002C,0x004A,0x0025,0x0026

Note

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


Definition at line 2585 of file wlan/rsi_wlan_apis.c

rsi_wlan_disconnect_stations#

int32_t rsi_wlan_disconnect_stations (uint8_t * mac_address)

Disconnect the connected stations 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 If return value is less than 0 -4 - Buffer not available to serve the command If return value is greater than 0 0x0013, 0x0021, 0x002C, 0x0015

Note

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


Definition at line 2654 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. Send IPconfig command to configure IP address with input parameters (like ipversion, static mode/dhcp mode,vap_id)and return error in case of invalid parameters.

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

[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

  • Success - RSI_SUCCESS Failure - Non-Zero Value RSI_ERROR_INVALID_PARAM - Invalid parametersRSI_ERROR_COMMAND_GIVEN_IN_WRONG_STATE - Command given in wrong state RSI_ERROR_PKT_ALLOCATION_FAILURE - Buffer not available to serve the command

Note

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


Definition at line 2750 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 If return value is less than 0 -2 Invalid Parameters -3 Command given in wrong state -4 Buffer not available to serve the command If return value is greater than 0 0x0015,0x0021,0x0025,0x0026,0x002C

Note

  • 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 supported only in WLAN mode.


Definition at line 2912 of file wlan/rsi_wlan_apis.c

rsi_wlan_get_status#

int32_t rsi_wlan_get_status (void )

Check the status (specific error code) of errors encountered during a call to a WLAN API or BSD sockets functions. User can call this API to check the error code.This is a non-blocking API.

Parameters
[in]

Returns

  • Return the error code that previously occurred. If no error occurred, return 0.

Note

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


Definition at line 3167 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: 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

[in]response

- Response of the requested command. This is an output parameter.

[in]length

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

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

  • Non-Zero Value - Failure 0 - Success -3 - Command given in wrong state -4 - Buffer not availableto serve the command -6 - Insufficient input buffer given

Note

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


Definition at line 3202 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: : 1 : RSI_SET_MAC_ADDRESS 2 : RSI_MULTICAST_FILTER 3 : RSI_JOIN_BSSID

[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]

Returns

  • 0 - Success Non-Zero Value - Failure If return value is less than 0 -2 - Invalid parameters -3 - Command given in wrong state -4 - Buffer not available to serve the command If return value is greater than 0 0x0002, 0x0003, 0x0005, 0x000A, 0x0014, 0x0015, 0x001A, 0x0021,0x0024,0x0025,0x0026,0x002C,0x003c

Note

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


Definition at line 3537 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 ,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

  • Non-Zero Value - Failure 0 - Success -2 - Invalid parameters -3 - Command given in wrong state -4 - Buffer not availableto serve the command If return value is greater than zero : 0x0021

Note

  • Refer to Error Codes section for the description of the above error codes Error Codes Parameters given here are used internally by the API


Definition at line 3696 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

- Type of the security modes on which an access point needs to be operated: 1 : RSI_OPEN 2 : RSI_WPA 3 : RSI_WPA2 4 : RSI_WPA_WPA2_MIXED 5 : RSI_WPS_PUSH_BUTTON

[in]channel

- Type of the encryption mode: 0 : RSI_NONE 1 : RSI_TKIP 2 : RSI_CCMP

[in]security_type

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

[in]encryption_mode

- Beacon interval

[in]password

- DTIM period

N/Abeacon_interval
N/Adtim_period
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

Note

  • DFS channels are not supported in AP mode.

Returns

  • Non-Zero Value - Failure 0 - Success -2 - Invalid parameters -3 - Command given in wrong state -4 - Buffer not availableto serve the command

Note

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


Definition at line 3822 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
[in]psp_type

parameter

Description

psp_mode

Following psp_mode is defined.

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):Connected sleep mode. In this sleep mode, SoC will go to sleep based on GPIO or Message based handshake.

Therefore handshake is required before sending data to the module.

RSI_SLEEP_MODE_8 (8):Unconnected sleep mode.

In this sleep mode, module will turn off the SoC and a GPIO or Message based handshake is required before sending commands to the module.

psp_type

Follwing psp_type is defined.

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.

listen interval

Used to configure sleep duration in power save.

N/Alisten_interval

Note

  • Valid only if BIT (7) in join_feature_bit_map is set. This value is given in time units (1024 microsecond). 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.

  • 1. psp_type is only valid in psp_mode 1 and 2.

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

  • 3. 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.

  • 4. 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.

  • 5. 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.

Returns

  • 0 - Success Non-Zero Value - Failure If return value is less than 0 -2 - Invalid parameters -3 - Command given in wrong state -4 - Buffer not available to serve the command


Definition at line 4212 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
[in]psp_type

parameter

Description

psp_mode

Following psp_mode is defined.

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):Connected sleep mode. In this sleep mode, SoC will go to sleep based on GPIO or Message based Handshake.

Therefore handshake is required before sending data to the module

RSI_SLEEP_MODE_8 (8):Unconnected sleep mode.

In this sleep mode, module will turn off the SoC and a GPIO or Message based handshake is required before sending commands to the module.

psp_type

Follwing psp_type is defined.

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 essentially a MAX PSP mode but switches to Fast PSP mode if AP does not deliver data within 20ms for PS-Poll. To enable this mode, follow procedure below: Add ENABLE_ENHANCED_MAX_PSP (BIT(26)) in RSI_CONFIG_FEATURE_BITMAP Set psp_type to RSI_FAST_PSP (1) Configure Monitor interval by RSI_MONITOR_INTERVAL in rsi_wlan_config.h file. (default value is 50 ms) Note

  • 1. psp_type is only valid in psp_mode 1 and 2.

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

  • 3. 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.

  • 4. 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.

  • 5. 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.

  • 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'.

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. Once the module wakes up, it continues to be in wakeup state until it gets power mode 8 commands from host.

  • 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 goes to sleep immediately and wakes up after sleep duration and it can be configured by host using rsi_wlan_set_sleep_timer API. If host does not set any sleep time, then the module wakes up in 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 (opermode) as module's state is not retained. Returns

    • 0 - Success Non-Zero Value - Failure If return value is less than 0 -2 - Invalid parameters -3 - Command given in wrong state -4 - Buffer not available to serve the command If return value is greater than 0 0x0021,0x0025,0x002C,0xFFF8,0x0015,0x0026,0x0052

    Note

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


Definition at line 4321 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

  • Non-Zero Value - Failure 0 - Success


Definition at line 4338 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.

Parameters
[in]power

- Set transmit data rate

[in]rate

- 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]length

- 0- Burst Mode 1- Continuous Mode 2- Continuous wave Mode (non modulation) in DC mode 3- Continuous wave Mode (non modulation) in single tone mode (center frequency -2.5MHz) 4- Continuous wave Mode (non modulation) in single tone mode (center frequency +5MHz)

[in]mode

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

N/Achannel

Note

  • This API is relevant in PER mode.

Note

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

  • 2. 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.

Note

  • 1. 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.

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

  • ii. Stop Continuous mode

  • iii Start Continuous Wave mode

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

    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

    14

    2484

  • To start transmit test in 12,13,14 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

Returns

  • 0 - Success Non-Zero Value - Failure if less than zero -4 - Buffer not available to serve the command If greater than zero 0x000A, 0x0021, 0x0025, 0x002C

Note

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


Definition at line 4442 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.

Parameters
[in]

Note

  • This API is relevant in PER mode.

Returns

  • 0 Successful execution of the command Non Zero Value Failure if return value is less than 0 -4: Buffer not available to serve the command If return value is greater than 0 0x0021, 0x0025, 0x002C

Note

  • 1. 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.

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


Definition at line 4544 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) & 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, otherwise, a blocking call.

Parameters
[in]channel

- Valid channel number 2.4GHz or 5GHz

Returns

  • 0 - Success Non-Zero Value - Failure If return value is less than 0 -4: Buffer not available to serve the command If return value is greater than 0 0x0021, 0x0025, 0x002c, 0x000A

Note

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


Definition at line 4620 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, otherwise, a blocking call.

Parameters
[in]

Returns

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

Note

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


Definition at line 4699 of file wlan/rsi_wlan_apis.c

rsi_wlan_wfd_start_discovery#

int32_t rsi_wlan_wfd_start_discovery (uint16_t go_intent, int8_t * device_name, uint16_t channel, int8_t * ssid_post_fix, uint8_t * psk, void(*)(uint16_t status, uint8_t *buffer, const uint32_t length) wlan_wfd_discovery_notify_handler, void(*)(uint16_t status, uint8_t *buffer, const uint32_t length) wlan_wfd_connection_request_notify_handler)

Start discovery in wi-fi direct mode.This is a non-blocking API. wlan_wfd_discovery_notify_handler() rsi_wlan_wfd_start_discovery() API is registered through rsi_wlan_register_callbacks(), its non blocking, otherwise blocking call.

Parameters
N/Ago_intent
N/Adevice_name
N/Achannel
N/Assid_post_fix
N/Apsk
N/Awlan_wfd_discovery_notify_handler
N/Awlan_wfd_connection_request_notify_handler
  • rsi_wireless_init() API needs to be called before this API.

    Parameter

    Description

    go_intent

    Determine whether the device is intended to form a GO (group owner) or work as a Wi-Fi Direct Peer node.

    Value used in the GO negotiation process, when the module negotiates with another Wi-Fi Direct Node on who would become the Group Owner.

    Valid range of values for this parameter is: 0 to 16. Higher the number, higher is the willingness of the module to become a GO.

    After the module becomes a GO in Wi-Fi Direct mode, it appears as an Access Point to the client devices.

    If the number is between 0 and 15, a GO negotiation takes place. If the value is 16, the module forms an Autonomous GO without negotiating with any other device.

    device_name

    Device name for the module. The maximum length of this field is 32 characters and the remaining bytes are filled with 0x00.

    Another Wi-Fi Direct device would see this name when it scans for Wi-Fi Direct nodes.

    channel

    Operating channel number. The specified channel is used if the device becomes a GO or Autonomous GO

    ssid_post_fix

    Used to add a postfix to the SSID in Wi-Fi Direct GO mode and Autonomous GO mode.

    psk

    Passphrase of a maximum length of 63 characters (a null character should be supplied to make it 64 bytes in the structure).

    PSK used if the module becomes a GO owner.

    wlan_wfd_discovery_notify_handler

    Asynchronous message sent from module to the host when module finds any Wi-Fi Direct node.

    Parameters involved are status, buffer. & length

    status

    Response status. If status is zero, it means that the wfd device response has some device information

    buffer

    Response buffer.

    Length

    Response buffer length

    wlan_wfd_connection_request_notify_handler

    Asynchronous message sent from module to the host when module receives a connection request from any remote Wi-Fi Direct node.

    Parameters involved are status, buffer, & length

    status

    Response status. If status is zero, it means that the connection request has come from some device.

    buffer

    Response buffer

    length

    Response buffer length

Returns

  • 0 - Success Non-Zero Value - Failure If return value is less than 0 -3 - Command given in wrong state -4 - Buffer not available to serve the command If return value is greater than 0 0x001D, 0x0021, 0x002C, 0x0015


Definition at line 4800 of file wlan/rsi_wlan_apis.c

rsi_wlan_wfd_connect#

int32_t rsi_wlan_wfd_connect (int8_t * device_name, void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length) join_response_handler, device_name, join_response_handler, status, buffer, length, <nodetype>)

A join_response_handler() API that connects to the specified Wi-Fi-Direct device.This is a non-blocking API. if join_response_handler() is registered through rsi_wlan_register_callbacks(), it's non blocking, otherwise, a blocking call.

Parameters
[in]device_name

- Device name of the Wi-Fi Direct node to connect.

[in]join_response_handler

- Called when the response for join has come from the module

[in]device_name

- Device name of the Wi-Fi Direct node to connect.

[in]join_response_handler

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

[out]status

- Response status If status is zero, join response is stated as success

[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

- Response buffer length

[out]<nodetype>

'G' - GO 'C' - Client

Note

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

Returns

  • 0 - Success Non-Zero Value - Failure If return value is less than 0 -4 - Buffer not available to serve the command If return value is greater than 0 0x0014, 0x0009, 0x0003, 0x0021, 0x0012c 0x0015


Definition at line 4932 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 5022 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, otherwise, a blocking call.

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 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 0x0015,0xBB21,0xBB4B,0xBB55

Note

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


Definition at line 5102 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, [])

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

N/A[]

state -

Returns

  • Void


Definition at line 5203 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

Note

  • This API is not supported in current release.

Returns

  • 0 - Success Non-Zero Value - Failure -4 - Buffer not availableto serve the command


Definition at line 5233 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

  • Return the 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 5335 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

Note

  • This API is not supported in current release.

Returns

  • 0 - Success Non-Zero Value - Failure If return value is less than 0 -4 - Buffer not available to serve the command


Definition at line 5363 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


Definition at line 5438 of file wlan/rsi_wlan_apis.c

References 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 , 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

Note

  • This API is not supported in current release.

Returns

  • 0 - Success Non-Zero Value - Failure If return value is less than 0 -4 - Buffer not available to serve the command


Definition at line 5827 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

- Enable/disable the profile configuration, first parameter value would be 1(CFG_ENABLE)- this command is used to enable or disable the feature of auto-join or auto-create on powerup and 2(enable_auto_config) -for profile based.

[in]type

- Profile type

Note

  • Possible profile types: // Client profile #define RSI_WLAN_PROFILE_CLIENT 0 // P2P profile #define RSI_WLAN_PROFILE_P2P 1 // EAP profile #define RSI_WLAN_PROFILE_EAP 2 // AP profile #define RSI_WLAN_PROFILE_AP 6 // All profiles #define RSI_WLAN_PROFILE_ALL 0xF

Returns

  • 0 - Success Non-Zero Value - Failure -4 - Buffer not available to serve the command

Note

  • If user tries to give any other command during autojoin, then user gets error 0x002C. To avoid this, user have to disable auto_join feature and give other commands.


Definition at line 5914 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 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 - Successful execution of the command. If TYPE value is 3. Non-Zero Value - Failure If return value is greater than 0 0x0021, 0x0025,0x0026,0x0028,0x002C,0x0039,0x003a, 0x003b

Note

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


Definition at line 5991 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

  • Can be issued any time in case of power save mode 9 (MSG_BASED).

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 6069 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, (void*)callback_handler_ptr)

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

Parameters
N/Acallback_id

NULL

N/Acallback_handler_ptr

Assert Value

N/Astatus

32

[in]buffer

- Payload of the asynchronous response

[in]length

- Length of the payload

parameter callback ID

Value

RSI_JOIN_FAIL_CB

0

RSI_IP_FAIL_CB

1

RSI_REMOTE_SOCKET_TERMINATE_CB

2

RSI_IP_CHANGE_NOTIFY_CB

3

RSI_STATIONS_DISCONNECT_NOTIFY_CB

4

RSI_STATIONS_CONNECT_NOTIFY_CB

5

RSI_WLAN_DATA_RECEIVE_NOTIFY_CB

6

RSI_WLAN_WFD_DISCOVERY_NOTIFY_CB

7

RSI_WLAN_RECEIVE_STATS_RESPONSE_CB

8

RSI_WLAN_WFD_CONNECTION_REQUEST_NOTIFY_CB

9

RSI_WLAN_SCAN_RESPONSE_HANDLER

10

RSI_WLAN_JOIN_RESPONSE_HANDLER

11

RSI_WLAN_RAW_DATA_RECEIVE_HANDLER

12

RSI_WLAN_SOCKET_CONNECT_NOTIFY_CB

13

RSI_WLAN_SERVER_CERT_RECEIVE_NOTIFY_CB

14

RSI_WLAN_ASYNC_STATS

15

RSI_FLASH_WRITE_RESPONSE

16

RSI_WLAN_ASSERT_NOTIFY_CB

17

RSI_WLAN_MAX_TCP_WINDOW_NOTIFY_CB

18

[in](void*)callback_handler_ptr

(uint16_t status,uint8_t *buffer, const uint32_t length) – Application callback handler to be registered [param] status - Status of the asynchronous response [param] buffer - Payload of the asynchronous response [param] length - Length of the payload

Note

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

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 FW. Application should try to re-join to the AP. This is valid in both AP and STA mode This call back is triggered when module fails to connect to AP in STA mode or when AP creation fails.

RSI_IP_FAIL_CB

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

RSI_REMOTE_SOCKET_TERMINATE_CB

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

  • Need to connect to socket.

RSI_IP_CHANGE_NOTIFY_CB

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

RSI_STATIONS_DISCONNECT_NOTIFY_CB

Called when asynchronous station disconnect notification is received from the FW 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 call back is triggered when STA's are disconnected

  • STA need to connect to the Accesspoint 9916.

RSI_STATIONS_CONNECT_NOTIFY_CB

Called when asynchronous station connect notification is received from the FW 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 call back is triggered when STA's are connected

  • STA need to connect to the accesspoint 9116.

RSI_WLAN_DATA_RECEIVE_NOTIFY_CB

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

  • Need to connect to socket.

RSI_WLAN_WFD_DISCOVERY_NOTIFY_CB

Called when wifi direct device discovery notification received from the FW. This is valid in WFD Mode only This call back is triggered when a PEER is discovered by the device

RSI_WLAN_RECEIVE_STATS_RESPONSE_CB

Called when asynchronous receive statistics from the FW in per or end to end mode. This is valid in PER Mode only This call back is triggered when module wants to receive stats

RSI_WLAN_WFD_CONNECTION_REQUEST_NOTIFY_CB

Called when wi-fi direct connection request from the FW. This is valid in WFD Mode only This call back is triggered when there is a connection request from other Peer device

RSI_WLAN_SCAN_RESPONSE_HANDLER

Called when a response for scan request is received from the FW. It is an indication to host that the scan is success or failed. This is valid only STA mode This call back is triggered when module try to scan and receive response of all the available AP's

  • Need to call rsi_scan() API.

RSI_WLAN_JOIN_RESPONSE_HANDLER

Called when a response for join request is received from the FW. It is an indication to application that the Join to AP is success or failed. This is valid in STA mode This call back is triggered when STA is sucessfully connected

  • Need to call rsi_scan API.

RSI_WLAN_RAW_DATA_RECEIVE_HANDLER

Called when raw data packets are received from the FW. This is valid in both AP and STA mode This call back 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 call back is registerd and triggered when socket connects

  • Need to create socket.

RSI_WLAN_SERVER_CERT_RECEIVE_NOTIFY_CB

Reserved

RSI_WLAN_ASYNC_STATS

Called when async response come from the FW 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 FW. It returns the assert value to the application

RSI_WLAN_MAX_TCP_WINDOW_NOTIFY_CB

Reserved


Definition at line 6181 of file wlan/rsi_wlan_apis.c

References 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::socket_connect_response_handler , rsi_callback_cb_s::certificate_response_handler , rsi_callback_cb_s::wlan_async_module_state , rsi_callback_cb_s::flash_write_response_handler , rsi_callback_cb_s::rsi_assertion_cb , and rsi_callback_cb_s::rsi_max_available_rx_window

rsi_load_bootup_params#

int32_t rsi_load_bootup_params ( Void)

Send Boot_up parameters to the Firmware.

Parameters
[in]Void

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 6920 of file wlan/rsi_wlan_apis.c

rsi_reset_mac#

int32_t rsi_reset_mac ( Void)

Reset MAC.

Parameters
[in]Void

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 7232 of file wlan/rsi_wlan_apis.c

translate_channel#

uint8_t translate_channel (uint8_t channelNum)

Channel translate.

Parameters
[in]channelNum

- Channel number

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 7299 of file wlan/rsi_wlan_apis.c

rsi_radio_caps#

int32_t rsi_radio_caps (uint8_t operating_channel)

Radio capabilities of the operating channel.

Parameters
[in]operating_channel

- Operating channel number

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 7321 of file wlan/rsi_wlan_apis.c

program_bb_rf#

int32_t program_bb_rf ( Void)

Program radio frequency.

Parameters
[in]Void

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 7454 of file wlan/rsi_wlan_apis.c

set_channel#

int32_t set_channel (uint8_t channel_num, uint8_t power_level)

Set the operating channel.

Parameters
[in]channel_num

- Operating channel number

[in]power_level

- Power level

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 7530 of file wlan/rsi_wlan_apis.c

rsi_feature_frame#

int32_t rsi_feature_frame ( Void)

Select internal or external RF type and clock frequency.

Parameters
[in]Void

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 7602 of file wlan/rsi_wlan_apis.c

rsi_send_per_packet#

int32_t rsi_send_per_packet (tx_per_params_t * per_params, uint32_t pkt_size)

Send packets.

Parameters
[in]per_params

- This is the parameter

[in]pkt_size

- Packet size

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 7670 of file wlan/rsi_wlan_apis.c

rsi_send_per_frame#

int32_t rsi_send_per_frame (tx_per_params_t * tx_per_params)

Send packets frame.

Parameters
[in]tx_per_params

- Transmitted parameter

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 7743 of file wlan/rsi_wlan_apis.c

rsi_prepare_per_pkt#

uint32_t rsi_prepare_per_pkt (tx_per_params_t * per_params, uint16_t length)

Prepare PER packet.

Parameters
[in]per_params

- Parameters

[in]length

- Length

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 7814 of file wlan/rsi_wlan_apis.c

rsi_process_transmit#

int32_t rsi_process_transmit (tx_per_params_t * per_params)

Transmit packets frame.

Parameters
[in]per_params

- Transmitted parameter

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 7960 of file wlan/rsi_wlan_apis.c

rsi_efuse_write#

int32_t rsi_efuse_write (rsi_efuse_write_t * efuse_write_p)

Write content to efuse.

Parameters
[in]efuse_write_p

- Write efuse content

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 8069 of file wlan/rsi_wlan_apis.c

rsi_efuse_read#

int32_t rsi_efuse_read (rsi_efuse_read_t * efuse_read_p, uint8_t * buf, uint32_t length)

Get efuse content.

Parameters
[in]efuse_read_p

- Read efuse content

[in]buf

- Pointer to buffer to store efuse content

[in]length

- Length of the efuse content

Returns

  • 0 - Success Non-Zero Value - Failure


Definition at line 8125 of file wlan/rsi_wlan_apis.c