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_get_pds_size(uint16_t *pds_size)
Driver hook to get the number of lines of the PDS.
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_deinit(void)
Driver hook to deinitialize the host resources.
sl_status_t sl_wfx_host_init(void)
Driver hook to initialize the host resources.
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_firmware_data(const uint8_t **data, uint32_t data_size)
Driver hook to retrieve a firmware chunk.
The host also needs to provide GPIO access to the FMAC driver.
uint32_t length);
sl_wfx_register_address_t
Enum listing the registers of the WFx solution.
Definition:
sl_wfx_constants.h:251
sl_wfx_host_bus_transfer_type_t
Enumerates the different types of bus transfers.
Definition:
sl_wfx_constants.h:324
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_set_wake_up_pin(uint8_t state)
Drive the wake up pin in the requested state.
sl_status_t sl_wfx_host_reset_chip(void)
Implement the reset of the WFx chip.
sl_status_t sl_wfx_host_hold_in_reset(void)
Hold the WFx chip in reset mode.
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)
Called when the driver sends a frame to the WFx chip.
In addition, several functions serve to manage the confirmations and indications coming from WFx.
void
**event_payload_out);
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.
Generic message structure for all requests, confirmations and indications.
Definition:
sl_wfx_general_api.h:124
sl_wfx_frame_type_t
Type of frame to be sent.
Definition:
sl_wfx_cmd_api.h:241
These functions allocate or free memory.
uint32_t buffer_size,
uint32_t wait_duration_ms);
sl_wfx_buffer_type_t
Enumerates the different types of buffer.
Definition:
sl_wfx_constants.h:314
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.
These functions are used to manage bus access.
sl_status_t sl_wfx_host_unlock(void)
Called when the driver needs to unlock its access.
sl_status_t sl_wfx_host_lock(void)
Called when the driver needs to lock its access.
These functions support the chosen communication bus.
uint8_t *header,
uint16_t header_length,
uint8_t *buffer,
uint16_t buffer_length);
uint8_t
function
,
uint32_t address,
uint8_t *buffer);
uint8_t
function
,
uint32_t address,
uint8_t *buffer,
uint16_t buffer_length);
sl_status_t sl_wfx_host_disable_platform_interrupt(void)
Disable the bus interrupt.
sl_status_t sl_wfx_host_enable_platform_interrupt(void)
Enable the bus interrupt.
sl_status_t sl_wfx_host_init_bus(void)
Initialize the host 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_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_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_deinit_bus(void)
Deinitialize the host bus.
sl_status_t sl_wfx_host_spi_cs_assert(void)
Assert the SPI Chip Select pin.
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_spi_cs_deassert(void)
Deassert the SPI Chip Select pin.
The following function is used to log debug info. Active only if SL_WFX_DEBUG_MASK is not null.
void sl_wfx_host_log(const char *string,...)
Log information about the driver.
These functions support SecureLink. Active only if SL_CATALOG_WFX_SECURE_LINK_PRESENT is defined.
const
uint8_t *sl_mac_key);
const
uint8_t *sl_mac_key,
uint8_t *sl_host_pub_key);
uint32_t length,
uint8_t *session_key);
uint32_t data_length,
uint8_t *session_key,
uint8_t *nonce);
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_free_crypto_context(void)
Free any crypto context.
sl_status_t sl_wfx_host_schedule_secure_link_renegotiation(void)
Schedule a session key renegotiation.
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_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_decode_secure_link_data(uint8_t *buffer, uint32_t length, uint8_t *session_key)
Decode a packet.
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.
Exchange Secure Link Public Keys.
Definition:
sl_wfx_general_api.h:610