Skip to content

Commit 4f95abc

Browse files
cy-opmKyle Kearney
authored andcommitted
Minor updates to BSP init for clarity
1 parent 8caeed3 commit 4f95abc

File tree

7 files changed

+54
-31
lines changed

7 files changed

+54
-31
lines changed

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062S2_43012/cybsp.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,15 @@ extern "C" {
3434

3535
cy_rslt_t cybsp_init(void)
3636
{
37-
cy_rslt_t result = CY_RSLT_SUCCESS;
37+
cy_rslt_t result;
3838

39+
result = cyhal_hwmgr_init();
3940
init_cycfg_system();
40-
result = cybsp_register_sysclk_pm_callback();
41+
42+
if (CY_RSLT_SUCCESS == result)
43+
{
44+
result = cybsp_register_sysclk_pm_callback();
45+
}
4146

4247
#ifndef __MBED__
4348
if (CY_RSLT_SUCCESS == result)
@@ -69,7 +74,7 @@ cy_rslt_t cybsp_init(void)
6974
result = cybsp_retarget_init();
7075
}
7176
}
72-
#endif
77+
#endif /* __MBED__ */
7378

7479
#if defined(CYBSP_WIFI_CAPABLE)
7580
/* Initialize SDIO interface.
@@ -81,10 +86,10 @@ cy_rslt_t cybsp_init(void)
8186
* CYBSP_WIFI_SDIO_CMD, CYBSP_WIFI_SDIO_CLK and CYBSP_WIFI_WL_REG_ON */
8287
result = cybsp_wifi_sdio_init();
8388
}
84-
#endif
85-
89+
#endif /* defined(CYBSP_WIFI_CAPABLE) */
90+
8691
/* CYHAL_HWMGR_RSLT_ERR_INUSE error code could be returned if any needed for BSP resource was reserved by
87-
* user previously. Please review the Device Configurator (design.modus) and the BSP reservation list
92+
* user previously. Please review the Device Configurator (design.modus) and the BSP reservation list
8893
* (cyreservedresources.list) to make sure no resources are reserved by both. */
8994
return result;
9095
}

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_BLE/cybsp.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,15 @@ extern "C" {
3232

3333
cy_rslt_t cybsp_init(void)
3434
{
35-
cy_rslt_t result = CY_RSLT_SUCCESS;
35+
cy_rslt_t result;
3636

37+
result = cyhal_hwmgr_init();
3738
init_cycfg_system();
38-
result = cybsp_register_sysclk_pm_callback();
39+
40+
if (CY_RSLT_SUCCESS == result)
41+
{
42+
result = cybsp_register_sysclk_pm_callback();
43+
}
3944

4045
#ifndef __MBED__
4146
if (CY_RSLT_SUCCESS == result)
@@ -64,10 +69,10 @@ cy_rslt_t cybsp_init(void)
6469
result = cybsp_retarget_init();
6570
}
6671
}
67-
#endif
72+
#endif /* __MBED__ */
6873

6974
/* CYHAL_HWMGR_RSLT_ERR_INUSE error code could be returned if any needed for BSP resource was reserved by
70-
* user previously. Please review the Device Configurator (design.modus) and the BSP reservation list
75+
* user previously. Please review the Device Configurator (design.modus) and the BSP reservation list
7176
* (cyreservedresources.list) to make sure no resources are reserved by both. */
7277
return result;
7378
}

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_WIFI_BT/cybsp.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,15 @@ extern "C" {
3434

3535
cy_rslt_t cybsp_init(void)
3636
{
37-
cy_rslt_t result = CY_RSLT_SUCCESS;
37+
cy_rslt_t result;
3838

39+
result = cyhal_hwmgr_init();
3940
init_cycfg_system();
40-
result = cybsp_register_sysclk_pm_callback();
41+
42+
if (CY_RSLT_SUCCESS == result)
43+
{
44+
result = cybsp_register_sysclk_pm_callback();
45+
}
4146

4247
#ifndef __MBED__
4348
if (CY_RSLT_SUCCESS == result)
@@ -61,12 +66,12 @@ cy_rslt_t cybsp_init(void)
6166
/* Initialize retargetting stdio to 'DEBUG_UART' peripheral */
6267
if (CY_RSLT_SUCCESS == result)
6368
{
64-
/* Reserves: CYBSP_DEBUG_UART_RX, CYBSP_DEBUG_UART_TX, corresponding SCB instance
69+
/* Reserves: CYBSP_DEBUG_UART_RX, CYBSP_DEBUG_UART_TX, corresponding SCB instance
6570
* and one of available clock dividers */
6671
result = cybsp_retarget_init();
6772
}
6873
}
69-
#endif
74+
#endif /* __MBED__ */
7075

7176
#if defined(CYBSP_WIFI_CAPABLE)
7277
/* 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)
7984
* CYBSP_WIFI_SDIO_CMD, CYBSP_WIFI_SDIO_CLK and CYBSP_WIFI_WL_REG_ON */
8085
result = cybsp_wifi_sdio_init();
8186
}
82-
#endif
87+
#endif /* defined(CYBSP_WIFI_CAPABLE) */
8388

8489
/* CYHAL_HWMGR_RSLT_ERR_INUSE error code could be returned if any needed for BSP resource was reserved by
85-
* user previously. Please review the Device Configurator (design.modus) and the BSP reservation list
90+
* user previously. Please review the Device Configurator (design.modus) and the BSP reservation list
8691
* (cyreservedresources.list) to make sure no resources are reserved by both. */
8792
return result;
8893
}

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CMOD_062_4343W/TARGET_CY8CPROTO_062_4343W/cybsp.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,15 @@ extern "C" {
3333

3434
cy_rslt_t cybsp_init(void)
3535
{
36-
cy_rslt_t result = CY_RSLT_SUCCESS;
36+
cy_rslt_t result;
3737

38+
result = cyhal_hwmgr_init();
3839
init_cycfg_system();
39-
result = cybsp_register_sysclk_pm_callback();
40+
41+
if (CY_RSLT_SUCCESS == result)
42+
{
43+
result = cybsp_register_sysclk_pm_callback();
44+
}
4045

4146
#ifndef __MBED__
4247
if (CY_RSLT_SUCCESS == result)
@@ -52,12 +57,12 @@ cy_rslt_t cybsp_init(void)
5257
/* Initialize retargetting stdio to 'DEBUG_UART' peripheral */
5358
if (CY_RSLT_SUCCESS == result)
5459
{
55-
/* Reserves: CYBSP_DEBUG_UART_RX, CYBSP_DEBUG_UART_TX, corresponding SCB instance
60+
/* Reserves: CYBSP_DEBUG_UART_RX, CYBSP_DEBUG_UART_TX, corresponding SCB instance
5661
* and one of available clock dividers */
5762
result = cybsp_retarget_init();
5863
}
5964
}
60-
#endif
65+
#endif /* __MBED__ */
6166

6267
#if defined(CYBSP_WIFI_CAPABLE)
6368
/* Initialize SDIO interface.
@@ -69,10 +74,10 @@ cy_rslt_t cybsp_init(void)
6974
* CYBSP_WIFI_SDIO_CMD, CYBSP_WIFI_SDIO_CLK and CYBSP_WIFI_WL_REG_ON */
7075
result = cybsp_wifi_sdio_init();
7176
}
72-
#endif
77+
#endif /* defined(CYBSP_WIFI_CAPABLE) */
7378

7479
/* CYHAL_HWMGR_RSLT_ERR_INUSE error code could be returned if any needed for BSP resource was reserved by
75-
* user previously. Please review the Device Configurator (design.modus) and the BSP reservation list
80+
* user previously. Please review the Device Configurator (design.modus) and the BSP reservation list
7681
* (cyreservedresources.list) to make sure no resources are reserved by both. */
7782
return result;
7883
}

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CYW943012P6EVB_01/cybsp.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,15 @@ extern "C" {
3333

3434
cy_rslt_t cybsp_init(void)
3535
{
36-
cy_rslt_t result = CY_RSLT_SUCCESS;
36+
cy_rslt_t result;
3737

38+
result = cyhal_hwmgr_init();
3839
init_cycfg_system();
39-
result = cybsp_register_sysclk_pm_callback();
40+
41+
if (CY_RSLT_SUCCESS == result)
42+
{
43+
result = cybsp_register_sysclk_pm_callback();
44+
}
4045

4146
#ifndef __MBED__
4247
if (CY_RSLT_SUCCESS == result)
@@ -57,12 +62,12 @@ cy_rslt_t cybsp_init(void)
5762
/* Initialize retargetting stdio to 'DEBUG_UART' peripheral */
5863
if (CY_RSLT_SUCCESS == result)
5964
{
60-
/* Reserves: CYBSP_DEBUG_UART_RX, CYBSP_DEBUG_UART_TX, corresponding SCB instance
65+
/* Reserves: CYBSP_DEBUG_UART_RX, CYBSP_DEBUG_UART_TX, corresponding SCB instance
6166
* and one of available clock dividers */
6267
result = cybsp_retarget_init();
6368
}
6469
}
65-
#endif
70+
#endif /* __MBED__ */
6671

6772
#if defined(CYBSP_WIFI_CAPABLE)
6873
/* 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)
7580
* CYBSP_WIFI_SDIO_CMD, CYBSP_WIFI_SDIO_CLK and CYBSP_WIFI_WL_REG_ON */
7681
result = cybsp_wifi_sdio_init();
7782
}
78-
#endif
83+
#endif /* defined(CYBSP_WIFI_CAPABLE) */
7984

8085
/* CYHAL_HWMGR_RSLT_ERR_INUSE error code could be returned if any needed for BSP resource was reserved by
81-
* user previously. Please review the Device Configurator (design.modus) and the BSP reservation list
86+
* user previously. Please review the Device Configurator (design.modus) and the BSP reservation list
8287
* (cyreservedresources.list) to make sure no resources are reserved by both. */
8388
return result;
8489
}

targets/TARGET_Cypress/TARGET_PSOC6/common/cybsp_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ void cybsp_btn_set_interrupt(cybsp_btn_t which, cyhal_gpio_event_t type, cyhal_g
135135
/**
136136
* \brief Registers a power management callback that prepares the clock system
137137
* for entering deep sleep mode and restore the clocks upon wakeup from deep sleep.
138+
* NOTE: This is called automatically as part of \ref cybsp_init
138139
* \returns CY_RSLT_SUCCESS if the callback is sucessfully registered, if there is
139140
* a problem registering the callback it returns CYBSP_RSLT_ERR_SYSCLK_PM_CALLBACK.
140141
*/

targets/TARGET_Cypress/TARGET_PSOC6/mbed_overrides.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ void mbed_sdk_init(void)
6262
/* Placed here as it must be done after proper LIBC initialization. */
6363
SystemInit();
6464

65-
/* Initialize hardware resource manager */
66-
cyhal_hwmgr_init();
67-
6865
#if defined(COMPONENT_SPM_MAILBOX)
6966
mailbox_init();
7067
#endif

0 commit comments

Comments
 (0)