mcu_locks.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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_locks.h
  21. * Device(s) : RX65N
  22. * Description : This source file has 1 lock per MCU resource.
  23. ***********************************************************************************************************************/
  24. /**********************************************************************************************************************
  25. * History : DD.MM.YYYY Version Description
  26. * : 01.10.2016 1.00 First Release
  27. * : 15.05.2017 2.00 Added the following enumeration constant.
  28. * - BSP_LOCK_RIIC1
  29. * - BSP_LOCK_GLCDC
  30. * - BSP_LOCK_DRW2D
  31. * : 27.07.2018 2.01 Added the following enumeration constant.
  32. * - BSP_LOCK_SMCI10
  33. * - BSP_LOCK_SMCI11
  34. ***********************************************************************************************************************/
  35. #ifndef MCU_LOCKS_H
  36. #define MCU_LOCKS_H
  37. /***********************************************************************************************************************
  38. Includes <System Includes> , "Project Includes"
  39. ***********************************************************************************************************************/
  40. /* Gets MCU configuration information. */
  41. #include "r_bsp_config.h"
  42. /***********************************************************************************************************************
  43. Macro definitions
  44. ***********************************************************************************************************************/
  45. /***********************************************************************************************************************
  46. Typedef definitions
  47. ***********************************************************************************************************************/
  48. /* This enum defines all of the available hardware locks for this MCU. If you delete an entry out of this list then you
  49. will decrease the size of the locks array but will not be able to use that lock. For example, if your design is not
  50. using CAN at all then you can safely remove the BSP_LOCK_CAN# entries below. */
  51. typedef enum
  52. {
  53. BSP_LOCK_BSC = 0,
  54. BSP_LOCK_CAC,
  55. BSP_LOCK_CAN0,
  56. BSP_LOCK_CAN1,
  57. BSP_LOCK_CMT,
  58. BSP_LOCK_CMT0,
  59. BSP_LOCK_CMT1,
  60. BSP_LOCK_CMT2,
  61. BSP_LOCK_CMT3,
  62. BSP_LOCK_CMTW0,
  63. BSP_LOCK_CMTW1,
  64. BSP_LOCK_CRC,
  65. BSP_LOCK_DA,
  66. BSP_LOCK_DMAC,
  67. BSP_LOCK_DMAC0,
  68. BSP_LOCK_DMAC1,
  69. BSP_LOCK_DMAC2,
  70. BSP_LOCK_DMAC3,
  71. BSP_LOCK_DMAC4,
  72. BSP_LOCK_DMAC5,
  73. BSP_LOCK_DMAC6,
  74. BSP_LOCK_DMAC7,
  75. BSP_LOCK_DOC,
  76. BSP_LOCK_DTC,
  77. BSP_LOCK_EDMAC0,
  78. BSP_LOCK_ELC,
  79. BSP_LOCK_ETHERC0,
  80. BSP_LOCK_EXDMAC,
  81. BSP_LOCK_EXDMAC0,
  82. BSP_LOCK_EXDMAC1,
  83. BSP_LOCK_FLASH,
  84. BSP_LOCK_IRQ0,
  85. BSP_LOCK_IRQ1,
  86. BSP_LOCK_IRQ2,
  87. BSP_LOCK_IRQ3,
  88. BSP_LOCK_IRQ4,
  89. BSP_LOCK_IRQ5,
  90. BSP_LOCK_IRQ6,
  91. BSP_LOCK_IRQ7,
  92. BSP_LOCK_IRQ8,
  93. BSP_LOCK_IRQ9,
  94. BSP_LOCK_IRQ10,
  95. BSP_LOCK_IRQ11,
  96. BSP_LOCK_IRQ12,
  97. BSP_LOCK_IRQ13,
  98. BSP_LOCK_IRQ14,
  99. BSP_LOCK_IRQ15,
  100. BSP_LOCK_ICU,
  101. BSP_LOCK_IWDT,
  102. BSP_LOCK_MMC,
  103. BSP_LOCK_MPC,
  104. BSP_LOCK_MPU,
  105. BSP_LOCK_MTU,
  106. BSP_LOCK_MTU0,
  107. BSP_LOCK_MTU1,
  108. BSP_LOCK_MTU2,
  109. BSP_LOCK_MTU3,
  110. BSP_LOCK_MTU4,
  111. BSP_LOCK_MTU5,
  112. BSP_LOCK_MTU6,
  113. BSP_LOCK_MTU7,
  114. BSP_LOCK_MTU8,
  115. BSP_LOCK_PDC,
  116. BSP_LOCK_POE,
  117. BSP_LOCK_PPG0,
  118. BSP_LOCK_PPG1,
  119. BSP_LOCK_QSPI,
  120. BSP_LOCK_RAM,
  121. BSP_LOCK_RIIC0,
  122. BSP_LOCK_RIIC1,
  123. BSP_LOCK_RIIC2,
  124. BSP_LOCK_RSPI0,
  125. BSP_LOCK_RSPI1,
  126. BSP_LOCK_RSPI2,
  127. BSP_LOCK_RTC,
  128. BSP_LOCK_S12AD,
  129. BSP_LOCK_S12AD1,
  130. BSP_LOCK_SCI0,
  131. BSP_LOCK_SCI1,
  132. BSP_LOCK_SCI2,
  133. BSP_LOCK_SCI3,
  134. BSP_LOCK_SCI4,
  135. BSP_LOCK_SCI5,
  136. BSP_LOCK_SCI6,
  137. BSP_LOCK_SCI7,
  138. BSP_LOCK_SCI8,
  139. BSP_LOCK_SCI9,
  140. BSP_LOCK_SCI10,
  141. BSP_LOCK_SCI11,
  142. BSP_LOCK_SCI12,
  143. BSP_LOCK_SDHI,
  144. BSP_LOCK_SDSI,
  145. BSP_LOCK_SMCI0,
  146. BSP_LOCK_SMCI1,
  147. BSP_LOCK_SMCI2,
  148. BSP_LOCK_SMCI3,
  149. BSP_LOCK_SMCI4,
  150. BSP_LOCK_SMCI5,
  151. BSP_LOCK_SMCI6,
  152. BSP_LOCK_SMCI7,
  153. BSP_LOCK_SMCI8,
  154. BSP_LOCK_SMCI9,
  155. BSP_LOCK_SMCI10,
  156. BSP_LOCK_SMCI11,
  157. BSP_LOCK_SMCI12,
  158. BSP_LOCK_SYSTEM,
  159. BSP_LOCK_TEMPS,
  160. BSP_LOCK_TMR0,
  161. BSP_LOCK_TMR1,
  162. BSP_LOCK_TMR2,
  163. BSP_LOCK_TMR3,
  164. BSP_LOCK_TMR01,
  165. BSP_LOCK_TMR23,
  166. BSP_LOCK_TPU0,
  167. BSP_LOCK_TPU1,
  168. BSP_LOCK_TPU2,
  169. BSP_LOCK_TPU3,
  170. BSP_LOCK_TPU4,
  171. BSP_LOCK_TPU5,
  172. BSP_LOCK_TPUA,
  173. BSP_LOCK_USB,
  174. BSP_LOCK_USB0,
  175. BSP_LOCK_WDT,
  176. BSP_LOCK_FLASHCONST,
  177. BSP_LOCK_TEMPSCONST,
  178. BSP_LOCK_GLCDC,
  179. BSP_LOCK_DRW2D,
  180. BSP_NUM_LOCKS //This entry is not a valid lock. It is used for sizing g_bsp_Locks[] array below. Do not touch!
  181. } mcu_lock_t;
  182. typedef struct
  183. {
  184. /* The actual lock. int32_t is used because this is what the xchg() instruction takes as parameters. */
  185. int32_t lock;
  186. /* Could add a ID for locking and unlocking. In this could protect against any function being able to unlock. */
  187. } bsp_lock_t;
  188. /***********************************************************************************************************************
  189. Error checking
  190. ***********************************************************************************************************************/
  191. #if BSP_CFG_USER_LOCKING_ENABLED == 0
  192. #undef BSP_CFG_USER_LOCKING_TYPE
  193. #define BSP_CFG_USER_LOCKING_TYPE bsp_lock_t
  194. #else
  195. #if !defined(BSP_CFG_USER_LOCKING_TYPE)
  196. #error "R_BSP ERROR - If you are using your own locking mechanism then you must define BSP_CFG_USER_LOCKING_TYPE in \
  197. r_bsp_config.h."
  198. #endif
  199. #endif
  200. /***********************************************************************************************************************
  201. Exported global variables (to be accessed by other files)
  202. ***********************************************************************************************************************/
  203. extern BSP_CFG_USER_LOCKING_TYPE g_bsp_Locks[];
  204. #endif /* MCU_LOCKS_H */