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 26 /* Define to prevent recursive inclusion */ 27 #ifndef __APM32F0XX_OB_H 28 #define __APM32F0XX_OB_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 /* Includes */ 35 #include "apm32f0xx.h" 36 37 /** @addtogroup APM32F0xx_StdPeriphDriver 38 @{ 39 */ 40 41 /** @addtogroup OB_Driver 42 @{ 43 */ 44 45 /** @defgroup OB_Macros Macros 46 @{ 47 */ 48 49 /**@} end of group OB_Macros*/ 50 51 52 /** @defgroup OB_Enumerations Enumerations 53 @{ 54 */ 55 56 /** 57 * @brief Read protection option byte 58 */ 59 typedef enum 60 { 61 OB_READ_PRO_LEVEL0 = 0xAA, /*!< No protection */ 62 OB_READ_PRO_LEVEL1 = 0xBB, /*!< Read protection of the memory */ 63 } OB_READ_PRO_T; 64 65 /** 66 * @brief Option Bytes Watchdog 67 */ 68 typedef enum 69 { 70 OB_WDG_HW = ((uint8_t)0), /*!< Hardware Watchdog */ 71 OB_WDG_SW = ((uint8_t)1), /*!< Software Watchdog */ 72 } OB_WDT_T; 73 74 /** 75 * @brief Option Bytes nRST STOP 76 */ 77 typedef enum 78 { 79 OB_STOP_RESET = ((uint8_t)0), /*!< Reset Stop mode */ 80 OB_STOP_SET = ((uint8_t)1), /*!< Into Stop mode */ 81 } OB_STOP_T; 82 83 /** 84 * @brief Option Bytes nRST Standby 85 */ 86 typedef enum 87 { 88 OB_STANDBY_RST = ((uint8_t)0), /*!< Reset STANDBY mode */ 89 OB_STANDBY_SET = ((uint8_t)1), /*!< Into STANDBY mode */ 90 } OB_STANDBY_T; 91 92 /** 93 * @brief Option Bytes nBOOT1 94 */ 95 typedef enum 96 { 97 OB_BOOT1_RST = ((uint8_t)0), /*!< Reset BOOT1 */ 98 OB_BOOT1_SET = ((uint8_t)1), /*!< Into BOOT1 */ 99 } OB_BOOT1_T; 100 101 /** 102 * @brief Option Bytes VDDA_Analog_Monitoring 103 */ 104 typedef enum 105 { 106 OB_VDDA_OFF = ((uint8_t)0), /*!< VDDA_Analog_Monitoring off */ 107 OB_VDDA_ON = ((uint8_t)1), /*!< VDDA_Analog_Monitoring on */ 108 } OB_VDDA_T; 109 110 /** 111 * @brief Option Bytes RAM PARITY CHECK 112 */ 113 typedef enum 114 { 115 OB_RAM_PARITY_CHECK_ENABLE = ((uint8_t)0), /*!< Enable Option Bytes RAM PARITY CHECK*/ 116 OB_RAM_PARITY_CHECK_DISABLE = ((uint8_t)1), /*!< Disbale Option Bytes RAM PARITY CHECK */ 117 } OB_RAM_PARITY_CHECK_T; 118 119 /**@} end of group OB_Enumerations*/ 120 121 /** @defgroup OB_Structures Structures 122 @{ 123 */ 124 125 /** 126 * @brief User Option byte config struct definition 127 */ 128 typedef struct 129 { 130 OB_READ_PRO_T readProtection; /*!< Read protection option byte */ 131 OB_WDT_T wdt; /*!< Watch dog activation */ 132 OB_STOP_T stop; /*!< Option Bytes nRST STOP */ 133 OB_STANDBY_T stdby; /*!< Option Bytes nRST STDBY */ 134 OB_BOOT1_T boot; /*!< Option Bytes nBOOT1 */ 135 OB_VDDA_T vdda; /*!< Option Bytes nRST STOP */ 136 OB_RAM_PARITY_CHECK_T ramParityCheck; /*!< Option Bytes RAM PARITY CHECK */ 137 } OB_UserConfig_T; 138 139 /**@} end of group OB_Structures*/ 140 141 /** @defgroup OB_Variables Variables 142 @{ 143 */ 144 145 /**@} end of group OB_Variables*/ 146 147 /** @defgroup OB_Functions Functions 148 @{ 149 */ 150 151 /* Read protection option byte */ 152 void OB_ReadProtectionOptionByte(OB_READ_PRO_T readProtection); 153 154 /* Option Bytes Watchdog */ 155 void OB_OptionBytesWatchdog(OB_WDT_T wdt); 156 157 /* Option Bytes nRST STOP */ 158 void OB_OptionBytesStop(OB_STOP_T stop); 159 160 /* Option Bytes nRST STDBY */ 161 void OB_OptionBytesStandby(OB_STANDBY_T standby); 162 163 /* Option Bytes nBOOT1 */ 164 void OB_OptionBytesBoot1(OB_BOOT1_T boot); 165 166 /* Option Bytes VDDA_Analog_Monitoring */ 167 void OB_OptionBytesVddaAnalog(OB_VDDA_T vdda); 168 169 /* Option Bytes RAM PARITY CHECK */ 170 void OB_OptionBytesRamParity(OB_RAM_PARITY_CHECK_T ramParityCheck); 171 172 #ifdef __cplusplus 173 } 174 #endif 175 176 #endif /* __APM32F0XX_OB_H */ 177 178 /**@} end of group OB_Functions*/ 179 /**@} end of group OB_Driver */ 180 /**@} end of group APM32F0xx_StdPeriphDriver*/ 181