📄 stm32f10x_wwdg.lst
字号:
###############################################################################
# #
# 30/Jul/2008 11:02:20 #
# 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_wwdg.c #
# Command line = E:\library\src\stm32f10x_wwdg.c -D EMB_FLASH -lcN #
# E:\ELE\yten\pro\Release\List\ -o #
# E:\ELE\yten\pro\Release\Obj\ --no_cse --no_unroll #
# --no_inline --no_code_motion --no_tbaa --no_clustering #
# --no_scheduling --debug --endian little --cpu Cortex-M3 #
# -e --fpu None --dlib_config "C:\Program Files\IAR #
# Systems\Embedded Workbench 5.0 #
# Evaluation\ARM\INC\DLib_Config_Normal.h" -I #
# E:\ELE\yten\pro\ -I E:\ELE\yten\pro\..\LIBRARY\INC\ -I #
# "C:\Program Files\IAR Systems\Embedded Workbench 5.0 #
# Evaluation\ARM\INC\" -On #
# List file = E:\ELE\yten\pro\Release\List\stm32f10x_wwdg.lst #
# Object file = E:\ELE\yten\pro\Release\Obj\stm32f10x_wwdg.o #
# #
# #
###############################################################################
E:\library\src\stm32f10x_wwdg.c
1 /******************** (C) COPYRIGHT 2007 STMicroelectronics ********************
2 * File Name : stm32f10x_wwdg.c
3 * Author : MCD Application Team
4 * Version : V1.0
5 * Date : 10/08/2007
6 * Description : This file provides all the WWDG 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_wwdg.h"
18 #include "stm32f10x_rcc.h"
19
20 /* Private typedef -----------------------------------------------------------*/
21 /* Private define ------------------------------------------------------------*/
22 /* ----------- WWDG registers bit address in the alias region ----------- */
23 #define WWDG_OFFSET (WWDG_BASE - PERIPH_BASE)
24
25 /* Alias word address of EWI bit */
26 #define CFR_OFFSET (WWDG_OFFSET + 0x04)
27 #define EWI_BitNumber 0x09
28 #define CFR_EWI_BB (PERIPH_BB_BASE + (CFR_OFFSET * 32) + (EWI_BitNumber * 4))
29
30 /* Alias word address of EWIF bit */
31 #define SR_OFFSET (WWDG_OFFSET + 0x08)
32 #define EWIF_BitNumber 0x00
33 #define SR_EWIF_BB (PERIPH_BB_BASE + (SR_OFFSET * 32) + (EWIF_BitNumber * 4))
34
35 /* --------------------- WWDG registers bit mask ------------------------ */
36 /* CR register bit mask */
37 #define CR_WDGA_Set ((u32)0x00000080)
38
39 /* CFR register bit mask */
40 #define CFR_WDGTB_Mask ((u32)0xFFFFFE7F)
41 #define CFR_W_Mask ((u32)0xFFFFFF80)
42
43 #define BIT_Mask ((u8)0x7F)
44
45 /* Private macro -------------------------------------------------------------*/
46 /* Private variables ---------------------------------------------------------*/
47 /* Private function prototypes -----------------------------------------------*/
48 /* Private functions ---------------------------------------------------------*/
49
50 /*******************************************************************************
51 * Function Name : WWDG_DeInit
52 * Description : Deinitializes the WWDG peripheral registers to their default
53 * reset values.
54 * Input : None
55 * Output : None
56 * Return : None
57 *******************************************************************************/
58 void WWDG_DeInit(void)
59 {
60 RCC_APB1PeriphResetCmd(RCC_APB1Periph_WWDG, ENABLE);
61 RCC_APB1PeriphResetCmd(RCC_APB1Periph_WWDG, DISABLE);
62 }
63
64 /*******************************************************************************
65 * Function Name : WWDG_SetPrescaler
66 * Description : Sets the WWDG Prescaler.
67 * Input : - WWDG_Prescaler: specifies the WWDG Prescaler.
68 * This parameter can be one of the following values:
69 * - WWDG_Prescaler_1: WWDG counter clock = (PCLK1/4096)/1
70 * - WWDG_Prescaler_2: WWDG counter clock = (PCLK1/4096)/2
71 * - WWDG_Prescaler_4: WWDG counter clock = (PCLK1/4096)/4
72 * - WWDG_Prescaler_8: WWDG counter clock = (PCLK1/4096)/8
73 * Output : None
74 * Return : None
75 *******************************************************************************/
76 void WWDG_SetPrescaler(u32 WWDG_Prescaler)
77 {
78 u32 tmpreg = 0;
79
80 /* Check the parameters */
81 assert_param(IS_WWDG_PRESCALER(WWDG_Prescaler));
82
83 /* Clear WDGTB[8:7] bits */
84 tmpreg = WWDG->CFR & CFR_WDGTB_Mask;
85
86 /* Set WDGTB[8:7] bits according to WWDG_Prescaler value */
87 tmpreg |= WWDG_Prescaler;
88
89 /* Store the new value */
90 WWDG->CFR = tmpreg;
91 }
92
93 /*******************************************************************************
94 * Function Name : WWDG_SetWindowValue
95 * Description : Sets the WWDG window value.
96 * Input : - WindowValue: specifies the window value to be compared to
97 * the downcounter.
98 * This parameter value must be lower than 0x80.
99 * Output : None
100 * Return : None
101 *******************************************************************************/
102 void WWDG_SetWindowValue(u8 WindowValue)
103 {
104 u32 tmpreg = 0;
105
106 /* Check the parameters */
107 assert_param(IS_WWDG_WINDOW_VALUE(WindowValue));
108
109 /* Clear W[6:0] bits */
110 tmpreg = WWDG->CFR & CFR_W_Mask;
111
112 /* Set W[6:0] bits according to WindowValue value */
113 tmpreg |= WindowValue & BIT_Mask;
114
115 /* Store the new value */
116 WWDG->CFR = tmpreg;
117 }
118
119 /*******************************************************************************
120 * Function Name : WWDG_EnableIT
121 * Description : Enables the WWDG Early Wakeup interrupt(EWI).
122 * Input : None
123 * Output : None
124 * Return : None
125 *******************************************************************************/
126 void WWDG_EnableIT(void)
127 {
128 *(vu32 *) CFR_EWI_BB = (u32)ENABLE;
129 }
130
131 /*******************************************************************************
132 * Function Name : WWDG_SetCounter
133 * Description : Sets the WWDG counter value.
134 * Input : - Counter: specifies the watchdog counter value.
135 * This parameter must be a number between 0x40 and 0x7F.
136 * Output : None
137 * Return : None
138 *******************************************************************************/
139 void WWDG_SetCounter(u8 Counter)
140 {
141 /* Check the parameters */
142 assert_param(IS_WWDG_COUNTER(Counter));
143
144 /* Write to T[6:0] bits to configure the counter value, no need to do
145 a read-modify-write; writing a 0 to WDGA bit does nothing */
146 WWDG->CR = Counter & BIT_Mask;
147 }
148
149 /*******************************************************************************
150 * Function Name : WWDG_Enable
151 * Description : Enables WWDG and load the counter value.
152 * - Counter: specifies the watchdog counter value.
153 * This parameter must be a number between 0x40 and 0x7F.
154 * Input : None
155 * Output : None
156 * Return : None
157 *******************************************************************************/
158 void WWDG_Enable(u8 Counter)
159 {
160 /* Check the parameters */
161 assert_param(IS_WWDG_COUNTER(Counter));
162
163 WWDG->CR = CR_WDGA_Set | Counter;
164 }
165
166 /*******************************************************************************
167 * Function Name : WWDG_GetFlagStatus
168 * Description : Checks whether the Early Wakeup interrupt flag is set or not.
169 * Input : None
170 * Output : None
171 * Return : The new state of the Early Wakeup interrupt flag (SET or RESET)
172 *******************************************************************************/
173 FlagStatus WWDG_GetFlagStatus(void)
174 {
175 return (FlagStatus)(*(vu32 *) SR_EWIF_BB);
176 }
177
178 /*******************************************************************************
179 * Function Name : WWDG_ClearFlag
180 * Description : Clears Early Wakeup interrupt flag.
181 * Input : None
182 * Output : None
183 * Return : None
184 *******************************************************************************/
185 void WWDG_ClearFlag(void)
186 {
187 WWDG->SR = (u32)RESET;
188 }
189
190 /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
Maximum stack usage in bytes:
Function .cstack
-------- -------
WWDG_ClearFlag 0
WWDG_DeInit 8
WWDG_Enable 0
WWDG_EnableIT 0
WWDG_GetFlagStatus 0
WWDG_SetCounter 0
WWDG_SetPrescaler 0
WWDG_SetWindowValue 0
Section sizes:
Function/Label Bytes
-------------- -----
WWDG_DeInit 26
WWDG_SetPrescaler 24
WWDG_SetWindowValue 30
WWDG_EnableIT 12
WWDG_SetCounter 12
WWDG_Enable 12
WWDG_GetFlagStatus 12
WWDG_ClearFlag 12
??DataTable3 4
??DataTable5 4
148 bytes in section .text
148 bytes of CODE memory
Errors: none
Warnings: none
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -