C:/Users/jutiron/Desktop/Bitbucket_repository/wf200_driver/wf200.c File Reference

WF200 Full MAC driver.

Functions

static sl_status_t wf200_send_request (uint16_t command_id, wf200_buffer_t *request, uint32_t request_length)
 Send a request to wf200.
 
static sl_status_t poll_for_value (uint32_t address, uint32_t polled_value, uint32_t max_retries)
 Poll a value from wf200.
 
static sl_status_t wf200_init_chip (void)
 Init wf200 chip.
 
static sl_status_t wf200_download_run_bootloader (void)
 Download wf200 bootloader.
 
static sl_status_t wf200_download_run_firmware (void)
 Download wf200 firmware.
 
sl_status_t wf200_init (wf200_context_t *context)
 Init wf200.
 
sl_status_t wf200_deinit (void)
 Deinit wf200.
 
sl_status_t wf200_set_mac_address (const wf200_mac_address_t *mac, wf200_interface_t interface)
 Set the MAC address used by wf200.
 
sl_status_t wf200_send_join_command (const uint8_t *ssid, uint32_t ssid_length, uint16_t security_mode, const uint8_t *passkey, uint32_t passkey_length)
 As a station, send a command to join a Wi-Fi network.
 
sl_status_t wf200_send_disconnect_command (void)
 As a station, send a disconnection request to the AP.
 
sl_status_t wf200_start_ap_command (uint32_t channel, uint8_t *ssid, uint32_t ssid_length, WfmSecurityMode security, const uint8_t *passkey, uint8_t passkey_length)
 Send a command to start the softap mode.
 
sl_status_t wf200_update_ap_command (uint16_t beacon_iedata_length, uint16_t proberesp_iedata_length, uint32_t *beacon_iedata, uint32_t *proberesp_iedata)
 Update AP settings.
 
sl_status_t wf200_stop_ap_command (void)
 Send a command to stop the softap mode.
 
sl_status_t wf200_send_ethernet_frame (wf200_frame_t *frame, uint32_t data_length, wf200_interface_t interface)
 Send an Ethernet frame.
 
sl_status_t wf200_send_scan_command (uint16_t scan_mode, const uint8_t *channel_list, uint16_t channel_list_count, const WfmHiSsidDef_t *ssid_list, uint16_t ssid_list_count, const uint8_t *ie_data, uint16_t ie_data_length)
 send a scan command
 
sl_status_t wf200_send_stop_scan_command (void)
 Stop a scan process.
 
sl_status_t wf200_get_signal_strength (uint32_t *signal_strength)
 Get the signal strength of the last packets received.
 
sl_status_t wf200_disconnect_ap_client_command (const wf200_mac_address_t *client)
 In AP mode, disconnect the specified client.
 
sl_status_t wf200_set_power_mode (WfmPmMode mode, uint16_t interval)
 Set the power mode used as a station.
 
sl_status_t wf200_add_multicast_address (const wf200_mac_address_t *mac_address, wf200_interface_t interface)
 Configure the maximum number of clients supported in softap mode //TODO.
 
sl_status_t wf200_set_max_ap_client (uint32_t max_clients)
 Configure the maximum number of clients supported in softap mode.
 
sl_status_t wf200_send_configuration (const char *pds_data, uint32_t pds_data_length)
 Function to send PDS chunks.
 
sl_status_t wf200_shutdown (void)
 Shutdown wf200.
 
sl_status_t wf200_send_command (uint32_t command_id, void *data, uint32_t data_size, wf200_interface_t interface)
 Send a command to WF200.
 
sl_status_t wf200_receive_frame (uint32_t *frame_size)
 Receive available frame from wf200.
 
sl_status_t wf200_enable_irq (void)
 Enable wf200 irq.
 
sl_status_t wf200_disable_irq (void)
 Disable wf200 irq.
 
sl_status_t wf200_set_access_mode_message (void)
 Set access mode message.
 
sl_status_t wf200_set_wake_up_bit (uint8_t state)
 Set wf200 wake up bit.
 
sl_status_t wf200_set_antenna_config (wf200_antenna_config_t config)
 Configure the antenna setting of wf200.
 
sl_status_t wf200_get_hardware_revision_and_type (uint8_t *revision, uint8_t *type)
 Retrieve the hardware version and type.
 
sl_status_t wf200_get_opn (uint8_t **opn)
 Get wf200 opn.

WF200 Full MAC driver.

Author
Silicon Labs
Version
0.0.1
Date
24 septembre 2018

wf200.c contains the APIs to communicate with the WF200 Full MAC API

Definition in file wf200.c.

Function Documentation

◆ poll_for_value()

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

Poll a value from wf200.

Parameters
addressAddress of the value to be polled
polled_valuewaiting for the value to be equal to polled_value
max_retriesNumber of polling to be done before returning SL_TIMEOUT
Returns
SL_SUCCESS if the value is received correctly, SL_ERROR otherwise

Definition at line 1208 of file wf200.c.

◆ wf200_deinit()

sl_status_t wf200_deinit ( void  )

Deinit wf200.

Returns
SL_SUCCESS if the deinitialization is successful, SL_ERROR otherwise

Definition at line 174 of file wf200.c.

References wf200_disable_irq().

◆ wf200_disable_irq()

sl_status_t wf200_disable_irq ( void  )

Disable wf200 irq.

Note
Disable the host irq and set wf200 register accordingly
Returns
SL_SUCCESS if the irq is disabled correctly, SL_ERROR otherwise

Definition at line 863 of file wf200.c.

Referenced by wf200_deinit().

◆ wf200_download_run_bootloader()

static sl_status_t wf200_download_run_bootloader ( void  )
static

Download wf200 bootloader.

Returns
SL_SUCCESS if the bootloader is downloaded correctly, SL_ERROR otherwise

Definition at line 1009 of file wf200.c.

◆ wf200_download_run_firmware()

static sl_status_t wf200_download_run_firmware ( void  )
static

Download wf200 firmware.

Returns
SL_SUCCESS if the firmware is downloaded correctly, SL_ERROR otherwise

Definition at line 1046 of file wf200.c.

◆ wf200_enable_irq()

sl_status_t wf200_enable_irq ( void  )

Enable wf200 irq.

Note
Enable the host irq and set wf200 register accordingly
Returns
SL_SUCCESS if the irq is enabled correctly, SL_ERROR otherwise

Definition at line 836 of file wf200.c.

◆ wf200_get_hardware_revision_and_type()

sl_status_t wf200_get_hardware_revision_and_type ( uint8_t *  revision,
uint8_t *  type 
)

Retrieve the hardware version and type.

Parameters
revisionpointer to retrieve the revision version
typepointer to retrieve the type
Returns
SL_SUCCESS if the values are retrieved correctly, SL_ERROR otherwise

Definition at line 1279 of file wf200.c.

◆ wf200_get_opn()

sl_status_t wf200_get_opn ( uint8_t **  opn)

Get wf200 opn.

Parameters
opn?? TODO
Returns
SL_SUCCESS if the value is retrieved correctly, SL_ERROR otherwise

Definition at line 1296 of file wf200.c.

◆ wf200_init()

sl_status_t wf200_init ( wf200_context_t context)

Init wf200.

Note
Actions performed by wf200_init(): Reset -> load firmware -> send PDS
Parameters
contextwf200 context to maintain wf200 information
Returns
SL_SUCCESS if the initialization is successful, SL_ERROR otherwise

Definition at line 95 of file wf200.c.

◆ wf200_init_chip()

static sl_status_t wf200_init_chip ( void  )
static

Init wf200 chip.

Returns
SL_SUCCESS if the initialization is successful, SL_ERROR otherwise

Definition at line 943 of file wf200.c.

◆ wf200_receive_frame()

sl_status_t wf200_receive_frame ( uint32_t *  frame_size)

Receive available frame from wf200.

Parameters
frame_sizeframe size to be read from WF200. If 0, the driver will read the control register to retrieve the frame size.
Returns
SL_SUCCESS if the request has been sent correctly, SL_ERROR otherwise

Definition at line 791 of file wf200.c.

◆ wf200_send_command()

sl_status_t wf200_send_command ( uint32_t  command_id,
void *  data,
uint32_t  data_size,
wf200_interface_t  interface 
)

Send a command to WF200.

Parameters
command_idID of the command to be sent (cf. wfm_fm_api.h)
dataPointer to the data to be sent by the command
data_sizeSize of the data to be sent
interfaceInterface used to send the ethernet frame. wf200_interface_t.
  • WF200_STA_INTERFACE
  • WF200_SOFTAP_INTERFACE
Returns
SL_SUCCESS if the command is sent correctly, SL_ERROR otherwise

Definition at line 731 of file wf200.c.

Referenced by wf200_disconnect_ap_client_command(), wf200_send_disconnect_command(), wf200_send_stop_scan_command(), wf200_set_mac_address(), wf200_set_power_mode(), wf200_shutdown(), wf200_start_ap_command(), wf200_stop_ap_command(), and wf200_update_ap_command().

◆ wf200_send_request()

static sl_status_t wf200_send_request ( uint16_t  command_id,
wf200_buffer_t request,
uint32_t  request_length 
)
static

Send a request to wf200.

Parameters
command_idID of the command to be sent (cf. wfm_fm_api.h)
requestPointer to the request to be sent
request_lengthSize of the request to be sent
Returns
SL_SUCCESS if the request is sent correctly, SL_ERROR otherwise

Definition at line 773 of file wf200.c.

◆ wf200_set_access_mode_message()

sl_status_t wf200_set_access_mode_message ( void  )

Set access mode message.

Returns
SL_SUCCESS if the message mode is enabled correctly, SL_ERROR otherwise

Definition at line 888 of file wf200.c.

◆ wf200_set_antenna_config()

sl_status_t wf200_set_antenna_config ( wf200_antenna_config_t  config)

Configure the antenna setting of wf200.

Note
May require a re-init of the wf200 to change antenna again. Seems to be required to change antenna more than once.
Parameters
configantenna configuration to be used.
  • WF200_ANTENNA_1_ONLY
  • WF200_ANTENNA_2_ONLY
  • WF200_ANTENNA_TX1_RX2
  • WF200_ANTENNA_TX2_RX1
  • WF200_ANTENNA_DIVERSITY
Returns
SL_SUCCESS if the setting is applied correctly, SL_ERROR otherwise

Definition at line 1247 of file wf200.c.

◆ wf200_set_wake_up_bit()

sl_status_t wf200_set_wake_up_bit ( uint8_t  state)

Set wf200 wake up bit.

Note
Depending on the state parameter, set or reset the wake up bit
Parameters
state0 to reset the wake up bit, set the wake up bit otherwise
Returns
SL_SUCCESS if the bit has been set correctly, SL_ERROR otherwise

Definition at line 911 of file wf200.c.