mcu_interrupts.c 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894
  1. /***********************************************************************************************************************
  2. * DISCLAIMER
  3. * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
  4. * other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
  5. * applicable laws, including copyright laws.
  6. * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
  7. * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
  8. * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
  9. * EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
  10. * SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS
  11. * SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  12. * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
  13. * this software. By using this software, you agree to the additional terms and conditions found by accessing the
  14. * following link:
  15. * http://www.renesas.com/disclaimer
  16. *
  17. * Copyright (C) 2016 Renesas Electronics Corporation. All rights reserved.
  18. ***********************************************************************************************************************/
  19. /***********************************************************************************************************************
  20. * File Name : mcu_interrupts.c
  21. * Description : This module allows for callbacks to be registered for certain interrupts.
  22. ***********************************************************************************************************************/
  23. /**********************************************************************************************************************
  24. * History : DD.MM.YYYY Version Description
  25. * : 01.10.2016 1.00 First Release
  26. * : 15.05.2017 2.00 Added callback processing of the following group interrupt sources.
  27. * - RIIC1_EEI1
  28. * - RIIC1_TEI1
  29. * - GLCDC_VPOS
  30. * - GLCDC_GR1UF
  31. * - GLCDC_GR2UF
  32. * - DRW2D_DRW_IRQ
  33. * Changed calling order of callback function in group interrupts.
  34. * : 27.07.2018 2.01 Added the comment to for statement.
  35. * : xx.xx.xxxx 2.02 Added support for GNUC and ICCRX.
  36. * Removed the wrong comment from for statement.
  37. ***********************************************************************************************************************/
  38. /***********************************************************************************************************************
  39. Includes <System Includes> , "Project Includes"
  40. ***********************************************************************************************************************/
  41. /* Access to r_bsp. */
  42. #include "platform.h"
  43. /***********************************************************************************************************************
  44. Macro definitions
  45. ***********************************************************************************************************************/
  46. /* This macro is used to suppress compiler messages about a parameter not being used in a function. The nice thing
  47. * about using this implementation is that it does not take any extra RAM or ROM.
  48. */
  49. #define INTERNAL_NOT_USED(p) ((void)(p))
  50. /* Let FPSW EV, EO, EZ, EU, EX=1 (FPU exceptions enabled.) */
  51. #define FPU_EXCEPTIONS_ENABLE (0x00007C00)
  52. /***********************************************************************************************************************
  53. Typedef definitions
  54. ***********************************************************************************************************************/
  55. /***********************************************************************************************************************
  56. Exported global variables (to be accessed by other files)
  57. ***********************************************************************************************************************/
  58. /***********************************************************************************************************************
  59. Private global variables and functions
  60. ***********************************************************************************************************************/
  61. /* This array holds callback functions. */
  62. static void (* g_bsp_vectors[BSP_INT_SRC_TOTAL_ITEMS])(void * pdata);
  63. bsp_int_err_t bsp_interrupt_enable_disable(bsp_int_src_t vector, bool enable);
  64. bsp_int_err_t bsp_interrupt_group_enable_disable(bsp_int_src_t vector, bool enable, uint32_t ipl);
  65. #ifndef GRROSE
  66. R_PRAGMA_INTERRUPT(group_bl0_handler_isr, VECT(ICU,GROUPBL0))
  67. R_PRAGMA_INTERRUPT(group_bl1_handler_isr, VECT(ICU,GROUPBL1))
  68. #endif
  69. R_PRAGMA_INTERRUPT(group_bl2_handler_isr, VECT(ICU,GROUPBL2))
  70. R_PRAGMA_INTERRUPT(group_al0_handler_isr, VECT(ICU,GROUPAL0))
  71. R_PRAGMA_INTERRUPT(group_al1_handler_isr, VECT(ICU,GROUPAL1))
  72. /***********************************************************************************************************************
  73. * Function Name: bsp_interrupt_open
  74. * Description : Initialize callback function array.
  75. * Arguments : None
  76. * Return Value : None
  77. ***********************************************************************************************************************/
  78. void bsp_interrupt_open (void)
  79. {
  80. uint32_t i;
  81. for (i = 0; i < BSP_INT_SRC_TOTAL_ITEMS; i++)
  82. {
  83. g_bsp_vectors[i] = FIT_NO_FUNC;
  84. }
  85. /* Initialize mapped interrupts. */
  86. bsp_mapped_interrupt_open();
  87. }
  88. /***********************************************************************************************************************
  89. * Function Name: R_BSP_InterruptWrite
  90. * Description : Registers a callback function for supported interrupts. If FIT_NO_FUNC, NULL, or
  91. * any other invalid function address is passed for the callback argument then any previously registered
  92. * callbacks are unregistered. Use of FIT_NO_FUNC is preferred over NULL since access to the address
  93. * defined by FIT_NO_FUNC will cause a bus error which is easy for the user to catch. NULL typically
  94. * resolves to 0 which is a valid address on RX MCUs.
  95. * Arguments : vector -
  96. * Which interrupt to register a callback for.
  97. * callback -
  98. * Pointer to function to call when interrupt occurs.
  99. * Return Value : BSP_INT_SUCCESS -
  100. * Callback registered
  101. * BSP_INT_ERR_INVALID_ARG -
  102. * Invalid function address input, any previous function has been unregistered
  103. ***********************************************************************************************************************/
  104. bsp_int_err_t R_BSP_InterruptWrite (bsp_int_src_t vector, bsp_int_cb_t callback)
  105. {
  106. bsp_int_err_t err;
  107. err = BSP_INT_SUCCESS;
  108. /* Check for valid address. */
  109. if (((uint32_t)callback == (uint32_t)NULL) || ((uint32_t)callback == (uint32_t)FIT_NO_FUNC))
  110. {
  111. g_bsp_vectors[vector] = FIT_NO_FUNC;
  112. }
  113. else
  114. {
  115. g_bsp_vectors[vector] = callback;
  116. }
  117. return err;
  118. }
  119. /***********************************************************************************************************************
  120. * Function Name: R_BSP_InterruptRead
  121. * Description : Returns the callback function address for an interrupt.
  122. * Arguments : vector -
  123. * Which interrupt to read the callback for.
  124. * callback -
  125. * Pointer of where to store callback address.
  126. * Return Value : BSP_INT_SUCCESS -
  127. * Callback was registered and address has been stored in 'callback' parameter.
  128. * BSP_INT_ERR_NO_REGISTERED_CALLBACK -
  129. * No valid callback has been registered for this interrupt source.
  130. ***********************************************************************************************************************/
  131. bsp_int_err_t R_BSP_InterruptRead (bsp_int_src_t vector, bsp_int_cb_t * callback)
  132. {
  133. bsp_int_err_t err;
  134. err = BSP_INT_SUCCESS;
  135. /* Check for valid address. */
  136. if (((uint32_t)g_bsp_vectors[vector] == (uint32_t)NULL) || ((uint32_t)g_bsp_vectors[vector] == (uint32_t)FIT_NO_FUNC))
  137. {
  138. err = BSP_INT_ERR_NO_REGISTERED_CALLBACK;
  139. }
  140. else
  141. {
  142. *callback = g_bsp_vectors[vector];
  143. }
  144. return err;
  145. }
  146. /***********************************************************************************************************************
  147. * Function Name: R_BSP_InterruptControl
  148. * Description : Executes specified command.
  149. * Arguments : vector -
  150. * Which vector is being used.
  151. * cmd -
  152. * Which command to execute.
  153. * pdata -
  154. * Pointer to data to use with command.
  155. * Currently only used for BSP_INT_CMD_GROUP_INTERRUPT_ENABLE, and points
  156. * to a bsp_int_ctrl_t *. Other commands should supply FIT_NO_PTR.
  157. * Return Value : BSP_INT_SUCCESS -
  158. * Command executed successfully.
  159. * BSP_INT_ERR_NO_REGISTERED_CALLBACK -
  160. * No valid callback has been registered for this interrupt source.
  161. * BSP_INT_ERR_INVALID_ARG -
  162. * Invalid command sent in.
  163. * BSP_INT_ERR_GROUP_STILL_ENABLED -
  164. * Not all group interrupts were disabled so group interrupt was not disabled.
  165. ***********************************************************************************************************************/
  166. bsp_int_err_t R_BSP_InterruptControl (bsp_int_src_t vector, bsp_int_cmd_t cmd, void * pdata)
  167. {
  168. bsp_int_err_t err;
  169. bsp_int_cb_args_t cb_args;
  170. err = BSP_INT_SUCCESS;
  171. switch (cmd)
  172. {
  173. case (BSP_INT_CMD_CALL_CALLBACK):
  174. if (((uint32_t)g_bsp_vectors[vector] != (uint32_t)NULL) &&
  175. ((uint32_t)g_bsp_vectors[vector] != (uint32_t)FIT_NO_FUNC))
  176. {
  177. /* Fill in callback info. */
  178. cb_args.vector = vector;
  179. g_bsp_vectors[vector](&cb_args);
  180. }
  181. else
  182. {
  183. err = BSP_INT_ERR_NO_REGISTERED_CALLBACK;
  184. }
  185. break;
  186. case (BSP_INT_CMD_INTERRUPT_ENABLE):
  187. err = bsp_interrupt_enable_disable(vector, true);
  188. break;
  189. case (BSP_INT_CMD_INTERRUPT_DISABLE):
  190. err = bsp_interrupt_enable_disable(vector, false);
  191. break;
  192. case (BSP_INT_CMD_GROUP_INTERRUPT_ENABLE):
  193. err = bsp_interrupt_group_enable_disable(vector, true, ((bsp_int_ctrl_t *)pdata)->ipl);
  194. break;
  195. case (BSP_INT_CMD_GROUP_INTERRUPT_DISABLE):
  196. err = bsp_interrupt_group_enable_disable(vector, false, 0);
  197. break;
  198. default:
  199. err = BSP_INT_ERR_INVALID_ARG;
  200. break;
  201. }
  202. return err;
  203. }
  204. /***********************************************************************************************************************
  205. * Function Name: bsp_interrupt_enable_disable
  206. * Description : Either enables or disables an interrupt.
  207. * Arguments : vector -
  208. * Which vector to enable or disable.
  209. * enable -
  210. * Whether to enable or disable the interrupt.
  211. * Return Value : BSP_INT_SUCCESS -
  212. * Interrupt enabled or disabled.
  213. * BSP_INT_ERR_UNSUPPORTED -
  214. * API does not support enabling/disabling for this vector.
  215. ***********************************************************************************************************************/
  216. bsp_int_err_t bsp_interrupt_enable_disable (bsp_int_src_t vector, bool enable)
  217. {
  218. uint32_t temp_fpsw;
  219. bsp_int_err_t err = BSP_INT_SUCCESS;
  220. switch (vector)
  221. {
  222. case (BSP_INT_SRC_BUS_ERROR):
  223. if (true == enable)
  224. {
  225. /* Enable the bus error interrupt to catch accesses to illegal/reserved areas of memory */
  226. /* Clear any pending interrupts */
  227. IR(BSC,BUSERR) = 0;
  228. /* Make this the highest priority interrupt (adjust as necessary for your application */
  229. IPR(BSC,BUSERR) = 0x0F;
  230. /* Enable the interrupt in the ICU*/
  231. IEN(BSC,BUSERR) = 1;
  232. /* Enable illegal address interrupt in the BSC */
  233. BSC.BEREN.BIT.IGAEN = 1;
  234. /* Enable timeout detection enable. */
  235. BSC.BEREN.BIT.TOEN = 1;
  236. }
  237. else
  238. {
  239. /* Disable the bus error interrupt. */
  240. /* Disable the interrupt in the ICU*/
  241. IEN(BSC,BUSERR) = 0;
  242. /* Disable illegal address interrupt in the BSC */
  243. BSC.BEREN.BIT.IGAEN = 0;
  244. /* Disable timeout detection enable. */
  245. BSC.BEREN.BIT.TOEN = 0;
  246. }
  247. break;
  248. case (BSP_INT_SRC_EXC_FPU):
  249. /* Get current FPSW. */
  250. temp_fpsw = (uint32_t)R_GET_FPSW();
  251. if (true == enable)
  252. {
  253. /* Set the FPU exception flags. */
  254. R_SET_FPSW(temp_fpsw | (uint32_t)FPU_EXCEPTIONS_ENABLE);
  255. }
  256. else
  257. {
  258. /* Clear only the FPU exception flags. */
  259. R_SET_FPSW(temp_fpsw & (uint32_t)~FPU_EXCEPTIONS_ENABLE);
  260. }
  261. break;
  262. case (BSP_INT_SRC_EXC_NMI_PIN):
  263. if (true == enable)
  264. {
  265. /* Enable NMI pin interrupt (cannot undo!) */
  266. ICU.NMIER.BIT.NMIEN = 1;
  267. }
  268. else
  269. {
  270. /* NMI pin interrupts cannot be disabled after being enabled. */
  271. err = BSP_INT_ERR_UNSUPPORTED;
  272. }
  273. break;
  274. default:
  275. err = BSP_INT_ERR_UNSUPPORTED;
  276. break;
  277. }
  278. return err;
  279. }
  280. /***********************************************************************************************************************
  281. * Function Name: bsp_interrupt_group_enable_disable
  282. * Description : Either enables or disables a group interrupt. If a group interrupt is called multiple times to be
  283. * enabled then it will use the highest given IPL. A group interrupt will only be disabled when all
  284. * interrupt sources for that group are already disabled.
  285. * Arguments : vector -
  286. * An interrupt source inside the group that is to be enabled/disabled.
  287. * enable -
  288. * Whether to enable or disable the interrupt.
  289. * ipl -
  290. * If enabling a group interrupt, what IPL to use.
  291. * Return Value : BSP_INT_SUCCESS -
  292. * Interrupt enabled or disabled.
  293. * BSP_INT_ERR_INVALID_ARG -
  294. * Invalid IPL or vector
  295. * BSP_INT_ERR_GROUP_STILL_ENABLED -
  296. * Not all group interrupts were disabled so group interrupt was not disabled.
  297. ***********************************************************************************************************************/
  298. bsp_int_err_t bsp_interrupt_group_enable_disable (bsp_int_src_t vector, bool enable, uint32_t ipl)
  299. {
  300. bsp_int_err_t err = BSP_INT_SUCCESS;
  301. #if BSP_CFG_PARAM_CHECKING_ENABLE == 1
  302. /* If interrupt is going to be enabled, verify that IPL is valid. */
  303. if ((true == enable) && ((ipl == BSP_MCU_IPL_MIN) || (ipl > BSP_MCU_IPL_MAX)))
  304. {
  305. return BSP_INT_ERR_INVALID_ARG;
  306. }
  307. #endif
  308. if ((vector >= BSP_INT_SRC_BL0_SCI0_TEI0) && (vector <= BSP_INT_SRC_BL0_PDC_PCERI))
  309. {
  310. /* Group BL0. */
  311. if (true == enable)
  312. {
  313. IEN(ICU, GROUPBL0) = 0;
  314. IR(ICU, GROUPBL0) = 0;
  315. IPR(ICU, GROUPBL0) = (uint8_t)(ipl > IPR(ICU, GROUPBL0) ? ipl : IPR(ICU, GROUPBL0));
  316. IEN(ICU, GROUPBL0) = 1;
  317. }
  318. else
  319. {
  320. /* Check to make sure all interrupt sources are already disabled for this group. */
  321. if (0 == ICU.GENBL0.LONG)
  322. {
  323. IEN(ICU, GROUPBL0) = 0;
  324. IPR(ICU, GROUPBL0) = 0;
  325. }
  326. else
  327. {
  328. err = BSP_INT_ERR_GROUP_STILL_ENABLED;
  329. }
  330. }
  331. }
  332. else if ((vector >= BSP_INT_SRC_BL1_SDHI_CDETI) && (vector <= BSP_INT_SRC_BL1_RIIC1_EEI1))
  333. {
  334. /* Group BL1. */
  335. if (true == enable)
  336. {
  337. IEN(ICU, GROUPBL1) = 0;
  338. IR(ICU, GROUPBL1) = 0;
  339. IPR(ICU, GROUPBL1) = (uint8_t)(ipl > IPR(ICU, GROUPBL1) ? ipl : IPR(ICU, GROUPBL1));
  340. IEN(ICU, GROUPBL1) = 1;
  341. }
  342. else
  343. {
  344. /* Check to make sure all interrupt sources are already disabled for this group. */
  345. if (0 == ICU.GENBL1.LONG)
  346. {
  347. IEN(ICU, GROUPBL1) = 0;
  348. IPR(ICU, GROUPBL1) = 0;
  349. }
  350. else
  351. {
  352. err = BSP_INT_ERR_GROUP_STILL_ENABLED;
  353. }
  354. }
  355. }
  356. else if (vector == BSP_INT_SRC_BL2_SDSI_SDIOI)
  357. {
  358. /* Group BL2. */
  359. if (true == enable)
  360. {
  361. IEN(ICU, GROUPBL2) = 0;
  362. IR(ICU, GROUPBL2) = 0;
  363. IPR(ICU, GROUPBL2) = (uint8_t)(ipl > IPR(ICU, GROUPBL2) ? ipl : IPR(ICU, GROUPBL2));
  364. IEN(ICU, GROUPBL2) = 1;
  365. }
  366. else
  367. {
  368. /* Check to make sure all interrupt sources are already disabled for this group. */
  369. if (0 == ICU.GENBL2.LONG)
  370. {
  371. IEN(ICU, GROUPBL2) = 0;
  372. IPR(ICU, GROUPBL2) = 0;
  373. }
  374. else
  375. {
  376. err = BSP_INT_ERR_GROUP_STILL_ENABLED;
  377. }
  378. }
  379. }
  380. else if ((vector >= BSP_INT_SRC_AL0_SCI10_TEI10) && (vector <= BSP_INT_SRC_AL0_RSPI2_SPEI2))
  381. {
  382. /* Group AL0. */
  383. if (true == enable)
  384. {
  385. IEN(ICU, GROUPAL0) = 0;
  386. IR(ICU, GROUPAL0) = 0;
  387. IPR(ICU, GROUPAL0) = (uint8_t)(ipl > IPR(ICU, GROUPAL0) ? ipl : IPR(ICU, GROUPAL0));
  388. IEN(ICU, GROUPAL0) = 1;
  389. }
  390. else
  391. {
  392. /* Check to make sure all interrupt sources are already disabled for this group. */
  393. if (0 == ICU.GENAL0.LONG)
  394. {
  395. IEN(ICU, GROUPAL0) = 0;
  396. IPR(ICU, GROUPAL0) = 0;
  397. }
  398. else
  399. {
  400. err = BSP_INT_ERR_GROUP_STILL_ENABLED;
  401. }
  402. }
  403. }
  404. else if ((vector >= BSP_INT_SRC_AL1_EDMAC0_EINT0) && (vector <= BSP_INT_SRC_AL1_DRW2D_DRW_IRQ))
  405. {
  406. /* Group AL1. */
  407. if (true == enable)
  408. {
  409. IEN(ICU, GROUPAL1) = 0;
  410. IR(ICU, GROUPAL1) = 0;
  411. IPR(ICU, GROUPAL1) = (uint8_t)(ipl > IPR(ICU, GROUPAL1) ? ipl : IPR(ICU, GROUPAL1));
  412. IEN(ICU, GROUPAL1) = 1;
  413. }
  414. else
  415. {
  416. /* Check to make sure all interrupt sources are already disabled for this group. */
  417. if (0 == ICU.GENAL1.LONG)
  418. {
  419. IEN(ICU, GROUPAL1) = 0;
  420. IPR(ICU, GROUPAL1) = 0;
  421. }
  422. else
  423. {
  424. err = BSP_INT_ERR_GROUP_STILL_ENABLED;
  425. }
  426. }
  427. }
  428. else
  429. {
  430. /* Vector given was not part of a group. */
  431. err = BSP_INT_ERR_INVALID_ARG;
  432. }
  433. return err;
  434. }
  435. #ifndef GRROSE
  436. /***********************************************************************************************************************
  437. * Function Name: group_bl0_handler_isr
  438. * Description : Interrupt handler for Group BL0 interrupts. The way this code works is that for each possible interrupt
  439. * in this group the following will be performed:
  440. * 1) Test to see if an interrupt is requested for this source
  441. * 2) If an interrupt is requested then the registered callback is called (if one is registered)
  442. * NOTE: The interrupt request flag must be cleared in the peripheral.
  443. * Arguments : None
  444. * Return Value : None
  445. ***********************************************************************************************************************/
  446. R_ATTRIB_INTERRUPT void group_bl0_handler_isr (void)
  447. {
  448. if (1 == ICU.GRPBL0.BIT.IS1)
  449. {
  450. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI0_ERI0, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  451. }
  452. if (1 == ICU.GRPBL0.BIT.IS0)
  453. {
  454. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI0_TEI0, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  455. }
  456. if (1 == ICU.GRPBL0.BIT.IS3)
  457. {
  458. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI1_ERI1, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  459. }
  460. if (1 == ICU.GRPBL0.BIT.IS2)
  461. {
  462. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI1_TEI1, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  463. }
  464. if (1 == ICU.GRPBL0.BIT.IS5)
  465. {
  466. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI2_ERI2, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  467. }
  468. if (1 == ICU.GRPBL0.BIT.IS4)
  469. {
  470. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI2_TEI2, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  471. }
  472. if (1 == ICU.GRPBL0.BIT.IS7)
  473. {
  474. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI3_ERI3, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  475. }
  476. if (1 == ICU.GRPBL0.BIT.IS6)
  477. {
  478. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI3_TEI3, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  479. }
  480. if (1 == ICU.GRPBL0.BIT.IS9)
  481. {
  482. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI4_ERI4, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  483. }
  484. if (1 == ICU.GRPBL0.BIT.IS8)
  485. {
  486. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI4_TEI4, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  487. }
  488. if (1 == ICU.GRPBL0.BIT.IS11)
  489. {
  490. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI5_ERI5, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  491. }
  492. if (1 == ICU.GRPBL0.BIT.IS10)
  493. {
  494. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI5_TEI5, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  495. }
  496. if (1 == ICU.GRPBL0.BIT.IS13)
  497. {
  498. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI6_ERI6, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  499. }
  500. if (1 == ICU.GRPBL0.BIT.IS12)
  501. {
  502. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI6_TEI6, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  503. }
  504. if (1 == ICU.GRPBL0.BIT.IS15)
  505. {
  506. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI7_ERI7, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  507. }
  508. if (1 == ICU.GRPBL0.BIT.IS14)
  509. {
  510. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI7_TEI7, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  511. }
  512. if (1 == ICU.GRPBL0.BIT.IS17)
  513. {
  514. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI12_ERI12, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  515. }
  516. if (1 == ICU.GRPBL0.BIT.IS16)
  517. {
  518. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI12_TEI12, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  519. }
  520. if (1 == ICU.GRPBL0.BIT.IS18)
  521. {
  522. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI12_SCIX0, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  523. }
  524. if (1 == ICU.GRPBL0.BIT.IS19)
  525. {
  526. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI12_SCIX1, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  527. }
  528. if (1 == ICU.GRPBL0.BIT.IS20)
  529. {
  530. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI12_SCIX2, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  531. }
  532. if (1 == ICU.GRPBL0.BIT.IS21)
  533. {
  534. R_BSP_InterruptControl(BSP_INT_SRC_BL0_SCI12_SCIX3, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  535. }
  536. if (1 == ICU.GRPBL0.BIT.IS24)
  537. {
  538. R_BSP_InterruptControl(BSP_INT_SRC_BL0_QSPI_QSPSSLI, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  539. }
  540. if (1 == ICU.GRPBL0.BIT.IS26)
  541. {
  542. R_BSP_InterruptControl(BSP_INT_SRC_BL0_CAC_FERRI, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  543. }
  544. if (1 == ICU.GRPBL0.BIT.IS27)
  545. {
  546. R_BSP_InterruptControl(BSP_INT_SRC_BL0_CAC_MENDI, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  547. }
  548. if (1 == ICU.GRPBL0.BIT.IS28)
  549. {
  550. R_BSP_InterruptControl(BSP_INT_SRC_BL0_CAC_OVFI, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  551. }
  552. if (1 == ICU.GRPBL0.BIT.IS29)
  553. {
  554. R_BSP_InterruptControl(BSP_INT_SRC_BL0_DOC_DOPCI, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  555. }
  556. if (1 == ICU.GRPBL0.BIT.IS31)
  557. {
  558. R_BSP_InterruptControl(BSP_INT_SRC_BL0_PDC_PCERI, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  559. }
  560. if (1 == ICU.GRPBL0.BIT.IS30)
  561. {
  562. R_BSP_InterruptControl(BSP_INT_SRC_BL0_PDC_PCFEI, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  563. }
  564. }
  565. /***********************************************************************************************************************
  566. * Function Name: group_bl1_handler_isr
  567. * Description : Interrupt handler for Group BL1 interrupts. The way this code works is that for each possible interrupt
  568. * in this group the following will be performed:
  569. * 1) Test to see if an interrupt is requested for this source
  570. * 2) If an interrupt is requested then the registered callback is called (if one is registered)
  571. * NOTE: The interrupt request flag must be cleared in the peripheral.
  572. * Arguments : None
  573. * Return Value : None
  574. ***********************************************************************************************************************/
  575. R_ATTRIB_INTERRUPT void group_bl1_handler_isr (void)
  576. {
  577. if (1 == ICU.GRPBL1.BIT.IS3)
  578. {
  579. R_BSP_InterruptControl(BSP_INT_SRC_BL1_SDHI_CDETI, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  580. }
  581. if (1 == ICU.GRPBL1.BIT.IS4)
  582. {
  583. R_BSP_InterruptControl(BSP_INT_SRC_BL1_SDHI_CACI, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  584. }
  585. if (1 == ICU.GRPBL1.BIT.IS5)
  586. {
  587. R_BSP_InterruptControl(BSP_INT_SRC_BL1_SDHI_SDACI, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  588. }
  589. if (1 == ICU.GRPBL1.BIT.IS6)
  590. {
  591. R_BSP_InterruptControl(BSP_INT_SRC_BL1_MMCIF_CDETIO, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  592. }
  593. if (1 == ICU.GRPBL1.BIT.IS7)
  594. {
  595. R_BSP_InterruptControl(BSP_INT_SRC_BL1_MMCIF_ERRIO, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  596. }
  597. if (1 == ICU.GRPBL1.BIT.IS8)
  598. {
  599. R_BSP_InterruptControl(BSP_INT_SRC_BL1_MMCIF_ACCIO, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  600. }
  601. if (1 == ICU.GRPBL1.BIT.IS9)
  602. {
  603. R_BSP_InterruptControl(BSP_INT_SRC_BL1_POE3_OEI1, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  604. }
  605. if (1 == ICU.GRPBL1.BIT.IS10)
  606. {
  607. R_BSP_InterruptControl(BSP_INT_SRC_BL1_POE3_OEI2, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  608. }
  609. if (1 == ICU.GRPBL1.BIT.IS11)
  610. {
  611. R_BSP_InterruptControl(BSP_INT_SRC_BL1_POE3_OEI3, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  612. }
  613. if (1 == ICU.GRPBL1.BIT.IS12)
  614. {
  615. R_BSP_InterruptControl(BSP_INT_SRC_BL1_POE3_OEI4, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  616. }
  617. if (1 == ICU.GRPBL1.BIT.IS14)
  618. {
  619. R_BSP_InterruptControl(BSP_INT_SRC_BL1_RIIC0_EEI0, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  620. }
  621. if (1 == ICU.GRPBL1.BIT.IS13)
  622. {
  623. R_BSP_InterruptControl(BSP_INT_SRC_BL1_RIIC0_TEI0, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  624. }
  625. if (1 == ICU.GRPBL1.BIT.IS16)
  626. {
  627. R_BSP_InterruptControl(BSP_INT_SRC_BL1_RIIC2_EEI2, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  628. }
  629. if (1 == ICU.GRPBL1.BIT.IS15)
  630. {
  631. R_BSP_InterruptControl(BSP_INT_SRC_BL1_RIIC2_TEI2, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  632. }
  633. if (1 == ICU.GRPBL1.BIT.IS20)
  634. {
  635. R_BSP_InterruptControl(BSP_INT_SRC_BL1_S12AD0_S12CMPAI, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  636. }
  637. if (1 == ICU.GRPBL1.BIT.IS21)
  638. {
  639. R_BSP_InterruptControl(BSP_INT_SRC_BL1_S12AD0_S12CMPBI, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  640. }
  641. if (1 == ICU.GRPBL1.BIT.IS22)
  642. {
  643. R_BSP_InterruptControl(BSP_INT_SRC_BL1_S12AD1_S12CMPAI1, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  644. }
  645. if (1 == ICU.GRPBL1.BIT.IS23)
  646. {
  647. R_BSP_InterruptControl(BSP_INT_SRC_BL1_S12AD1_S12CMPBI1, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  648. }
  649. if (1 == ICU.GRPBL1.BIT.IS25)
  650. {
  651. R_BSP_InterruptControl(BSP_INT_SRC_BL1_SCI8_ERI8, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  652. }
  653. if (1 == ICU.GRPBL1.BIT.IS24)
  654. {
  655. R_BSP_InterruptControl(BSP_INT_SRC_BL1_SCI8_TEI8, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  656. }
  657. if (1 == ICU.GRPBL1.BIT.IS27)
  658. {
  659. R_BSP_InterruptControl(BSP_INT_SRC_BL1_SCI9_ERI9, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  660. }
  661. if (1 == ICU.GRPBL1.BIT.IS26)
  662. {
  663. R_BSP_InterruptControl(BSP_INT_SRC_BL1_SCI9_TEI9, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  664. }
  665. if (1 == ICU.GRPBL1.BIT.IS29)
  666. {
  667. R_BSP_InterruptControl(BSP_INT_SRC_BL1_RIIC1_EEI1, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  668. }
  669. if (1 == ICU.GRPBL1.BIT.IS28)
  670. {
  671. R_BSP_InterruptControl(BSP_INT_SRC_BL1_RIIC1_TEI1, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  672. }
  673. }
  674. #endif
  675. /***********************************************************************************************************************
  676. * Function Name: group_bl2_handler_isr
  677. * Description : Interrupt handler for Group BL1 interrupts. The way this code works is that for each possible interrupt
  678. * in this group the following will be performed:
  679. * 1) Test to see if an interrupt is requested for this source
  680. * 2) If an interrupt is requested then the registered callback is called (if one is registered)
  681. * NOTE: The interrupt request flag must be cleared in the peripheral.
  682. * Arguments : None
  683. * Return Value : None
  684. ***********************************************************************************************************************/
  685. R_ATTRIB_INTERRUPT void group_bl2_handler_isr (void)
  686. {
  687. if (1 == ICU.GRPBL2.BIT.IS0)
  688. {
  689. R_BSP_InterruptControl(BSP_INT_SRC_BL2_SDSI_SDIOI, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  690. }
  691. }
  692. /***********************************************************************************************************************
  693. * Function Name: group_al0_handler_isr
  694. * Description : Interrupt handler for Group AL0 interrupts. The way this code works is that for each possible interrupt
  695. * in this group the following will be performed:
  696. * 1) Test to see if an interrupt is requested for this source
  697. * 2) If an interrupt is requested then the registered callback is called (if one is registered)
  698. * NOTE: The interrupt request flag must be cleared in the peripheral.
  699. * Arguments : None
  700. * Return Value : None
  701. ***********************************************************************************************************************/
  702. R_ATTRIB_INTERRUPT void group_al0_handler_isr (void)
  703. {
  704. if (1 == ICU.GRPAL0.BIT.IS9)
  705. {
  706. R_BSP_InterruptControl(BSP_INT_SRC_AL0_SCI10_ERI10, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  707. }
  708. if (1 == ICU.GRPAL0.BIT.IS8)
  709. {
  710. R_BSP_InterruptControl(BSP_INT_SRC_AL0_SCI10_TEI10, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  711. }
  712. if (1 == ICU.GRPAL0.BIT.IS13)
  713. {
  714. R_BSP_InterruptControl(BSP_INT_SRC_AL0_SCI11_ERI11, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  715. }
  716. if (1 == ICU.GRPAL0.BIT.IS12)
  717. {
  718. R_BSP_InterruptControl(BSP_INT_SRC_AL0_SCI11_TEI11, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  719. }
  720. if (1 == ICU.GRPAL0.BIT.IS17)
  721. {
  722. R_BSP_InterruptControl(BSP_INT_SRC_AL0_RSPI0_SPEI0, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  723. }
  724. if (1 == ICU.GRPAL0.BIT.IS16)
  725. {
  726. R_BSP_InterruptControl(BSP_INT_SRC_AL0_RSPI0_SPII0, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  727. }
  728. if (1 == ICU.GRPAL0.BIT.IS19)
  729. {
  730. R_BSP_InterruptControl(BSP_INT_SRC_AL0_RSPI1_SPEI1, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  731. }
  732. if (1 == ICU.GRPAL0.BIT.IS18)
  733. {
  734. R_BSP_InterruptControl(BSP_INT_SRC_AL0_RSPI1_SPII1, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  735. }
  736. if (1 == ICU.GRPAL0.BIT.IS21)
  737. {
  738. R_BSP_InterruptControl(BSP_INT_SRC_AL0_RSPI2_SPEI2, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  739. }
  740. if (1 == ICU.GRPAL0.BIT.IS20)
  741. {
  742. R_BSP_InterruptControl(BSP_INT_SRC_AL0_RSPI2_SPII2, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  743. }
  744. }
  745. /***********************************************************************************************************************
  746. * Function Name: group_al1_handler_isr
  747. * Description : Interrupt handler for Group AL1 interrupts. The way this code works is that for each possible interrupt
  748. * in this group the following will be performed:
  749. * 1) Test to see if an interrupt is requested for this source
  750. * 2) If an interrupt is requested then the registered callback is called (if one is registered)
  751. * NOTE: The interrupt request flag must be cleared in the peripheral.
  752. * Arguments : None
  753. * Return Value : None
  754. ***********************************************************************************************************************/
  755. R_ATTRIB_INTERRUPT void group_al1_handler_isr (void)
  756. {
  757. if (1 == ICU.GRPAL1.BIT.IS4)
  758. {
  759. R_BSP_InterruptControl(BSP_INT_SRC_AL1_EDMAC0_EINT0, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  760. }
  761. if (1 == ICU.GRPAL1.BIT.IS9)
  762. {
  763. R_BSP_InterruptControl(BSP_INT_SRC_AL1_GLCDC_GR1UF, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  764. }
  765. if (1 == ICU.GRPAL1.BIT.IS10)
  766. {
  767. R_BSP_InterruptControl(BSP_INT_SRC_AL1_GLCDC_GR2UF, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  768. }
  769. if (1 == ICU.GRPAL1.BIT.IS8)
  770. {
  771. R_BSP_InterruptControl(BSP_INT_SRC_AL1_GLCDC_VPOS, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  772. }
  773. if (1 == ICU.GRPAL1.BIT.IS11)
  774. {
  775. R_BSP_InterruptControl(BSP_INT_SRC_AL1_DRW2D_DRW_IRQ, BSP_INT_CMD_CALL_CALLBACK, FIT_NO_PTR);
  776. }
  777. }