HOST_API

Functions

sl_status_t sl_wfx_host_init (void)
 Driver hook to initialize the host resources.
 
sl_status_t sl_wfx_host_get_firmware_data (const uint8_t **data, uint32_t data_size)
 Driver hook to retrieve a firmware chunk.
 
sl_status_t sl_wfx_host_get_firmware_size (uint32_t *firmware_size)
 Driver hook to retrieve the firmware size.
 
sl_status_t sl_wfx_host_get_pds_data (const char **pds_data, uint16_t index)
 Driver hook to retrieve a PDS line.
 
sl_status_t sl_wfx_host_get_pds_size (uint16_t *pds_size)
 Driver hook to get the number of lines of the PDS.
 
sl_status_t sl_wfx_host_deinit (void)
 Driver hook to deinitialize the host resources.
 
sl_status_t sl_wfx_host_reset_chip (void)
 Implement the reset of the WFx chip.
 
sl_status_t sl_wfx_host_set_wake_up_pin (uint8_t state)
 Drive the wake up pin in the requested state.
 
sl_status_t sl_wfx_host_wait_for_wake_up (void)
 Called once the WFx chip is waking up.
 
sl_status_t sl_wfx_host_sleep_grant (sl_wfx_host_bus_transfer_type_t type, sl_wfx_register_address_t address, uint32_t length)
 Called when the driver is considering putting the WFx in sleep mode.
 
sl_status_t sl_wfx_host_hold_in_reset (void)
 Hold the WFx chip in reset mode.
 
sl_status_t sl_wfx_host_setup_waited_event (uint8_t event_id)
 Set up the next event that the driver will wait.
 
sl_status_t sl_wfx_host_wait_for_confirmation (uint8_t confirmation_id, uint32_t timeout_ms, void **event_payload_out)
 Called when the driver is waiting for a confirmation.
 
sl_status_t sl_wfx_host_wait (uint32_t wait_ms)
 Called when the FMAC driver wants to add a delay.
 
sl_status_t sl_wfx_host_post_event (sl_wfx_generic_message_t *event_payload)
 Called when a message is received from the WFx chip.
 
sl_status_t sl_wfx_host_allocate_buffer (void **buffer, sl_wfx_buffer_type_t type, uint32_t buffer_size)
 Called when the driver wants to allocate memory.
 
sl_status_t sl_wfx_host_free_buffer (void *buffer, sl_wfx_buffer_type_t type)
 Called when the driver wants to free memory.
 
sl_status_t sl_wfx_host_transmit_frame (void *frame, uint32_t frame_len)
 Called when the driver sends a frame to the WFx chip.
 
sl_status_t sl_wfx_host_lock (void)
 Called when the driver needs to lock its access.
 
sl_status_t sl_wfx_host_unlock (void)
 Called when the driver needs to unlock its access.
 
sl_status_t sl_wfx_host_init_bus (void)
 Initialize the host bus.
 
sl_status_t sl_wfx_host_deinit_bus (void)
 Deinitialize the host bus.
 
sl_status_t sl_wfx_host_enable_platform_interrupt (void)
 Enable the bus interrupt.
 
sl_status_t sl_wfx_host_disable_platform_interrupt (void)
 Disable the bus interrupt.
 
sl_status_t sl_wfx_host_spi_cs_assert (void)
 Assert the SPI Chip Select pin.
 
sl_status_t sl_wfx_host_spi_cs_deassert (void)
 Deassert the SPI Chip Select pin.
 
sl_status_t sl_wfx_host_spi_transfer_no_cs_assert (sl_wfx_host_bus_transfer_type_t type, uint8_t *header, uint16_t header_length, uint8_t *buffer, uint16_t buffer_length)
 Send data on the SPI bus.
 
sl_status_t sl_wfx_host_sdio_transfer_cmd52 (sl_wfx_host_bus_transfer_type_t type, uint8_t function, uint32_t address, uint8_t *buffer)
 Send command 52 on the SDIO bus.
 
sl_status_t sl_wfx_host_sdio_transfer_cmd53 (sl_wfx_host_bus_transfer_type_t type, uint8_t function, uint32_t address, uint8_t *buffer, uint16_t buffer_length)
 Send command 53 on the SDIO bus.
 
sl_status_t sl_wfx_host_sdio_enable_high_speed_mode (void)
 Enable the SDIO high-speed mode.
 
sl_status_t sl_wfx_host_get_secure_link_mac_key (uint8_t *sl_mac_key)
 Get the secure link mac key of the part.
 
sl_status_t sl_wfx_host_compute_pub_key (sl_wfx_securelink_exchange_pub_keys_req_body_t *request, const uint8_t *sl_mac_key)
 Compute the secure link public key.
 
sl_status_t sl_wfx_host_verify_pub_key (sl_wfx_securelink_exchange_pub_keys_ind_t *response_packet, const uint8_t *sl_mac_key, uint8_t *sl_host_pub_key)
 Verify the WFX hashed public key.
 
sl_status_t sl_wfx_host_free_crypto_context (void)
 Free any crypto context.
 
sl_status_t sl_wfx_host_decode_secure_link_data (uint8_t *buffer, uint32_t length, uint8_t *session_key)
 Decode a packet.
 
sl_status_t sl_wfx_host_encode_secure_link_data (sl_wfx_generic_message_t *buffer, uint32_t data_length, uint8_t *session_key, uint8_t *nonce)
 Encode a packet.
 
sl_status_t sl_wfx_host_schedule_secure_link_renegotiation (void)
 Schedule a session key renegotiation.
 
void sl_wfx_host_log (const char *string,...)
 Log information about the driver.

Function Documentation

◆ sl_wfx_host_allocate_buffer()

sl_status_t sl_wfx_host_allocate_buffer ( void **  buffer,
sl_wfx_buffer_type_t  type,
uint32_t  buffer_size 
)

Called when the driver wants to allocate memory.

Parameters
bufferis a pointer to the data
typeis the type of buffer to allocate (see sl_wfx_buffer_type_t)
buffer_sizerepresents the amount of memory to allocate
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
Note
Called by the driver every time it needs memory

Referenced by sl_wfx_allocate_command_buffer().

◆ sl_wfx_host_compute_pub_key()

sl_status_t sl_wfx_host_compute_pub_key ( sl_wfx_securelink_exchange_pub_keys_req_body_t request,
const uint8_t *  sl_mac_key 
)

Compute the secure link public key.

Parameters
requestis a pointer to the SL_WFX_SECURELINK_EXCHANGE_PUB_KEYS_REQ body.
sl_mac_keyis a pointer to the context mac key
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise

◆ sl_wfx_host_decode_secure_link_data()

sl_status_t sl_wfx_host_decode_secure_link_data ( uint8_t *  buffer,
uint32_t  length,
uint8_t *  session_key 
)

Decode a packet.

Parameters
bufferis the pointer to the encrypted part of the packet
lengthis the length of the encrypted part
session_keyis the pointer to the context session key
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise

◆ sl_wfx_host_deinit()

sl_status_t sl_wfx_host_deinit ( void  )

Driver hook to deinitialize the host resources.

Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
Note
Called if an error occurs during the initialization phase

Referenced by sl_wfx_download_run_firmware().

◆ sl_wfx_host_deinit_bus()

sl_status_t sl_wfx_host_deinit_bus ( void  )

Deinitialize the host bus.

Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
Note
Called if an error occurs during the initialization phase

◆ sl_wfx_host_disable_platform_interrupt()

sl_status_t sl_wfx_host_disable_platform_interrupt ( void  )

Disable the bus interrupt.

Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise

◆ sl_wfx_host_enable_platform_interrupt()

sl_status_t sl_wfx_host_enable_platform_interrupt ( void  )

Enable the bus interrupt.

Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise

Referenced by sl_wfx_enable_irq().

◆ sl_wfx_host_encode_secure_link_data()

sl_status_t sl_wfx_host_encode_secure_link_data ( sl_wfx_generic_message_t buffer,
uint32_t  data_length,
uint8_t *  session_key,
uint8_t *  nonce 
)

Encode a packet.

Parameters
bufferis the pointer to the message that will be encrypted
data_lengthis the length of the payload to be encrypted
session_keyis the pointer to context session key
nonceis the pointer to the encryption nonce
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise

◆ sl_wfx_host_free_buffer()

sl_status_t sl_wfx_host_free_buffer ( void *  buffer,
sl_wfx_buffer_type_t  type 
)

Called when the driver wants to free memory.

Parameters
bufferis the pointer to the memory to free
typeis the type of buffer to free (see sl_wfx_buffer_type_t)
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise

Referenced by sl_wfx_free_command_buffer().

◆ sl_wfx_host_free_crypto_context()

sl_status_t sl_wfx_host_free_crypto_context ( void  )

Free any crypto context.

Returns
Always returns SL_STATUS_OK

◆ sl_wfx_host_get_firmware_data()

sl_status_t sl_wfx_host_get_firmware_data ( const uint8_t **  data,
uint32_t  data_size 
)

Driver hook to retrieve a firmware chunk.

Parameters
datais a pointer to the firmware data
data_sizeis the size of data requested by the driver
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
Note
Called multiple times during the driver initialization phase

Referenced by sl_wfx_download_run_firmware().

◆ sl_wfx_host_get_firmware_size()

sl_status_t sl_wfx_host_get_firmware_size ( uint32_t *  firmware_size)

Driver hook to retrieve the firmware size.

Parameters
firmware_sizeis a pointer to the firmware size value
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
Note
Called once during the driver initialization phase

Referenced by sl_wfx_download_run_firmware().

◆ sl_wfx_host_get_pds_data()

sl_status_t sl_wfx_host_get_pds_data ( const char **  pds_data,
uint16_t  index 
)

Driver hook to retrieve a PDS line.

Parameters
pds_datais a pointer to the PDS data
indexis the index of the line requested by the driver
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
Note
Called multiple times during the driver initialization phase

◆ sl_wfx_host_get_pds_size()

sl_status_t sl_wfx_host_get_pds_size ( uint16_t *  pds_size)

Driver hook to get the number of lines of the PDS.

Parameters
pds_sizeis a pointer to the PDS size value
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
Note
Called once during the driver initialization phase

◆ sl_wfx_host_get_secure_link_mac_key()

sl_status_t sl_wfx_host_get_secure_link_mac_key ( uint8_t *  sl_mac_key)

Get the secure link mac key of the part.

Parameters
sl_mac_keyis the pointer to the sl_wfx_context key in which the key must be copied.
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_WIFI_SECURE_LINK_MAC_KEY_ERROR otherwise

◆ sl_wfx_host_hold_in_reset()

sl_status_t sl_wfx_host_hold_in_reset ( void  )

Hold the WFx chip in reset mode.

Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
Note
The reset pin is asserted by the host to keep the WFx chip in reset

◆ sl_wfx_host_init()

sl_status_t sl_wfx_host_init ( void  )

Driver hook to initialize the host resources.

Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
Note
Called once during the driver initialization phase

Referenced by sl_wfx_download_run_firmware().

◆ sl_wfx_host_init_bus()

sl_status_t sl_wfx_host_init_bus ( void  )

Initialize the host bus.

Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
Note
Called once during the driver initialization phase

◆ sl_wfx_host_lock()

sl_status_t sl_wfx_host_lock ( void  )

Called when the driver needs to lock its access.

Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise

Referenced by sl_wfx_send_request().

◆ sl_wfx_host_log()

void sl_wfx_host_log ( const char *  string,
  ... 
)

Log information about the driver.

Parameters
stringis a string to display
anynumber of arguments

Referenced by sl_wfx_download_run_firmware(), and sl_wfx_get_status_code().

◆ sl_wfx_host_post_event()

sl_status_t sl_wfx_host_post_event ( sl_wfx_generic_message_t event_payload)

Called when a message is received from the WFx chip.

Parameters
event_payloadis a pointer to the data received
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
Note
Called by sl_wfx_receive_frame function

◆ sl_wfx_host_reset_chip()

sl_status_t sl_wfx_host_reset_chip ( void  )

Implement the reset of the WFx chip.

Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
Note
This function asserts the reset pin of the WFx chip for a while before returning

◆ sl_wfx_host_schedule_secure_link_renegotiation()

sl_status_t sl_wfx_host_schedule_secure_link_renegotiation ( void  )

Schedule a session key renegotiation.

Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise

◆ sl_wfx_host_sdio_enable_high_speed_mode()

sl_status_t sl_wfx_host_sdio_enable_high_speed_mode ( void  )

Enable the SDIO high-speed mode.

Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise

◆ sl_wfx_host_sdio_transfer_cmd52()

sl_status_t sl_wfx_host_sdio_transfer_cmd52 ( sl_wfx_host_bus_transfer_type_t  type,
uint8_t  function,
uint32_t  address,
uint8_t *  buffer 
)

Send command 52 on the SDIO bus.

Parameters
typeis the type of bus action (see sl_wfx_host_bus_transfer_type_t)
functionis the function to use in the SDIO command
addressis the address to use in the SDIO command
bufferis a pointer to the buffer data
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise

◆ sl_wfx_host_sdio_transfer_cmd53()

sl_status_t sl_wfx_host_sdio_transfer_cmd53 ( sl_wfx_host_bus_transfer_type_t  type,
uint8_t  function,
uint32_t  address,
uint8_t *  buffer,
uint16_t  buffer_length 
)

Send command 53 on the SDIO bus.

Parameters
typeis the type of bus action (see sl_wfx_host_bus_transfer_type_t)
functionis the function to use in the SDIO command
addressis the address to use in the SDIO command
bufferis a pointer to the buffer data
buffer_lengthis the length of the buffer data
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise

◆ sl_wfx_host_set_wake_up_pin()

sl_status_t sl_wfx_host_set_wake_up_pin ( uint8_t  state)

Drive the wake up pin in the requested state.

Parameters
stateto be applied to the wake up pin
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
Note
Called if the sleep mode is enabled

◆ sl_wfx_host_setup_waited_event()

sl_status_t sl_wfx_host_setup_waited_event ( uint8_t  event_id)

Set up the next event that the driver will wait.

Parameters
event_idis the ID to be waited
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
Note
Called every time a API command is called

◆ sl_wfx_host_sleep_grant()

sl_status_t sl_wfx_host_sleep_grant ( sl_wfx_host_bus_transfer_type_t  type,
sl_wfx_register_address_t  address,
uint32_t  length 
)

Called when the driver is considering putting the WFx in sleep mode.

Parameters
typeis the type of the message sent
addressis the address of the message sent
lengthis the length of the message to be sent
Returns
Returns SL_STATUS_WIFI_SLEEP_GRANTED to let the WFx go to sleep, SL_STATUS_WIFI_SLEEP_NOT_GRANTED otherwise
Note
The parameters are given as information for the host to take a decision on whether or not the WFx is put back to sleep mode.

◆ sl_wfx_host_spi_cs_assert()

sl_status_t sl_wfx_host_spi_cs_assert ( void  )

Assert the SPI Chip Select pin.

Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise

◆ sl_wfx_host_spi_cs_deassert()

sl_status_t sl_wfx_host_spi_cs_deassert ( void  )

Deassert the SPI Chip Select pin.

Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise

◆ sl_wfx_host_spi_transfer_no_cs_assert()

sl_status_t sl_wfx_host_spi_transfer_no_cs_assert ( sl_wfx_host_bus_transfer_type_t  type,
uint8_t *  header,
uint16_t  header_length,
uint8_t *  buffer,
uint16_t  buffer_length 
)

Send data on the SPI bus.

Parameters
typeis the type of bus action (see sl_wfx_host_bus_transfer_type_t)
headeris a pointer to the header data
header_lengthis the length of the header data
bufferis a pointer to the buffer data
buffer_lengthis the length of the buffer data
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise

◆ sl_wfx_host_transmit_frame()

sl_status_t sl_wfx_host_transmit_frame ( void *  frame,
uint32_t  frame_len 
)

Called when the driver sends a frame to the WFx chip.

Parameters
frameis a pointer to the frame data
frame_lenis size of the frame
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise

◆ sl_wfx_host_unlock()

sl_status_t sl_wfx_host_unlock ( void  )

Called when the driver needs to unlock its access.

Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise

◆ sl_wfx_host_verify_pub_key()

sl_status_t sl_wfx_host_verify_pub_key ( sl_wfx_securelink_exchange_pub_keys_ind_t *  response_packet,
const uint8_t *  sl_mac_key,
uint8_t *  sl_host_pub_key 
)

Verify the WFX hashed public key.

Parameters
response_packetis a pointer to the SL_WFX_SECURELINK_EXCHANGE_PUB_KEYS_IND returned by the WFX.
sl_mac_keyis a pointer to the context mac key
sl_host_pub_keyis a pointer the the host public key
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise

◆ sl_wfx_host_wait()

sl_status_t sl_wfx_host_wait ( uint32_t  wait_ms)

Called when the FMAC driver wants to add a delay.

Parameters
wait_msis the time to wait
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
Note
Can be a passive wait or in a RTOS context a task sleep

Referenced by sl_wfx_poll_for_value().

◆ sl_wfx_host_wait_for_confirmation()

sl_status_t sl_wfx_host_wait_for_confirmation ( uint8_t  confirmation_id,
uint32_t  timeout_ms,
void **  event_payload_out 
)

Called when the driver is waiting for a confirmation.

Parameters
confirmation_idis the ID to be waited
timeout_msis the time before the command times out
event_payload_outis a pointer to the data returned by the confirmation
Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
Note
Called every time a API command is called

◆ sl_wfx_host_wait_for_wake_up()

sl_status_t sl_wfx_host_wait_for_wake_up ( void  )

Called once the WFx chip is waking up.

Returns
Returns SL_STATUS_OK if successful, SL_STATUS_FAIL otherwise
Note
Called if the sleep mode is enabled. The function waits for the WFx interruption