1 /***********************************************************************************************//**
2  * \file cybsp.h
3  *
4  * \brief
5  * Basic API for setting up boards containing a Cypress MCU.
6  *
7  ***************************************************************************************************
8  * \copyright
9  * Copyright 2018-2022 Cypress Semiconductor Corporation (an Infineon company) or
10  * an affiliate of Cypress Semiconductor Corporation
11  *
12  * SPDX-License-Identifier: Apache-2.0
13  *
14  * Licensed under the Apache License, Version 2.0 (the "License");
15  * you may not use this file except in compliance with the License.
16  * You may obtain a copy of the License at
17  *
18  *     http://www.apache.org/licenses/LICENSE-2.0
19  *
20  * Unless required by applicable law or agreed to in writing, software
21  * distributed under the License is distributed on an "AS IS" BASIS,
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  * See the License for the specific language governing permissions and
24  * limitations under the License.
25  **************************************************************************************************/
26 
27 #pragma once
28 
29 #include "cy_result.h"
30 #include "cybsp_types.h"
31 #include "cybsp_hw_config.h"
32 #if defined(COMPONENT_WICED_BLE) || defined(COMPONENT_WICED_DUALMODE)
33 #include "cybsp_bt_config.h"
34 #endif
35 
36 #if defined(__cplusplus)
37 extern "C" {
38 #endif
39 
40 /**
41  * \addtogroup group_bsp_errors Error Codes
42  * \{
43  * Error codes specific to the board.
44  */
45 
46 /** Failed to configure sysclk power management callback */
47 #define CYBSP_RSLT_ERR_SYSCLK_PM_CALLBACK  \
48     (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_BSP, 0))
49 
50 /** \} group_bsp_errors */
51 
52 /**
53  * \addtogroup group_bsp_functions Functions
54  * \{
55  * All functions exposed by the board.
56  */
57 
58 /**
59  * \brief Initialize all hardware on the board
60  * \returns CY_RSLT_SUCCESS if the board is successfully initialized, if there is
61  *          a problem initializing any hardware it returns an error code specific
62  *          to the hardware module that had a problem.
63  */
64 cy_rslt_t cybsp_init(void);
65 
66 #if defined(CYBSP_CUSTOM_SYSCLK_PM_CALLBACK)
67 //--------------------------------------------------------------------------------------------------
68 // cybsp_register_custom_sysclk_pm_callback
69 //
70 // Registers a power management callback that prepares the clock system for entering deep sleep mode
71 // and restore the clocks upon wakeup from deep sleep. The application should implement this
72 // function and define `CYBSP_CUSTOM_SYSCLK_PM_CALLBACK` if it needs to replace the default SysClk
73 // DeepSleep callback behavior with application specific logic.
74 // NOTE: This is called automatically as part of \ref cybsp_init
75 //--------------------------------------------------------------------------------------------------
76 cy_rslt_t cybsp_register_custom_sysclk_pm_callback(void);
77 #endif // defined(CYBSP_CUSTOM_SYSCLK_PM_CALLBACK)
78 
79 /** \} group_bsp_functions */
80 
81 #ifdef __cplusplus
82 }
83 #endif // __cplusplus
84