1# WiFi Host Driver Board Support Package Integration 2 3## Overview 4 5This library provides some convenience functions for connecting the WiFi Host Driver (WHD) library to a Board Support Package (BSP) that includes a WLAN chip. This library initializes the hardware and passes a reference to the communication interface on the board into WHD. It also sets up the LwIP or NetXDuo based network buffers to be used for sending packets back and forth. 6 7The BSP is expected to set a component indicating what communication interface to use to relay information between the MCU and the WIFI chip. The legal options are restricted based on what MCU and WIFI chips are being used. The selected interface must be supported by both sides. The legal component values are one of: 8* WIFI_INTERFACE_SDIO 9* WIFI_INTERFACE_SPI 10* WIFI_INTERFACE_M2M 11 12Some additional customization of the library is possible by setting defines when building the library. If no custom value is provided, the library will pick a reasonable default value. The following options are available for customization: 13* CY_WIFI_COUNTRY: Defines the country this will operate in for wifi initialization parameters. See the wifi-host-driver's whd_country_code_t for legal options. 14* CY_WIFI_THREAD_STACK_SIZE: Defines the amount of stack memory available for the wifi thread. 15* CY_WIFI_THREAD_PRIORITY: Defines the priority of the thread that services wifi packets. Legal values are defined by the RTOS being used. 16* CY_WIFI_HOST_WAKE_SW_FORCE: Defines whether to use the out-of-band pin to allow the WIFI chip to wake up the MCU. 17* CY_WIFI_OOB_INTR_PRIORITY: Defines the priority of the interrupt that handles out-of-band notifications from the WIFI chip. Legal values are defined by the MCU running this code. 18 19 20## Getting Started 21 22To use this library: 231. Implement the cy_network_process_ethernet_data() function. This should be something similar to the example below. 24```cpp 25/* This needs to be the same item as passed to netifapi_netif_add() */ 26static struct netif *default_interface = NULL; 27 28void cy_network_process_ethernet_data(whd_interface_t iface, whd_buffer_t buf) 29{ 30 if (default_interface != NULL) 31 { 32 if (default_interface->input(buf, default_interface) != ERR_OK) 33 cy_buffer_release(buf, WHD_NETWORK_RX); 34 } 35 else 36 { 37 cy_buffer_release(buf, WHD_NETWORK_RX); 38 } 39} 40``` 412. Include a reference to `cybsp_wifi.h`. 423. Call cybsp_wifi_init_primary() to initialize the interface. This needs to be done after having called cybsp_init(). 43 44## Features 45 46* APIs for setting up the WHD interface with the BSP's SDIO/SPI/M2M interface. 47 * Initialize a primary WiFi interface 48 * Optionally initialize a secondary WiFi interface 49 * Cleanup interfaces 50* APIs for connecting WHD to LwIP/NetXDuo memory buffers (whd_buffer_funcs_t) 51* Framework for connecting WHD to LwIP/NetXDuo network interface (whd_netif_funcs_t) 52 53## More information 54* [API Reference Guide](https://infineon.github.io/whd-bsp-integration/html/modules.html) 55* [Cypress Semiconductor, an Infineon Technologies Company](http://www.cypress.com) 56* [Infineon GitHub](https://github.com/infineon) 57* [ModusToolbox™](https://www.cypress.com/products/modustoolbox-software-environment) 58 59--- 60© Cypress Semiconductor Corporation (an Infineon company) or an affiliate of Cypress Semiconductor Corporation, 2019-2022. 61