hpm_bcfg_drv.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (c) 2022 HPMicro
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #ifndef HPM_BCFG_DRV_H
  8. #define HPM_BCFG_DRV_H
  9. #include "hpm_common.h"
  10. #include "hpm_bcfg_regs.h"
  11. /**
  12. *
  13. * @brief BCFG driver APIs
  14. * @defgroup bcfg_interface BCFG driver APIs
  15. * @ingroup io_interfaces
  16. * @{
  17. */
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. /**
  22. * @brief enable VBAT LP mode
  23. *
  24. * @param[in] ptr base address
  25. */
  26. static inline void bcfg_vbg_enable_lp_mode(BCFG_Type *ptr)
  27. {
  28. ptr->VBG_CFG |= BCFG_VBG_CFG_LP_MODE_MASK;
  29. }
  30. /**
  31. * @brief disable VBAT LP mode
  32. *
  33. * @param[in] ptr base address
  34. */
  35. static inline void bcfg_vbg_disable_lp_mode(BCFG_Type *ptr)
  36. {
  37. ptr->VBG_CFG &= ~BCFG_VBG_CFG_LP_MODE_MASK;
  38. }
  39. /**
  40. * @brief enable power save mode
  41. *
  42. * @param[in] ptr base address
  43. */
  44. static inline void bcfg_vbg_enable_power_save_mode(BCFG_Type *ptr)
  45. {
  46. ptr->VBG_CFG |= BCFG_VBG_CFG_POWER_SAVE_MASK;
  47. }
  48. /**
  49. * @brief disable power save mode
  50. *
  51. * @param[in] ptr base address
  52. */
  53. static inline void bcfg_vbg_disable_power_save_mode(BCFG_Type *ptr)
  54. {
  55. ptr->VBG_CFG &= ~BCFG_VBG_CFG_POWER_SAVE_MASK;
  56. }
  57. #ifdef __cplusplus
  58. }
  59. #endif
  60. /**
  61. * @}
  62. */
  63. #endif /* HPM_BCFG_DRV_H */