Host API

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

The first set of functions is responsible for the initialization of the host and retrieving 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);
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);

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_status_t sl_wfx_host_post_event(sl_wfx_frame_type_t frame_type,
sl_wfx_generic_message_t *event_payload);

These functions allocate or free memory.

sl_status_t sl_wfx_host_allocate_buffer(void **buffer,
sl_wfx_buffer_type_t type,
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);

The last set of required functions are supporting 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);
sl_status_t sl_wfx_host_enable_platform_interrupt(void);
sl_status_t sl_wfx_host_disable_platform_interrupt(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);
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);
/* WF200 host SDIO bus API */
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);
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);
sl_status_t sl_wfx_host_sdio_enable_high_speed_mode(void);