Mercurial > ~darius > hgwebdir.cgi > stm32temp
comparison libs/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/USART/Interrupt/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 USART/Interrupt/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>© COPYRIGHT 2011 STMicroelectronics</center></h2> | |
21 ****************************************************************************** | |
22 */ | |
23 | |
24 /* Includes ------------------------------------------------------------------*/ | |
25 #include "stm32f10x_it.h" | |
26 #include "platform_config.h" | |
27 | |
28 /** @addtogroup STM32F10x_StdPeriph_Examples | |
29 * @{ | |
30 */ | |
31 | |
32 /** @addtogroup USART_Interrupt | |
33 * @{ | |
34 */ | |
35 | |
36 /* Private typedef -----------------------------------------------------------*/ | |
37 /* Private define ------------------------------------------------------------*/ | |
38 /* Private macro -------------------------------------------------------------*/ | |
39 /* Private variables ---------------------------------------------------------*/ | |
40 extern uint8_t TxBuffer1[]; | |
41 extern uint8_t TxBuffer2[]; | |
42 extern uint8_t RxBuffer1[]; | |
43 extern uint8_t RxBuffer2[]; | |
44 extern __IO uint8_t TxCounter1; | |
45 extern __IO uint8_t TxCounter2; | |
46 extern __IO uint8_t RxCounter1; | |
47 extern __IO uint8_t RxCounter2; | |
48 extern uint8_t NbrOfDataToTransfer1; | |
49 extern uint8_t NbrOfDataToTransfer2; | |
50 extern uint8_t NbrOfDataToRead1; | |
51 extern uint8_t NbrOfDataToRead2; | |
52 | |
53 /* Private function prototypes -----------------------------------------------*/ | |
54 /* Private functions ---------------------------------------------------------*/ | |
55 | |
56 /******************************************************************************/ | |
57 /* Cortex-M3 Processor Exceptions Handlers */ | |
58 /******************************************************************************/ | |
59 | |
60 /** | |
61 * @brief This function handles NMI exception. | |
62 * @param None | |
63 * @retval None | |
64 */ | |
65 void NMI_Handler(void) | |
66 { | |
67 } | |
68 | |
69 /** | |
70 * @brief This function handles Hard Fault exception. | |
71 * @param None | |
72 * @retval None | |
73 */ | |
74 void HardFault_Handler(void) | |
75 { | |
76 /* Go to infinite loop when Hard Fault exception occurs */ | |
77 while (1) | |
78 { | |
79 } | |
80 } | |
81 | |
82 /** | |
83 * @brief This function handles Memory Manage exception. | |
84 * @param None | |
85 * @retval None | |
86 */ | |
87 void MemManage_Handler(void) | |
88 { | |
89 /* Go to infinite loop when Memory Manage exception occurs */ | |
90 while (1) | |
91 { | |
92 } | |
93 } | |
94 | |
95 /** | |
96 * @brief This function handles Bus Fault exception. | |
97 * @param None | |
98 * @retval None | |
99 */ | |
100 void BusFault_Handler(void) | |
101 { | |
102 /* Go to infinite loop when Bus Fault exception occurs */ | |
103 while (1) | |
104 { | |
105 } | |
106 } | |
107 | |
108 /** | |
109 * @brief This function handles Usage Fault exception. | |
110 * @param None | |
111 * @retval None | |
112 */ | |
113 void UsageFault_Handler(void) | |
114 { | |
115 /* Go to infinite loop when Usage Fault exception occurs */ | |
116 while (1) | |
117 { | |
118 } | |
119 } | |
120 | |
121 /** | |
122 * @brief This function handles SVCall exception. | |
123 * @param None | |
124 * @retval None | |
125 */ | |
126 void SVC_Handler(void) | |
127 { | |
128 } | |
129 | |
130 /** | |
131 * @brief This function handles Debug Monitor exception. | |
132 * @param None | |
133 * @retval None | |
134 */ | |
135 void DebugMon_Handler(void) | |
136 { | |
137 } | |
138 | |
139 /** | |
140 * @brief This function handles PendSV_Handler exception. | |
141 * @param None | |
142 * @retval None | |
143 */ | |
144 void PendSV_Handler(void) | |
145 { | |
146 } | |
147 | |
148 /** | |
149 * @brief This function handles SysTick Handler. | |
150 * @param None | |
151 * @retval None | |
152 */ | |
153 void SysTick_Handler(void) | |
154 { | |
155 } | |
156 | |
157 /******************************************************************************/ | |
158 /* STM32F10x Peripherals Interrupt Handlers */ | |
159 /******************************************************************************/ | |
160 | |
161 /** | |
162 * @brief This function handles USARTy global interrupt request. | |
163 * @param None | |
164 * @retval None | |
165 */ | |
166 void USARTy_IRQHandler(void) | |
167 { | |
168 if(USART_GetITStatus(USARTy, USART_IT_RXNE) != RESET) | |
169 { | |
170 /* Read one byte from the receive data register */ | |
171 RxBuffer1[RxCounter1++] = USART_ReceiveData(USARTy); | |
172 | |
173 if(RxCounter1 == NbrOfDataToRead1) | |
174 { | |
175 /* Disable the USARTy Receive interrupt */ | |
176 USART_ITConfig(USARTy, USART_IT_RXNE, DISABLE); | |
177 } | |
178 } | |
179 | |
180 if(USART_GetITStatus(USARTy, USART_IT_TXE) != RESET) | |
181 { | |
182 /* Write one byte to the transmit data register */ | |
183 USART_SendData(USARTy, TxBuffer1[TxCounter1++]); | |
184 | |
185 if(TxCounter1 == NbrOfDataToTransfer1) | |
186 { | |
187 /* Disable the USARTy Transmit interrupt */ | |
188 USART_ITConfig(USARTy, USART_IT_TXE, DISABLE); | |
189 } | |
190 } | |
191 } | |
192 | |
193 /** | |
194 * @brief This function handles USARTz global interrupt request. | |
195 * @param None | |
196 * @retval None | |
197 */ | |
198 void USARTz_IRQHandler(void) | |
199 { | |
200 if(USART_GetITStatus(USARTz, USART_IT_RXNE) != RESET) | |
201 { | |
202 /* Read one byte from the receive data register */ | |
203 RxBuffer2[RxCounter2++] = USART_ReceiveData(USARTz); | |
204 | |
205 if(RxCounter2 == NbrOfDataToRead1) | |
206 { | |
207 /* Disable the USARTz Receive interrupt */ | |
208 USART_ITConfig(USARTz, USART_IT_RXNE, DISABLE); | |
209 } | |
210 } | |
211 | |
212 if(USART_GetITStatus(USARTz, USART_IT_TXE) != RESET) | |
213 { | |
214 /* Write one byte to the transmit data register */ | |
215 USART_SendData(USARTz, TxBuffer2[TxCounter2++]); | |
216 | |
217 if(TxCounter2 == NbrOfDataToTransfer2) | |
218 { | |
219 /* Disable the USARTz Transmit interrupt */ | |
220 USART_ITConfig(USARTz, USART_IT_TXE, DISABLE); | |
221 } | |
222 } | |
223 } | |
224 | |
225 /******************************************************************************/ | |
226 /* STM32F10x Peripherals Interrupt Handlers */ | |
227 /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ | |
228 /* available peripheral interrupt handler's name please refer to the startup */ | |
229 /* file (startup_stm32f10x_xx.s). */ | |
230 /******************************************************************************/ | |
231 | |
232 /** | |
233 * @brief This function handles PPP interrupt request. | |
234 * @param None | |
235 * @retval None | |
236 */ | |
237 /*void PPP_IRQHandler(void) | |
238 { | |
239 }*/ | |
240 | |
241 /** | |
242 * @} | |
243 */ | |
244 | |
245 /** | |
246 * @} | |
247 */ | |
248 | |
249 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ |