hal_bkp.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. ////////////////////////////////////////////////////////////////////////////////
  2. /// @file hal_bkp.h
  3. /// @author AE TEAM
  4. /// @brief THIS FILE CONTAINS ALL THE FUNCTIONS PROTOTYPES FOR THE BKP
  5. /// FIRMWARE LIBRARY.
  6. ////////////////////////////////////////////////////////////////////////////////
  7. /// @attention
  8. ///
  9. /// THE EXISTING FIRMWARE IS ONLY FOR REFERENCE, WHICH IS DESIGNED TO PROVIDE
  10. /// CUSTOMERS WITH CODING INFORMATION ABOUT THEIR PRODUCTS SO THEY CAN SAVE
  11. /// TIME. THEREFORE, MINDMOTION SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT OR
  12. /// CONSEQUENTIAL DAMAGES ABOUT ANY CLAIMS ARISING OUT OF THE CONTENT OF SUCH
  13. /// HARDWARE AND/OR THE USE OF THE CODING INFORMATION CONTAINED HEREIN IN
  14. /// CONNECTION WITH PRODUCTS MADE BY CUSTOMERS.
  15. ///
  16. /// <H2><CENTER>&COPY; COPYRIGHT MINDMOTION </CENTER></H2>
  17. ////////////////////////////////////////////////////////////////////////////////
  18. // Define to prevent recursive inclusion
  19. #ifndef __HAL_BKP_H
  20. #define __HAL_BKP_H
  21. // Files includes
  22. #include "types.h"
  23. #include "reg_bkp.h"
  24. ////////////////////////////////////////////////////////////////////////////////
  25. /// @addtogroup MM32_Hardware_Abstract_Layer
  26. /// @{
  27. ////////////////////////////////////////////////////////////////////////////////
  28. /// @defgroup BKP_HAL
  29. /// @brief BKP HAL modules
  30. /// @{
  31. ////////////////////////////////////////////////////////////////////////////////
  32. /// @defgroup BKP_Exported_Types
  33. /// @{
  34. ////////////////////////////////////////////////////////////////////////////////
  35. /// @brief Data_Backup_Register
  36. /// @anchor Data_Backup_Register
  37. typedef enum {
  38. BKP_DR1 = 0x0010,
  39. BKP_DR2 = 0x0014,
  40. BKP_DR3 = 0x0018,
  41. BKP_DR4 = 0x001C,
  42. BKP_DR5 = 0x0020,
  43. BKP_DR6 = 0x0024,
  44. BKP_DR7 = 0x0028,
  45. BKP_DR8 = 0x002C,
  46. BKP_DR9 = 0x0030,
  47. BKP_DR10 = 0x0034,
  48. BKP_DR11 = 0x0038,
  49. BKP_DR12 = 0x003C,
  50. BKP_DR13 = 0x0040,
  51. BKP_DR14 = 0x0044,
  52. BKP_DR15 = 0x0048,
  53. BKP_DR16 = 0x004C,
  54. BKP_DR17 = 0x0050,
  55. BKP_DR18 = 0x0054,
  56. BKP_DR19 = 0x0058,
  57. BKP_DR20 = 0x005C
  58. } BKPDR_Typedef;
  59. ////////////////////////////////////////////////////////////////////////////////
  60. /// @brief Tamper_Pin_active_level
  61. /// @anchor Tamper_Pin_active_level
  62. typedef enum {
  63. BKP_TamperPinLevel_High, ///< Tamper pin active on high level
  64. BKP_TamperPinLevel_Low = BKP_CR_TPAL, ///< Tamper pin active on low level
  65. } BKPTPAL_Typedef;
  66. ////////////////////////////////////////////////////////////////////////////////
  67. /// @brief RTC_output_source_to_output_on_the_Tamper_pin
  68. /// @anchor RTC_output_source_to_output_on_the_Tamper_pin
  69. typedef enum {
  70. BKP_RTCOutputSource_None = 0x0000, ///< No RTC output on the Tamper pin
  71. BKP_RTCOutputSource_CalibClock = 0x0080, ///< Output the RTC clock with frequency divided by 64 on the Tamper pin
  72. BKP_RTCOutputSource_Alarm = 0x0100, ///< Output the RTC Alarm pulse signal on the Tamper pin
  73. BKP_RTCOutputSource_Second = 0x0300 ///< Output the RTC Second pulse signal on the Tamper pin
  74. } BKPRTCOUTPUTSRC_Typedef;
  75. /// @}
  76. ////////////////////////////////////////////////////////////////////////////////
  77. /// @defgroup BKP_Exported_Variables
  78. /// @{
  79. #ifdef _HAL_BKP_C_
  80. #define GLOBAL
  81. #else
  82. #define GLOBAL extern
  83. #endif
  84. #undef GLOBAL
  85. /// @}
  86. ////////////////////////////////////////////////////////////////////////////////
  87. /// @defgroup BKP_Exported_Functions
  88. /// @{
  89. void BKP_WriteBackupRegister(BKPDR_Typedef bkp_dr, u16 data);
  90. u16 BKP_ReadBackupRegister(BKPDR_Typedef bkp_dr);
  91. void BKP_DeInit(void);
  92. void BKP_ClearFlag(void);
  93. void BKP_ClearITPendingBit(void);
  94. void BKP_TamperPinLevelConfig(BKPTPAL_Typedef tamper_pin_level);
  95. void BKP_TamperPinCmd(FunctionalState state);
  96. void BKP_ITConfig(FunctionalState state);
  97. void BKP_RTCOutputConfig(BKPRTCOUTPUTSRC_Typedef rtc_output_source);
  98. void BKP_SetRTCCalibrationValue(u8 calibration_value);
  99. ITStatus BKP_GetITStatus(void);
  100. FlagStatus BKP_GetFlagStatus(void);
  101. void exBKP_Init(void);
  102. void exBKP_ImmWrite(BKPDR_Typedef bkp_dr, u16 data);
  103. u16 exBKP_ImmRead(BKPDR_Typedef bkp_dr);
  104. /// @}
  105. /// @}
  106. /// @}
  107. ////////////////////////////////////////////////////////////////////////////////
  108. #endif // __HAL_BKP_H
  109. ////////////////////////////////////////////////////////////////////////////////