reg_bkp.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. ////////////////////////////////////////////////////////////////////////////////
  2. /// @file reg_bkp.h
  3. /// @author AE TEAM
  4. /// @brief THIS FILE CONTAINS ALL THE FUNCTIONS PROTOTYPES FOR THE SERIES OF
  5. /// MM32 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 __REG_BKP_H
  20. #define __REG_BKP_H
  21. // Files includes
  22. #include <stdint.h>
  23. #include <stdbool.h>
  24. #include "types.h"
  25. #if defined ( __CC_ARM )
  26. #pragma anon_unions
  27. #endif
  28. ////////////////////////////////////////////////////////////////////////////////
  29. /// @brief BKP Base Address Definition
  30. ////////////////////////////////////////////////////////////////////////////////
  31. #define BKP_BASE (APB1PERIPH_BASE + 0x2840) ///< Base Address: 0x40002840
  32. ////////////////////////////////////////////////////////////////////////////////
  33. /// @brief BKP Register Structure Definition
  34. ////////////////////////////////////////////////////////////////////////////////
  35. #define BKP_NUMBER 20
  36. typedef struct {
  37. __IO u32 RTCCR; ///< RTC clock calibration register, offset: 0x00
  38. __IO u32 CR; ///< BKP control register, offset: 0x04
  39. __IO u32 CSR; ///< BKP control/status register, offset: 0x08
  40. __IO u32 RESERVED0; ///< Reserved, offset: 0x0C
  41. __IO u32 DR1; ///< BKP data register 1, offset: 0x10
  42. __IO u32 DR2; ///< BKP data register 2, offset: 0x14
  43. __IO u32 DR3; ///< BKP data register 3, offset: 0x18
  44. __IO u32 DR4; ///< BKP data register 4, offset: 0x1C
  45. __IO u32 DR5; ///< BKP data register 5, offset: 0x20
  46. __IO u32 DR6; ///< BKP data register 6, offset: 0x24
  47. __IO u32 DR7; ///< BKP data register 7, offset: 0x28
  48. __IO u32 DR8; ///< BKP data register 8, offset: 0x2C
  49. __IO u32 DR9; ///< BKP data register 9, offset: 0x30
  50. __IO u32 DR10; ///< BKP data register 10 offset: 0x34
  51. __IO u32 DR11; ///< BKP data register 11, offset: 0x38
  52. __IO u32 DR12; ///< BKP data register 12, offset: 0x3C
  53. __IO u32 DR13; ///< BKP data register 13, offset: 0x40
  54. __IO u32 DR14; ///< BKP data register 14, offset: 0x44
  55. __IO u32 DR15; ///< BKP data register 15, offset: 0x48
  56. __IO u32 DR16; ///< BKP data register 16, offset: 0x4C
  57. __IO u32 DR17; ///< BKP data register 17, offset: 0x50
  58. __IO u32 DR18; ///< BKP data register 18, offset: 0x54
  59. __IO u32 DR19; ///< BKP data register 19, offset: 0x58
  60. __IO u32 DR20; ///< BKP data register 20, offset: 0x5C
  61. } BKP_TypeDef;
  62. ////////////////////////////////////////////////////////////////////////////////
  63. /// @brief BKP type pointer Definition
  64. ////////////////////////////////////////////////////////////////////////////////
  65. #define BKP ((BKP_TypeDef*) BKP_BASE)
  66. ////////////////////////////////////////////////////////////////////////////////
  67. /// @brief BKP_DRn Register Bit Definition
  68. ////////////////////////////////////////////////////////////////////////////////
  69. #define BKP_DR_DATA_Pos (0)
  70. #define BKP_DR_DATA (0xFFFFU << BKP_DR_DATA) ///< Backup data
  71. ////////////////////////////////////////////////////////////////////////////////
  72. /// @brief BKP_RTCCR Register Bit Definition
  73. ////////////////////////////////////////////////////////////////////////////////
  74. #define BKP_RTCCR_CAL_Pos (0)
  75. #define BKP_RTCCR_CAL (0x7FU << BKP_RTCCR_CAL_Pos) ///< Calibration value
  76. #define BKP_RTCCR_CCO_Pos (7)
  77. #define BKP_RTCCR_CCO (0x01U << BKP_RTCCR_CCO_Pos) ///< Calibration Clock Output
  78. #define BKP_RTCCR_ASOE_Pos (8)
  79. #define BKP_RTCCR_ASOE (0x01U << BKP_RTCCR_ASOE_Pos) ///< Alarm or Second Output Enable
  80. #define BKP_RTCCR_ASOS_Pos (9)
  81. #define BKP_RTCCR_ASOS (0x01U << BKP_RTCCR_ASOS_Pos) ///< Alarm or Second Output Selection
  82. ////////////////////////////////////////////////////////////////////////////////
  83. /// @brief BKP_CR Register Bit Definition
  84. ////////////////////////////////////////////////////////////////////////////////
  85. #define BKP_CR_TPE_Pos (0)
  86. #define BKP_CR_TPE (0x01U << BKP_CR_TPE_Pos) ///< TAMPER pin enable
  87. #define BKP_CR_TPAL_Pos (1)
  88. #define BKP_CR_TPAL (0x01U << BKP_CR_TPAL_Pos) ///< TAMPER pin active level
  89. ////////////////////////////////////////////////////////////////////////////////
  90. /// @brief BKP_CSR Register Bit Definition
  91. ////////////////////////////////////////////////////////////////////////////////
  92. #define BKP_CSR_CTE_Pos (0)
  93. #define BKP_CSR_CTE (0x01U << BKP_CSR_CTE_Pos) ///< Clear Tamper event
  94. #define BKP_CSR_CTI_Pos (1)
  95. #define BKP_CSR_CTI (0x01U << BKP_CSR_CTI_Pos) ///< Clear Tamper Interrupt
  96. #define BKP_CSR_TPIE_Pos (2)
  97. #define BKP_CSR_TPIE (0x01U << BKP_CSR_TPIE_Pos) ///< TAMPER Pin interrupt enable
  98. #define BKP_CSR_TEF_Pos (8)
  99. #define BKP_CSR_TEF (0x01U << BKP_CSR_TEF_Pos) ///< Tamper Event Flag
  100. #define BKP_CSR_TIF_Pos (9)
  101. #define BKP_CSR_TIF (0x01U << BKP_CSR_TIF_Pos) ///< Tamper Interrupt Flag
  102. /// @}
  103. /// @}
  104. /// @}
  105. ////////////////////////////////////////////////////////////////////////////////
  106. #endif
  107. ////////////////////////////////////////////////////////////////////////////////