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 cac11ef2f3..06036122a7 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 @@ -34,10 +34,15 @@ extern "C" { cy_rslt_t cybsp_init(void) { - cy_rslt_t result = CY_RSLT_SUCCESS; + cy_rslt_t result; + result = cyhal_hwmgr_init(); init_cycfg_system(); - result = cybsp_register_sysclk_pm_callback(); + + if (CY_RSLT_SUCCESS == result) + { + result = cybsp_register_sysclk_pm_callback(); + } #ifndef __MBED__ if (CY_RSLT_SUCCESS == result) @@ -69,7 +74,7 @@ cy_rslt_t cybsp_init(void) result = cybsp_retarget_init(); } } -#endif +#endif /* __MBED__ */ #if defined(CYBSP_WIFI_CAPABLE) /* Initialize SDIO interface. @@ -81,10 +86,10 @@ cy_rslt_t cybsp_init(void) * CYBSP_WIFI_SDIO_CMD, CYBSP_WIFI_SDIO_CLK and CYBSP_WIFI_WL_REG_ON */ result = cybsp_wifi_sdio_init(); } -#endif - +#endif /* defined(CYBSP_WIFI_CAPABLE) */ + /* CYHAL_HWMGR_RSLT_ERR_INUSE error code could be returned if any needed for BSP resource was reserved by - * user previously. Please review the Device Configurator (design.modus) and the BSP reservation list + * user previously. Please review the Device Configurator (design.modus) and the BSP reservation list * (cyreservedresources.list) to make sure no resources are reserved by both. */ return result; } 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 a8d64758c8..f88ca772de 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 @@ -32,10 +32,15 @@ extern "C" { cy_rslt_t cybsp_init(void) { - cy_rslt_t result = CY_RSLT_SUCCESS; + cy_rslt_t result; + result = cyhal_hwmgr_init(); init_cycfg_system(); - result = cybsp_register_sysclk_pm_callback(); + + if (CY_RSLT_SUCCESS == result) + { + result = cybsp_register_sysclk_pm_callback(); + } #ifndef __MBED__ if (CY_RSLT_SUCCESS == result) @@ -64,10 +69,10 @@ cy_rslt_t cybsp_init(void) result = cybsp_retarget_init(); } } -#endif +#endif /* __MBED__ */ /* CYHAL_HWMGR_RSLT_ERR_INUSE error code could be returned if any needed for BSP resource was reserved by - * user previously. Please review the Device Configurator (design.modus) and the BSP reservation list + * user previously. Please review the Device Configurator (design.modus) and the BSP reservation list * (cyreservedresources.list) to make sure no resources are reserved by both. */ return result; } 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 81f4e6e525..fdda76e36f 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 @@ -34,10 +34,15 @@ extern "C" { cy_rslt_t cybsp_init(void) { - cy_rslt_t result = CY_RSLT_SUCCESS; + cy_rslt_t result; + result = cyhal_hwmgr_init(); init_cycfg_system(); - result = cybsp_register_sysclk_pm_callback(); + + if (CY_RSLT_SUCCESS == result) + { + result = cybsp_register_sysclk_pm_callback(); + } #ifndef __MBED__ if (CY_RSLT_SUCCESS == result) @@ -61,12 +66,12 @@ cy_rslt_t cybsp_init(void) /* Initialize retargetting stdio to 'DEBUG_UART' peripheral */ if (CY_RSLT_SUCCESS == result) { - /* Reserves: CYBSP_DEBUG_UART_RX, CYBSP_DEBUG_UART_TX, corresponding SCB instance + /* Reserves: CYBSP_DEBUG_UART_RX, CYBSP_DEBUG_UART_TX, corresponding SCB instance * and one of available clock dividers */ result = cybsp_retarget_init(); } } -#endif +#endif /* __MBED__ */ #if defined(CYBSP_WIFI_CAPABLE) /* Initialize UDB SDIO interface. This must be done before any other HAL API attempts to allocate clocks or DMA @@ -79,10 +84,10 @@ cy_rslt_t cybsp_init(void) * CYBSP_WIFI_SDIO_CMD, CYBSP_WIFI_SDIO_CLK and CYBSP_WIFI_WL_REG_ON */ result = cybsp_wifi_sdio_init(); } -#endif +#endif /* defined(CYBSP_WIFI_CAPABLE) */ /* CYHAL_HWMGR_RSLT_ERR_INUSE error code could be returned if any needed for BSP resource was reserved by - * user previously. Please review the Device Configurator (design.modus) and the BSP reservation list + * user previously. Please review the Device Configurator (design.modus) and the BSP reservation list * (cyreservedresources.list) to make sure no resources are reserved by both. */ return result; } 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 caaa3747dc..65ca9de552 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 @@ -33,10 +33,15 @@ extern "C" { cy_rslt_t cybsp_init(void) { - cy_rslt_t result = CY_RSLT_SUCCESS; + cy_rslt_t result; + result = cyhal_hwmgr_init(); init_cycfg_system(); - result = cybsp_register_sysclk_pm_callback(); + + if (CY_RSLT_SUCCESS == result) + { + result = cybsp_register_sysclk_pm_callback(); + } #ifndef __MBED__ if (CY_RSLT_SUCCESS == result) @@ -52,12 +57,12 @@ cy_rslt_t cybsp_init(void) /* Initialize retargetting stdio to 'DEBUG_UART' peripheral */ if (CY_RSLT_SUCCESS == result) { - /* Reserves: CYBSP_DEBUG_UART_RX, CYBSP_DEBUG_UART_TX, corresponding SCB instance + /* Reserves: CYBSP_DEBUG_UART_RX, CYBSP_DEBUG_UART_TX, corresponding SCB instance * and one of available clock dividers */ result = cybsp_retarget_init(); } } -#endif +#endif /* __MBED__ */ #if defined(CYBSP_WIFI_CAPABLE) /* Initialize SDIO interface. @@ -69,10 +74,10 @@ cy_rslt_t cybsp_init(void) * CYBSP_WIFI_SDIO_CMD, CYBSP_WIFI_SDIO_CLK and CYBSP_WIFI_WL_REG_ON */ result = cybsp_wifi_sdio_init(); } -#endif +#endif /* defined(CYBSP_WIFI_CAPABLE) */ /* CYHAL_HWMGR_RSLT_ERR_INUSE error code could be returned if any needed for BSP resource was reserved by - * user previously. Please review the Device Configurator (design.modus) and the BSP reservation list + * user previously. Please review the Device Configurator (design.modus) and the BSP reservation list * (cyreservedresources.list) to make sure no resources are reserved by both. */ return result; } 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 fe3d2c78da..7f6f29ad83 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CYW943012P6EVB_01/cybsp.c +++ b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CYW943012P6EVB_01/cybsp.c @@ -33,10 +33,15 @@ extern "C" { cy_rslt_t cybsp_init(void) { - cy_rslt_t result = CY_RSLT_SUCCESS; + cy_rslt_t result; + result = cyhal_hwmgr_init(); init_cycfg_system(); - result = cybsp_register_sysclk_pm_callback(); + + if (CY_RSLT_SUCCESS == result) + { + result = cybsp_register_sysclk_pm_callback(); + } #ifndef __MBED__ if (CY_RSLT_SUCCESS == result) @@ -57,12 +62,12 @@ cy_rslt_t cybsp_init(void) /* Initialize retargetting stdio to 'DEBUG_UART' peripheral */ if (CY_RSLT_SUCCESS == result) { - /* Reserves: CYBSP_DEBUG_UART_RX, CYBSP_DEBUG_UART_TX, corresponding SCB instance + /* Reserves: CYBSP_DEBUG_UART_RX, CYBSP_DEBUG_UART_TX, corresponding SCB instance * and one of available clock dividers */ result = cybsp_retarget_init(); } } -#endif +#endif /* __MBED__ */ #if defined(CYBSP_WIFI_CAPABLE) /* Initialize UDB SDIO interface. This must be done before any other HAL API attempts to allocate clocks or DMA @@ -75,10 +80,10 @@ cy_rslt_t cybsp_init(void) * CYBSP_WIFI_SDIO_CMD, CYBSP_WIFI_SDIO_CLK and CYBSP_WIFI_WL_REG_ON */ result = cybsp_wifi_sdio_init(); } -#endif +#endif /* defined(CYBSP_WIFI_CAPABLE) */ /* CYHAL_HWMGR_RSLT_ERR_INUSE error code could be returned if any needed for BSP resource was reserved by - * user previously. Please review the Device Configurator (design.modus) and the BSP reservation list + * user previously. Please review the Device Configurator (design.modus) and the BSP reservation list * (cyreservedresources.list) to make sure no resources are reserved by both. */ return result; } diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/common/cybsp_core.h b/targets/TARGET_Cypress/TARGET_PSOC6/common/cybsp_core.h index 2b644341ce..0f876e7660 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/common/cybsp_core.h +++ b/targets/TARGET_Cypress/TARGET_PSOC6/common/cybsp_core.h @@ -135,6 +135,7 @@ void cybsp_btn_set_interrupt(cybsp_btn_t which, cyhal_gpio_event_t type, cyhal_g /** * \brief Registers a power management callback that prepares the clock system * for entering deep sleep mode and restore the clocks upon wakeup from deep sleep. + * NOTE: This is called automatically as part of \ref cybsp_init * \returns CY_RSLT_SUCCESS if the callback is sucessfully registered, if there is * a problem registering the callback it returns CYBSP_RSLT_ERR_SYSCLK_PM_CALLBACK. */ diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/mbed_overrides.c b/targets/TARGET_Cypress/TARGET_PSOC6/mbed_overrides.c index de6e52b0de..fd28bc3e19 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/mbed_overrides.c +++ b/targets/TARGET_Cypress/TARGET_PSOC6/mbed_overrides.c @@ -62,9 +62,6 @@ void mbed_sdk_init(void) /* Placed here as it must be done after proper LIBC initialization. */ SystemInit(); - /* Initialize hardware resource manager */ - cyhal_hwmgr_init(); - #if defined(COMPONENT_SPM_MAILBOX) mailbox_init(); #endif