📄 stm32f10x_nvic.lst
字号:
###############################################################################
# #
# 30/Jul/2008 11:02:24 #
# 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_nvic.c #
# Command line = E:\library\src\stm32f10x_nvic.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_nvic.lst #
# Object file = E:\ELE\yten\pro\Release\Obj\stm32f10x_nvic.o #
# #
# #
###############################################################################
E:\library\src\stm32f10x_nvic.c
1 /******************** (C) COPYRIGHT 2007 STMicroelectronics ********************
2 * File Name : stm32f10x_nvic.c
3 * Author : MCD Application Team
4 * Version : V1.0
5 * Date : 10/08/2007
6 * Description : This file provides all the NVIC 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_nvic.h"
18
19 /* Private typedef -----------------------------------------------------------*/
20 /* Private define ------------------------------------------------------------*/
21 #define AIRCR_VECTKEY_MASK ((u32)0x05FA0000)
22
23 /* Private macro -------------------------------------------------------------*/
24 /* Private variables ---------------------------------------------------------*/
25 /* Private function prototypes -----------------------------------------------*/
26 /* Private functions ---------------------------------------------------------*/
27
28 /*******************************************************************************
29 * Function Name : NVIC_DeInit
30 * Description : Deinitializes the NVIC peripheral registers to their default
31 * reset values.
32 * Input : None
33 * Output : None
34 * Return : None
35 *******************************************************************************/
36 void NVIC_DeInit(void)
37 {
38 u32 index = 0;
39
40 NVIC->ICER[0] = 0xFFFFFFFF;
41 NVIC->ICER[1] = 0x000007FF;
42 NVIC->ICPR[0] = 0xFFFFFFFF;
43 NVIC->ICPR[1] = 0x000007FF;
44
45 for(index = 0; index < 0x0B; index++)
46 {
47 NVIC->IPR[index] = 0x00000000;
48 }
49 }
50
51 /*******************************************************************************
52 * Function Name : NVIC_SCBDeInit
53 * Description : Deinitializes the SCB peripheral registers to their default
54 * reset values.
55 * Input : None
56 * Output : None
57 * Return : None
58 *******************************************************************************/
59 void NVIC_SCBDeInit(void)
60 {
61 u32 index = 0x00;
62
63 SCB->ICSR = 0x0A000000;
64 SCB->VTOR = 0x00000000;
65 SCB->AIRCR = AIRCR_VECTKEY_MASK;
66 SCB->SCR = 0x00000000;
67 SCB->CCR = 0x00000000;
68 for(index = 0; index < 0x03; index++)
69 {
70 SCB->SHPR[index] = 0;
71 }
72 SCB->SHCSR = 0x00000000;
73 SCB->CFSR = 0xFFFFFFFF;
74 SCB->HFSR = 0xFFFFFFFF;
75 SCB->DFSR = 0xFFFFFFFF;
76 }
77
78 /*******************************************************************************
79 * Function Name : NVIC_PriorityGroupConfig
80 * Description : Configures the priority grouping: pre-emption priority
81 * and subpriority.
82 * Input : - NVIC_PriorityGroup: specifies the priority grouping bits
83 * length. This parameter can be one of the following values:
84 * - NVIC_PriorityGroup_0: 0 bits for pre-emption priority
85 * 4 bits for subpriority
86 * - NVIC_PriorityGroup_1: 1 bits for pre-emption priority
87 * 3 bits for subpriority
88 * - NVIC_PriorityGroup_2: 2 bits for pre-emption priority
89 * 2 bits for subpriority
90 * - NVIC_PriorityGroup_3: 3 bits for pre-emption priority
91 * 1 bits for subpriority
92 * - NVIC_PriorityGroup_4: 4 bits for pre-emption priority
93 * 0 bits for subpriority
94 * Output : None
95 * Return : None
96 *******************************************************************************/
97 void NVIC_PriorityGroupConfig(u32 NVIC_PriorityGroup)
98 {
99 /* Check the parameters */
100 assert_param(IS_NVIC_PRIORITY_GROUP(NVIC_PriorityGroup));
101
102 /* Set the PRIGROUP[10:8] bits according to NVIC_PriorityGroup value */
103 SCB->AIRCR = AIRCR_VECTKEY_MASK | NVIC_PriorityGroup;
104 }
105
106 /*******************************************************************************
107 * Function Name : NVIC_Init
108 * Description : Initializes the NVIC peripheral according to the specified
109 * parameters in the NVIC_InitStruct.
110 * Input : - NVIC_InitStruct: pointer to a NVIC_InitTypeDef structure
111 * that contains the configuration information for the
112 * specified NVIC peripheral.
113 * Output : None
114 * Return : None
115 *******************************************************************************/
116 void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct)
117 {
118 u32 tmppriority = 0x00, tmpreg = 0x00, tmpmask = 0x00;
119 u32 tmppre = 0, tmpsub = 0x0F;
120
121 /* Check the parameters */
122 assert_param(IS_FUNCTIONAL_STATE(NVIC_InitStruct->NVIC_IRQChannelCmd));
123 assert_param(IS_NVIC_IRQ_CHANNEL(NVIC_InitStruct->NVIC_IRQChannel));
124 assert_param(IS_NVIC_PREEMPTION_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority));
125 assert_param(IS_NVIC_SUB_PRIORITY(NVIC_InitStruct->NVIC_IRQChannelSubPriority));
126
127 if (NVIC_InitStruct->NVIC_IRQChannelCmd != DISABLE)
128 {
129 /* Compute the Corresponding IRQ Priority --------------------------------*/
130 tmppriority = (0x700 - (SCB->AIRCR & (u32)0x700))>> 0x08;
131 tmppre = (0x4 - tmppriority);
132 tmpsub = tmpsub >> tmppriority;
133
134 tmppriority = (u32)NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority << tmppre;
135 tmppriority |= NVIC_InitStruct->NVIC_IRQChannelSubPriority & tmpsub;
136
137 tmppriority = tmppriority << 0x04;
138 tmppriority = ((u32)tmppriority) << ((NVIC_InitStruct->NVIC_IRQChannel & (u8)0x03) * 0x08);
139
140 tmpreg = NVIC->IPR[(NVIC_InitStruct->NVIC_IRQChannel >> 0x02)];
141 tmpmask = (u32)0xFF << ((NVIC_InitStruct->NVIC_IRQChannel & (u8)0x03) * 0x08);
142 tmpreg &= ~tmpmask;
143 tmppriority &= tmpmask;
144 tmpreg |= tmppriority;
145
146 NVIC->IPR[(NVIC_InitStruct->NVIC_IRQChannel >> 0x02)] = tmpreg;
147
148 /* Enable the Selected IRQ Channels --------------------------------------*/
149 NVIC->ISER[(NVIC_InitStruct->NVIC_IRQChannel >> 0x05)] =
150 (u32)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (u8)0x1F);
151 }
152 else
153 {
154 /* Disable the Selected IRQ Channels -------------------------------------*/
155 NVIC->ICER[(NVIC_InitStruct->NVIC_IRQChannel >> 0x05)] =
156 (u32)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (u8)0x1F);
157 }
158 }
159
160 /*******************************************************************************
161 * Function Name : NVIC_StructInit
162 * Description : Fills each NVIC_InitStruct member with its default value.
163 * Input : - NVIC_InitStruct: pointer to a NVIC_InitTypeDef structure which
164 * will be initialized.
165 * Output : None
166 * Return : None
167 *******************************************************************************/
168 void NVIC_StructInit(NVIC_InitTypeDef* NVIC_InitStruct)
169 {
170 /* NVIC_InitStruct members default value */
171 NVIC_InitStruct->NVIC_IRQChannel = 0x00;
172 NVIC_InitStruct->NVIC_IRQChannelPreemptionPriority = 0x00;
173 NVIC_InitStruct->NVIC_IRQChannelSubPriority = 0x00;
174 NVIC_InitStruct->NVIC_IRQChannelCmd = DISABLE;
175 }
176
177 /*******************************************************************************
178 * Function Name : NVIC_SETPRIMASK
179 * Description : Enables the PRIMASK priority: Raises the execution priority to 0.
180 * Input : None
181 * Output : None
182 * Return : None
183 *******************************************************************************/
184 void NVIC_SETPRIMASK(void)
185 {
186 __SETPRIMASK();
187 }
188
189 /*******************************************************************************
190 * Function Name : NVIC_RESETPRIMASK
191 * Description : Disables the PRIMASK priority.
192 * Input : None
193 * Output : None
194 * Return : None
195 *******************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -