DRIVER_API

Modules

GENERAL_DRIVER_API

FULL_MAC_DRIVER_API

Functions

void sl_wfx_init_secure_link_encryption_bitmap (uint8_t *bitmap)
Initializes the whole SecureLink bitmap to disable encryption for all request IDs.
uint8_t sl_wfx_secure_link_encryption_required_get (uint8_t request_id)
Get the encryption state of a request ID.
void sl_wfx_secure_link_bitmap_set_all_encrypted (uint8_t *bitmap)
Quickly set the bitmap to encrypt all requests.
void sl_wfx_secure_link_bitmap_add_request_id (uint8_t *bitmap, uint8_t request_id)
Add a request ID to the SecureLink bitmap.
void sl_wfx_secure_link_bitmap_remove_request_id (uint8_t *bitmap, uint8_t request_id)
Remove a request ID to the SecureLink bitmap.
sl_status_t sl_wfx_init ( sl_wfx_context_t *context)
Init the Wi-Fi chip.
sl_status_t sl_wfx_deinit (void)
Deinit the Wi-Fi chip.
sl_status_t sl_wfx_send_command (uint8_t command_id, void *data, uint32_t data_size, sl_wfx_interface_t interface, sl_wfx_generic_confirmation_t **response)
Send a command to WF200.
sl_status_t sl_wfx_send_request (uint8_t command_id, sl_wfx_generic_message_t *request, uint16_t request_length)
Send a request to the Wi-Fi chip.
sl_status_t sl_wfx_receive_frame (uint16_t *ctrl_reg)
Receive available frame from the Wi-Fi chip.
sl_status_t sl_wfx_enable_irq (void)
Enable the Wi-Fi chip irq.
sl_status_t sl_wfx_disable_irq (void)
Disable the Wi-Fi chip irq.
sl_status_t sl_wfx_set_access_mode_message (void)
Set access mode message.
sl_status_t sl_wfx_set_wake_up_bit (uint8_t state)
Set the Wi-Fi chip wake up bit.
sl_status_t sl_wfx_enable_device_power_save (void)
Active the power save feature in the FMAC driver and let the WFx go in sleep mode.
sl_status_t sl_wfx_disable_device_power_save (void)
Disable the power save feature in the FMAC driver and prevent the WFx going in sleep mode.
static sl_status_t sl_wfx_init_chip (void)
Init the Wi-Fi chip.
static sl_status_t sl_wfx_download_run_bootloader (void)
run the Wi-Fi chip bootloader
static sl_status_t sl_wfx_download_run_firmware (void)
Download the Wi-Fi chip firmware.
static sl_status_t sl_wfx_poll_for_value (uint32_t address, uint32_t polled_value, uint32_t max_retries)
Poll a value from the Wi-Fi chip.
static sl_status_t sl_wfx_compare_keysets (uint8_t chip_keyset, char *firmware_keyset)
Compare the chip keyset and the firmware one to check compatibility.
sl_status_t sl_wfx_set_antenna_config ( sl_wfx_antenna_config_t config)
Configure the antenna setting (done through the PDS)
sl_status_t sl_wfx_get_hardware_revision_and_type (uint8_t *revision, uint8_t *type)
Retrieve the hardware version and type.
sl_status_t sl_wfx_get_opn (uint8_t **opn)
Get the part opn.
sl_status_t sl_wfx_get_status_code (uint32_t wfx_status, uint8_t command_id)
Extract status code from WFx message.
sl_status_t sl_wfx_allocate_command_buffer ( sl_wfx_generic_message_t **buffer, uint32_t command_id, sl_wfx_buffer_type_t type, uint32_t buffer_size)
Allocate a buffer for the Wi-Fi driver.
sl_status_t sl_wfx_free_command_buffer ( sl_wfx_generic_message_t *buffer, uint32_t command_id, sl_wfx_buffer_type_t type)
Free a buffer for the Wi-Fi driver.

Function Documentation

sl_wfx_allocate_command_buffer()

sl_status_t sl_wfx_allocate_command_buffer ( sl_wfx_generic_message_t ** buffer,
uint32_t command_id,
sl_wfx_buffer_type_t type,
uint32_t buffer_size
)

Allocate a buffer for the Wi-Fi driver.

Parameters
buffer
command_id is the ID of the command to check if encryption is required
type of the buffer to allocate
buffer_size is the size of the buffer to allocate
Returns
SL_STATUS_OK if the values are retrieved correctly, SL_STATUS_TIMEOUT if the buffer is not allocated in time, SL_STATUS_FAIL otherwise

Definition at line 2412 of file sl_wfx.c .

References sl_wfx_host_allocate_buffer() , and sl_wfx_secure_link_encryption_required_get() .

Referenced by sl_wfx_secure_link_exchange_keys() , sl_wfx_send_command() , sl_wfx_send_configuration() , sl_wfx_send_join_command() , sl_wfx_send_scan_command() , sl_wfx_set_roam_parameters() , sl_wfx_shutdown() , sl_wfx_start_ap_command() , and sl_wfx_update_ap_command() .

sl_wfx_compare_keysets()

static sl_status_t sl_wfx_compare_keysets ( uint8_t chip_keyset,
char * firmware_keyset
)
static

Compare the chip keyset and the firmware one to check compatibility.

Parameters
chip_keyset is the value retrieved from the Wi-Fi chip
firmware_keyset is the 8 first bytes of the firmware
Returns
SL_STATUS_OK if the firmware is compatible with the WF200, SL_STATUS_WIFI_INVALID_KEY otherwise

Definition at line 2218 of file sl_wfx.c .

Referenced by sl_wfx_download_run_firmware() .

sl_wfx_deinit()

sl_status_t sl_wfx_deinit ( void )

Deinit the Wi-Fi chip.

Returns
Returns SL_STATUS_OK if the deinitialization is successful, SL_STATUS_FAIL otherwise

Definition at line 255 of file sl_wfx.c .

References sl_wfx_disable_irq() , and sl_wfx_shutdown() .

sl_wfx_disable_device_power_save()

sl_status_t sl_wfx_disable_device_power_save ( void )

Disable the power save feature in the FMAC driver and prevent the WFx going in sleep mode.

Returns
SL_STATUS_OK if the bit has been set correctly, SL_STATUS_FAIL otherwise

Definition at line 1881 of file sl_wfx.c .

References sl_wfx_context_t::state .

sl_wfx_disable_irq()

sl_status_t sl_wfx_disable_irq ( void )

Disable the Wi-Fi chip irq.

Returns
SL_STATUS_OK if the irq is disabled correctly, SL_STATUS_FAIL otherwise
Note
Disable the host irq and set the Wi-Fi chip register accordingly

Definition at line 1770 of file sl_wfx.c .

Referenced by sl_wfx_deinit() .

sl_wfx_download_run_bootloader()

static sl_status_t sl_wfx_download_run_bootloader ( void )
static

run the Wi-Fi chip bootloader

Returns
SL_STATUS_OK if the bootloader runs correctly, SL_STATUS_FAIL otherwise

Definition at line 1981 of file sl_wfx.c .

sl_wfx_download_run_firmware()

static sl_status_t sl_wfx_download_run_firmware ( void )
static

Download the Wi-Fi chip firmware.

Returns
SL_STATUS_OK if the firmware is downloaded correctly, SL_STATUS_WIFI_INVALID_KEY if the firmware keyset does not match the chip one, SL_STATUS_WIFI_FIRMWARE_DOWNLOAD_TIMEOUT or SL_STATUS_TIMEOUT if the process times out, SL_STATUS_FAIL otherwise

Definition at line 2020 of file sl_wfx.c .

References sl_wfx_compare_keysets() , sl_wfx_host_deinit() , sl_wfx_host_get_firmware_data() , sl_wfx_host_get_firmware_size() , sl_wfx_host_init() , sl_wfx_host_log() , and sl_wfx_poll_for_value() .

sl_wfx_enable_device_power_save()

sl_status_t sl_wfx_enable_device_power_save ( void )

Active the power save feature in the FMAC driver and let the WFx go in sleep mode.

Returns
SL_STATUS_OK if the bit has been set correctly, SL_STATUS_FAIL otherwise
Note
In connected state, it is required to activate the Wi-Fi power mode using sl_wfx_set_power_mode() to allow the WFx chip to go to sleep.

Definition at line 1847 of file sl_wfx.c .

References sl_wfx_context_t::state .

sl_wfx_enable_irq()

sl_status_t sl_wfx_enable_irq ( void )

Enable the Wi-Fi chip irq.

Returns
SL_STATUS_OK if the irq is enabled correctly, SL_STATUS_FAIL otherwise
Note
Enable the host irq and set the Wi-Fi chip register accordingly

Definition at line 1743 of file sl_wfx.c .

References sl_wfx_host_enable_platform_interrupt() .

sl_wfx_free_command_buffer()

sl_status_t sl_wfx_free_command_buffer ( sl_wfx_generic_message_t * buffer,
uint32_t command_id,
sl_wfx_buffer_type_t type
)

Free a buffer for the Wi-Fi driver.

Parameters
buffer
command_id is the ID of the command to check if encryption is required
type of the buffer to allocate
Returns
SL_STATUS_OK if the values are retrieved correctly, SL_STATUS_FAIL otherwise

Definition at line 2461 of file sl_wfx.c .

References sl_wfx_host_free_buffer() , and sl_wfx_secure_link_encryption_required_get() .

sl_wfx_get_hardware_revision_and_type()

sl_status_t sl_wfx_get_hardware_revision_and_type ( uint8_t * revision,
uint8_t * type
)

Retrieve the hardware version and type.

Parameters
revision is the pointer to retrieve the revision version
type is the pointer to retrieve the type
Returns
SL_STATUS_OK if the values are retrieved correctly, SL_STATUS_FAIL otherwise

Definition at line 2277 of file sl_wfx.c .

sl_wfx_get_opn()

sl_status_t sl_wfx_get_opn ( uint8_t ** opn )

Get the part opn.

Parameters
opn
Returns
SL_STATUS_OK if the values are retrieved correctly, SL_STATUS_FAIL otherwise

Definition at line 2295 of file sl_wfx.c .

References sl_wfx_context_t::wfx_opn .

sl_wfx_get_status_code()

sl_status_t sl_wfx_get_status_code ( uint32_t wfx_status,
uint8_t command_id
)

Extract status code from WFx message.

Parameters
wfx_status is the status returned by the WFx
command_id is the ID of the command
Returns
corresponding driver status code enumerated in sl_status_t

Definition at line 2314 of file sl_wfx.c .

References SL_WFX_ERROR_UNSUPPORTED_MSG_ID , sl_wfx_host_log() , SL_WFX_INVALID_PARAMETER , SL_WFX_MAC_KEY_STATUS_FAILED_KEY_ALREADY_BURNED , SL_WFX_MAC_KEY_STATUS_FAILED_RAM_MODE_NOT_ALLOWED , SL_WFX_MAC_KEY_STATUS_FAILED_UNKNOWN_MODE , SL_WFX_MAC_KEY_STATUS_SUCCESS , SL_WFX_PREVENT_ROLLBACK_CNF_SUCCESS , SL_WFX_PREVENT_ROLLBACK_CNF_WRONG_MAGIC_WORD , SL_WFX_PUB_KEY_EXCHANGE_STATUS_FAILED , SL_WFX_PUB_KEY_EXCHANGE_STATUS_SUCCESS , SL_WFX_STATUS_FAILURE , SL_WFX_STATUS_GPIO_WARNING , SL_WFX_STATUS_SUCCESS , WFM_STATUS_CHANNEL_NOT_ALLOWED , WFM_STATUS_CONNECTION_ABORTED , WFM_STATUS_CONNECTION_AUTH_FAILURE , WFM_STATUS_CONNECTION_REJECTED_BY_AP , WFM_STATUS_CONNECTION_TIMEOUT , WFM_STATUS_GENERAL_FAILURE , WFM_STATUS_INVALID_PARAMETER , WFM_STATUS_NO_MATCHING_AP , WFM_STATUS_RETRY_EXCEEDED , WFM_STATUS_SUCCESS , WFM_STATUS_TX_LIFETIME_EXCEEDED , WFM_STATUS_WARNING , and WFM_STATUS_WRONG_STATE .

Referenced by sl_wfx_control_gpio() , sl_wfx_get_ap_client_signal_strength() , sl_wfx_get_max_tx_power() , sl_wfx_get_pmk() , and sl_wfx_get_signal_strength() .

sl_wfx_init()

sl_status_t sl_wfx_init ( sl_wfx_context_t * context )

Init the Wi-Fi chip.

Copyright 2018, Silicon Laboratories Inc.

Parameters
context maintain the Wi-Fi chip information
Returns
Returns SL_STATUS_OK if the initialization is successful, SL_STATUS_FAIL otherwise
Note
Actions performed by sl_wfx_init() : Reset -> load firmware -> send PDS

Definition at line 86 of file sl_wfx.c .

sl_wfx_init_chip()

static sl_status_t sl_wfx_init_chip ( void )
static

Init the Wi-Fi chip.

Returns
SL_STATUS_OK if the initialization is successful, SL_STATUS_FAIL otherwise

Definition at line 1919 of file sl_wfx.c .

sl_wfx_init_secure_link_encryption_bitmap()

void sl_wfx_init_secure_link_encryption_bitmap ( uint8_t * bitmap )

Initializes the whole SecureLink bitmap to disable encryption for all request IDs.

Copyright 2018, Silicon Laboratories Inc.

Parameters
bitmap is the bitmap that must be updated
Note
It is advised to apply these changes to a transitory bitmap. Its data will be copied to the sl_wfx_context bitmap once the sl_wfx_send_secure_link_encryption_bitmap() has completed successfully.

Definition at line 73 of file sl_wfx_secure_link.c .

sl_wfx_poll_for_value()

static sl_status_t sl_wfx_poll_for_value ( uint32_t address,
uint32_t polled_value,
uint32_t max_retries
)
static

Poll a value from the Wi-Fi chip.

Parameters
address is the address of the value to be polled
polled_value waiting for the value to be equal to polled_value
max_retries is the number of polling to be done before returning SL_STATUS_TIMEOUT
Returns
SL_STATUS_OK if the value is received correctly, SL_STATUS_TIMEOUT if the value is not found in time, SL_STATUS_FAIL if not able to poll the value from the Wi-Fi chip

Definition at line 2188 of file sl_wfx.c .

References sl_wfx_host_wait() .

Referenced by sl_wfx_download_run_firmware() .

sl_wfx_receive_frame()

sl_status_t sl_wfx_receive_frame ( uint16_t * ctrl_reg )

Receive available frame from the Wi-Fi chip.

Parameters
ctrl_reg is the control register value of the last call of sl_wfx_receive_frame() . If equal to 0, the driver will read the control register.
Returns
SL_STATUS_OK if the frame has been received correctly, SL_STATUS_WIFI_NO_PACKET_TO_RECEIVE if no frame are pending inside the Wi-Fi chip SL_STATUS_FAIL otherwise

Definition at line 1609 of file sl_wfx.c .

sl_wfx_secure_link_bitmap_add_request_id()

void sl_wfx_secure_link_bitmap_add_request_id ( uint8_t * bitmap,
uint8_t request_id
)

Add a request ID to the SecureLink bitmap.

Parameters
bitmap is the bitmap that must be updated
request_id is id to add to the bitmap
Note
It is advised to apply these changes to a transitory bitmap. Its data will be copied to the sl_wfx_context bitmap once the sl_wfx_send_secure_link_encryption_bitmap() has completed successfully.

Definition at line 317 of file sl_wfx_secure_link.c .

sl_wfx_secure_link_bitmap_remove_request_id()

void sl_wfx_secure_link_bitmap_remove_request_id ( uint8_t * bitmap,
uint8_t request_id
)

Remove a request ID to the SecureLink bitmap.

Parameters
bitmap is the bitmap that must be updated
request_id is id to remove from the bitmap
Note
It is advised to apply these changes to a transitory bitmap. Its data will be copied to the sl_wfx_context bitmap once the sl_wfx_send_secure_link_encryption_bitmap() has completed successfully.

Definition at line 332 of file sl_wfx_secure_link.c .

Referenced by sl_wfx_secure_link_bitmap_set_all_encrypted() .

sl_wfx_secure_link_bitmap_set_all_encrypted()

void sl_wfx_secure_link_bitmap_set_all_encrypted ( uint8_t * bitmap )

Quickly set the bitmap to encrypt all requests.

Parameters
bitmap is the bitmap that must be updated
Note
It is advised to apply these changes to a transitory bitmap. Its data will be copied to the sl_wfx_context bitmap once the sl_wfx_send_secure_link_encryption_bitmap() has completed successfully.
SL_WFX_EXCEPTION_IND_ID, SL_WFX_ERROR_IND_ID, SL_WFX_STARTUP_IND_ID, SL_WFX_SECURELINK_EXCHANGE_PUB_KEYS_REQ_ID and SL_WFX_SECURELINK_EXCHANGE_PUB_KEYS_IND_ID cannot be encrypted and are excluded from this function.
SL_WFX_WAKEUP_IND_ID is empty and there is no point encrypting it.
SL_WFX_SEND_FRAME_REQ_ID, SL_WFX_RECEIVED_IND_ID are not encrypted by default as enabling encryption for these can lower the throughput. If needed, use sl_wfx_secure_link_bitmap_add_request_id() separately.

Definition at line 276 of file sl_wfx_secure_link.c .

References SL_WFX_ERROR_IND_ID , SL_WFX_EXCEPTION_IND_ID , SL_WFX_RECEIVED_IND_ID , sl_wfx_secure_link_bitmap_remove_request_id() , SL_WFX_SECURELINK_EXCHANGE_PUB_KEYS_IND_ID , SL_WFX_SECURELINK_EXCHANGE_PUB_KEYS_REQ_ID , SL_WFX_SEND_FRAME_REQ_ID , SL_WFX_STARTUP_IND_ID , and SL_WFX_WAKEUP_IND_ID .

sl_wfx_secure_link_encryption_required_get()

uint8_t sl_wfx_secure_link_encryption_required_get ( uint8_t request_id )

Get the encryption state of a request ID.

Parameters
request_id to check in the bitmap
Returns
Returns SL_WFX_SECURE_LINK_ENCRYPTION_REQUIRED if the request should be encrypted, SL_WFX_SECURE_LINK_ENCRYPTION_NOT_REQUIRED otherwise

Definition at line 85 of file sl_wfx_secure_link.c .

Referenced by sl_wfx_allocate_command_buffer() , and sl_wfx_free_command_buffer() .

sl_wfx_send_command()

sl_status_t sl_wfx_send_command ( uint8_t command_id,
void * data,
uint32_t data_size,
sl_wfx_interface_t interface,
sl_wfx_generic_confirmation_t ** response
)

Send a command to WF200.

Parameters
command_id is the ID of the command to be sent (cf. sl_wfx_cmd_api.h )
data is the pointer to the data to be sent by the command
data_size is the size of the data to be sent
interface is the interface affected by the command
response is a pointer to the response retrieved
  • SL_WFX_STA_INTERFACE
  • SL_WFX_SOFTAP_INTERFACE
Returns
SL_STATUS_OK if the command is sent correctly, SL_STATUS_FAIL otherwise

Definition at line 1463 of file sl_wfx.c .

References sl_wfx_allocate_command_buffer() .

Referenced by sl_wfx_add_blacklist_address() , sl_wfx_add_multicast_address() , sl_wfx_add_whitelist_address() , sl_wfx_control_gpio() , sl_wfx_disconnect_ap_client_command() , sl_wfx_get_ap_client_signal_strength() , sl_wfx_get_max_tx_power() , sl_wfx_get_pmk() , sl_wfx_get_signal_strength() , sl_wfx_prevent_rollback() , sl_wfx_pta_priority() , sl_wfx_pta_settings() , sl_wfx_pta_state() , sl_wfx_remove_multicast_address() , sl_wfx_send_disconnect_command() , sl_wfx_send_stop_scan_command() , sl_wfx_set_arp_ip_address() , sl_wfx_set_broadcast_filter() , sl_wfx_set_cca_config() , sl_wfx_set_mac_address() , sl_wfx_set_max_ap_client() , sl_wfx_set_max_ap_client_inactivity() , sl_wfx_set_max_tx_power() , sl_wfx_set_ns_ip_address() , sl_wfx_set_power_mode() , sl_wfx_set_scan_parameters() , sl_wfx_set_tx_rate_parameters() , sl_wfx_set_unicast_filter() , and sl_wfx_stop_ap_command() .

sl_wfx_send_request()

sl_status_t sl_wfx_send_request ( uint8_t command_id,
sl_wfx_generic_message_t * request,
uint16_t request_length
)

Send a request to the Wi-Fi chip.

Parameters
command_id is the ID of the command to be sent (cf. sl_wfx_cmd_api.h )
request is the pointer to the request to be sent
request_length is the size of the request to be sent
Returns
SL_STATUS_OK if the command is sent correctly, SL_STATUS_FAIL otherwise

Definition at line 1515 of file sl_wfx.c .

References sl_wfx_generic_message_t::header , sl_wfx_header_t::id , sl_wfx_header_t::length , sl_wfx_host_lock() , and sl_wfx_context_t::used_buffers .

Referenced by sl_wfx_send_ethernet_frame() .

sl_wfx_set_access_mode_message()

sl_status_t sl_wfx_set_access_mode_message ( void )

Set access mode message.

Returns
SL_STATUS_OK if the message mode is enabled correctly, SL_STATUS_FAIL otherwise

Definition at line 1796 of file sl_wfx.c .

sl_wfx_set_antenna_config()

sl_status_t sl_wfx_set_antenna_config ( sl_wfx_antenna_config_t config )

Configure the antenna setting (done through the PDS)

Parameters
config is the antenna configuration to be used.
  • SL_WFX_ANTENNA_1_ONLY
  • SL_WFX_ANTENNA_2_ONLY
  • SL_WFX_ANTENNA_TX1_RX2
  • SL_WFX_ANTENNA_TX2_RX1
  • SL_WFX_ANTENNA_DIVERSITY
Returns
SL_STATUS_OK if the setting is applied correctly, SL_STATUS_FAIL otherwise

Definition at line 2248 of file sl_wfx.c .

References SL_WFX_ANTENNA_DIVERSITY , and sl_wfx_send_configuration() .

sl_wfx_set_wake_up_bit()

sl_status_t sl_wfx_set_wake_up_bit ( uint8_t state )

Set the Wi-Fi chip wake up bit.

Parameters
state is the state of the wake up bit to configure
Returns
SL_STATUS_OK if the bit has been set correctly, SL_STATUS_FAIL otherwise

Definition at line 1818 of file sl_wfx.c .