1 /*! 2 * @file apm32f0xx_ob.c 3 * 4 * @brief This file contains all the functions for the OB peripheral 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 #include "apm32f0xx_ob.h" 27 28 /** @addtogroup APM32F0xx_StdPeriphDriver 29 @{ 30 */ 31 32 /** @addtogroup OB_Driver 33 @{ 34 */ 35 36 /** @defgroup OB_Macros Macros 37 @{ 38 */ 39 40 /**@} end of group OB_Macros*/ 41 42 /** @defgroup OB_Enumerations Enumerations 43 @{ 44 */ 45 46 /**@} end of group OB_Enumerations*/ 47 48 /** @defgroup OB_Structures Structures 49 @{ 50 */ 51 52 /**@} end of group OB_Structures*/ 53 54 /** @defgroup OB_Variables Variables 55 @{ 56 */ 57 58 /**@} end of group OB_Variables*/ 59 60 /** @defgroup OB_Functions Functions 61 @{ 62 */ 63 64 /*! 65 * @brief Read Flash Protection Level 66 * 67 * @param readProtection: Specifies the read protection level. 68 * The parameter can be one of following values: 69 * @arg OB_READ_PRO_LEVEL0: No protection 70 * @arg OB_READ_PRO_LEVEL1: Read protection of the memory 71 * @retval None 72 */ OB_ReadProtectionOptionByte(OB_READ_PRO_T readProtection)73void OB_ReadProtectionOptionByte(OB_READ_PRO_T readProtection) 74 { 75 OB->READPORT_B.READPROT = readProtection; 76 } 77 78 /*! 79 * @brief Option Bytes Watchdog 80 * 81 * @param wdt: Select Watchdog SW/HW 82 * 83 * @retval None 84 */ OB_OptionBytesWatchdog(OB_WDT_T wdt)85void OB_OptionBytesWatchdog(OB_WDT_T wdt) 86 { 87 OB->USER_B.WDTSEL = wdt; 88 } 89 90 /*! 91 * @brief Option Bytes nRST STOP 92 * 93 * @param stop: Select nRST STOP RST/SET 94 * 95 * @retval None 96 */ OB_OptionBytesStop(OB_STOP_T stop)97void OB_OptionBytesStop(OB_STOP_T stop) 98 { 99 OB->USER_B.RSTSTOP = stop; 100 } 101 102 /*! 103 * @brief Option Bytes nRST STDBY 104 * 105 * @param standby: Select nRST STDBY RST/SET 106 * 107 * @retval None 108 */ OB_OptionBytesStandby(OB_STANDBY_T standby)109void OB_OptionBytesStandby(OB_STANDBY_T standby) 110 { 111 OB->USER_B.RSTSTDBY = standby; 112 } 113 114 /*! 115 * @brief Option Bytes nBOOT1 116 * 117 * @param boot: Select nRST BOOT1 RST/SET 118 * 119 * @retval None 120 */ OB_OptionBytesBoot1(OB_BOOT1_T boot)121void OB_OptionBytesBoot1(OB_BOOT1_T boot) 122 { 123 OB->USER_B.BOT1 = boot; 124 } 125 126 /*! 127 * @brief Option Bytes VDDA_Analog_Monitoring 128 * 129 * @param vdda: Select VDDA ANALOG OFF/ON 130 * 131 * @retval None 132 */ OB_OptionBytesVddaAnalog(OB_VDDA_T vdda)133void OB_OptionBytesVddaAnalog(OB_VDDA_T vdda) 134 { 135 OB->USER_B.VDDAMON = vdda; 136 } 137 138 /*! 139 * @brief Option Bytes RAM PARITY CHECK 140 * 141 * @param rpc: Select RAM PARITY OFF/ON 142 * 143 * @retval None 144 */ OB_OptionBytesRamParity(OB_RAM_PARITY_CHECK_T ramParityCheck)145void OB_OptionBytesRamParity(OB_RAM_PARITY_CHECK_T ramParityCheck) 146 { 147 OB->USER_B.RPC = ramParityCheck; 148 } 149 150 /**@} end of group OB_Functions */ 151 /**@} end of group OB_Driver */ 152 /**@} end of group APM32F0xx_StdPeriphDriver */ 153