Minor updates to BSP init for clarity

pull/11367/head
Ryan Morse 2019-08-25 21:12:26 +01:00 committed by Kyle Kearney
parent 85dd8d704b
commit 0164ddcc80
7 changed files with 54 additions and 31 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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.
*/

View File

@ -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