comparison libs/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/NVIC/IRQ_Priority/stm32f10x_it.c @ 0:c59513fd84fb

Initial commit of STM32 test code.
author Daniel O'Connor <darius@dons.net.au>
date Mon, 03 Oct 2011 21:19:15 +1030
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c59513fd84fb
1 /**
2 ******************************************************************************
3 * @file NVIC/IRQ_Priority/stm32f10x_it.c
4 * @author MCD Application Team
5 * @version V3.5.0
6 * @date 08-April-2011
7 * @brief Main Interrupt Service Routines.
8 * This file provides template for all exceptions handler and peripherals
9 * interrupt service routine.
10 ******************************************************************************
11 * @attention
12 *
13 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
14 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
15 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
16 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
17 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
18 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
19 *
20 * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
21 ******************************************************************************
22 */
23
24 /* Includes ------------------------------------------------------------------*/
25 #include "stm32f10x_it.h"
26 #include "stm32_eval.h"
27
28 /** @addtogroup STM32F10x_StdPeriph_Examples
29 * @{
30 */
31
32 /** @addtogroup IRQ_Priority
33 * @{
34 */
35
36 /* Private typedef -----------------------------------------------------------*/
37 /* Private define ------------------------------------------------------------*/
38 /* Private macro -------------------------------------------------------------*/
39 /* Private variables ---------------------------------------------------------*/
40 extern uint8_t PreemptionOccured;
41 extern uint8_t PreemptionPriorityValue;
42
43 /* Private function prototypes -----------------------------------------------*/
44 /* Private functions ---------------------------------------------------------*/
45
46 /******************************************************************************/
47 /* Cortex-M3 Processor Exceptions Handlers */
48 /******************************************************************************/
49
50 /**
51 * @brief This function handles NMI exception.
52 * @param None
53 * @retval None
54 */
55 void NMI_Handler(void)
56 {
57 }
58
59 /**
60 * @brief This function handles Hard Fault exception.
61 * @param None
62 * @retval None
63 */
64 void HardFault_Handler(void)
65 {
66 /* Go to infinite loop when Hard Fault exception occurs */
67 while (1)
68 {
69 }
70 }
71
72 /**
73 * @brief This function handles Memory Manage exception.
74 * @param None
75 * @retval None
76 */
77 void MemManage_Handler(void)
78 {
79 /* Go to infinite loop when Memory Manage exception occurs */
80 while (1)
81 {
82 }
83 }
84
85 /**
86 * @brief This function handles Bus Fault exception.
87 * @param None
88 * @retval None
89 */
90 void BusFault_Handler(void)
91 {
92 /* Go to infinite loop when Bus Fault exception occurs */
93 while (1)
94 {
95 }
96 }
97
98 /**
99 * @brief This function handles Usage Fault exception.
100 * @param None
101 * @retval None
102 */
103 void UsageFault_Handler(void)
104 {
105 /* Go to infinite loop when Usage Fault exception occurs */
106 while (1)
107 {
108 }
109 }
110
111 /**
112 * @brief This function handles SVCall exception.
113 * @param None
114 * @retval None
115 */
116 void SVC_Handler(void)
117 {
118 }
119
120 /**
121 * @brief This function handles Debug Monitor exception.
122 * @param None
123 * @retval None
124 */
125 void DebugMon_Handler(void)
126 {
127 }
128
129 /**
130 * @brief This function handles PendSV_Handler exception.
131 * @param None
132 * @retval None
133 */
134 void PendSV_Handler(void)
135 {
136 }
137
138 /**
139 * @brief This function handles SysTick Handler.
140 * @param None
141 * @retval None
142 */
143 void SysTick_Handler(void)
144 {
145 /* If the EXTI0 IRQ Handler was preempted by SysTick Handler */
146 if(NVIC_GetActive(WAKEUP_BUTTON_EXTI_IRQn) != 0)
147 {
148 PreemptionOccured = 1;
149 }
150 }
151
152 /******************************************************************************/
153 /* STM32F10x Peripherals Interrupt Handlers */
154 /******************************************************************************/
155
156 /**
157 * @brief This function handles External interrupt Line 0 request.
158 * @param None
159 * @retval None
160 */
161 void EXTI0_IRQHandler(void)
162 {
163 /* Generate SysTick exception */
164 SCB->ICSR |= 0x04000000;
165
166 /* Clear WAKEUP_BUTTON_EXTI_LINE pending bit */
167 EXTI_ClearITPendingBit(WAKEUP_BUTTON_EXTI_LINE);
168 }
169
170 /**
171 * @brief This function handles External lines 9 to 5 interrupt request.
172 * @param None
173 * @retval None
174 */
175 void EXTI9_5_IRQHandler(void)
176 {
177 NVIC_InitTypeDef NVIC_InitStructure;
178
179 if(EXTI_GetITStatus(KEY_BUTTON_EXTI_LINE) != RESET)
180 {
181 PreemptionPriorityValue = !PreemptionPriorityValue;
182 PreemptionOccured = 0;
183
184 /* Modify the WAKEUP_BUTTON_EXTI_IRQn Interrupt Preemption Priority */
185 NVIC_InitStructure.NVIC_IRQChannel = WAKEUP_BUTTON_EXTI_IRQn;
186 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = PreemptionPriorityValue;
187 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
188 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
189 NVIC_Init(&NVIC_InitStructure);
190
191 /* Configure the SysTick Handler Priority: Preemption priority and subpriority */
192 NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), !PreemptionPriorityValue, 0));
193
194 /* Clear KEY_BUTTON_EXTI_LINE pending bit */
195 EXTI_ClearITPendingBit(KEY_BUTTON_EXTI_LINE);
196 }
197 }
198
199 /******************************************************************************/
200 /* STM32F10x Peripherals Interrupt Handlers */
201 /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
202 /* available peripheral interrupt handler's name please refer to the startup */
203 /* file (startup_stm32f10x_xx.s). */
204 /******************************************************************************/
205
206 /**
207 * @brief This function handles PPP interrupt request.
208 * @param None
209 * @retval None
210 */
211 /*void PPP_IRQHandler(void)
212 {
213 }*/
214
215 /**
216 * @}
217 */
218
219 /**
220 * @}
221 */
222
223 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/