1 /*""FILE COMMENT""*******************************************************
2 * System Name	: Interrupt program for RX62Nxx
3 * File Name		: Interrupt_SCI.c
4 * Version		: 1.02
5 * Contents		: Interrupt handlers for all SCI channels
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_sci.h"
24 #include "r_pdl_definitions.h"
25 #include "r_pdl_user_definitions.h"
26 
27 /*""FUNC COMMENT""***************************************************
28 * Module outline: SCIn receive data error interrupt processing
29 *-------------------------------------------------------------------
30 * Declaration	: void Interrupt_SCIn_ERIn(void)
31 *-------------------------------------------------------------------
32 * Function		:
33 *-------------------------------------------------------------------
34 * Argument		: Nothing
35 *-------------------------------------------------------------------
36 * Return value	: Nothing
37 *-------------------------------------------------------------------
38 * Output		: SSR for that SCI channel
39 *-------------------------------------------------------------------
40 * Use function	: rpdl_SCI_RX_Error_callback_func
41 *-------------------------------------------------------------------
42 * Notes			:
43 *-------------------------------------------------------------------
44 * History		: 2011.04.08
45 *				: Ver 1.02
46 *				: CS-5 release.
47 *""FUNC COMMENT END""**********************************************/
48 
49 #if FAST_INTC_VECTOR == VECT_SCI0_ERI0
Interrupt_SCI0_ERI0(void)50 __fast_interrupt void Interrupt_SCI0_ERI0(void)
51 #else
52 #pragma vector = VECT_SCI0_ERI0
53 __interrupt void Interrupt_SCI0_ERI0(void)
54 #endif
55 {
56   /* Will the user handle the errors? */
57   if (rpdl_SCI_RX_Error_callback_func[0] != PDL_NO_FUNC)
58   {
59     /* Call the error handler */
60     rpdl_SCI_RX_Error_callback_func[0]();
61   }
62   else
63   {
64     /* Clear the error flags */
65     SCI0.SSR.BYTE = (uint8_t)(BIT_7 | BIT_6);
66   }
67 }
68 
69 #if FAST_INTC_VECTOR == VECT_SCI1_ERI1
Interrupt_SCI1_ERI1(void)70 __fast_interrupt void Interrupt_SCI1_ERI1(void)
71 #else
72 #pragma vector = VECT_SCI1_ERI1
73 __interrupt void Interrupt_SCI1_ERI1(void)
74 #endif
75 {
76   /* Will the user handle the errors? */
77   if (rpdl_SCI_RX_Error_callback_func[1] != PDL_NO_FUNC)
78   {
79     /* Call the error handler */
80     rpdl_SCI_RX_Error_callback_func[1]();
81   }
82   else
83   {
84     /* Clear the error flags */
85     SCI1.SSR.BYTE = (uint8_t)(BIT_7 | BIT_6);
86   }
87 }
88 #if 0
89 #if FAST_INTC_VECTOR == VECT_SCI2_ERI2
90 __fast_interrupt void Interrupt_SCI2_ERI2(void)
91 #else
92 #pragma vector = VECT_SCI2_ERI2
93 __interrupt void Interrupt_SCI2_ERI2(void)
94 #endif
95 {
96   /* Will the user handle the errors? */
97   if (rpdl_SCI_RX_Error_callback_func[2] != PDL_NO_FUNC)
98   {
99     /* Call the error handler */
100     rpdl_SCI_RX_Error_callback_func[2]();
101   }
102   else
103   {
104     /* Clear the error flags */
105     SCI2.SSR.BYTE = (uint8_t)(BIT_7 | BIT_6);
106   }
107 }
108 #endif
109 
110 #if FAST_INTC_VECTOR == VECT_SCI3_ERI3
Interrupt_SCI3_ERI3(void)111 __fast_interrupt void Interrupt_SCI3_ERI3(void)
112 #else
113 #pragma vector = VECT_SCI3_ERI3
114 __interrupt void Interrupt_SCI3_ERI3(void)
115 #endif
116 {
117   /* Will the user handle the errors? */
118   if (rpdl_SCI_RX_Error_callback_func[3] != PDL_NO_FUNC)
119   {
120     /* Call the error handler */
121     rpdl_SCI_RX_Error_callback_func[3]();
122   }
123   else
124   {
125     /* Clear the error flags */
126     SCI3.SSR.BYTE = (uint8_t)(BIT_7 | BIT_6);
127   }
128 }
129 
130 
131 #if FAST_INTC_VECTOR == VECT_SCI5_ERI5
Interrupt_SCI5_ERI5(void)132 __fast_interrupt void Interrupt_SCI5_ERI5(void)
133 #else
134 #pragma vector = VECT_SCI5_ERI5
135 __interrupt void Interrupt_SCI5_ERI5(void)
136 #endif
137 {
138   /* Will the user handle the errors? */
139   if (rpdl_SCI_RX_Error_callback_func[5] != PDL_NO_FUNC)
140   {
141     /* Call the error handler */
142     rpdl_SCI_RX_Error_callback_func[5]();
143   }
144   else
145   {
146     /* Clear the error flags */
147     SCI5.SSR.BYTE = (uint8_t)(BIT_7 | BIT_6);
148   }
149 }
150 
151 #if FAST_INTC_VECTOR == VECT_SCI6_ERI6
Interrupt_SCI6_ERI6(void)152 __fast_interrupt void Interrupt_SCI6_ERI6(void)
153 #else
154 #pragma vector = VECT_SCI6_ERI6
155 __interrupt void Interrupt_SCI6_ERI6(void)
156 #endif
157 {
158   /* Will the user handle the errors? */
159   if (rpdl_SCI_RX_Error_callback_func[6] != PDL_NO_FUNC)
160   {
161     /* Call the error handler */
162     rpdl_SCI_RX_Error_callback_func[6]();
163   }
164   else
165   {
166     /* Clear the error flags */
167     SCI6.SSR.BYTE = (uint8_t)(BIT_7 | BIT_6);
168   }
169 }
170 
171 /*""FUNC COMMENT""***************************************************
172 * Module outline: SCIn receive data interrupt processing
173 *-------------------------------------------------------------------
174 * Declaration	: void Interrupt_SCIn_RXIn(void)
175 *-------------------------------------------------------------------
176 * Function		:
177 *-------------------------------------------------------------------
178 * Argument		: Nothing
179 *-------------------------------------------------------------------
180 * Return value	: Nothing
181 *-------------------------------------------------------------------
182 * Output		:
183 *-------------------------------------------------------------------
184 * Use function	: rpdl_SCI_RX_End_callback_func
185 *-------------------------------------------------------------------
186 * Notes			:
187 *-------------------------------------------------------------------
188 * History		: 2011.04.08
189 *				: Ver 1.02
190 *				: CS-5 release.
191 *""FUNC COMMENT END""**********************************************/
192 
193 #if FAST_INTC_VECTOR == VECT_SCI0_RXI0
Interrupt_SCI0_RXI0(void)194 __fast_interrupt void Interrupt_SCI0_RXI0(void)
195 #else
196 #pragma vector = VECT_SCI0_RXI0
197 __interrupt void Interrupt_SCI0_RXI0(void)
198 #endif
199 {
200   /* Ok to process the data? */
201   if (rpdl_SCI_rx_using_irq[0] == true)
202   {
203     /* check if ID reception in Multiprocessor mode */
204     if (rpdl_SCI_MP_mode[0] == 2)
205     {
206       /* check if ID cycle ? */
207       if (SCI0.SSR.BIT.MPB == 1)
208       {
209         uint8_t id;
210 
211         /* Read the ID */
212         id = SCI0.RDR;
213 
214         /* ID matching ? */
215         if (id != rpdl_SCI_MP_rx_stationID[0])
216         {
217           /* ID does not match */
218           /* MPIE = 1 */
219           SCI0.SCR.BIT.MPIE = 1;
220         }
221         else
222         {
223           /* ID matches */
224           /* Disable interrupt request generation, and try to disable reception */
225           SCI0.SCR.BYTE &= (uint8_t)(INV_BIT_6 & INV_BIT_4);
226 
227           /* Notify the user */
228           if (rpdl_SCI_RX_End_callback_func[0] != PDL_NO_FUNC)
229           {
230             rpdl_SCI_RX_End_callback_func[0]();
231           }
232         }
233 
234         /* Exit ISR */
235         return;
236       }
237     }
238 
239     /* Read and store the character */
240     *rpdl_SCI_rx_string_pointer[0] = SCI0.RDR;
241 
242     /* Increment the character counter */
243     rpdl_SCI_rx_counter[0]++;
244 
245     /* More characters expected? */
246     if (rpdl_SCI_rx_counter[0] < rpdl_SCI_rx_threshold[0])
247     {
248       /* Move to the next location in the buffer */
249       rpdl_SCI_rx_string_pointer[0]++;
250     }
251     else
252     {
253       /* Disable interrupt request generation, and try to disable reception */
254       SCI0.SCR.BYTE &= (uint8_t)(INV_BIT_6 & INV_BIT_4);
255 
256       /* Async MP mode ? */
257       if (((SCI0.SMR.BIT.MP) != 0) && ((rpdl_SCI_MP_mode[0]) != 0))
258       {
259         /* Set MPIE = 1 (multiprocessor mode reception) */
260         SCI0.SCR.BIT.MPIE = 1;
261       }
262 
263       /* Notify the user */
264       if (rpdl_SCI_RX_End_callback_func[0] != PDL_NO_FUNC)
265       {
266         rpdl_SCI_RX_End_callback_func[0]();
267       }
268     }
269   }
270   /* Either the DMAC or DTC has passed on the interrupt */
271   else
272   {
273     /* Call the callback function */
274     if (rpdl_SCI_RX_End_callback_func[0] != PDL_NO_FUNC)
275     {
276       rpdl_SCI_RX_End_callback_func[0]();
277     }
278   }
279 }
280 
281 #if FAST_INTC_VECTOR == VECT_SCI1_RXI1
Interrupt_SCI1_RXI1(void)282 __fast_interrupt void Interrupt_SCI1_RXI1(void)
283 #else
284 #pragma vector = VECT_SCI1_RXI1
285 __interrupt void Interrupt_SCI1_RXI1(void)
286 #endif
287 {
288   /* Ok to process the data? */
289   if (rpdl_SCI_rx_using_irq[1] == true)
290   {
291     /* check if ID reception in Multiprocessor mode */
292     if (rpdl_SCI_MP_mode[1] == 2)
293     {
294       /* check if ID cycle ? */
295       if (SCI1.SSR.BIT.MPB == 1)
296       {
297         uint8_t id;
298 
299         /* Read the ID */
300         id = SCI1.RDR;
301 
302         /* ID matching ? */
303         if (id != rpdl_SCI_MP_rx_stationID[1])
304         {
305           /* ID does not match */
306           /* MPIE = 1 */
307           SCI1.SCR.BIT.MPIE = 1;
308         }
309         else
310         {
311           /* ID matches */
312           /* Disable interrupt request generation, and try to disable reception */
313           SCI1.SCR.BYTE &= (uint8_t)(INV_BIT_6 & INV_BIT_4);
314 
315           /* Notify the user */
316           if (rpdl_SCI_RX_End_callback_func[1] != PDL_NO_FUNC)
317           {
318             rpdl_SCI_RX_End_callback_func[1]();
319           }
320         }
321 
322         /* Exit ISR */
323         return;
324       }
325     }
326 
327     /* Read and store the character */
328     *rpdl_SCI_rx_string_pointer[1] = SCI1.RDR;
329 
330     /* Increment the character counter */
331     rpdl_SCI_rx_counter[1]++;
332 
333     /* More characters expected? */
334     if (rpdl_SCI_rx_counter[1] < rpdl_SCI_rx_threshold[1])
335     {
336       /* Move to the next location in the buffer */
337       rpdl_SCI_rx_string_pointer[1]++;
338     }
339     else
340     {
341       /* Disable interrupt request generation, and try to disable reception */
342       SCI1.SCR.BYTE &= (uint8_t)(INV_BIT_6 & INV_BIT_4);
343 
344       /* Async MP mode ? */
345       if (((SCI1.SMR.BIT.MP) != 0) && ((rpdl_SCI_MP_mode[1]) != 0))
346       {
347         /* Set MPIE = 1 (multiprocessor mode reception) */
348         SCI1.SCR.BIT.MPIE = 1;
349       }
350 
351       /* Notify the user */
352       if (rpdl_SCI_RX_End_callback_func[1] != PDL_NO_FUNC)
353       {
354         rpdl_SCI_RX_End_callback_func[1]();
355       }
356     }
357   }
358   /* Either the DMAC or DTC has passed on the interrupt */
359   else
360   {
361     /* Call the callback function */
362     if (rpdl_SCI_RX_End_callback_func[1] != PDL_NO_FUNC)
363     {
364       rpdl_SCI_RX_End_callback_func[1]();
365     }
366   }
367 }
368 
369 #if 0
370 #if FAST_INTC_VECTOR == VECT_SCI2_RXI2
371 __fast_interrupt void Interrupt_SCI2_RXI2(void)
372 #else
373 #pragma vector = VECT_SCI2_RXI2
374 __interrupt void Interrupt_SCI2_RXI2(void)
375 #endif
376 {
377   /* Ok to process the data? */
378   if (rpdl_SCI_rx_using_irq[2] == true)
379   {
380     /* check if ID reception in Multiprocessor mode */
381     if (rpdl_SCI_MP_mode[2] == 2)
382     {
383       /* check if ID cycle ? */
384       if (SCI2.SSR.BIT.MPB == 1)
385       {
386         uint8_t id;
387 
388         /* Read the ID */
389         id = SCI2.RDR;
390 
391         /* ID matching ? */
392         if (id != rpdl_SCI_MP_rx_stationID[2])
393         {
394           /* ID does not match */
395           /* MPIE = 1 */
396           SCI2.SCR.BIT.MPIE = 1;
397         }
398         else
399         {
400           /* ID matches */
401           /* Disable interrupt request generation, and try to disable reception */
402           SCI2.SCR.BYTE &= (uint8_t)(INV_BIT_6 & INV_BIT_4);
403 
404           /* Notify the user */
405           if (rpdl_SCI_RX_End_callback_func[2] != PDL_NO_FUNC)
406           {
407             rpdl_SCI_RX_End_callback_func[2]();
408           }
409         }
410 
411         /* Exit ISR */
412         return;
413       }
414     }
415 
416 
417     /* Read and store the character */
418     *rpdl_SCI_rx_string_pointer[2] = SCI2.RDR;
419 
420     /* Increment the character counter */
421     rpdl_SCI_rx_counter[2]++;
422 
423     /* More characters expected? */
424     if (rpdl_SCI_rx_counter[2] < rpdl_SCI_rx_threshold[2])
425     {
426       /* Move to the next location in the buffer */
427       rpdl_SCI_rx_string_pointer[2]++;
428     }
429     else
430     {
431       /* Disable interrupt request generation, and try to disable reception */
432       SCI2.SCR.BYTE &= (uint8_t)(INV_BIT_6 & INV_BIT_4);
433 
434       /* Async MP mode ? */
435       if (((SCI2.SMR.BIT.MP) != 0) && ((rpdl_SCI_MP_mode[2]) != 0))
436       {
437         /* Set MPIE = 1 (multiprocessor mode reception) */
438         SCI2.SCR.BIT.MPIE = 1;
439       }
440 
441       /* Notify the user */
442       if (rpdl_SCI_RX_End_callback_func[2] != PDL_NO_FUNC)
443       {
444         rpdl_SCI_RX_End_callback_func[2]();
445       }
446     }
447   }
448   /* Either the DMAC or DTC has passed on the interrupt */
449   else
450   {
451     /* Call the callback function */
452     if (rpdl_SCI_RX_End_callback_func[2] != PDL_NO_FUNC)
453     {
454       rpdl_SCI_RX_End_callback_func[2]();
455     }
456   }
457 }
458      #endif
459 #if FAST_INTC_VECTOR == VECT_SCI3_RXI3
Interrupt_SCI3_RXI3(void)460 __fast_interrupt void Interrupt_SCI3_RXI3(void)
461 #else
462 #pragma vector = VECT_SCI3_RXI3
463 __interrupt void Interrupt_SCI3_RXI3(void)
464 #endif
465 {
466   /* Ok to process the data? */
467   if (rpdl_SCI_rx_using_irq[3] == true)
468   {
469     /* check if ID reception in Multiprocessor mode */
470     if (rpdl_SCI_MP_mode[3] == 2)
471     {
472       /* check if ID cycle ? */
473       if (SCI3.SSR.BIT.MPB == 1)
474       {
475         uint8_t id;
476 
477         /* Read the ID */
478         id = SCI3.RDR;
479 
480         /* ID matching ? */
481         if (id != rpdl_SCI_MP_rx_stationID[3])
482         {
483           /* ID does not match */
484           /* MPIE = 1 */
485           SCI3.SCR.BIT.MPIE = 1;
486         }
487         else
488         {
489           /* ID matches */
490           /* Disable interrupt request generation, and try to disable reception */
491           SCI3.SCR.BYTE &= (uint8_t)(INV_BIT_6 & INV_BIT_4);
492 
493           /* Notify the user */
494           if (rpdl_SCI_RX_End_callback_func[3] != PDL_NO_FUNC)
495           {
496             rpdl_SCI_RX_End_callback_func[3]();
497           }
498         }
499 
500         /* Exit ISR */
501         return;
502       }
503     }
504 
505     /* Read and store the character */
506     *rpdl_SCI_rx_string_pointer[3] = SCI3.RDR;
507 
508     /* Increment the character counter */
509     rpdl_SCI_rx_counter[3]++;
510 
511     /* More characters expected? */
512     if (rpdl_SCI_rx_counter[3] < rpdl_SCI_rx_threshold[3])
513     {
514       /* Move to the next location in the buffer */
515       rpdl_SCI_rx_string_pointer[3]++;
516     }
517     else
518     {
519       /* Disable interrupt request generation, and try to disable reception */
520       SCI3.SCR.BYTE &= (uint8_t)(INV_BIT_6 & INV_BIT_4);
521 
522       /* Async MP mode ? */
523       if (((SCI3.SMR.BIT.MP) != 0) && ((rpdl_SCI_MP_mode[3]) != 0))
524       {
525         /* Set MPIE = 1 (multiprocessor mode reception) */
526         SCI3.SCR.BIT.MPIE = 1;
527       }
528 
529       /* Notify the user */
530       if (rpdl_SCI_RX_End_callback_func[3] != PDL_NO_FUNC)
531       {
532         rpdl_SCI_RX_End_callback_func[3]();
533       }
534     }
535   }
536   /* Either the DMAC or DTC has passed on the interrupt */
537   else
538   {
539     /* Call the callback function */
540     if (rpdl_SCI_RX_End_callback_func[3] != PDL_NO_FUNC)
541     {
542       rpdl_SCI_RX_End_callback_func[3]();
543     }
544   }
545 }
546 
547 
548 #if FAST_INTC_VECTOR == VECT_SCI5_RXI5
Interrupt_SCI5_RXI5(void)549 __fast_interrupt void Interrupt_SCI5_RXI5(void)
550 #else
551 #pragma vector = VECT_SCI5_RXI5
552 __interrupt void Interrupt_SCI5_RXI5(void)
553 #endif
554 {
555   /* Ok to process the data? */
556   if (rpdl_SCI_rx_using_irq[5] == true)
557   {
558     /* check if ID reception in Multiprocessor mode */
559     if (rpdl_SCI_MP_mode[5] == 2)
560     {
561       /* check if ID cycle ? */
562       if (SCI5.SSR.BIT.MPB == 1)
563       {
564         uint8_t id;
565 
566         /* Read the ID */
567         id = SCI5.RDR;
568 
569         /* ID matching ? */
570         if (id != rpdl_SCI_MP_rx_stationID[5])
571         {
572           /* ID does not match */
573           /* MPIE = 1 */
574           SCI5.SCR.BIT.MPIE = 1;
575         }
576         else
577         {
578           /* ID matches */
579           /* Disable interrupt request generation, and try to disable reception */
580           SCI5.SCR.BYTE &= (uint8_t)(INV_BIT_6 & INV_BIT_4);
581 
582           /* Notify the user */
583           if (rpdl_SCI_RX_End_callback_func[5] != PDL_NO_FUNC)
584           {
585             rpdl_SCI_RX_End_callback_func[5]();
586           }
587         }
588 
589         /* Exit ISR */
590         return;
591       }
592     }
593 
594     /* Read and store the character */
595     *rpdl_SCI_rx_string_pointer[5] = SCI5.RDR;
596 
597     /* Increment the character counter */
598     rpdl_SCI_rx_counter[5]++;
599 
600     /* More characters expected? */
601     if (rpdl_SCI_rx_counter[5] < rpdl_SCI_rx_threshold[5])
602     {
603       /* Move to the next location in the buffer */
604       rpdl_SCI_rx_string_pointer[5]++;
605     }
606     else
607     {
608       /* Disable interrupt request generation, and try to disable reception */
609       SCI5.SCR.BYTE &= (uint8_t)(INV_BIT_6 & INV_BIT_4);
610 
611       /* Async MP mode ? */
612       if (((SCI5.SMR.BIT.MP) != 0) && ((rpdl_SCI_MP_mode[5]) != 0))
613       {
614         /* Set MPIE = 1 (multiprocessor mode reception) */
615         SCI5.SCR.BIT.MPIE = 1;
616       }
617 
618       /* Notify the user */
619       if (rpdl_SCI_RX_End_callback_func[5] != PDL_NO_FUNC)
620       {
621         rpdl_SCI_RX_End_callback_func[5]();
622       }
623     }
624   }
625   /* Either the DMAC or DTC has passed on the interrupt */
626   else
627   {
628     /* Call the callback function */
629     if (rpdl_SCI_RX_End_callback_func[5] != PDL_NO_FUNC)
630     {
631       rpdl_SCI_RX_End_callback_func[5]();
632     }
633   }
634 }
635 
636 #if FAST_INTC_VECTOR == VECT_SCI6_RXI6
Interrupt_SCI6_RXI6(void)637 __fast_interrupt void Interrupt_SCI6_RXI6(void)
638 #else
639 #pragma vector = VECT_SCI6_RXI6
640 __interrupt void Interrupt_SCI6_RXI6(void)
641 #endif
642 {
643   /* Ok to process the data? */
644   if (rpdl_SCI_rx_using_irq[6] == true)
645   {
646     /* check if ID reception in Multiprocessor mode */
647     if (rpdl_SCI_MP_mode[6] == 2)
648     {
649       /* check if ID cycle ? */
650       if (SCI6.SSR.BIT.MPB == 1)
651       {
652         uint8_t id;
653 
654         /* Read the ID */
655         id = SCI6.RDR;
656 
657         /* ID matching ? */
658         if (id != rpdl_SCI_MP_rx_stationID[6])
659         {
660           /* ID does not match */
661           /* MPIE = 1 */
662           SCI6.SCR.BIT.MPIE = 1;
663         }
664         else
665         {
666           /* ID matches */
667           /* Disable interrupt request generation, and try to disable reception */
668           SCI6.SCR.BYTE &= (uint8_t)(INV_BIT_6 & INV_BIT_4);
669 
670           /* Notify the user */
671           if (rpdl_SCI_RX_End_callback_func[6] != PDL_NO_FUNC)
672           {
673             rpdl_SCI_RX_End_callback_func[6]();
674           }
675         }
676 
677         /* Exit ISR */
678         return;
679       }
680     }
681 
682     /* Read and store the character */
683     *rpdl_SCI_rx_string_pointer[6] = SCI6.RDR;
684 
685     /* Increment the character counter */
686     rpdl_SCI_rx_counter[6]++;
687 
688     /* More characters expected? */
689     if (rpdl_SCI_rx_counter[6] < rpdl_SCI_rx_threshold[6])
690     {
691       /* Move to the next location in the buffer */
692       rpdl_SCI_rx_string_pointer[6]++;
693     }
694     else
695     {
696       /* Disable interrupt request generation, and try to disable reception */
697       SCI6.SCR.BYTE &= (uint8_t)(INV_BIT_6 & INV_BIT_4);
698 
699       /* Async MP mode ? */
700       if (((SCI6.SMR.BIT.MP) != 0) && ((rpdl_SCI_MP_mode[6]) != 0))
701       {
702         /* Set MPIE = 1 (multiprocessor mode reception) */
703         SCI6.SCR.BIT.MPIE = 1;
704       }
705 
706       /* Notify the user */
707       if (rpdl_SCI_RX_End_callback_func[6] != PDL_NO_FUNC)
708       {
709         rpdl_SCI_RX_End_callback_func[6]();
710       }
711     }
712   }
713   /* Either the DMAC or DTC has passed on the interrupt */
714   else
715   {
716     /* Call the callback function */
717     if (rpdl_SCI_RX_End_callback_func[6] != PDL_NO_FUNC)
718     {
719       rpdl_SCI_RX_End_callback_func[6]();
720     }
721   }
722 }
723 
724 /*""FUNC COMMENT""***************************************************
725 * Module outline: SCIn transmit data interrupt processing
726 *-------------------------------------------------------------------
727 * Declaration	: void Interrupt_SCIn_TXIn(void)
728 *-------------------------------------------------------------------
729 * Function		:
730 *-------------------------------------------------------------------
731 * Argument		: Nothing
732 *-------------------------------------------------------------------
733 * Return value	: Nothing
734 *-------------------------------------------------------------------
735 * Output		: TDR for that SCI channel
736 *-------------------------------------------------------------------
737 * Use function	:
738 *-------------------------------------------------------------------
739 * Notes			:
740 *-------------------------------------------------------------------
741 * History		: 2011.04.08
742 *				: Ver 1.02
743 *				: CS-5 release.
744 *""FUNC COMMENT END""**********************************************/
745 
746 #if FAST_INTC_VECTOR == VECT_SCI0_TXI0
Interrupt_SCI0_TXI0(void)747 __fast_interrupt void Interrupt_SCI0_TXI0(void)
748 #else
749 #pragma vector = VECT_SCI0_TXI0
750 __interrupt void Interrupt_SCI0_TXI0(void)
751 #endif
752 {
753   /* Ok to process the string? */
754   if (rpdl_SCI_tx_using_irq[0] == true)
755   {
756     /* Another character to be sent? */
757     if (
758       /* Sending a string and next character is not a Null? */
759       ((rpdl_SCI_tx_threshold[0] == 0) && (*rpdl_SCI_tx_string_pointer[0] != NULL))
760       ||
761       /* Not reached the byte total? */
762       (rpdl_SCI_tx_counter[0] < rpdl_SCI_tx_threshold[0])
763       )
764     {
765       /* Send the character */
766       SCI0.TDR = *rpdl_SCI_tx_string_pointer[0];
767 
768       /* Increment the pointer */
769       rpdl_SCI_tx_string_pointer[0]++;
770 
771       /* Increment the counter */
772       rpdl_SCI_tx_counter[0]++;
773     }
774     else
775     {
776       /* Disable interrupt request generation */
777       SCI0.SCR.BIT.TIE = 0;
778 
779       /* Smart card mode? */
780       if (SCI0.SCMR.BIT.SMIF == 1)
781       {
782         /* Disable transmission and interrupt request generation */
783         SCI0.SCR.BYTE &= (uint8_t)(INV_BIT_7 & INV_BIT_5);
784 
785         /* Call the callback function */
786         if (rpdl_SCI_TX_End_callback_func[0] != PDL_NO_FUNC)
787         {
788           rpdl_SCI_TX_End_callback_func[0]();
789         }
790       }
791     }
792   }
793   /* Either the DMAC or DTC has passed on the interrupt */
794   else
795   {
796     /* Call the callback function */
797     if (rpdl_SCI_TX_End_callback_func[0] != PDL_NO_FUNC)
798     {
799       rpdl_SCI_TX_End_callback_func[0]();
800     }
801   }
802 }
803 
804 #if FAST_INTC_VECTOR == VECT_SCI1_TXI1
Interrupt_SCI1_TXI1(void)805 __fast_interrupt void Interrupt_SCI1_TXI1(void)
806 #else
807 #pragma vector = VECT_SCI1_TXI1
808 __interrupt void Interrupt_SCI1_TXI1(void)
809 #endif
810 {
811   /* Ok to process the string? */
812   if (rpdl_SCI_tx_using_irq[1] == true)
813   {
814     /* Another character to be sent? */
815     if (
816       /* Sending a string and next character is not a Null? */
817       ((rpdl_SCI_tx_threshold[1] == 0) && (*rpdl_SCI_tx_string_pointer[1] != NULL))
818       ||
819       /* Not reached the byte total? */
820       (rpdl_SCI_tx_counter[1] < rpdl_SCI_tx_threshold[1])
821       )
822     {
823       /* Send the character */
824       SCI1.TDR = *rpdl_SCI_tx_string_pointer[1];
825 
826       /* Increment the pointer */
827       rpdl_SCI_tx_string_pointer[1]++;
828 
829       /* Increment the counter */
830       rpdl_SCI_tx_counter[1]++;
831     }
832     else
833     {
834       /* Disable interrupt request generation */
835       SCI1.SCR.BIT.TIE = 0;
836 
837       /* Smart card mode? */
838       if (SCI1.SCMR.BIT.SMIF == 1)
839       {
840         /* Disable transmission and interrupt request generation */
841         SCI1.SCR.BYTE &= (uint8_t)(INV_BIT_7 & INV_BIT_5);
842 
843         /* Call the callback function */
844         if (rpdl_SCI_TX_End_callback_func[1] != PDL_NO_FUNC)
845         {
846           rpdl_SCI_TX_End_callback_func[1]();
847         }
848       }
849     }
850   }
851   /* Either the DMAC or DTC has passed on the interrupt */
852   else
853   {
854     /* Call the callback function */
855     if (rpdl_SCI_TX_End_callback_func[1] != PDL_NO_FUNC)
856     {
857       rpdl_SCI_TX_End_callback_func[1]();
858     }
859   }
860 }
861 
862 #if FAST_INTC_VECTOR == VECT_SCI2_TXI2
Interrupt_SCI2_TXI2(void)863 __fast_interrupt void Interrupt_SCI2_TXI2(void)
864 #else
865 #pragma vector = VECT_SCI2_TXI2
866 __interrupt void Interrupt_SCI2_TXI2(void)
867 #endif
868 {
869   /* Ok to process the string? */
870   if (rpdl_SCI_tx_using_irq[2] == true)
871   {
872     /* Another character to be sent? */
873     if (
874       /* Sending a string and next character is not a Null? */
875       ((rpdl_SCI_tx_threshold[2] == 0) && (*rpdl_SCI_tx_string_pointer[2] != NULL))
876       ||
877       /* Not reached the byte total? */
878       (rpdl_SCI_tx_counter[2] < rpdl_SCI_tx_threshold[2])
879       )
880     {
881       /* Send the character */
882       SCI2.TDR = *rpdl_SCI_tx_string_pointer[2];
883 
884       /* Increment the pointer */
885       rpdl_SCI_tx_string_pointer[2]++;
886 
887       /* Increment the counter */
888       rpdl_SCI_tx_counter[2]++;
889     }
890     else
891     {
892       /* Disable interrupt request generation */
893       SCI2.SCR.BIT.TIE = 0;
894 
895       /* Smart card mode? */
896       if (SCI2.SCMR.BIT.SMIF == 1)
897       {
898         /* Disable transmission and interrupt request generation */
899         SCI2.SCR.BYTE &= (uint8_t)(INV_BIT_7 & INV_BIT_5);
900 
901         /* Call the callback function */
902         if (rpdl_SCI_TX_End_callback_func[2] != PDL_NO_FUNC)
903         {
904           rpdl_SCI_TX_End_callback_func[2]();
905         }
906       }
907     }
908   }
909   /* Either the DMAC or DTC has passed on the interrupt */
910   else
911   {
912     /* Call the callback function */
913     if (rpdl_SCI_TX_End_callback_func[2] != PDL_NO_FUNC)
914     {
915       rpdl_SCI_TX_End_callback_func[2]();
916     }
917   }
918 }
919 
920 #if FAST_INTC_VECTOR == VECT_SCI3_TXI3
Interrupt_SCI3_TXI3(void)921 __fast_interrupt void Interrupt_SCI3_TXI3(void)
922 #else
923 #pragma vector = VECT_SCI3_TXI3
924 __interrupt void Interrupt_SCI3_TXI3(void)
925 #endif
926 {
927   /* Ok to process the string? */
928   if (rpdl_SCI_tx_using_irq[3] == true)
929   {
930     /* Another character to be sent? */
931     if (
932       /* Sending a string and next character is not a Null? */
933       ((rpdl_SCI_tx_threshold[3] == 0) && (*rpdl_SCI_tx_string_pointer[3] != NULL))
934       ||
935       /* Not reached the byte total? */
936       (rpdl_SCI_tx_counter[3] < rpdl_SCI_tx_threshold[3])
937       )
938     {
939       /* Send the character */
940       SCI3.TDR = *rpdl_SCI_tx_string_pointer[3];
941 
942       /* Increment the pointer */
943       rpdl_SCI_tx_string_pointer[3]++;
944 
945       /* Increment the counter */
946       rpdl_SCI_tx_counter[3]++;
947     }
948     else
949     {
950       /* Disable interrupt request generation */
951       SCI3.SCR.BIT.TIE = 0;
952 
953       /* Smart card mode? */
954       if (SCI3.SCMR.BIT.SMIF == 1)
955       {
956         /* Disable transmission and interrupt request generation */
957         SCI3.SCR.BYTE &= (uint8_t)(INV_BIT_7 & INV_BIT_5);
958 
959         /* Call the callback function */
960         if (rpdl_SCI_TX_End_callback_func[3] != PDL_NO_FUNC)
961         {
962           rpdl_SCI_TX_End_callback_func[3]();
963         }
964       }
965     }
966   }
967   /* Either the DMAC or DTC has passed on the interrupt */
968   else
969   {
970     /* Call the callback function */
971     if (rpdl_SCI_TX_End_callback_func[3] != PDL_NO_FUNC)
972     {
973       rpdl_SCI_TX_End_callback_func[3]();
974     }
975   }
976 }
977 
978 
979 #if FAST_INTC_VECTOR == VECT_SCI5_TXI5
Interrupt_SCI5_TXI5(void)980 __fast_interrupt void Interrupt_SCI5_TXI5(void)
981 #else
982 #pragma vector = VECT_SCI5_TXI5
983 __interrupt void Interrupt_SCI5_TXI5(void)
984 #endif
985 {
986   /* Ok to process the string? */
987   if (rpdl_SCI_tx_using_irq[5] == true)
988   {
989     /* Another character to be sent? */
990     if (
991       /* Sending a string and next character is not a Null? */
992       ((rpdl_SCI_tx_threshold[5] == 0) && (*rpdl_SCI_tx_string_pointer[5] != NULL))
993       ||
994       /* Not reached the byte total? */
995       (rpdl_SCI_tx_counter[5] < rpdl_SCI_tx_threshold[5])
996       )
997     {
998       /* Send the character */
999       SCI5.TDR = *rpdl_SCI_tx_string_pointer[5];
1000 
1001       /* Increment the pointer */
1002       rpdl_SCI_tx_string_pointer[5]++;
1003 
1004       /* Increment the counter */
1005       rpdl_SCI_tx_counter[5]++;
1006     }
1007     else
1008     {
1009       /* Disable interrupt request generation */
1010       SCI5.SCR.BIT.TIE = 0;
1011 
1012       /* Smart card mode? */
1013       if (SCI5.SCMR.BIT.SMIF == 1)
1014       {
1015         /* Disable transmission and interrupt request generation */
1016         SCI5.SCR.BYTE &= (uint8_t)(INV_BIT_7 & INV_BIT_5);
1017 
1018         /* Call the callback function */
1019         if (rpdl_SCI_TX_End_callback_func[5] != PDL_NO_FUNC)
1020         {
1021           rpdl_SCI_TX_End_callback_func[5]();
1022         }
1023       }
1024     }
1025   }
1026   /* Either the DMAC or DTC has passed on the interrupt */
1027   else
1028   {
1029     /* Call the callback function */
1030     if (rpdl_SCI_TX_End_callback_func[5] != PDL_NO_FUNC)
1031     {
1032       rpdl_SCI_TX_End_callback_func[5]();
1033     }
1034   }
1035 }
1036 
1037 #if FAST_INTC_VECTOR == VECT_SCI6_TXI6
Interrupt_SCI6_TXI6(void)1038 __fast_interrupt void Interrupt_SCI6_TXI6(void)
1039 #else
1040 #pragma vector = VECT_SCI6_TXI6
1041 __interrupt void Interrupt_SCI6_TXI6(void)
1042 #endif
1043 {
1044   /* Ok to process the string? */
1045   if (rpdl_SCI_tx_using_irq[6] == true)
1046   {
1047     /* Another character to be sent? */
1048     if (
1049       /* Sending a string and next character is not a Null? */
1050       ((rpdl_SCI_tx_threshold[6] == 0) && (*rpdl_SCI_tx_string_pointer[6] != NULL))
1051       ||
1052       /* Not reached the byte total? */
1053       (rpdl_SCI_tx_counter[6] < rpdl_SCI_tx_threshold[6])
1054       )
1055     {
1056       /* Send the character */
1057       SCI6.TDR = *rpdl_SCI_tx_string_pointer[6];
1058 
1059       /* Increment the pointer */
1060       rpdl_SCI_tx_string_pointer[6]++;
1061 
1062       /* Increment the counter */
1063       rpdl_SCI_tx_counter[6]++;
1064     }
1065     else
1066     {
1067       /* Disable interrupt request generation */
1068       SCI6.SCR.BIT.TIE = 0;
1069 
1070       /* Smart card mode? */
1071       if (SCI6.SCMR.BIT.SMIF == 1)
1072       {
1073         /* Disable transmission and interrupt request generation */
1074         SCI6.SCR.BYTE &= (uint8_t)(INV_BIT_7 & INV_BIT_5);
1075 
1076         /* Call the callback function */
1077         if (rpdl_SCI_TX_End_callback_func[6] != PDL_NO_FUNC)
1078         {
1079           rpdl_SCI_TX_End_callback_func[6]();
1080         }
1081       }
1082     }
1083   }
1084   /* Either the DMAC or DTC has passed on the interrupt */
1085   else
1086   {
1087     /* Call the callback function */
1088     if (rpdl_SCI_TX_End_callback_func[6] != PDL_NO_FUNC)
1089     {
1090       rpdl_SCI_TX_End_callback_func[6]();
1091     }
1092   }
1093 }
1094 
1095 /*""FUNC COMMENT""***************************************************
1096 * Module outline: SCIn transmit end interrupt processing
1097 *-------------------------------------------------------------------
1098 * Declaration	: void Interrupt_SCIn_TEIn(void)
1099 *-------------------------------------------------------------------
1100 * Function		:
1101 *-------------------------------------------------------------------
1102 * Argument		: Nothing
1103 *-------------------------------------------------------------------
1104 * Return value	: Nothing
1105 *-------------------------------------------------------------------
1106 * Output		: SCR for that channel
1107 *-------------------------------------------------------------------
1108 * Use function	: rpdl_SCI_TX_End_callback_func()
1109 *-------------------------------------------------------------------
1110 * Notes			:
1111 *-------------------------------------------------------------------
1112 * History		: 2011.04.08
1113 *				: Ver 1.02
1114 *				: CS-5 release.
1115 *""FUNC COMMENT END""**********************************************/
1116 
1117 #if FAST_INTC_VECTOR == VECT_SCI0_TEI0
Interrupt_SCI0_TEI0(void)1118 __fast_interrupt void Interrupt_SCI0_TEI0(void)
1119 #else
1120 #pragma vector = VECT_SCI0_TEI0
1121 __interrupt void Interrupt_SCI0_TEI0(void)
1122 #endif
1123 {
1124   /* Disable interrupt request generation, and try to disable transmission */
1125   SCI0.SCR.BYTE &= (uint8_t)(INV_BIT_7 & INV_BIT_5 & INV_BIT_2);
1126 
1127   /* Call the callback function */
1128   if (rpdl_SCI_TX_End_callback_func[0] != PDL_NO_FUNC)
1129   {
1130     rpdl_SCI_TX_End_callback_func[0]();
1131   }
1132 }
1133 
1134 #if FAST_INTC_VECTOR == VECT_SCI1_TEI1
Interrupt_SCI1_TEI1(void)1135 __fast_interrupt void Interrupt_SCI1_TEI1(void)
1136 #else
1137 #pragma vector = VECT_SCI1_TEI1
1138 __interrupt void Interrupt_SCI1_TEI1(void)
1139 #endif
1140 {
1141   /* Disable interrupt request generation, and try to disable transmission */
1142   SCI1.SCR.BYTE &= (uint8_t)(INV_BIT_7 & INV_BIT_5 & INV_BIT_2);
1143 
1144   /* Call the callback function */
1145   if (rpdl_SCI_TX_End_callback_func[1] != PDL_NO_FUNC)
1146   {
1147     rpdl_SCI_TX_End_callback_func[1]();
1148   }
1149 }
1150 
1151 #if FAST_INTC_VECTOR == VECT_SCI2_TEI2
Interrupt_SCI2_TEI2(void)1152 __fast_interrupt void Interrupt_SCI2_TEI2(void)
1153 #else
1154 #pragma vector = VECT_SCI2_TEI2
1155 __interrupt void Interrupt_SCI2_TEI2(void)
1156 #endif
1157 {
1158   /* Disable interrupt request generation, and try to disable transmission */
1159   SCI2.SCR.BYTE &= (uint8_t)(INV_BIT_7 & INV_BIT_5 & INV_BIT_2);
1160 
1161   /* Call the callback function */
1162   if (rpdl_SCI_TX_End_callback_func[2] != PDL_NO_FUNC)
1163   {
1164     rpdl_SCI_TX_End_callback_func[2]();
1165   }
1166 }
1167 
1168 #if FAST_INTC_VECTOR == VECT_SCI3_TEI3
Interrupt_SCI3_TEI3(void)1169 __fast_interrupt void Interrupt_SCI3_TEI3(void)
1170 #else
1171 #pragma vector = VECT_SCI3_TEI3
1172 __interrupt void Interrupt_SCI3_TEI3(void)
1173 #endif
1174 {
1175   /* Disable interrupt request generation, and try to disable transmission */
1176   SCI3.SCR.BYTE &= (uint8_t)(INV_BIT_7 & INV_BIT_5 & INV_BIT_2);
1177 
1178   /* Call the callback function */
1179   if (rpdl_SCI_TX_End_callback_func[3] != PDL_NO_FUNC)
1180   {
1181     rpdl_SCI_TX_End_callback_func[3]();
1182   }
1183 }
1184 
1185 
1186 #if FAST_INTC_VECTOR == VECT_SCI5_TEI5
Interrupt_SCI5_TEI5(void)1187 __fast_interrupt void Interrupt_SCI5_TEI5(void)
1188 #else
1189 #pragma vector = VECT_SCI5_TEI5
1190 __interrupt void Interrupt_SCI5_TEI5(void)
1191 #endif
1192 {
1193   /* Disable interrupt request generation, and try to disable transmission */
1194   SCI5.SCR.BYTE &= (uint8_t)(INV_BIT_7 & INV_BIT_5 & INV_BIT_2);
1195 
1196   /* Call the callback function */
1197   if (rpdl_SCI_TX_End_callback_func[5] != PDL_NO_FUNC)
1198   {
1199     rpdl_SCI_TX_End_callback_func[5]();
1200   }
1201 }
1202 
1203 #if FAST_INTC_VECTOR == VECT_SCI6_TEI6
Interrupt_SCI6_TEI6(void)1204 __fast_interrupt void Interrupt_SCI6_TEI6(void)
1205 #else
1206 #pragma vector = VECT_SCI6_TEI6
1207 __interrupt void Interrupt_SCI6_TEI6(void)
1208 #endif
1209 {
1210   /* Disable interrupt request generation, and try to disable transmission */
1211   SCI6.SCR.BYTE &= (uint8_t)(INV_BIT_7 & INV_BIT_5 & INV_BIT_2);
1212 
1213   /* Call the callback function */
1214   if (rpdl_SCI_TX_End_callback_func[6] != PDL_NO_FUNC)
1215   {
1216     rpdl_SCI_TX_End_callback_func[6]();
1217   }
1218 }
1219 /* End of file */
1220