STM32F10x_StdPeriph_Examples/USART/Smartcard/stm32f10x_it.c

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    USART/Smartcard/stm32f10x_it.c 
00004   * @author  MCD Application Team
00005   * @version V3.4.0
00006   * @date    10/15/2010
00007   * @brief   Main Interrupt Service Routines.
00008   *          This file provides template for all exceptions handler and peripherals
00009   *          interrupt service routine.
00010   ******************************************************************************
00011   * @copy
00012   *
00013   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00014   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
00015   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
00016   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
00017   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
00018   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00019   *
00020   * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
00021   */ 
00022 
00023 /* Includes ------------------------------------------------------------------*/
00024 #include "stm32f10x_it.h"
00025 #include "platform_config.h"
00026 
00027 /** @addtogroup STM32F10x_StdPeriph_Examples
00028   * @{
00029   */
00030 
00031 /** @addtogroup USART_Smartcard
00032   * @{
00033   */ 
00034 
00035 /* Private typedef -----------------------------------------------------------*/
00036 /* Private define ------------------------------------------------------------*/
00037 /* Private macro -------------------------------------------------------------*/
00038 /* Private variables ---------------------------------------------------------*/
00039 extern __IO uint32_t CardInserted; 
00040 
00041 /* Private function prototypes -----------------------------------------------*/
00042 /* Private functions ---------------------------------------------------------*/
00043 
00044 /******************************************************************************/
00045 /*            Cortex-M3 Processor Exceptions Handlers                         */
00046 /******************************************************************************/
00047 
00048 /**
00049   * @brief  This function handles NMI exception.
00050   * @param  None
00051   * @retval None
00052   */
00053 void NMI_Handler(void)
00054 {
00055 }
00056 
00057 /**
00058   * @brief  This function handles Hard Fault exception.
00059   * @param  None
00060   * @retval None
00061   */
00062 void HardFault_Handler(void)
00063 {
00064   /* Go to infinite loop when Hard Fault exception occurs */
00065   while (1)
00066   {
00067   }
00068 }
00069 
00070 /**
00071   * @brief  This function handles Memory Manage exception.
00072   * @param  None
00073   * @retval None
00074   */
00075 void MemManage_Handler(void)
00076 {
00077   /* Go to infinite loop when Memory Manage exception occurs */
00078   while (1)
00079   {
00080   }
00081 }
00082 
00083 /**
00084   * @brief  This function handles Bus Fault exception.
00085   * @param  None
00086   * @retval None
00087   */
00088 void BusFault_Handler(void)
00089 {
00090   /* Go to infinite loop when Bus Fault exception occurs */
00091   while (1)
00092   {
00093   }
00094 }
00095 
00096 /**
00097   * @brief  This function handles Usage Fault exception.
00098   * @param  None
00099   * @retval None
00100   */
00101 void UsageFault_Handler(void)
00102 {
00103   /* Go to infinite loop when Usage Fault exception occurs */
00104   while (1)
00105   {
00106   }
00107 }
00108 
00109 /**
00110   * @brief  This function handles SVCall exception.
00111   * @param  None
00112   * @retval None
00113   */
00114 void SVC_Handler(void)
00115 {
00116 }
00117 
00118 /**
00119   * @brief  This function handles Debug Monitor exception.
00120   * @param  None
00121   * @retval None
00122   */
00123 void DebugMon_Handler(void)
00124 {
00125 }
00126 
00127 /**
00128   * @brief  This function handles PendSV_Handler exception.
00129   * @param  None
00130   * @retval None
00131   */
00132 void PendSV_Handler(void)
00133 {
00134 }
00135 
00136 /**
00137   * @brief  This function handles SysTick Handler.
00138   * @param  None
00139   * @retval None
00140   */
00141 void SysTick_Handler(void)
00142 {
00143 }
00144 
00145 /******************************************************************************/
00146 /*            STM32F10x Peripherals Interrupt Handlers                        */
00147 /******************************************************************************/
00148 
00149 /**
00150   * @brief  This function handles External lines 9 to 5 interrupt request.
00151   * @param  None
00152   * @retval None
00153   */
00154 void EXTI9_5_IRQHandler(void)
00155 {
00156   /* Select Smart Card CMDVCC */  
00157   GPIO_ResetBits(GPIO_CMDVCC, SC_CMDVCC);
00158 
00159   /* Set RSTIN LOW */  
00160   GPIO_ResetBits(GPIO_RESET, SC_RESET);
00161 
00162   /* Set RSTIN HIGH */  
00163   GPIO_SetBits(GPIO_RESET, SC_RESET);
00164     
00165   /* Clear SC EXTIT Line Pending Bit */
00166   EXTI_ClearITPendingBit(SC_EXTI);
00167 
00168   /* Smart card detected */
00169   CardInserted = 1;
00170 }
00171 
00172 /**
00173   * @brief  This function handles SC_USART global interrupt request.
00174   * @param  None
00175   * @retval None
00176   */
00177 void SC_USART_IRQHandler(void)
00178 {
00179   /* If the SC_USART detects a parity error */
00180   if(USART_GetITStatus(SC_USART, USART_IT_PE) != RESET)
00181   {
00182     /* Enable SC_USART RXNE Interrupt (until receiving the corrupted byte) */
00183     USART_ITConfig(SC_USART, USART_IT_RXNE, ENABLE);
00184     /* Flush the SC_USART DR register */
00185     USART_ReceiveData(SC_USART);
00186   }
00187   
00188   if(USART_GetITStatus(SC_USART, USART_IT_RXNE) != RESET)
00189   {
00190     /* Disable SC_USART RXNE Interrupt */
00191     USART_ITConfig(SC_USART, USART_IT_RXNE, DISABLE);
00192     USART_ReceiveData(SC_USART);
00193   }
00194 }
00195 
00196 /**
00197   * @brief  This function handles External lines 15 to 10 interrupt request.
00198   * @param  None
00199   * @retval None
00200   */
00201 void EXTI15_10_IRQHandler(void)
00202 {
00203   /* Select Smart Card CMDVCC */  
00204   GPIO_ResetBits(GPIO_CMDVCC, SC_CMDVCC);
00205 
00206   /* Set RSTIN LOW */  
00207   GPIO_ResetBits(GPIO_RESET, SC_RESET);
00208 
00209   /* Set RSTIN HIGH */  
00210   GPIO_SetBits(GPIO_RESET, SC_RESET);
00211     
00212   /* Clear SC EXTIT Line Pending Bit */
00213   EXTI_ClearITPendingBit(SC_EXTI);
00214 
00215   /* Smart card detected */
00216   CardInserted = 1;
00217 }
00218 
00219 /******************************************************************************/
00220 /*                 STM32F10x Peripherals Interrupt Handlers                   */
00221 /*  Add here the Interrupt Handler for the used peripheral(s) (PPP), for the  */
00222 /*  available peripheral interrupt handler's name please refer to the startup */
00223 /*  file (startup_stm32f10x_xx.s).                                            */
00224 /******************************************************************************/
00225 
00226 /**
00227   * @brief  This function handles PPP interrupt request.
00228   * @param  None
00229   * @retval None
00230   */
00231 /*void PPP_IRQHandler(void)
00232 {
00233 }*/
00234 
00235 /**
00236   * @}
00237   */ 
00238 
00239 
00240 /**
00241   * @}
00242   */
00243 
00244 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32