WiFi Initialization

group group_bsp_wifi

Basic integration code for interfacing the WiFi Host Driver (WHD) with the Board Support Packages (BSPs).

Defines

CYBSP_RSLT_WIFI_INIT_FAILED

Initialization of the WiFi driver failed.

CYBSP_RSLT_WIFI_SDIO_ENUM_TIMEOUT

SDIO enumeration failed.

Functions

cy_rslt_t cybsp_wifi_init_primary_extended(whd_interface_t *interface, whd_resource_source_t *resource_if, whd_buffer_funcs_t *buffer_if, whd_netif_funcs_t *netif_if)

Initializes the primary interface for the WiFi driver on the board.

This sets up the WHD interface to use the Buffer management APIs and to communicate over the SDIO interface on the board. This function does the following:

1) Initializes the WiFi driver.

2) Turns on the WiFi chip.

note

This function cannot be called multiple times. If the interface needs to be reinitialized, cybsp_wifi_deinit must be called before calling this function again.

Return

CY_RSLT_SUCCESS for successful initialization or error if initialization failed.

Parameters
  • [out] interface: Interface to be initialized

  • [in] resource_if: Pointer to resource interface to provide resources to the driver initialization process. Passing NULL will use the default.

  • [in] buffer_if: Pointer to a buffer interface to provide buffer related services to the driver instance. Passing NULL will use the default.

  • [in] netif_if: Pointer to a whd_netif_funcs_t to provide network stack services to the driver instance. Passing NULL will use the default.

static inline cy_rslt_t cybsp_wifi_init_primary(whd_interface_t *interface)

Initializes the primary interface for the WiFi driver on the board using the default resource, buffer, and network interfaces.

See cybsp_wifi_init_primary_extended() for more details.

Return

CY_RSLT_SUCCESS for successful initialization or error if initialization failed.

Parameters
  • [out] interface: Interface to be initialized

cy_rslt_t cybsp_wifi_init_secondary(whd_interface_t *interface, whd_mac_t *mac_address)

This function initializes and adds a secondary interface to the WiFi driver.

note

This function does not initialize the WiFi driver or turn on the WiFi chip. That is required to be done by first calling cybsp_wifi_init_primary.

Return

CY_RSLT_SUCCESS for successful initialization or error if initialization failed.

Parameters
  • [out] interface: Interface to be initialized

  • [in] mac_address: Mac address for secondary interface

cy_rslt_t cybsp_wifi_deinit(whd_interface_t interface)

De-initializes all WiFi interfaces and the WiFi driver.

This function does the following:

1) Deinitializes all WiFi interfaces and WiFi driver.

2) Turns off the WiFi chip.

Return

CY_RSLT_SUCCESS for successful de-initialization or error if de-initialization failed.

Parameters
  • [in] interface: Interface to be de-initialized.

whd_driver_t cybsp_get_wifi_driver(void)

Gets the wifi driver instance initialized by the driver.

This should only be called after being initialized by cybsp_wifi_init_primary() and before being deinitialized by cybsp_wifi_deinit(). This is also the only time where the driver reference is valid.

Return

Wifi driver instance pointer.