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