STM8S/A Standard Peripherals Firmware Library: stm8s_it.c Source File

STM8S/A

STM8S_StdPeriph_Examples/UART1/UART1_Interrupt/stm8s_it.c
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file     stm8s_it.c
00004   * @author   MCD Application Team
00005   * @version  V2.2.0
00006   * @date     30-September-2014
00007   * @brief    Main Interrupt Service Routines.
00008   ******************************************************************************
00009   * @attention
00010   *
00011   * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
00012   *
00013   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
00014   * You may not use this file except in compliance with the License.
00015   * You may obtain a copy of the License at:
00016   *
00017   *        http://www.st.com/software_license_agreement_liberty_v2
00018   *
00019   * Unless required by applicable law or agreed to in writing, software 
00020   * distributed under the License is distributed on an "AS IS" BASIS, 
00021   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00022   * See the License for the specific language governing permissions and
00023   * limitations under the License.
00024   *
00025   ******************************************************************************
00026   */ 
00027 
00028 /* Includes ------------------------------------------------------------------*/
00029 #include "stm8s_it.h"
00030 #include "main.h"
00031 
00032 /** @addtogroup UART1_Interrupt
00033   * @{
00034   */
00035 /* Private typedef -----------------------------------------------------------*/
00036 /* Private define ------------------------------------------------------------*/
00037 /* Private macro -------------------------------------------------------------*/
00038 /* Private variables ---------------------------------------------------------*/
00039 extern uint8_t TxBuffer1[];
00040 extern uint8_t TxBuffer2[];
00041 extern uint8_t RxBuffer1[];
00042 extern uint8_t RxBuffer2[];
00043 /* Private function prototypes -----------------------------------------------*/
00044 /* Private functions ---------------------------------------------------------*/
00045 /* Public functions ----------------------------------------------------------*/
00046 extern void Delay (uint16_t nCount);
00047 
00048 
00049 #ifdef _COSMIC_
00050 /**
00051   * @brief  Dummy interrupt routine
00052   * @param  None
00053   * @retval None
00054   */
00055 @far @interrupt void NonHandledInterrupt(void)
00056 {
00057   /* In order to detect unexpected events during development,
00058      it is recommended to set a breakpoint on the following instruction.
00059   */
00060 }
00061 
00062 /**
00063   * @brief  TRAP interrupt routine
00064   * @param  None
00065   * @retval None
00066   */
00067 @far @interrupt void TRAP_IRQHandler(void)
00068 {
00069   /* In order to detect unexpected events during development,
00070      it is recommended to set a breakpoint on the following instruction.
00071   */
00072 }
00073 #else /*_RAISONANCE_*/
00074 
00075 /**
00076   * @brief  TRAP interrupt routine
00077   * @param  None
00078   * @retval None
00079   */
00080 INTERRUPT_HANDLER_TRAP(TRAP_IRQHandler)
00081 {
00082   /* In order to detect unexpected events during development,
00083      it is recommended to set a breakpoint on the following instruction.
00084   */
00085 }
00086 #endif /*_COSMIC_*/
00087 
00088 /**
00089   * @brief  Top Level Interrupt routine
00090   * @param None
00091   * @retval
00092   * None
00093   */
00094 INTERRUPT_HANDLER(TLI_IRQHandler, 0)
00095 {
00096   /* In order to detect unexpected events during development,
00097      it is recommended to set a breakpoint on the following instruction.
00098   */
00099 }
00100 
00101 /**
00102   * @brief  Auto Wake Up Interrupt routine
00103   * @param None
00104   * @retval
00105   * None
00106   */
00107 INTERRUPT_HANDLER(AWU_IRQHandler, 1)    
00108 {
00109   /* In order to detect unexpected events during development,
00110      it is recommended to set a breakpoint on the following instruction.
00111   */
00112 }
00113 
00114 /**
00115   * @brief  Clock Controller Interrupt routine
00116   * @param None
00117   * @retval
00118   * None
00119   */
00120 INTERRUPT_HANDLER(CLK_IRQHandler, 2)
00121 {
00122   /* In order to detect unexpected events during development,
00123      it is recommended to set a breakpoint on the following instruction.
00124   */
00125 }
00126 
00127 /**
00128   * @brief  External Interrupt PORTA Interrupt routine
00129   * @param None
00130   * @retval
00131   * None
00132   */
00133 INTERRUPT_HANDLER(EXTI_PORTA_IRQHandler, 3)
00134 {
00135   /* In order to detect unexpected events during development,
00136      it is recommended to set a breakpoint on the following instruction.
00137   */
00138 }
00139 
00140 /**
00141   * @brief  External Interrupt PORTB Interrupt routine
00142   * @param  None
00143   * @retval None
00144   */
00145 INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4)
00146 {
00147   /* In order to detect unexpected events during development,
00148      it is recommended to set a breakpoint on the following instruction.
00149   */
00150 }
00151 
00152 /**
00153   * @brief  External Interrupt PORTC Interrupt routine
00154   * @param None
00155   * @retval
00156   * None
00157   */
00158 INTERRUPT_HANDLER(EXTI_PORTC_IRQHandler, 5)
00159 {
00160   /* In order to detect unexpected events during development,
00161      it is recommended to set a breakpoint on the following instruction.
00162   */
00163 }
00164 
00165 /**
00166   * @brief  External Interrupt PORTD Interrupt routine
00167   * @param None
00168   * @retval
00169   * None
00170   */
00171 INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6)
00172 {
00173   /* In order to detect unexpected events during development,
00174      it is recommended to set a breakpoint on the following instruction.
00175   */
00176 }
00177 
00178 /**
00179   * @brief  External Interrupt PORTE Interrupt routine
00180   * @param None
00181   * @retval
00182   * None
00183   */
00184 INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7)
00185 {
00186   /* In order to detect unexpected events during development,
00187      it is recommended to set a breakpoint on the following instruction.
00188   */
00189 }
00190 #ifdef STM8S903
00191 /**
00192   * @brief  External Interrupt PORTF Interrupt routine
00193   * @param None
00194   * @retval
00195   * None
00196   */
00197  INTERRUPT_HANDLER(EXTI_PORTF_IRQHandler, 8)
00198 {
00199   /* In order to detect unexpected events during development,
00200      it is recommended to set a breakpoint on the following instruction.
00201   */
00202 }
00203 #endif /*STM8S903*/
00204 
00205 #ifdef STM8S208
00206 /**
00207   * @brief  CAN RX Interrupt routine
00208   * @param None
00209   * @retval
00210   * None
00211   */
00212  INTERRUPT_HANDLER(CAN_RX_IRQHandler, 8)
00213 {
00214   /* In order to detect unexpected events during development,
00215      it is recommended to set a breakpoint on the following instruction.
00216   */
00217 }
00218 
00219 /**
00220   * @brief  CAN TX Interrupt routine
00221   * @param None
00222   * @retval
00223   * None
00224   */
00225  INTERRUPT_HANDLER(CAN_TX_IRQHandler, 9)
00226 {
00227   /* In order to detect unexpected events during development,
00228      it is recommended to set a breakpoint on the following instruction.
00229   */
00230 }
00231 #endif /*STM8S208 || STM8AF52Ax */
00232 
00233 /**
00234   * @brief  SPI Interrupt routine
00235   * @param None
00236   * @retval
00237   * None
00238   */
00239 INTERRUPT_HANDLER(SPI_IRQHandler, 10)
00240 {
00241   /* In order to detect unexpected events during development,
00242      it is recommended to set a breakpoint on the following instruction.
00243   */
00244 }
00245 
00246 /**
00247   * @brief  Timer1 Update/Overflow/Trigger/Break Interrupt routine
00248   * @param None
00249   * @retval
00250   * None
00251   */
00252 INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11)
00253 {
00254   /* In order to detect unexpected events during development,
00255      it is recommended to set a breakpoint on the following instruction.
00256   */
00257 }
00258 
00259 /**
00260   * @brief  Timer1 Capture/Compare Interrupt routine
00261   * @param None
00262   * @retval
00263   * None
00264   */
00265 INTERRUPT_HANDLER(TIM1_CAP_COM_IRQHandler, 12)
00266 {
00267   /* In order to detect unexpected events during development,
00268      it is recommended to set a breakpoint on the following instruction.
00269   */
00270 }
00271 
00272 #ifdef STM8S903
00273 /**
00274   * @brief  Timer5 Update/Overflow/Break/Trigger Interrupt routine
00275   * @param None
00276   * @retval
00277   * None
00278   */
00279  INTERRUPT_HANDLER(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13)
00280 {
00281   /* In order to detect unexpected events during development,
00282      it is recommended to set a breakpoint on the following instruction.
00283   */
00284 }
00285 /**
00286   * @brief  Timer5 Capture/Compare Interrupt routine
00287   * @param None
00288   * @retval
00289   * None
00290   */
00291  INTERRUPT_HANDLER(TIM5_CAP_COM_IRQHandler, 14)
00292 {
00293   /* In order to detect unexpected events during development,
00294      it is recommended to set a breakpoint on the following instruction.
00295   */
00296 }
00297 
00298 #else /*STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x */
00299 /**
00300   * @brief  Timer2 Update/Overflow/Break Interrupt routine
00301   * @param None
00302   * @retval
00303   * None
00304   */
00305  INTERRUPT_HANDLER(TIM2_UPD_OVF_BRK_IRQHandler, 13)
00306 {
00307   /* In order to detect unexpected events during development,
00308      it is recommended to set a breakpoint on the following instruction.
00309   */
00310 }
00311 
00312 /**
00313   * @brief  Timer2 Capture/Compare Interrupt routine
00314   * @param None
00315   * @retval
00316   * None
00317   */
00318  INTERRUPT_HANDLER(TIM2_CAP_COM_IRQHandler, 14)
00319 {
00320   /* In order to detect unexpected events during development,
00321      it is recommended to set a breakpoint on the following instruction.
00322   */
00323 }
00324 #endif /*STM8S903*/
00325 
00326 #if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
00327     defined(STM8S005) ||  defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
00328 /**
00329   * @brief  Timer3 Update/Overflow/Break Interrupt routine
00330   * @param None
00331   * @retval
00332   * None
00333   */
00334  INTERRUPT_HANDLER(TIM3_UPD_OVF_BRK_IRQHandler, 15)
00335 {
00336   /* In order to detect unexpected events during development,
00337      it is recommended to set a breakpoint on the following instruction.
00338   */
00339 }
00340 
00341 /**
00342   * @brief  Timer3 Capture/Compare Interrupt routine
00343   * @param None
00344   * @retval
00345   * None
00346   */
00347  INTERRUPT_HANDLER(TIM3_CAP_COM_IRQHandler, 16)
00348 {
00349   /* In order to detect unexpected events during development,
00350      it is recommended to set a breakpoint on the following instruction.
00351   */
00352 }
00353 #endif /*STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x */
00354 
00355 #if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
00356     defined(STM8S003) ||  defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
00357 /**
00358   * @brief  UART1 TX Interrupt routine
00359   * @param None
00360   * @retval
00361   * None
00362   */
00363  INTERRUPT_HANDLER(UART1_TX_IRQHandler, 17)
00364 {
00365     /* Write one byte to the transmit data register */
00366     UART1_SendData8(TxBuffer1[IncrementVar_TxCounter1()]);
00367 
00368     if (GetVar_TxCounter1() == GetVar_NbrOfDataToTransfer1())
00369     {
00370         /* Disable the UART1 Transmit interrupt */
00371         UART1_ITConfig(UART1_IT_TXE, DISABLE);
00372     }
00373 }
00374 
00375 /**
00376   * @brief  UART1 RX Interrupt routine
00377   * @param None
00378   * @retval
00379   * None
00380   */
00381  INTERRUPT_HANDLER(UART1_RX_IRQHandler, 18)
00382 {
00383     /* Read one byte from the receive data register */
00384     RxBuffer1[IncrementVar_RxCounter1()] = UART1_ReceiveData8();
00385 
00386     if (GetVar_RxCounter1() == GetVar_NbrOfDataToRead1())
00387     {
00388         /* Disable the UART1 Receive interrupt */
00389         UART1_ITConfig(UART1_IT_RXNE_OR, DISABLE);
00390     }
00391 }
00392 #endif /*STM8S105*/
00393 
00394 /**
00395   * @brief  I2C Interrupt routine
00396   * @param None
00397   * @retval
00398   * None
00399   */
00400 INTERRUPT_HANDLER(I2C_IRQHandler, 19)
00401 {
00402   /* In order to detect unexpected events during development,
00403      it is recommended to set a breakpoint on the following instruction.
00404   */
00405 }
00406 
00407 #if defined(STM8S105) || defined(STM8S005) ||  defined (STM8AF626x)
00408 /**
00409   * @brief  UART2 TX interrupt routine.
00410   * @param None
00411   * @retval
00412   * None
00413   */
00414  INTERRUPT_HANDLER(UART2_TX_IRQHandler, 20)
00415 {
00416     /* In order to detect unexpected events during development,
00417        it is recommended to set a breakpoint on the following instruction.
00418     */
00419 }
00420 
00421 /**
00422   * @brief  UART2 RX interrupt routine.
00423   * @param None
00424   * @retval
00425   * None
00426   */
00427  INTERRUPT_HANDLER(UART2_RX_IRQHandler, 21)
00428 {
00429     /* In order to detect unexpected events during development,
00430        it is recommended to set a breakpoint on the following instruction.
00431     */
00432 }
00433 #endif /* STM8S105*/
00434 
00435 #if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
00436 /**
00437   * @brief  UART3 TX interrupt routine.
00438   * @param None
00439   * @retval
00440   * None
00441   */
00442  INTERRUPT_HANDLER(UART3_TX_IRQHandler, 20)
00443 {
00444     /* Write one byte to the transmit data register */
00445     UART3_SendData8(TxBuffer2[IncrementVar_TxCounter2()]);
00446 
00447          if (GetVar_TxCounter2() == GetVar_NbrOfDataToTransfer2())
00448     {
00449         /* Disable the UART3 Transmit interrupt */
00450         UART3_ITConfig(UART3_IT_TXE, DISABLE);
00451     }
00452 }
00453 
00454 /**
00455   * @brief  UART3 RX interrupt routine.
00456   * @param None
00457   * @retval
00458   * None
00459   */
00460  INTERRUPT_HANDLER(UART3_RX_IRQHandler, 21)
00461 {
00462     /* Read one byte from the receive data register */
00463     RxBuffer2[IncrementVar_RxCounter2()] = UART3_ReceiveData8();
00464 
00465     if (GetVar_RxCounter2() == GetVar_NbrOfDataToRead2())
00466     {
00467         /* Disable the UART1 Receive interrupt */
00468         UART3_ITConfig(UART3_IT_RXNE_OR, DISABLE);
00469     }
00470 }
00471 #endif /*STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax */
00472 
00473 #if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
00474 /**
00475   * @brief  ADC2 interrupt routine.
00476   * @param None
00477   * @retval
00478   * None
00479   */
00480  INTERRUPT_HANDLER(ADC2_IRQHandler, 22)
00481 {
00482     /* In order to detect unexpected events during development,
00483        it is recommended to set a breakpoint on the following instruction.
00484     */
00485 }
00486 #else /*STM8S105, STM8S103 or STM8S903 or STM8AF626x */
00487 /**
00488   * @brief  ADC1 interrupt routine.
00489   * @param  None
00490   * @retval None
00491   */
00492  INTERRUPT_HANDLER(ADC1_IRQHandler, 22)
00493 {
00494     /* In order to detect unexpected events during development,
00495        it is recommended to set a breakpoint on the following instruction.
00496     */
00497 }
00498 #endif /*STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax */
00499 
00500 #ifdef STM8S903
00501 /**
00502   * @brief  Timer6 Update/Overflow/Trigger Interrupt routine
00503   * @param None
00504   * @retval
00505   * None
00506   */
00507 INTERRUPT_HANDLER(TIM6_UPD_OVF_TRG_IRQHandler, 23)
00508 {
00509   /* In order to detect unexpected events during development,
00510      it is recommended to set a breakpoint on the following instruction.
00511   */
00512 }
00513 #else /*STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x */
00514 /**
00515   * @brief  Timer4 Update/Overflow Interrupt routine
00516   * @param None
00517   * @retval
00518   * None
00519   */
00520  INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23)
00521 {
00522   /* In order to detect unexpected events during development,
00523      it is recommended to set a breakpoint on the following instruction.
00524   */
00525 }
00526 #endif /*STM8S903*/
00527 
00528 /**
00529   * @brief  Eeprom EEC Interrupt routine
00530   * @param None
00531   * @retval
00532         * None
00533   */
00534 INTERRUPT_HANDLER(EEPROM_EEC_IRQHandler, 24)
00535 {
00536   /* In order to detect unexpected events during development,
00537      it is recommended to set a breakpoint on the following instruction.
00538   */
00539 }
00540 
00541 /**
00542   * @}
00543   */
00544 
00545 
00546 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
STM8 Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM8 8-bit Microcontrollers platform visit www.st.com