ciu32f003_std_pmu(1).h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /************************************************************************************************/
  2. /**
  3. * @file ciu32f003_std_pmu.h
  4. * @author MCU Ecosystem Development Team
  5. * @brief PMU STD库驱动头文件。
  6. * 提供PMU相关STD库操作函数声明、数据类型以及常量的定义。
  7. *
  8. *
  9. **************************************************************************************************
  10. * @attention
  11. * Copyright (c) CEC Huada Electronic Design Co.,Ltd. All rights reserved.
  12. *
  13. **************************************************************************************************
  14. */
  15. /*避免头文件重复引用*/
  16. #ifndef CIU32F003_STD_PMU_H
  17. #define CIU32F003_STD_PMU_H
  18. /************************************************************************************************/
  19. /**
  20. * @addtogroup CIU32F003_STD_Driver
  21. * @{
  22. */
  23. /**
  24. * @defgroup PMU PMU
  25. * @brief 电源管理单元的STD库驱动
  26. * @{
  27. */
  28. /************************************************************************************************/
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. /*------------------------------------------includes--------------------------------------------*/
  33. #include "ciu32f003_std_common.h"
  34. /*--------------------------------------------define--------------------------------------------*/
  35. /************************************************************************************************/
  36. /**
  37. * @defgroup PMU_Constants PMU Constants
  38. * @brief PMU常量定义及宏定义
  39. * @{
  40. */
  41. /************************************************************************************************/
  42. /* 低功耗进入方式定义 */
  43. #define PMU_ENTRY_LOWPOWER_MODE_WFI (0x00UL) /**< WFI方式进入低功耗 */
  44. #define PMU_ENTRY_LOWPOWER_MODE_WFE (0x01UL) /**< WFE方式进入低功耗 */
  45. /* 低功耗模式定义 */
  46. #define PMU_MODE_STOP PMU_CR_LP_MODE_STOP /**< Stop模式 */
  47. #define PMU_MODE_DEEPSTOP PMU_CR_LP_MODE_DEEPSTOP /**< Deepstop模式 */
  48. /* Deepstop模式唤醒过程中Flash的唤醒等待时间定义 */
  49. #define PMU_DEEPSTOP_FLASH_WAKEUP_TIME_0 (0x3UL << PMU_FLASH_WAKEUP_FLASH_WAKEUP_POS) /**< Deepstop模式唤醒过程中Flash的唤醒等待时间为0us */
  50. #define PMU_DEEPSTOP_FLASH_WAKEUP_TIME_10 (0x00000000U) /**< Deepstop模式唤醒过程中Flash的唤醒等待时间为10us */
  51. /**
  52. * @}
  53. */
  54. /*-------------------------------------------functions------------------------------------------*/
  55. /************************************************************************************************/
  56. /**
  57. * @defgroup PMU_External_Functions PMU External Functions
  58. * @brief PMU对外函数
  59. * @{
  60. */
  61. /************************************************************************************************/
  62. /**
  63. * @brief 配置Deepstop模式唤醒过程中Flash的唤醒等待时间
  64. * @param time_value 等待时间
  65. * @arg PMU_DEEPSTOP_FLASH_WAKEUP_TIME_0 : 0us
  66. * @arg PMU_DEEPSTOP_FLASH_WAKEUP_TIME_10: 10us
  67. * @retval 无
  68. */
  69. __STATIC_INLINE void std_pmu_deepstop_flash_wakeup_time_config(uint32_t time_value)
  70. {
  71. MODIFY_REG(PMU->FLASH_WAKEUP, PMU_FLASH_WAKEUP_FLASH_WAKEUP, time_value);
  72. }
  73. /* PMU低功耗模式相关函数 */
  74. void std_pmu_enter_sleep(uint32_t mode_entry);
  75. void std_pmu_enter_stop(uint32_t stop_mode, uint32_t mode_entry);
  76. /**
  77. * @}
  78. */
  79. #ifdef __cplusplus
  80. }
  81. #endif
  82. /**
  83. * @}
  84. */
  85. /**
  86. * @}
  87. */
  88. #endif /* CIU32F003_STD_PMU_H */