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_tranfer_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_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_tranfer_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_tranfer_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_tranfer_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)
Verify the WFX hashed public key.
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.

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
buffer is a pointer to the data
type is the type of buffer to allocate (see sl_wfx_buffer_type_t )
buffer_size represents the amount of memory to allocate
Returns
Returns SL_SUCCESS if successful, SL_ERROR 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
request is a pointer to the SL_WFX_SECURELINK_EXCHANGE_PUB_KEYS_REQ body.
sl_mac_key is a pointer to the context mac key
Returns
Returns SL_SUCCESS if successful, SL_ERROR 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
buffer is the pointer to the encrypted part of the packet
length is the length of the encrypted part
session_key is the pointer to the context session key
Returns
Returns SL_SUCCESS if successful, SL_ERROR otherwise

sl_wfx_host_deinit()

sl_status_t sl_wfx_host_deinit ( void )

Driver hook to deinitialize the host resources.

Returns
Returns SL_SUCCESS if successful, SL_ERROR 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_SUCCESS if successful, SL_ERROR 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_SUCCESS if successful, SL_ERROR otherwise

sl_wfx_host_enable_platform_interrupt()

sl_status_t sl_wfx_host_enable_platform_interrupt ( void )

Enable the bus interrupt.

Returns
Returns SL_SUCCESS if successful, SL_ERROR 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
buffer is the pointer to the message that will be encrypted
data_length is the length of the payload to be encrypted
session_key is the pointer to context session key
nonce is the pointer to the encryption nonce
Returns
Returns SL_SUCCESS if successful, SL_ERROR 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
buffer is the pointer to the memory to free
type is the type of buffer to free (see sl_wfx_buffer_type_t )
Returns
Returns SL_SUCCESS if successful, SL_ERROR otherwise

Referenced by sl_wfx_free_command_buffer() .

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
data is a pointer to the firmware data
data_size is the size of data requested by the driver
Returns
Returns SL_SUCCESS if successful, SL_ERROR 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_size is a pointer to the firmware size value
Returns
Returns SL_SUCCESS if successful, SL_ERROR 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_data is a pointer to the PDS data
index is the index of the line requested by the driver
Returns
Returns SL_SUCCESS if successful, SL_ERROR 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_size is a pointer to the PDS size value
Returns
Returns SL_SUCCESS if successful, SL_ERROR 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_key is the pointer to the sl_wfx_context key in which the key must be copied.
Returns
Returns SL_SUCCESS if successful, SL_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_SUCCESS if successful, SL_ERROR 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_SUCCESS if successful, SL_ERROR 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_SUCCESS if successful, SL_ERROR otherwise
Note
Called once during the driver initialization phase

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_payload is a pointer to the data received
Returns
Returns SL_SUCCESS if successful, SL_ERROR 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_SUCCESS if successful, SL_ERROR 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_SUCCESS if successful, SL_ERROR 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_SUCCESS if successful, SL_ERROR otherwise

sl_wfx_host_sdio_transfer_cmd52()

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

Send command 52 on the SDIO bus.

Parameters
type is the type of bus action (see sl_wfx_host_bus_tranfer_type_t )
function is the function to use in the SDIO command
address is the address to use in the SDIO command
buffer is a pointer to the buffer data
Returns
Returns SL_SUCCESS if successful, SL_ERROR otherwise

sl_wfx_host_sdio_transfer_cmd53()

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

Send command 53 on the SDIO bus.

Parameters
type is the type of bus action (see sl_wfx_host_bus_tranfer_type_t )
function is the function to use in the SDIO command
address is the address to use in the SDIO command
buffer is a pointer to the buffer data
buffer_length is the length of the buffer data
Returns
Returns SL_SUCCESS if successful, SL_ERROR 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
state to be applied to the wake up pin
Returns
Returns SL_SUCCESS if successful, SL_ERROR 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_id is the ID to be waited
Returns
Returns SL_SUCCESS if successful, SL_ERROR 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_tranfer_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
type is the type of the message sent
address is the address of the message sent
length is the length of the message to be sent
Returns
Returns SL_WIFI_SLEEP_GRANTED to let the WFx go to sleep, SL_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_SUCCESS if successful, SL_ERROR 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_SUCCESS if successful, SL_ERROR otherwise

sl_wfx_host_spi_transfer_no_cs_assert()

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

Send data on the SPI bus.

Parameters
type is the type of bus action (see sl_wfx_host_bus_tranfer_type_t )
header is a pointer to the header data
header_length is the length of the header data
buffer is a pointer to the buffer data
buffer_length is the length of the buffer data
Returns
Returns SL_SUCCESS if successful, SL_ERROR 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
frame is a pointer to the frame data
frame_len is size of the frame
Returns
Returns SL_SUCCESS if successful, SL_ERROR 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
)

Verify the WFX hashed public key.

Parameters
response_packet is a pointer to the SL_WFX_SECURELINK_EXCHANGE_PUB_KEYS_IND returned by the WFX.
sl_mac_key is a pointer to the context mac key
Returns
Returns SL_SUCCESS if successful, SL_ERROR 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_ms is the time to wait
Returns
Returns SL_SUCCESS if successful, SL_ERROR 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_id is the ID to be waited
timeout_ms is the time before the command times out
event_payload_out is a pointer to the data returned by the confirmation
Returns
Returns SL_SUCCESS if successful, SL_ERROR 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_SUCCESS if successful, SL_ERROR otherwise
Note
Called if the sleep mode is enabled. The function waits for the WFx interruption