Host API

The host has to implement a set of functions to enable the driver to access multiple resources (Firmware, GPIOs, memory, buses, and so on). The implementation of these functions is dependent on the platform and type of operating system used. The list of functions required to be implemented by the host are located in sl_wfx_host_api.h. For each function, you can find additional information in their Doxygen header or in the HOST_API group.

The first set of functions initializes the host and retrieves the firmware information and the PDS information.

sl_status_t sl_wfx_host_init(void);
sl_status_t sl_wfx_host_get_firmware_data(const uint8_t **data, uint32_t data_size);
sl_status_t sl_wfx_host_get_firmware_size(uint32_t *firmware_size);
sl_status_t sl_wfx_host_get_pds_data(const char **pds_data, uint16_t index);
sl_status_t sl_wfx_host_get_pds_size(uint16_t *pds_size);
sl_status_t sl_wfx_host_deinit(void);

The host also needs to provide GPIO access to the FMAC driver.

sl_status_t sl_wfx_host_reset_chip(void);
sl_status_t sl_wfx_host_set_wake_up_pin(uint8_t state);
sl_status_t sl_wfx_host_wait_for_wake_up(void);
sl_status_t sl_wfx_host_hold_in_reset(void);
uint32_t length);

The following function is used to transmit a message to the WFx chip.

sl_status_t sl_wfx_host_transmit_frame(void *frame, uint32_t frame_len);

In addition, several functions serve to manage the confirmations and indications coming from WFx.

sl_status_t sl_wfx_host_wait_for_confirmation(uint32_t timeout_ms,
void **event_payload_out);
sl_status_t sl_wfx_host_wait(uint32_t wait_ms);
sl_wfx_generic_message_t *event_payload);

These functions allocate or free memory.

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

These functions are used to manage bus access.

sl_status_t sl_wfx_host_lock(void);
sl_status_t sl_wfx_host_unlock(void);

These functions support the chosen communication bus.

/* WF200 host bus API */
sl_status_t sl_wfx_host_init_bus(void);
sl_status_t sl_wfx_host_deinit_bus(void);
/* WF200 host SPI bus API */
sl_status_t sl_wfx_host_spi_cs_assert(void);
sl_status_t sl_wfx_host_spi_cs_deassert(void);
uint8_t *header,
uint16_t header_length,
uint8_t *buffer,
uint16_t buffer_length);
/* WF200 host SDIO bus API */
uint8_t function,
uint32_t address,
uint8_t *buffer);
uint8_t function,
uint32_t address,
uint8_t *buffer,
uint16_t buffer_length);

The following function is used to log debug info. Active only if SL_WFX_DEBUG_MASK is not null.

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

These functions support SecureLink. Active only if SL_WFX_USE_SECURE_LINK is defined.

sl_status_t sl_wfx_host_get_secure_link_mac_key(uint8_t *sl_mac_key);
const uint8_t *sl_mac_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);
sl_status_t sl_wfx_host_decode_secure_link_data(uint8_t *buffer,
uint32_t length,
uint8_t *session_key);
uint32_t data_length,
uint8_t *session_key,
uint8_t *nonce);