apm32f0xx_ob.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*!
  2. * @file apm32f0xx_ob.h
  3. *
  4. * @brief This file contains all the functions prototypes for the OB firmware library
  5. *
  6. * @version V1.0.3
  7. *
  8. * @date 2022-09-20
  9. *
  10. * @attention
  11. *
  12. * Copyright (C) 2020-2022 Geehy Semiconductor
  13. *
  14. * You may not use this file except in compliance with the
  15. * GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
  16. *
  17. * The program is only for reference, which is distributed in the hope
  18. * that it will be useful and instructional for customers to develop
  19. * their software. Unless required by applicable law or agreed to in
  20. * writing, the program is distributed on an "AS IS" BASIS, WITHOUT
  21. * ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
  23. * and limitations under the License.
  24. */
  25. /* Define to prevent recursive inclusion */
  26. #ifndef __APM32F0XX_OB_H
  27. #define __APM32F0XX_OB_H
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /* Includes */
  32. #include "apm32f0xx.h"
  33. /** @addtogroup APM32F0xx_StdPeriphDriver
  34. @{
  35. */
  36. /** @addtogroup OB_Driver
  37. @{
  38. */
  39. /** @defgroup OB_Macros Macros
  40. @{
  41. */
  42. /**@} end of group OB_Macros*/
  43. /** @defgroup OB_Enumerations Enumerations
  44. @{
  45. */
  46. /**
  47. * @brief Read protection option byte
  48. */
  49. typedef enum
  50. {
  51. OB_READ_PRO_LEVEL0 = 0xAA, /*!< No protection */
  52. OB_READ_PRO_LEVEL1 = 0xBB, /*!< Read protection of the memory */
  53. } OB_READ_PRO_T;
  54. /**
  55. * @brief Option Bytes Watchdog
  56. */
  57. typedef enum
  58. {
  59. OB_WDG_HW = ((uint8_t)0), /*!< Hardware Watchdog */
  60. OB_WDG_SW = ((uint8_t)1), /*!< Software Watchdog */
  61. } OB_WDT_T;
  62. /**
  63. * @brief Option Bytes nRST STOP
  64. */
  65. typedef enum
  66. {
  67. OB_STOP_RESET = ((uint8_t)0), /*!< Reset Stop mode */
  68. OB_STOP_SET = ((uint8_t)1), /*!< Into Stop mode */
  69. } OB_STOP_T;
  70. /**
  71. * @brief Option Bytes nRST Standby
  72. */
  73. typedef enum
  74. {
  75. OB_STANDBY_RST = ((uint8_t)0), /*!< Reset STANDBY mode */
  76. OB_STANDBY_SET = ((uint8_t)1), /*!< Into STANDBY mode */
  77. } OB_STANDBY_T;
  78. /**
  79. * @brief Option Bytes nBOOT1
  80. */
  81. typedef enum
  82. {
  83. OB_BOOT1_RST = ((uint8_t)0), /*!< Reset BOOT1 */
  84. OB_BOOT1_SET = ((uint8_t)1), /*!< Into BOOT1 */
  85. } OB_BOOT1_T;
  86. /**
  87. * @brief Option Bytes VDDA_Analog_Monitoring
  88. */
  89. typedef enum
  90. {
  91. OB_VDDA_OFF = ((uint8_t)0), /*!< VDDA_Analog_Monitoring off */
  92. OB_VDDA_ON = ((uint8_t)1), /*!< VDDA_Analog_Monitoring on */
  93. } OB_VDDA_T;
  94. /**
  95. * @brief Option Bytes RAM PARITY CHECK
  96. */
  97. typedef enum
  98. {
  99. OB_RAM_PARITY_CHECK_ENABLE = ((uint8_t)0), /*!< Enable Option Bytes RAM PARITY CHECK*/
  100. OB_RAM_PARITY_CHECK_DISABLE = ((uint8_t)1), /*!< Disbale Option Bytes RAM PARITY CHECK */
  101. } OB_RAM_PARITY_CHECK_T;
  102. /**@} end of group OB_Enumerations*/
  103. /** @defgroup OB_Structures Structures
  104. @{
  105. */
  106. /**
  107. * @brief User Option byte config struct definition
  108. */
  109. typedef struct
  110. {
  111. OB_READ_PRO_T readProtection; /*!< Read protection option byte */
  112. OB_WDT_T wdt; /*!< Watch dog activation */
  113. OB_STOP_T stop; /*!< Option Bytes nRST STOP */
  114. OB_STANDBY_T stdby; /*!< Option Bytes nRST STDBY */
  115. OB_BOOT1_T boot; /*!< Option Bytes nBOOT1 */
  116. OB_VDDA_T vdda; /*!< Option Bytes nRST STOP */
  117. OB_RAM_PARITY_CHECK_T ramParityCheck; /*!< Option Bytes RAM PARITY CHECK */
  118. } OB_UserConfig_T;
  119. /**@} end of group OB_Structures*/
  120. /** @defgroup OB_Variables Variables
  121. @{
  122. */
  123. /**@} end of group OB_Variables*/
  124. /** @defgroup OB_Functions Functions
  125. @{
  126. */
  127. /* Read protection option byte */
  128. void OB_ReadProtectionOptionByte(OB_READ_PRO_T readProtection);
  129. /* Option Bytes Watchdog */
  130. void OB_OptionBytesWatchdog(OB_WDT_T wdt);
  131. /* Option Bytes nRST STOP */
  132. void OB_OptionBytesStop(OB_STOP_T stop);
  133. /* Option Bytes nRST STDBY */
  134. void OB_OptionBytesStandby(OB_STANDBY_T standby);
  135. /* Option Bytes nBOOT1 */
  136. void OB_OptionBytesBoot1(OB_BOOT1_T boot);
  137. /* Option Bytes VDDA_Analog_Monitoring */
  138. void OB_OptionBytesVddaAnalog(OB_VDDA_T vdda);
  139. /* Option Bytes RAM PARITY CHECK */
  140. void OB_OptionBytesRamParity(OB_RAM_PARITY_CHECK_T ramParityCheck);
  141. #ifdef __cplusplus
  142. }
  143. #endif
  144. #endif /* __APM32F0XX_OB_H */
  145. /**@} end of group OB_Functions*/
  146. /**@} end of group OB_Driver */
  147. /**@} end of group APM32F0xx_StdPeriphDriver*/