diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062S2_43012/cybsp.c b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062S2_43012/cybsp.c
index d3c0a8629f..4bd9370200 100644
--- a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062S2_43012/cybsp.c
+++ b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062S2_43012/cybsp.c
@@ -40,28 +40,42 @@ cy_rslt_t cybsp_init(void)
init_cycfg_system();
#ifndef __MBED__
- /* Initialize User LEDs */
- result |= cybsp_led_init(CYBSP_USER_LED1);
- result |= cybsp_led_init(CYBSP_USER_LED2);
- result |= cybsp_led_init(CYBSP_USER_LED3);
- result |= cybsp_led_init(CYBSP_USER_LED4);
- result |= cybsp_led_init(CYBSP_USER_LED5);
- /* Initialize User Buttons */
- result |= cybsp_btn_init(CYBSP_USER_BTN1);
- result |= cybsp_btn_init(CYBSP_USER_BTN2);
-
- CY_ASSERT(CY_RSLT_SUCCESS == result);
-
- /* Initialize retargetting stdio to 'DEBUG_UART' peripheral */
if (CY_RSLT_SUCCESS == result)
{
- result = cybsp_retarget_init();
+ /* Initialize User LEDs */
+ result |= cybsp_led_init(CYBSP_USER_LED1);
+ result |= cybsp_led_init(CYBSP_USER_LED2);
+ result |= cybsp_led_init(CYBSP_USER_LED3);
+ result |= cybsp_led_init(CYBSP_USER_LED4);
+ result |= cybsp_led_init(CYBSP_USER_LED5);
+ /* Initialize User Buttons */
+ result |= cybsp_btn_init(CYBSP_USER_BTN1);
+ result |= cybsp_btn_init(CYBSP_USER_BTN2);
+
+ CY_ASSERT(CY_RSLT_SUCCESS == result);
+
+ /* Initialize retargetting stdio to 'DEBUG_UART' peripheral */
+ if (CY_RSLT_SUCCESS == result)
+ {
+ result = cybsp_retarget_init();
+ }
+ }
+#endif
+
+#if defined(CYBSP_WIFI_CAPABLE)
+ /* Initialize SDIO interface.
+ NOTE: The full WiFi interface still needs to be initialized via cybsp_wifi_init_primary(). This is typically done
+ when starting up WiFi. */
+ if (CY_RSLT_SUCCESS == result)
+ {
+ result = cybsp_wifi_sdio_init();
}
#endif
return result;
}
+
#if defined(__cplusplus)
}
#endif
diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062S2_43012/cybsp.h b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062S2_43012/cybsp.h
index a6ed49dde9..70e4fd7b9f 100644
--- a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062S2_43012/cybsp.h
+++ b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062S2_43012/cybsp.h
@@ -55,9 +55,10 @@
#pragma once
#include "cybsp_api_core.h"
-#ifdef __MBED__
-#include "cybsp_api_wifi.h"
-#else
+#if defined(CYBSP_WIFI_CAPABLE)
+#include "cybsp_wifi_sdio.h"
+#endif
+#ifndef __MBED__
#include "cybsp_retarget.h"
#include "cybsp_serial_flash.h"
#endif /* __MBED__ */
diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_BLE/cybsp.c b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_BLE/cybsp.c
index 25bad541fe..a95ebd5512 100644
--- a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_BLE/cybsp.c
+++ b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_BLE/cybsp.c
@@ -38,24 +38,25 @@ cy_rslt_t cybsp_init(void)
cy_rslt_t result = CY_RSLT_SUCCESS;
+
#ifndef __MBED__
- /* Initialize User LEDs */
- result |= cybsp_led_init(CYBSP_USER_LED1);
- result |= cybsp_led_init(CYBSP_USER_LED2);
- result |= cybsp_led_init(CYBSP_USER_LED3);
- result |= cybsp_led_init(CYBSP_USER_LED4);
- result |= cybsp_led_init(CYBSP_USER_LED5);
- /* Initialize User Buttons */
- result |= cybsp_btn_init(CYBSP_USER_BTN1);
-
- CY_ASSERT(CY_RSLT_SUCCESS == result);
-#endif
-
-#if defined(CYBSP_RETARGET_ENABLED)
- /* Initialize retargetting stdio to 'DEBUG_UART' peripheral */
if (CY_RSLT_SUCCESS == result)
{
- result = cybsp_retarget_init();
+ /* Initialize User LEDs */
+ result |= cybsp_led_init(CYBSP_USER_LED1);
+ result |= cybsp_led_init(CYBSP_USER_LED2);
+ result |= cybsp_led_init(CYBSP_USER_LED3);
+ result |= cybsp_led_init(CYBSP_USER_LED4);
+ result |= cybsp_led_init(CYBSP_USER_LED5);
+ /* Initialize User Buttons */
+ result |= cybsp_btn_init(CYBSP_USER_BTN1);
+ CY_ASSERT(CY_RSLT_SUCCESS == result);
+
+ /* Initialize retargetting stdio to 'DEBUG_UART' peripheral */
+ if (CY_RSLT_SUCCESS == result)
+ {
+ result = cybsp_retarget_init();
+ }
}
#endif
diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_WIFI_BT/cybsp.c b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_WIFI_BT/cybsp.c
index fd72d57fb8..6a16ee7712 100644
--- a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_WIFI_BT/cybsp.c
+++ b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_WIFI_BT/cybsp.c
@@ -40,34 +40,34 @@ cy_rslt_t cybsp_init(void)
cy_rslt_t result = CY_RSLT_SUCCESS;
#ifndef __MBED__
- /* Initialize User LEDs */
- result |= cybsp_led_init(CYBSP_USER_LED1);
- result |= cybsp_led_init(CYBSP_USER_LED2);
- result |= cybsp_led_init(CYBSP_USER_LED3);
- result |= cybsp_led_init(CYBSP_USER_LED4);
- result |= cybsp_led_init(CYBSP_USER_LED5);
- /* Initialize User Buttons */
- result |= cybsp_btn_init(CYBSP_USER_BTN1);
+ if (CY_RSLT_SUCCESS == result)
+ {
+ /* Initialize User LEDs */
+ result |= cybsp_led_init(CYBSP_USER_LED1);
+ result |= cybsp_led_init(CYBSP_USER_LED2);
+ result |= cybsp_led_init(CYBSP_USER_LED3);
+ result |= cybsp_led_init(CYBSP_USER_LED4);
+ result |= cybsp_led_init(CYBSP_USER_LED5);
+ /* Initialize User Buttons */
+ result |= cybsp_btn_init(CYBSP_USER_BTN1);
+ CY_ASSERT(CY_RSLT_SUCCESS == result);
- CY_ASSERT(CY_RSLT_SUCCESS == result);
+ /* Initialize retargetting stdio to 'DEBUG_UART' peripheral */
+ if (CY_RSLT_SUCCESS == result)
+ {
+ result = cybsp_retarget_init();
+ }
+ }
#endif
#if defined(CYBSP_WIFI_CAPABLE)
/* Initialize UDB SDIO interface. This must be done before any other HAL API attempts to allocate clocks or DMA
instances. The UDB SDIO interface uses specific instances which are reserved as part of this call.
- NOTE: The full WiFi interface still needs to be initialized via cybsp_wifi_init(). This is typically done
+ NOTE: The full WiFi interface still needs to be initialized via cybsp_wifi_init_primary(). This is typically done
when starting up WiFi. */
if (CY_RSLT_SUCCESS == result)
{
- result = cybsp_sdio_init();
- }
-#endif
-
-#if defined(CYBSP_RETARGET_ENABLED)
- /* Initialize retargetting stdio to 'DEBUG_UART' peripheral */
- if (CY_RSLT_SUCCESS == result)
- {
- result = cybsp_retarget_init();
+ result = cybsp_wifi_sdio_init();
}
#endif
diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_WIFI_BT/cybsp.h b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_WIFI_BT/cybsp.h
index 7d3b8d2e0b..3074116e09 100644
--- a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_WIFI_BT/cybsp.h
+++ b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_WIFI_BT/cybsp.h
@@ -23,40 +23,12 @@
* limitations under the License.
*******************************************************************************/
-/**
-* \addtogroup group_bsp_cy8ckit_062_wifi_bt CY8CKIT-062-WIFI-BT
-* \ingroup group_bsp
-* \{
-* The PSoC 6 WiFi-BT Pioneer Kit is a low-cost hardware platform
-* that enables design and debug of the PSoC 62 MCU (CY8C6247BZI-D54)
-* and the Murata LBEE5KL1DX Module (CYW4343W WiFi + Bluetooth Combo Chip).
-*
-*
Kit Features:
-*
-* - BLE v5.0
-* - Serial memory interface
-* - PDM-PCM digital microphone interface
-* - Industry-leading CapSense
-*
-*
-* Kit Contents:
-*
-* - CY8CKIT-062-WIFI-BT evaluation board
-* - TFT display shield with a 2.4" TFT display, light sensor, 6-axis motion sensor, and digital microphone
-* - USB cable
-*
-*
-* \defgroup group_bsp_cy8ckit_062_wifi_bt_macros Macros
-* \defgroup group_bsp_cy8ckit_062_wifi_bt_functions Functions
-* \defgroup group_bsp_cy8ckit_062_wifi_bt_enums Enumerated Types
-*/
-
#pragma once
#include "cybsp_api_core.h"
-#ifdef MBED
-#include "cybsp_api_wifi.h"
-#endif /* MBED */
+#if defined(CYBSP_WIFI_CAPABLE)
+#include "cybsp_wifi_sdio.h"
+#endif
#if defined(__cplusplus)
extern "C" {
diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CMOD_062_4343W/TARGET_CY8CPROTO_062_4343W/cybsp.c b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CMOD_062_4343W/TARGET_CY8CPROTO_062_4343W/cybsp.c
index 558042cd56..ee7669cdb3 100644
--- a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CMOD_062_4343W/TARGET_CY8CPROTO_062_4343W/cybsp.c
+++ b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CMOD_062_4343W/TARGET_CY8CPROTO_062_4343W/cybsp.c
@@ -39,18 +39,29 @@ cy_rslt_t cybsp_init(void)
cy_rslt_t result = CY_RSLT_SUCCESS;
#ifndef __MBED__
- /* Initialize User LEDs */
- result |= cybsp_led_init(CYBSP_USER_LED1);
- /* Initialize User Buttons */
- result |= cybsp_btn_init(CYBSP_USER_BTN1);
- CY_ASSERT(CY_RSLT_SUCCESS == result);
-#endif
-
-#if defined(CYBSP_RETARGET_ENABLED)
- /* Initialize retargetting stdio to 'DEBUG_UART' peripheral */
if (CY_RSLT_SUCCESS == result)
{
- result = cybsp_retarget_init();
+ /* Initialize User LEDs */
+ result |= cybsp_led_init(CYBSP_USER_LED1);
+ /* Initialize User Buttons */
+ result |= cybsp_btn_init(CYBSP_USER_BTN1);
+ CY_ASSERT(CY_RSLT_SUCCESS == result);
+
+ /* Initialize retargetting stdio to 'DEBUG_UART' peripheral */
+ if (CY_RSLT_SUCCESS == result)
+ {
+ result = cybsp_retarget_init();
+ }
+ }
+#endif
+
+#if defined(CYBSP_WIFI_CAPABLE)
+ /* Initialize SDIO interface.
+ NOTE: The full WiFi interface still needs to be initialized via cybsp_wifi_init_primary(). This is typically done
+ when starting up WiFi. */
+ if (CY_RSLT_SUCCESS == result)
+ {
+ result = cybsp_wifi_sdio_init();
}
#endif
diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CYW943012P6EVB_01/cybsp.c b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CYW943012P6EVB_01/cybsp.c
index c295767fc6..5272e58cc8 100644
--- a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CYW943012P6EVB_01/cybsp.c
+++ b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CYW943012P6EVB_01/cybsp.c
@@ -39,32 +39,33 @@ cy_rslt_t cybsp_init(void)
cy_rslt_t result = CY_RSLT_SUCCESS;
#ifndef __MBED__
- /* Initialize User LEDs */
- result |= cybsp_led_init(CYBSP_USER_LED1);
- result |= cybsp_led_init(CYBSP_USER_LED2);
- result |= cybsp_led_init(CYBSP_USER_LED3);
- /* Initialize User Buttons */
- result |= cybsp_btn_init(CYBSP_USER_BTN1);
+ if (CY_RSLT_SUCCESS == result)
+ {
+ /* Initialize User LEDs */
+ result |= cybsp_led_init(CYBSP_USER_LED1);
+ result |= cybsp_led_init(CYBSP_USER_LED2);
+ result |= cybsp_led_init(CYBSP_USER_LED3);
+ /* Initialize User Buttons */
+ result |= cybsp_btn_init(CYBSP_USER_BTN1);
- CY_ASSERT(CY_RSLT_SUCCESS == result);
+ CY_ASSERT(CY_RSLT_SUCCESS == result);
+
+ /* Initialize retargetting stdio to 'DEBUG_UART' peripheral */
+ if (CY_RSLT_SUCCESS == result)
+ {
+ result = cybsp_retarget_init();
+ }
+ }
#endif
#if defined(CYBSP_WIFI_CAPABLE)
/* Initialize UDB SDIO interface. This must be done before any other HAL API attempts to allocate clocks or DMA
instances. The UDB SDIO interface uses specific instances which are reserved as part of this call.
- NOTE: The full WiFi interface still needs to be initialized via cybsp_wifi_init(). This is typically done
+ NOTE: The full WiFi interface still needs to be initialized via cybsp_wifi_init_primary(). This is typically done
when starting up WiFi. */
if (CY_RSLT_SUCCESS == result)
{
- result = cybsp_sdio_init();
- }
-#endif
-
-#if defined(CYBSP_RETARGET_ENABLED)
- /* Initialize retargetting stdio to 'DEBUG_UART' peripheral */
- if (CY_RSLT_SUCCESS == result)
- {
- result = cybsp_retarget_init();
+ result = cybsp_wifi_sdio_init();
}
#endif
diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/common/cybsp_wifi.c b/targets/TARGET_Cypress/TARGET_PSOC6/common/cybsp_wifi.c
index 4033fbafa7..2942c2d9a0 100644
--- a/targets/TARGET_Cypress/TARGET_PSOC6/common/cybsp_wifi.c
+++ b/targets/TARGET_Cypress/TARGET_PSOC6/common/cybsp_wifi.c
@@ -21,14 +21,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
-#if defined(TARGET_WHD)
+#if defined(CYBSP_WIFI_CAPABLE)
-#include "cybsp_api_wifi.h"
+#include "cybsp_types.h"
+#include "cybsp_wifi.h"
#include "cy_network_buffer.h"
#include "cmsis_os2.h"
#include "whd_types.h"
#include "cyhal.h"
-#include "cyhal_implementation.h"
+#include "cybsp_wifi_sdio.h"
+#include "cycfg.h"
#if defined(__cplusplus)
extern "C" {
@@ -239,21 +241,8 @@ static cy_rslt_t init_sdio_bus(void)
return result;
}
-cy_rslt_t cybsp_sdio_init(void)
+cy_rslt_t cybsp_wifi_init_primary(whd_interface_t* interface)
{
- cy_rslt_t result = cyhal_sdio_init(&sdio_obj, CYBSP_WIFI_SDIO_CMD, CYBSP_WIFI_SDIO_CLK, CYBSP_WIFI_SDIO_D0, CYBSP_WIFI_SDIO_D1, CYBSP_WIFI_SDIO_D2, CYBSP_WIFI_SDIO_D3);
- sdio_initialized = (result == CY_RSLT_SUCCESS);
- return result;
-}
-
-cy_rslt_t cybsp_wifi_init(void)
-{
- cy_rslt_t result = init_sdio_whd();
- if(result != CY_RSLT_SUCCESS)
- {
- return result;
- }
-
whd_init_config_t whd_init_config;
whd_init_config.thread_stack_size = (uint32_t) THREAD_STACK_SIZE;
whd_init_config.thread_stack_start = (uint8_t *)malloc(THREAD_STACK_SIZE);
@@ -265,26 +254,21 @@ cy_rslt_t cybsp_wifi_init(void)
{
result = init_sdio_bus();
}
- else
- {
- result = CYBSP_RSLT_WIFI_INIT_FAILED;
- }
-
- if (result != CY_RSLT_SUCCESS)
- {
- deinit_sdio_whd();
- }
-
return result;
}
-whd_driver_t* cybsp_get_wifi_driver(void)
+cy_rslt_t cybsp_wifi_init_secondary(whd_interface_t* interface, whd_mac_t* mac_address)
{
- return &whd_drv;
+ return whd_add_secondary_interface(whd_drv, mac_address, interface);
+}
+
+whd_driver_t cybsp_get_wifi_driver(void)
+{
+ return whd_drv;
}
#if defined(__cplusplus)
}
#endif
-#endif /* defined(TARGET_WHD) */
+#endif /* defined(CYBSP_WIFI_CAPABLE) */
diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/psoc6csp/abstraction/include/cybsp_api_wifi.h b/targets/TARGET_Cypress/TARGET_PSOC6/common/cybsp_wifi.h
similarity index 61%
rename from targets/TARGET_Cypress/TARGET_PSOC6/psoc6csp/abstraction/include/cybsp_api_wifi.h
rename to targets/TARGET_Cypress/TARGET_PSOC6/common/cybsp_wifi.h
index 5157c15e78..b5de32ef66 100644
--- a/targets/TARGET_Cypress/TARGET_PSOC6/psoc6csp/abstraction/include/cybsp_api_wifi.h
+++ b/targets/TARGET_Cypress/TARGET_PSOC6/common/cybsp_wifi.h
@@ -1,5 +1,5 @@
/***************************************************************************//**
-* \file cybsp_api_wifi.h
+* \file cybsp_wifi.h
*
* \brief
* Basic abstraction layer for dealing with boards containing a Cypress MCU. This
@@ -25,19 +25,18 @@
*******************************************************************************/
/**
-* \addtogroup group_abstraction_board_wifi Board Wifi abstraction
-* \ingroup group_abstraction
+* \addtogroup group_bsp_wifi WiFi
* \{
* Basic abstraction layer for dealing with boards containing a Cypress MCU. This
* API provides convenience methods for initializing and manipulating different
* hardware found on the board.
*
-* \defgroup group_abstraction_board_wifi_macros Macros
-* \defgroup group_abstraction_board_wifi_functions Functions
+* \defgroup group_bsp_wifi_macros Macros
+* \defgroup group_bsp_wifi_functions Functions
*/
#pragma once
-#include "cybsp_api_core.h"
+#include "cy_result.h"
#include "whd_wifi_api.h"
#if defined(__cplusplus)
@@ -45,50 +44,50 @@ extern "C" {
#endif
/**
-* \addtogroup group_abstraction_board_wifi_macros
+* \addtogroup group_bsp_wifi_macros
* \{
*/
-/** Indicates that the wifi driver is available and can be used. */
-#define CYBSP_WIFI_CAPABLE 1
-
/** Initialization of the wifi driver failed. */
#define CYBSP_RSLT_WIFI_INIT_FAILED (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_BSP, 4))
-/** SDIO enumeration failed. */
-#define CYBSP_RSLT_WIFI_SDIO_ENUM_TIMEOUT (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_BSP, 5))
-/** \} group_abstraction_board_wifi_macros */
+/** \} group_bsp_board_macros */
/**
-* \addtogroup group_abstraction_board_wifi_functions
+* \addtogroup group_bsp_wifi_functions
* \{
*/
-/** Initializes the SDIO interface on the board. This only needs to be called if the
- * SDIO interface needs to be initialized before the general wifi interface. If not
- * called directly, it will automatically be called by cybsp_wifi_init().
- *
+/** Initializes the primary interface for the wifi driver on the board. This function does the following
+ * 1) Initializes the wifi driver.
+ * 2) Turns on the WIFI chip.
+ *
+ * @param[out] interface Interface to be initialized
* @return CY_RSLT_SUCCESS for successful initialization or error if initialization failed.
*/
-cy_rslt_t cybsp_sdio_init(void);
+cy_rslt_t cybsp_wifi_init_primary(whd_interface_t* interface);
-/** Initializes the wifi chip on the board.
- *
+/** 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 the primary interface
+ *
+ * @param[out] interface Interface to be initialized
+ * @param[in] mac_address Mac address for secondary interface
* @return CY_RSLT_SUCCESS for successful initialization or error if initialization failed.
*/
-cy_rslt_t cybsp_wifi_init(void);
+cy_rslt_t cybsp_wifi_init_secondary(whd_interface_t* interface, whd_mac_t* mac_address);
/** Gets the wifi driver instance initialized by the driver. This should only be called
- * after the interface is initialized by cybsp_wifi_init().
+ * after the interface is initialized by cybsp_wifi_init_primary().
*
* @return Wifi driver instance pointer.
*/
-whd_driver_t* cybsp_get_wifi_driver(void);
+whd_driver_t cybsp_get_wifi_driver(void);
-/** \} group_abstraction_board_wifi_functions */
+/** \} group_bsp_wifi_functions */
#ifdef __cplusplus
}
#endif /* __cplusplus */
-/** \} group_abstraction_board_wifi */
\ No newline at end of file
+/** \} group_bsp_wifi */
diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/common/cybsp_wifi_sdio.c b/targets/TARGET_Cypress/TARGET_PSOC6/common/cybsp_wifi_sdio.c
new file mode 100644
index 0000000000..1780057e37
--- /dev/null
+++ b/targets/TARGET_Cypress/TARGET_PSOC6/common/cybsp_wifi_sdio.c
@@ -0,0 +1,73 @@
+/***************************************************************************//**
+* \file cybsp_wifi_sdio.c
+*
+* \brief
+* Utility functions to intialize the SDIO communication bus used to
+* communicate with the WiFi radio.
+*
+********************************************************************************
+* \copyright
+* Copyright 2018-2019 Cypress Semiconductor Corporation
+* SPDX-License-Identifier: Apache-2.0
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*******************************************************************************/
+#include "cybsp_wifi_sdio.h"
+#include "cyhal_gpio_impl.h"
+#include "cybsp_types.h"
+
+#if defined(CYBSP_WIFI_CAPABLE)
+
+#define WLAN_POWER_UP_DELAY_MS 250
+
+static cyhal_sdio_t sdio_obj;
+
+static cy_rslt_t reset_wifi_chip(void)
+{
+ /* WiFi into reset */
+ cy_rslt_t result = cyhal_gpio_init(CYBSP_WIFI_WL_REG_ON, CYHAL_GPIO_DIR_OUTPUT, CYHAL_GPIO_DRIVE_PULLUP, 0);
+ if(result == CY_RSLT_SUCCESS)
+ {
+ /* WiFi out of reset */
+ cyhal_gpio_write(CYBSP_WIFI_WL_REG_ON, true);
+ Cy_SysLib_Delay(WLAN_POWER_UP_DELAY_MS);
+ }
+ return result;
+}
+
+void cybsp_wifi_sdio_deinit(void)
+{
+ cyhal_sdio_free(&sdio_obj);
+ cyhal_gpio_free(CYBSP_WIFI_WL_REG_ON);
+}
+
+cy_rslt_t cybsp_wifi_sdio_init(void)
+{
+ cy_rslt_t result = cyhal_sdio_init(&sdio_obj, CYBSP_WIFI_SDIO_CMD, CYBSP_WIFI_SDIO_CLK, CYBSP_WIFI_SDIO_D0, CYBSP_WIFI_SDIO_D1, CYBSP_WIFI_SDIO_D2, CYBSP_WIFI_SDIO_D3);
+ if(result == CY_RSLT_SUCCESS)
+ {
+ cy_rslt_t result = reset_wifi_chip();
+ if (result != CY_RSLT_SUCCESS)
+ {
+ cybsp_wifi_sdio_deinit();
+ }
+ }
+ return result;
+}
+
+cyhal_sdio_t* cybsp_get_wifi_sdio_obj(void)
+{
+ return &sdio_obj;
+}
+
+#endif /* defined(CYBSP_WIFI_CAPABLE) */
diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/common/cybsp_wifi_sdio.h b/targets/TARGET_Cypress/TARGET_PSOC6/common/cybsp_wifi_sdio.h
new file mode 100644
index 0000000000..f8152cbaf0
--- /dev/null
+++ b/targets/TARGET_Cypress/TARGET_PSOC6/common/cybsp_wifi_sdio.h
@@ -0,0 +1,85 @@
+/***************************************************************************//**
+* \file cybsp_wifi_sdio.h
+*
+* \brief
+* Utility functions to intialize the SDIO communication bus used to
+* communicate with the WiFi radio.
+*
+********************************************************************************
+* \copyright
+* Copyright 2018-2019 Cypress Semiconductor Corporation
+* SPDX-License-Identifier: Apache-2.0
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*******************************************************************************/
+
+/**
+* \addtogroup group_bsp_board_wifi WiFi
+* \ingroup group_bsp_abstraction
+* \{
+* Basic abstraction layer for dealing with boards containing a Cypress MCU. This
+* API provides convenience methods for initializing and manipulating different
+* hardware found on the board.
+*
+* \defgroup group_bsp_board_wifi_macros Macros
+* \defgroup group_bsp_board_wifi_functions Functions
+*/
+#pragma once
+
+#include "cy_result.h"
+#include "cyhal.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/**
+* \addtogroup group_bsp_board_wifi_macros
+* \{
+*/
+
+/** SDIO enumeration failed. */
+#define CYBSP_RSLT_WIFI_SDIO_ENUM_TIMEOUT (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_BSP, 5))
+
+/** \} group_bsp_board_wifi_macros */
+
+/**
+* \addtogroup group_bsp_board_wifi_functions
+* \{
+*/
+
+/** Initializes and enumerates the SDIO object connected to the wifi chip.
+ * The following operations are performed,
+ * -# Initializes the SDIO interface on the board connect to the wifi chip.
+ * -# Resets the wifi chip.
+ *
+ * @return CY_RSLT_SUCCESS for successful initialization or error if initialization failed.
+ */
+cy_rslt_t cybsp_wifi_sdio_init(void);
+
+/** Frees up any resources allocated by the cybsp_wifi_sdio_init() */
+void cybsp_wifi_sdio_deinit(void);
+
+/** Get the initialized sdio object. This should only be called after cybsp_wifi_sdio_init();
+ *
+ * @return The initialized and enumerated sdio object.
+ */
+cyhal_sdio_t* cybsp_get_wifi_sdio_obj(void);
+
+/** \} group_bsp_board_wifi_functions */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+/** \} group_bsp_board_wifi */
\ No newline at end of file