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 33 #if defined(__cplusplus) 34 extern "C" { 35 #endif 36 37 /** 38 * \addtogroup group_bsp_errors Error Codes 39 * \{ 40 * Error codes specific to the board. 41 */ 42 43 /** Failed to configure sysclk power management callback */ 44 #define CYBSP_RSLT_ERR_SYSCLK_PM_CALLBACK \ 45 (CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_BSP, 0)) 46 47 /** \} group_bsp_errors */ 48 49 /** 50 * \addtogroup group_bsp_functions Functions 51 * \{ 52 * All functions exposed by the board. 53 */ 54 55 /** 56 * \brief Initialize all hardware on the board 57 * \returns CY_RSLT_SUCCESS if the board is successfully initialized, if there is 58 * a problem initializing any hardware it returns an error code specific 59 * to the hardware module that had a problem. 60 */ 61 cy_rslt_t cybsp_init(void); 62 63 #if defined(CYBSP_CUSTOM_SYSCLK_PM_CALLBACK) 64 //-------------------------------------------------------------------------------------------------- 65 // cybsp_register_custom_sysclk_pm_callback 66 // 67 // Registers a power management callback that prepares the clock system for entering deep sleep mode 68 // and restore the clocks upon wakeup from deep sleep. The application should implement this 69 // function and define `CYBSP_CUSTOM_SYSCLK_PM_CALLBACK` if it needs to replace the default SysClk 70 // DeepSleep callback behavior with application specific logic. 71 // NOTE: This is called automatically as part of \ref cybsp_init 72 //-------------------------------------------------------------------------------------------------- 73 cy_rslt_t cybsp_register_custom_sysclk_pm_callback(void); 74 #endif // defined(CYBSP_CUSTOM_SYSCLK_PM_CALLBACK) 75 76 /** \} group_bsp_functions */ 77 78 #ifdef __cplusplus 79 } 80 #endif // __cplusplus 81