📄 stm32f10x_pwr.lst
字号:
###############################################################################
# #
# 06/Jun/2008 15:47:45 #
# IAR ARM ANSI C/C++ Compiler V5.11.0.20622/W32 EVALUATION #
# Copyright 1999-2007 IAR Systems. All rights reserved. #
# #
# Cpu mode = thumb #
# Endian = little #
# Source file = E:\library\src\stm32f10x_pwr.c #
# Command line = E:\library\src\stm32f10x_pwr.c -lcN #
# E:\ELE\yten\pro\Debug\List\ -o #
# E:\ELE\yten\pro\Debug\Obj\ --debug --endian little #
# --cpu Cortex-M3 -e --fpu None --dlib_config #
# D:\IARARM\ARM\INC\DLib_Config_Normal.h -I #
# E:\ELE\yten\pro\ -I E:\ELE\yten\pro\..\LIBRARY\INC\ -I #
# D:\IARARM\ARM\INC\ -Oh #
# List file = E:\ELE\yten\pro\Debug\List\stm32f10x_pwr.lst #
# Object file = E:\ELE\yten\pro\Debug\Obj\stm32f10x_pwr.o #
# #
# #
###############################################################################
E:\library\src\stm32f10x_pwr.c
1 /******************** (C) COPYRIGHT 2007 STMicroelectronics ********************
2 * File Name : stm32f10x_pwr.c
3 * Author : MCD Application Team
4 * Version : V1.0
5 * Date : 10/08/2007
6 * Description : This file provides all the PWR firmware functions.
7 ********************************************************************************
8 * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
9 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
10 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
11 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
12 * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
13 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
14 *******************************************************************************/
15
16 /* Includes ------------------------------------------------------------------*/
17 #include "stm32f10x_pwr.h"
18 #include "stm32f10x_rcc.h"
19
20 /* Private typedef -----------------------------------------------------------*/
21 /* Private define ------------------------------------------------------------*/
22 /* --------- PWR registers bit address in the alias region ---------- */
23 #define PWR_OFFSET (PWR_BASE - PERIPH_BASE)
24
25 /* --- CR Register ---*/
26 /* Alias word address of DBP bit */
27 #define CR_OFFSET (PWR_OFFSET + 0x00)
28 #define DBP_BitNumber 0x08
29 #define CR_DBP_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (DBP_BitNumber * 4))
30
31 /* Alias word address of PVDE bit */
32 #define PVDE_BitNumber 0x04
33 #define CR_PVDE_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (PVDE_BitNumber * 4))
34
35 /* --- CSR Register ---*/
36 /* Alias word address of EWUP bit */
37 #define CSR_OFFSET (PWR_OFFSET + 0x04)
38 #define EWUP_BitNumber 0x08
39 #define CSR_EWUP_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (EWUP_BitNumber * 4))
40
41 /* ------------------ PWR registers bit mask ------------------------ */
42 /* CR register bit mask */
43 #define CR_PDDS_Set ((u32)0x00000002)
44 #define CR_DS_Mask ((u32)0xFFFFFFFC)
45 #define CR_CWUF_Set ((u32)0x00000004)
46 #define CR_PLS_Mask ((u32)0xFFFFFF1F)
47
48 /* --------- Cortex System Control register bit mask ---------------- */
49 /* Cortex System Control register address */
50 #define SCB_SysCtrl ((u32)0xE000ED10)
51 /* SLEEPDEEP bit mask */
52 #define SysCtrl_SLEEPDEEP_Set ((u32)0x00000004)
53
54 /* Private macro -------------------------------------------------------------*/
55 /* Private variables ---------------------------------------------------------*/
56 /* Private function prototypes -----------------------------------------------*/
57 /* Private functions ---------------------------------------------------------*/
58
59 /*******************************************************************************
60 * Function Name : PWR_DeInit
61 * Description : Deinitializes the PWR peripheral registers to their default
62 * reset values.
63 * Input : None
64 * Output : None
65 * Return : None
66 *******************************************************************************/
67 void PWR_DeInit(void)
68 {
69 RCC_APB1PeriphResetCmd(RCC_APB1Periph_PWR, ENABLE);
70 RCC_APB1PeriphResetCmd(RCC_APB1Periph_PWR, DISABLE);
71 }
72
73 /*******************************************************************************
74 * Function Name : PWR_BackupAccessCmd
75 * Description : Enables or disables access to the RTC and backup registers.
76 * Input : - NewState: new state of the access to the RTC and backup
77 * registers. This parameter can be: ENABLE or DISABLE.
78 * Output : None
79 * Return : None
80 *******************************************************************************/
81 void PWR_BackupAccessCmd(FunctionalState NewState)
82 {
83 /* Check the parameters */
84 assert_param(IS_FUNCTIONAL_STATE(NewState));
85
86 *(vu32 *) CR_DBP_BB = (u32)NewState;
87 }
88
89 /*******************************************************************************
90 * Function Name : PWR_PVDCmd
91 * Description : Enables or disables the Power Voltage Detector(PVD).
92 * Input : - NewState: new state of the PVD.
93 * This parameter can be: ENABLE or DISABLE.
94 * Output : None
95 * Return : None
96 *******************************************************************************/
97 void PWR_PVDCmd(FunctionalState NewState)
98 {
99 /* Check the parameters */
100 assert_param(IS_FUNCTIONAL_STATE(NewState));
101
102 *(vu32 *) CR_PVDE_BB = (u32)NewState;
103 }
104
105 /*******************************************************************************
106 * Function Name : PWR_PVDLevelConfig
107 * Description : Configures the voltage threshold detected by the Power Voltage
108 * Detector(PVD).
109 * Input : - PWR_PVDLevel: specifies the PVD detection level
110 * This parameter can be one of the following values:
111 * - PWR_PVDLevel_2V2: PVD detection level set to 2.2V
112 * - PWR_PVDLevel_2V3: PVD detection level set to 2.3V
113 * - PWR_PVDLevel_2V4: PVD detection level set to 2.4V
114 * - PWR_PVDLevel_2V5: PVD detection level set to 2.5V
115 * - PWR_PVDLevel_2V6: PVD detection level set to 2.6V
116 * - PWR_PVDLevel_2V7: PVD detection level set to 2.7V
117 * - PWR_PVDLevel_2V8: PVD detection level set to 2.8V
118 * - PWR_PVDLevel_2V9: PVD detection level set to 2.9V
119 * Output : None
120 * Return : None
121 *******************************************************************************/
122 void PWR_PVDLevelConfig(u32 PWR_PVDLevel)
123 {
124 u32 tmpreg = 0;
125
126 /* Check the parameters */
127 assert_param(IS_PWR_PVD_LEVEL(PWR_PVDLevel));
128
129 tmpreg = PWR->CR;
130
131 /* Clear PLS[7:5] bits */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -