📄 stm32f10x_iwdg.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_iwdg.c #
# Command line = E:\library\src\stm32f10x_iwdg.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_iwdg.lst #
# Object file = E:\ELE\yten\pro\Debug\Obj\stm32f10x_iwdg.o #
# #
# #
###############################################################################
E:\library\src\stm32f10x_iwdg.c
1 /******************** (C) COPYRIGHT 2007 STMicroelectronics ********************
2 * File Name : stm32f10x_iwdg.c
3 * Author : MCD Application Team
4 * Version : V1.0
5 * Date : 10/08/2007
6 * Description : This file provides all the IWDG 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_iwdg.h"
18
19 /* Private typedef -----------------------------------------------------------*/
20 /* Private define ------------------------------------------------------------*/
21 /* ---------------------- IWDG registers bit mask ------------------------ */
22 /* KR register bit mask */
23 #define KR_Reload ((u16)0xAAAA)
24 #define KR_Enable ((u16)0xCCCC)
25
26 /* Private macro -------------------------------------------------------------*/
27 /* Private variables ---------------------------------------------------------*/
28 /* Private function prototypes -----------------------------------------------*/
29 /* Private functions ---------------------------------------------------------*/
30
31 /*******************************************************************************
32 * Function Name : IWDG_WriteAccessCmd
33 * Description : Enables or disables write access to IWDG_PR and IWDG_RLR
34 * registers.
35 * Input : - IWDG_WriteAccess: new state of write access to IWDG_PR and
36 * IWDG_RLR registers.
37 * This parameter can be one of the following values:
38 * - IWDG_WriteAccess_Enable: Enable write access to
39 * IWDG_PR and IWDG_RLR registers
40 * - IWDG_WriteAccess_Disable: Disable write access to
41 * IWDG_PR and IWDG_RLR registers
42 * Output : None
43 * Return : None
44 *******************************************************************************/
45 void IWDG_WriteAccessCmd(u16 IWDG_WriteAccess)
46 {
47 /* Check the parameters */
48 assert_param(IS_IWDG_WRITE_ACCESS(IWDG_WriteAccess));
49
50 IWDG->KR = IWDG_WriteAccess;
51 }
52
53 /*******************************************************************************
54 * Function Name : IWDG_SetPrescaler
55 * Description : Sets IWDG Prescaler value.
56 * Input : - IWDG_Prescaler: specifies the IWDG Prescaler value.
57 * This parameter can be one of the following values:
58 * - IWDG_Prescaler_4: IWDG prescaler set to 4
59 * - IWDG_Prescaler_8: IWDG prescaler set to 8
60 * - IWDG_Prescaler_16: IWDG prescaler set to 16
61 * - IWDG_Prescaler_32: IWDG prescaler set to 32
62 * - IWDG_Prescaler_64: IWDG prescaler set to 64
63 * - IWDG_Prescaler_128: IWDG prescaler set to 128
64 * - IWDG_Prescaler_256: IWDG prescaler set to 256
65 * Output : None
66 * Return : None
67 *******************************************************************************/
68 void IWDG_SetPrescaler(u8 IWDG_Prescaler)
69 {
70 /* Check the parameters */
71 assert_param(IS_IWDG_PRESCALER(IWDG_Prescaler));
72
73 IWDG->PR = IWDG_Prescaler;
74 }
75
76 /*******************************************************************************
77 * Function Name : IWDG_SetReload
78 * Description : Sets IWDG Reload value.
79 * Input : - Reload: specifies the IWDG Reload value.
80 * This parameter must be a number between 0 and 0x0FFF.
81 * Output : None
82 * Return : None
83 *******************************************************************************/
84 void IWDG_SetReload(u16 Reload)
85 {
86 /* Check the parameters */
87 assert_param(IS_IWDG_RELOAD(Reload));
88
89 IWDG->RLR = Reload;
90 }
91
92 /*******************************************************************************
93 * Function Name : IWDG_ReloadCounter
94 * Description : Reloads IWDG counter with value defined in the reload register
95 * (write access to IWDG_PR and IWDG_RLR registers disabled).
96 * Input : None
97 * Output : None
98 * Return : None
99 *******************************************************************************/
100 void IWDG_ReloadCounter(void)
101 {
102 IWDG->KR = KR_Reload;
103 }
104
105 /*******************************************************************************
106 * Function Name : IWDG_Enable
107 * Description : Enables IWDG (write access to IWDG_PR and IWDG_RLR registers
108 * disabled).
109 * Input : None
110 * Output : None
111 * Return : None
112 *******************************************************************************/
113 void IWDG_Enable(void)
114 {
115 IWDG->KR = KR_Enable;
116 }
117
118 /*******************************************************************************
119 * Function Name : IWDG_GetFlagStatus
120 * Description : Checks whether the specified IWDG flag is set or not.
121 * Input : - IWDG_FLAG: specifies the flag to check.
122 * This parameter can be one of the following values:
123 * - IWDG_FLAG_PVU: Prescaler Value Update on going
124 * - IWDG_FLAG_RVU: Reload Value Update on going
125 * Output : None
126 * Return : The new state of IWDG_FLAG (SET or RESET).
127 *******************************************************************************/
128 FlagStatus IWDG_GetFlagStatus(u16 IWDG_FLAG)
129 {
130 FlagStatus bitstatus = RESET;
131
132 /* Check the parameters */
133 assert_param(IS_IWDG_FLAG(IWDG_FLAG));
134
135 if ((IWDG->SR & IWDG_FLAG) != (u32)RESET)
136 {
137 bitstatus = SET;
138 }
139 else
140 {
141 bitstatus = RESET;
142 }
143
144 /* Return the flag status */
145 return bitstatus;
146 }
147
148 /******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
Errors: 6
Warnings: none
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -