1
0

interrupt_sci.c 32 KB

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