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);

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);

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);
/* 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);