mcu_info.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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_info.h
  21. * Device(s) : RX65N
  22. * Description : Information about the MCU on this board.
  23. ***********************************************************************************************************************/
  24. /***********************************************************************************************************************
  25. * History : DD.MM.YYYY Version Description
  26. * : 01.10.2016 1.00 First Release
  27. * : 15.05.2017 2.00 Deleted the following macro definition.
  28. * - BSP_MCU_RX651
  29. * Changed the name of the following macro definition, because there was a mistake
  30. * in the name of macro definition.
  31. * - BSP_PACKAGE_LFQFP144 - Changed package type from LQFP to LFQFP.
  32. * - BSP_PACKAGE_LFQFP100 - Changed package type from LQFP to LFQFP.
  33. * Changed the value of the following macro definition.
  34. * - BSP_CFG_MCU_PART_PACKAGE - Changed the value from 0x6 to 0xA.
  35. * Added the following macro definition.
  36. * - BSP_MCU_RX65N_2MB
  37. * - BSP_PACKAGE_LFQFP176
  38. * - BSP_PACKAGE_LFBGA176
  39. * - BSP_PACKAGE_TFLGA177
  40. * Added the following setting.
  41. * - Setting of 177 pins.
  42. * - Setting of 176 pins.
  43. * - Setting of 2-Mbyte ROM capacity.
  44. * - Setting of 1.5-Mbyte ROM capacity.
  45. * : 01.12.2017 2.01 Added EBMAPCR register set value check.
  46. ***********************************************************************************************************************/
  47. #ifndef MCU_INFO
  48. #define MCU_INFO
  49. /***********************************************************************************************************************
  50. Includes <System Includes> , "Project Includes"
  51. ***********************************************************************************************************************/
  52. /* Gets MCU configuration information. */
  53. #include "r_bsp_config.h"
  54. /***********************************************************************************************************************
  55. Macro definitions
  56. ***********************************************************************************************************************/
  57. /* CPU cycles. */
  58. #define CPU_CYCLES_PER_LOOP (4) // Known number of RXv2 CPU cycles required to execute the delayWait() loop
  59. /* MCU Series. */
  60. #if (BSP_CFG_MCU_PART_SERIES == 0x0)
  61. #define BSP_MCU_SERIES_RX600 (1)
  62. #else
  63. #error "ERROR - BSP_CFG_MCU_PART_SERIES - Unknown MCU Series chosen in r_bsp_config.h"
  64. #endif
  65. /* This macro means that this MCU is part of the RX65x collection of MCUs (i.e. RX651/N). */
  66. #define BSP_MCU_RX65_ALL (1)
  67. /* MCU Group name. */
  68. #if (BSP_CFG_MCU_PART_GROUP == 0x0)
  69. #define BSP_MCU_RX65N (1)
  70. #if (BSP_CFG_MCU_PART_MEMORY_SIZE == 0xC) || (BSP_CFG_MCU_PART_MEMORY_SIZE == 0xE)
  71. #define BSP_MCU_RX65N_2MB (1)
  72. #endif
  73. #else
  74. #error "ERROR - BSP_CFG_MCU_PART_GROUP - Unknown MCU Group chosen in r_bsp_config.h"
  75. #endif
  76. /* Package. */
  77. #if (BSP_CFG_MCU_PART_PACKAGE == 0x0)
  78. #define BSP_PACKAGE_LFQFP176 (1)
  79. #define BSP_PACKAGE_PINS (176)
  80. #elif (BSP_CFG_MCU_PART_PACKAGE == 0x1)
  81. #define BSP_PACKAGE_LFBGA176 (1)
  82. #define BSP_PACKAGE_PINS (176)
  83. #elif (BSP_CFG_MCU_PART_PACKAGE == 0x2)
  84. #define BSP_PACKAGE_TFLGA177 (1)
  85. #define BSP_PACKAGE_PINS (177)
  86. #elif (BSP_CFG_MCU_PART_PACKAGE == 0x3)
  87. #define BSP_PACKAGE_LFQFP144 (1)
  88. #define BSP_PACKAGE_PINS (144)
  89. #elif (BSP_CFG_MCU_PART_PACKAGE == 0x4)
  90. #define BSP_PACKAGE_TFLGA145 (1)
  91. #define BSP_PACKAGE_PINS (145)
  92. #elif (BSP_CFG_MCU_PART_PACKAGE == 0x5)
  93. #define BSP_PACKAGE_LFQFP100 (1)
  94. #define BSP_PACKAGE_PINS (100)
  95. #elif (BSP_CFG_MCU_PART_PACKAGE == 0xA)
  96. #define BSP_PACKAGE_TFLGA100 (1)
  97. #define BSP_PACKAGE_PINS (100)
  98. #else
  99. #error "ERROR - BSP_CFG_MCU_PART_PACKAGE - Unknown package chosen in r_bsp_config.h"
  100. #endif
  101. /* Memory size of your MCU. */
  102. #if (BSP_CFG_MCU_PART_MEMORY_SIZE == 0x4)
  103. #define BSP_ROM_SIZE_BYTES (524288)
  104. #define BSP_RAM_SIZE_BYTES (262144)
  105. #define BSP_DATA_FLASH_SIZE_BYTES (0)
  106. #elif (BSP_CFG_MCU_PART_MEMORY_SIZE == 0x7)
  107. #define BSP_ROM_SIZE_BYTES (786432)
  108. #define BSP_RAM_SIZE_BYTES (262144)
  109. #define BSP_DATA_FLASH_SIZE_BYTES (0)
  110. #elif (BSP_CFG_MCU_PART_MEMORY_SIZE == 0x9)
  111. #define BSP_ROM_SIZE_BYTES (1048576)
  112. #define BSP_RAM_SIZE_BYTES (262144)
  113. #define BSP_DATA_FLASH_SIZE_BYTES (0)
  114. #elif (BSP_CFG_MCU_PART_MEMORY_SIZE == 0xC)
  115. #define BSP_ROM_SIZE_BYTES (1572864)
  116. #define BSP_RAM_SIZE_BYTES (655360)
  117. #define BSP_DATA_FLASH_SIZE_BYTES (32768)
  118. #elif (BSP_CFG_MCU_PART_MEMORY_SIZE == 0xE)
  119. #define BSP_ROM_SIZE_BYTES (2097152)
  120. #define BSP_RAM_SIZE_BYTES (655360)
  121. #define BSP_DATA_FLASH_SIZE_BYTES (32768)
  122. #else
  123. #error "ERROR - BSP_CFG_MCU_PART_MEMORY_SIZE - Unknown memory size chosen in r_bsp_config.h"
  124. #endif
  125. /* These macros define clock speeds for fixed speed clocks. */
  126. #define BSP_LOCO_HZ (240000) //Low-speed On-Chip Oscillator
  127. #define BSP_SUB_CLOCK_HZ (32768) //Sub-Clock Oscillator
  128. /* Define frequency of HOCO. */
  129. #if (BSP_CFG_HOCO_FREQUENCY == 0)
  130. #define BSP_HOCO_HZ (16000000)
  131. #elif (BSP_CFG_HOCO_FREQUENCY == 1)
  132. #define BSP_HOCO_HZ (18000000)
  133. #elif (BSP_CFG_HOCO_FREQUENCY == 2)
  134. #define BSP_HOCO_HZ (20000000)
  135. #else
  136. #error "ERROR - Invalid HOCO frequency chosen in r_bsp_config.h! Set valid value for BSP_CFG_HOCO_FREQUENCY."
  137. #endif
  138. /* Clock source select (CKSEL).
  139. 0 = Low Speed On-Chip Oscillator (LOCO)
  140. 1 = High Speed On-Chip Oscillator (HOCO)
  141. 2 = Main Clock Oscillator
  142. 3 = Sub-Clock Oscillator
  143. 4 = PLL Circuit
  144. */
  145. #if (BSP_CFG_CLOCK_SOURCE == 0)
  146. #define BSP_SELECTED_CLOCK_HZ (BSP_LOCO_HZ)
  147. #elif (BSP_CFG_CLOCK_SOURCE == 1)
  148. #define BSP_SELECTED_CLOCK_HZ (BSP_HOCO_HZ)
  149. #elif (BSP_CFG_CLOCK_SOURCE == 2)
  150. #define BSP_SELECTED_CLOCK_HZ (BSP_CFG_XTAL_HZ)
  151. #elif (BSP_CFG_CLOCK_SOURCE == 3)
  152. #define BSP_SELECTED_CLOCK_HZ (BSP_SUB_CLOCK_HZ)
  153. #elif (BSP_CFG_CLOCK_SOURCE == 4)
  154. #if (BSP_CFG_PLL_SRC == 0)
  155. #define BSP_SELECTED_CLOCK_HZ ((BSP_CFG_XTAL_HZ/BSP_CFG_PLL_DIV) * BSP_CFG_PLL_MUL)
  156. #elif (BSP_CFG_PLL_SRC == 1)
  157. #define BSP_SELECTED_CLOCK_HZ ((BSP_HOCO_HZ/BSP_CFG_PLL_DIV) * BSP_CFG_PLL_MUL)
  158. #else
  159. #error "ERROR - Valid PLL clock source must be chosen in r_bsp_config.h using BSP_CFG_PLL_SRC macro."
  160. #endif
  161. #endif
  162. #if defined(BSP_MCU_RX65N_2MB)
  163. /* Extended Bus Master Priority setting
  164. 0 = GLCDC graphics 1 data read
  165. 1 = DRW2D texture data read
  166. 2 = DRW2D frame buffer data read write and display list data read
  167. 3 = GLCDC graphics 2 data read
  168. 4 = EDMAC
  169. Note : Settings other than above are prohibited.
  170. Duplicate priority settings can not be made.
  171. */
  172. #if ((BSP_CFG_EBMAPCR_1ST_PRIORITY == BSP_CFG_EBMAPCR_2ND_PRIORITY) ||\
  173. (BSP_CFG_EBMAPCR_1ST_PRIORITY == BSP_CFG_EBMAPCR_3RD_PRIORITY) ||\
  174. (BSP_CFG_EBMAPCR_1ST_PRIORITY == BSP_CFG_EBMAPCR_4TH_PRIORITY) ||\
  175. (BSP_CFG_EBMAPCR_1ST_PRIORITY == BSP_CFG_EBMAPCR_5TH_PRIORITY) ||\
  176. (BSP_CFG_EBMAPCR_2ND_PRIORITY == BSP_CFG_EBMAPCR_3RD_PRIORITY) ||\
  177. (BSP_CFG_EBMAPCR_2ND_PRIORITY == BSP_CFG_EBMAPCR_4TH_PRIORITY) ||\
  178. (BSP_CFG_EBMAPCR_2ND_PRIORITY == BSP_CFG_EBMAPCR_5TH_PRIORITY) ||\
  179. (BSP_CFG_EBMAPCR_3RD_PRIORITY == BSP_CFG_EBMAPCR_4TH_PRIORITY) ||\
  180. (BSP_CFG_EBMAPCR_3RD_PRIORITY == BSP_CFG_EBMAPCR_5TH_PRIORITY) ||\
  181. (BSP_CFG_EBMAPCR_4TH_PRIORITY == BSP_CFG_EBMAPCR_5TH_PRIORITY))
  182. #error "Error! Invalid setting for Extended Bus Master Priority in r_bsp_config.h. Please check BSP_CFG_EX_BUS_1ST_PRIORITY to BSP_CFG_EX_BUS_5TH_PRIORITY"
  183. #endif
  184. #if ((5 <= BSP_CFG_EBMAPCR_1ST_PRIORITY) ||\
  185. (5 <= BSP_CFG_EBMAPCR_2ND_PRIORITY) ||\
  186. (5 <= BSP_CFG_EBMAPCR_3RD_PRIORITY) ||\
  187. (5 <= BSP_CFG_EBMAPCR_4TH_PRIORITY) ||\
  188. (5 <= BSP_CFG_EBMAPCR_5TH_PRIORITY))
  189. #error "Error! Invalid setting for Extended Bus Master Priority in r_bsp_config.h. Please check BSP_CFG_EX_BUS_1ST_PRIORITY to BSP_CFG_EX_BUS_5TH_PRIORITY"
  190. #endif
  191. #endif/* BSP_MCU_RX65N_2MB */
  192. /* System clock speed in Hz. */
  193. #define BSP_ICLK_HZ (BSP_SELECTED_CLOCK_HZ / BSP_CFG_ICK_DIV)
  194. /* Peripheral Module Clock A speed in Hz. Used for ETHERC and EDMAC. */
  195. #define BSP_PCLKA_HZ (BSP_SELECTED_CLOCK_HZ / BSP_CFG_PCKA_DIV)
  196. /* Peripheral Module Clock B speed in Hz. */
  197. #define BSP_PCLKB_HZ (BSP_SELECTED_CLOCK_HZ / BSP_CFG_PCKB_DIV)
  198. /* Peripheral Module Clock C speed in Hz. */
  199. #define BSP_PCLKC_HZ (BSP_SELECTED_CLOCK_HZ / BSP_CFG_PCKC_DIV)
  200. /* Peripheral Module Clock D speed in Hz. */
  201. #define BSP_PCLKD_HZ (BSP_SELECTED_CLOCK_HZ / BSP_CFG_PCKD_DIV)
  202. /* External bus clock speed in Hz. */
  203. #define BSP_BCLK_HZ (BSP_SELECTED_CLOCK_HZ / BSP_CFG_BCK_DIV)
  204. /* FlashIF clock speed in Hz. */
  205. #define BSP_FCLK_HZ (BSP_SELECTED_CLOCK_HZ / BSP_CFG_FCK_DIV)
  206. /* USB clock speed in Hz. */
  207. #define BSP_UCLK_HZ (BSP_SELECTED_CLOCK_HZ / BSP_CFG_UCK_DIV)
  208. /* Null argument definitions. */
  209. #define FIT_NO_FUNC ((void (*)(void *))0x10000000) //Reserved space on RX
  210. #define FIT_NO_PTR ((void *)0x10000000) //Reserved space on RX
  211. /* Mininum and maximum IPL levels available for this MCU. */
  212. #define BSP_MCU_IPL_MAX (0xF)
  213. #define BSP_MCU_IPL_MIN (0)
  214. #endif /* MCU_INFO */