Interrupt_TMR.c 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. /*""FILE COMMENT""*******************************************************
  2. * System Name : Interrupt program for RX62Nxx
  3. * File Name : Interrupt_TMR.c
  4. * Version : 1.02
  5. * Contents : Interrupt handlers for the Timer units
  6. * Customer :
  7. * Model :
  8. * Order :
  9. * CPU : RX
  10. * Compiler : RXC
  11. * OS : Nothing
  12. * Programmer :
  13. * Note :
  14. ************************************************************************
  15. * Copyright, 2011. Renesas Electronics Corporation
  16. * and Renesas Solutions Corporation
  17. ************************************************************************
  18. * History : 2011.04.08
  19. * : Ver 1.02
  20. * : CS-5 release.
  21. *""FILE COMMENT END""**************************************************/
  22. #include "r_pdl_tmr.h"
  23. #include "r_pdl_definitions.h"
  24. #include "r_pdl_user_definitions.h"
  25. /*""FUNC COMMENT""***************************************************
  26. * Module outline : Timer interrupt processing
  27. *-------------------------------------------------------------------
  28. * Declaration : void Interrupt_TMRn_XXX(void)
  29. *-------------------------------------------------------------------
  30. * Function : Interrupt processing function for Timer TMR channel n
  31. *-------------------------------------------------------------------
  32. * Argument : Nothing
  33. *-------------------------------------------------------------------
  34. * Return value : Nothing
  35. *-------------------------------------------------------------------
  36. * Input :
  37. * Output :
  38. *-------------------------------------------------------------------
  39. * Use function : R_TmrOverflowFunc[n](), R_TmrCMAFunc[n]() or
  40. * : R_TmrCMBFunc[n]() as appropriate.
  41. *-------------------------------------------------------------------
  42. * Notes :
  43. *-------------------------------------------------------------------
  44. * History : 2011.04.08
  45. * : Ver 1.02
  46. * : CS-5 release.
  47. *""FUNC COMMENT END""**********************************************/
  48. #if FAST_INTC_VECTOR == VECT_TMR0_CMIA0
  49. __fast_interrupt void Interrupt_TMR0_CMA(void)
  50. #else
  51. #pragma vector = VECT_TMR0_CMIA0
  52. __interrupt void Interrupt_TMR0_CMA(void)
  53. #endif
  54. {
  55. /* Call the user function? */
  56. if (rpdl_TMR_CMA_callback_func[0] != PDL_NO_FUNC)
  57. {
  58. /* Call the user function */
  59. rpdl_TMR_CMA_callback_func[0]();
  60. }
  61. }
  62. #if FAST_INTC_VECTOR == VECT_TMR0_CMIB0
  63. __fast_interrupt void Interrupt_TMR0_CMB(void)
  64. #else
  65. #pragma vector = VECT_TMR0_CMIB0
  66. __interrupt void Interrupt_TMR0_CMB(void)
  67. #endif
  68. {
  69. if (rpdl_TMR_one_shot[0] != false)
  70. {
  71. /* Channel mode? */
  72. if (rpdl_TMR_one_shot[0] == CHANNEL_MODE)
  73. {
  74. /* Stop the channel 0 clock input */
  75. TMR0.TCCR.BYTE = 0x00u;
  76. }
  77. /* Unit mode? */
  78. else
  79. {
  80. /* Stop the channel 1 clock input */
  81. TMR1.TCCR.BYTE = 0x00u;
  82. }
  83. rpdl_TMR_one_shot[0] = false;
  84. /* Clear the interrupt request flag (the timer may have set it again) */
  85. ICU.IR[VECT_TMR0_CMIB0].BIT.IR = 0;
  86. }
  87. /* Call the user function? */
  88. if (rpdl_TMR_CMB_callback_func[0] != PDL_NO_FUNC)
  89. {
  90. rpdl_TMR_CMB_callback_func[0]();
  91. }
  92. }
  93. #if FAST_INTC_VECTOR == VECT_TMR0_OVI0
  94. __fast_interrupt void Interrupt_TMR0_OV(void)
  95. #else
  96. #pragma vector = VECT_TMR0_OVI0
  97. __interrupt void Interrupt_TMR0_OV(void)
  98. #endif
  99. {
  100. /* Call the user function */
  101. if (rpdl_TMR_Overflow_callback_func[0] != PDL_NO_FUNC)
  102. {
  103. rpdl_TMR_Overflow_callback_func[0]();
  104. }
  105. }
  106. #if FAST_INTC_VECTOR == VECT_TMR1_CMIA1
  107. __fast_interrupt void Interrupt_TMR1_CMA(void)
  108. #else
  109. #pragma vector = VECT_TMR1_CMIA1
  110. __interrupt void Interrupt_TMR1_CMA(void)
  111. #endif
  112. {
  113. /* Call the user function? */
  114. if (rpdl_TMR_CMA_callback_func[1] != PDL_NO_FUNC)
  115. {
  116. /* Call the user function */
  117. rpdl_TMR_CMA_callback_func[1]();
  118. }
  119. }
  120. #if FAST_INTC_VECTOR == VECT_TMR1_CMIB1
  121. __fast_interrupt void Interrupt_TMR1_CMB(void)
  122. #else
  123. #pragma vector = VECT_TMR1_CMIB1
  124. __interrupt void Interrupt_TMR1_CMB(void)
  125. #endif
  126. {
  127. if (rpdl_TMR_one_shot[1] != false)
  128. {
  129. /* Stop the channel 1 clock input */
  130. TMR1.TCCR.BYTE = 0x00u;
  131. rpdl_TMR_one_shot[1] = false;
  132. /* Clear the interrupt request flag (the timer may have set it again) */
  133. ICU.IR[VECT_TMR1_CMIB1].BIT.IR = 0u;
  134. }
  135. /* Call the user function? */
  136. if (rpdl_TMR_CMB_callback_func[1] != PDL_NO_FUNC)
  137. {
  138. rpdl_TMR_CMB_callback_func[1]();
  139. }
  140. }
  141. #if FAST_INTC_VECTOR == VECT_TMR1_OVI1
  142. __fast_interrupt void Interrupt_TMR1_OV(void)
  143. #else
  144. #pragma vector = VECT_TMR1_OVI1
  145. __interrupt void Interrupt_TMR1_OV(void)
  146. #endif
  147. {
  148. /* Call the user function */
  149. if (rpdl_TMR_Overflow_callback_func[1] != PDL_NO_FUNC)
  150. {
  151. rpdl_TMR_Overflow_callback_func[1]();
  152. }
  153. }
  154. #if FAST_INTC_VECTOR == VECT_TMR2_CMIA2
  155. __fast_interrupt void Interrupt_TMR2_CMA(void)
  156. #else
  157. #pragma vector = VECT_TMR2_CMIA2
  158. __interrupt void Interrupt_TMR2_CMA(void)
  159. #endif
  160. {
  161. /* Call the user function? */
  162. if (rpdl_TMR_CMA_callback_func[2] != PDL_NO_FUNC)
  163. {
  164. /* Call the user function */
  165. rpdl_TMR_CMA_callback_func[2]();
  166. }
  167. }
  168. #if FAST_INTC_VECTOR == VECT_TMR2_CMIB2
  169. __fast_interrupt void Interrupt_TMR2_CMB(void)
  170. #else
  171. #pragma vector = VECT_TMR2_CMIB2
  172. __interrupt void Interrupt_TMR2_CMB(void)
  173. #endif
  174. {
  175. if (rpdl_TMR_one_shot[2] != false)
  176. {
  177. /* Channel mode? */
  178. if (rpdl_TMR_one_shot[2] == CHANNEL_MODE)
  179. {
  180. /* Stop the channel 2 clock input */
  181. TMR2.TCCR.BYTE = 0x00u;
  182. }
  183. /* Unit mode? */
  184. else
  185. {
  186. /* Stop the channel 3 clock input */
  187. TMR3.TCCR.BYTE = 0x00u;
  188. }
  189. rpdl_TMR_one_shot[2] = false;
  190. /* Clear the interrupt request flag (the timer may have set it again) */
  191. ICU.IR[VECT_TMR2_CMIB2].BIT.IR = 0;
  192. }
  193. /* Call the user function? */
  194. if (rpdl_TMR_CMB_callback_func[2] != PDL_NO_FUNC)
  195. {
  196. rpdl_TMR_CMB_callback_func[2]();
  197. }
  198. }
  199. #if FAST_INTC_VECTOR == VECT_TMR2_OVI2
  200. __fast_interrupt void Interrupt_TMR2_OV(void)
  201. #else
  202. #pragma vector = VECT_TMR2_OVI2
  203. __interrupt void Interrupt_TMR2_OV(void)
  204. #endif
  205. {
  206. /* Call the user function */
  207. if (rpdl_TMR_Overflow_callback_func[2] != PDL_NO_FUNC)
  208. {
  209. rpdl_TMR_Overflow_callback_func[2]();
  210. }
  211. }
  212. #if FAST_INTC_VECTOR == VECT_TMR3_CMIA3
  213. __fast_interrupt void Interrupt_TMR3_CMA(void)
  214. #else
  215. #pragma vector = VECT_TMR3_CMIA3
  216. __interrupt void Interrupt_TMR3_CMA(void)
  217. #endif
  218. {
  219. /* Call the user function? */
  220. if (rpdl_TMR_CMA_callback_func[3] != PDL_NO_FUNC)
  221. {
  222. /* Call the user function */
  223. rpdl_TMR_CMA_callback_func[3]();
  224. }
  225. }
  226. #if FAST_INTC_VECTOR == VECT_TMR3_CMIB3
  227. __fast_interrupt void Interrupt_TMR3_CMB(void)
  228. #else
  229. #pragma vector = VECT_TMR3_CMIB3
  230. __interrupt void Interrupt_TMR3_CMB(void)
  231. #endif
  232. {
  233. if (rpdl_TMR_one_shot[3] != false)
  234. {
  235. /* Stop the channel 3 clock input */
  236. TMR3.TCCR.BYTE = 0x00u;
  237. rpdl_TMR_one_shot[3] = false;
  238. /* Clear the interrupt request flag (the timer may have set it again) */
  239. ICU.IR[VECT_TMR3_CMIB3].BIT.IR = 0;
  240. }
  241. /* Call the user function? */
  242. if (rpdl_TMR_CMB_callback_func[3] != PDL_NO_FUNC)
  243. {
  244. rpdl_TMR_CMB_callback_func[3]();
  245. }
  246. }
  247. #if FAST_INTC_VECTOR == VECT_TMR3_OVI3
  248. __fast_interrupt void Interrupt_TMR3_OV(void)
  249. #else
  250. #pragma vector = VECT_TMR3_OVI3
  251. __interrupt void Interrupt_TMR3_OV(void)
  252. #endif
  253. {
  254. /* Call the user function */
  255. if (rpdl_TMR_Overflow_callback_func[3] != PDL_NO_FUNC)
  256. {
  257. rpdl_TMR_Overflow_callback_func[3]();
  258. }
  259. }
  260. /* End of file */