cybsp.h 2.9 KB

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