boot.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. /**
  14. * @file boot.h
  15. * @brief Boot parameters for the SPC56ECxx.
  16. * @{
  17. */
  18. #ifndef BOOT_H
  19. #define BOOT_H
  20. /*===========================================================================*/
  21. /* Module constants. */
  22. /*===========================================================================*/
  23. /**
  24. * @name MASx registers definitions
  25. * @{
  26. */
  27. #define MAS0_TBLMAS_TBL 0x10000000
  28. #define MAS0_ESEL_MASK 0x000F0000
  29. #define MAS0_ESEL(n) ((n) << 16)
  30. #define MAS1_VALID 0x80000000
  31. #define MAS1_IPROT 0x40000000
  32. #define MAS1_TID_MASK 0x00FF0000
  33. #define MAS1_TS 0x00001000
  34. #define MAS1_TSISE_MASK 0x00000F80
  35. #define MAS1_TSISE_1K 0x00000000
  36. #define MAS1_TSISE_2K 0x00000080
  37. #define MAS1_TSISE_4K 0x00000100
  38. #define MAS1_TSISE_8K 0x00000180
  39. #define MAS1_TSISE_16K 0x00000200
  40. #define MAS1_TSISE_32K 0x00000280
  41. #define MAS1_TSISE_64K 0x00000300
  42. #define MAS1_TSISE_128K 0x00000380
  43. #define MAS1_TSISE_256K 0x00000400
  44. #define MAS1_TSISE_512K 0x00000480
  45. #define MAS1_TSISE_1M 0x00000500
  46. #define MAS1_TSISE_2M 0x00000580
  47. #define MAS1_TSISE_4M 0x00000600
  48. #define MAS1_TSISE_8M 0x00000680
  49. #define MAS1_TSISE_16M 0x00000700
  50. #define MAS1_TSISE_32M 0x00000780
  51. #define MAS1_TSISE_64M 0x00000800
  52. #define MAS1_TSISE_128M 0x00000880
  53. #define MAS1_TSISE_256M 0x00000900
  54. #define MAS1_TSISE_512M 0x00000980
  55. #define MAS1_TSISE_1G 0x00000A00
  56. #define MAS1_TSISE_2G 0x00000A80
  57. #define MAS1_TSISE_4G 0x00000B00
  58. #define MAS2_EPN_MASK 0xFFFFFC00
  59. #define MAS2_EPN(n) ((n) & MAS2_EPN_MASK)
  60. #define MAS2_EBOOK 0x00000000
  61. #define MAS2_VLE 0x00000020
  62. #define MAS2_W 0x00000010
  63. #define MAS2_I 0x00000008
  64. #define MAS2_M 0x00000004
  65. #define MAS2_G 0x00000002
  66. #define MAS2_E 0x00000001
  67. #define MAS3_RPN_MASK 0xFFFFFC00
  68. #define MAS3_RPN(n) ((n) & MAS3_RPN_MASK)
  69. #define MAS3_U0 0x00000200
  70. #define MAS3_U1 0x00000100
  71. #define MAS3_U2 0x00000080
  72. #define MAS3_U3 0x00000040
  73. #define MAS3_UX 0x00000020
  74. #define MAS3_SX 0x00000010
  75. #define MAS3_UW 0x00000008
  76. #define MAS3_SW 0x00000004
  77. #define MAS3_UR 0x00000002
  78. #define MAS3_SR 0x00000001
  79. /** @} */
  80. /**
  81. * @name BUCSR registers definitions
  82. * @{
  83. */
  84. #define BUCSR_BPEN 0x00000001
  85. #define BUCSR_BPRED_MASK 0x00000006
  86. #define BUCSR_BPRED_0 0x00000000
  87. #define BUCSR_BPRED_1 0x00000002
  88. #define BUCSR_BPRED_2 0x00000004
  89. #define BUCSR_BPRED_3 0x00000006
  90. #define BUCSR_BALLOC_MASK 0x00000030
  91. #define BUCSR_BALLOC_0 0x00000000
  92. #define BUCSR_BALLOC_1 0x00000010
  93. #define BUCSR_BALLOC_2 0x00000020
  94. #define BUCSR_BALLOC_3 0x00000030
  95. #define BUCSR_BALLOC_BFI 0x00000200
  96. /** @} */
  97. /**
  98. * @name LICSR1 registers definitions
  99. * @{
  100. */
  101. #define LICSR1_ICE 0x00000001
  102. #define LICSR1_ICINV 0x00000002
  103. #define LICSR1_ICORG 0x00000010
  104. /** @} */
  105. /**
  106. * @name MSR register definitions
  107. * @{
  108. */
  109. #define MSR_UCLE 0x04000000
  110. #define MSR_SPE 0x02000000
  111. #define MSR_WE 0x00040000
  112. #define MSR_CE 0x00020000
  113. #define MSR_EE 0x00008000
  114. #define MSR_PR 0x00004000
  115. #define MSR_FP 0x00002000
  116. #define MSR_ME 0x00001000
  117. #define MSR_FE0 0x00000800
  118. #define MSR_DE 0x00000200
  119. #define MSR_FE1 0x00000100
  120. #define MSR_IS 0x00000020
  121. #define MSR_DS 0x00000010
  122. #define MSR_RI 0x00000002
  123. /** @} */
  124. /*===========================================================================*/
  125. /* Module pre-compile time settings. */
  126. /*===========================================================================*/
  127. /*
  128. * TLB default settings.
  129. */
  130. #define TLB0_MAS0 (MAS0_TBLMAS_TBL | MAS0_ESEL(0))
  131. #define TLB0_MAS1 (MAS1_VALID | MAS1_IPROT | MAS1_TSISE_4M)
  132. #define TLB0_MAS2 (MAS2_EPN(0x00000000) | MAS2_VLE)
  133. #define TLB0_MAS3 (MAS3_RPN(0x00000000) | \
  134. MAS3_UX | MAS3_SX | MAS3_UW | MAS3_SW | \
  135. MAS3_UR | MAS3_SR)
  136. #define TLB1_MAS0 (MAS0_TBLMAS_TBL | MAS0_ESEL(1))
  137. #define TLB1_MAS1 (MAS1_VALID | MAS1_IPROT | MAS1_TSISE_256K)
  138. #define TLB1_MAS2 (MAS2_EPN(0x40000000) | MAS2_VLE)
  139. #define TLB1_MAS3 (MAS3_RPN(0x40000000) | \
  140. MAS3_UX | MAS3_SX | MAS3_UW | MAS3_SW | \
  141. MAS3_UR | MAS3_SR)
  142. #define TLB2_MAS0 (MAS0_TBLMAS_TBL | MAS0_ESEL(2))
  143. #define TLB2_MAS1 (MAS1_VALID | MAS1_IPROT | MAS1_TSISE_1M)
  144. #define TLB2_MAS2 (MAS2_EPN(0xC3F00000) | MAS2_I)
  145. #define TLB2_MAS3 (MAS3_RPN(0xC3F00000) | \
  146. MAS3_UW | MAS3_SW | MAS3_UR | MAS3_SR)
  147. #define TLB3_MAS0 (MAS0_TBLMAS_TBL | MAS0_ESEL(3))
  148. #define TLB3_MAS1 (MAS1_VALID | MAS1_IPROT | MAS1_TSISE_1M)
  149. #define TLB3_MAS2 (MAS2_EPN(0xFFE00000) | MAS2_I)
  150. #define TLB3_MAS3 (MAS3_RPN(0xFFE00000) | \
  151. MAS3_UW | MAS3_SW | MAS3_UR | MAS3_SR)
  152. #define TLB4_MAS0 (MAS0_TBLMAS_TBL | MAS0_ESEL(4))
  153. #define TLB4_MAS1 (MAS1_VALID | MAS1_IPROT | MAS1_TSISE_1M)
  154. #define TLB4_MAS2 (MAS2_EPN(0x8FF00000) | MAS2_I)
  155. #define TLB4_MAS3 (MAS3_RPN(0x8FF00000) | \
  156. MAS3_UW | MAS3_SW | MAS3_UR | MAS3_SR)
  157. #define TLB5_MAS0 (MAS0_TBLMAS_TBL | MAS0_ESEL(5))
  158. #define TLB5_MAS1 (MAS1_VALID | MAS1_IPROT | MAS1_TSISE_1M)
  159. #define TLB5_MAS2 (MAS2_EPN(0xFFF00000) | MAS2_I)
  160. #define TLB5_MAS3 (MAS3_RPN(0xFFF00000) | \
  161. MAS3_UW | MAS3_SW | MAS3_UR | MAS3_SR)
  162. /*
  163. * BUCSR default settings.
  164. */
  165. #if !defined(BOOT_BUCSR_DEFAULT) || defined(__DOXYGEN__)
  166. #define BOOT_BUCSR_DEFAULT (BUCSR_BPEN | BUCSR_BPRED_0 | \
  167. BUCSR_BALLOC_0 | BUCSR_BALLOC_BFI)
  168. #endif
  169. /*
  170. * LICSR1 default settings.
  171. */
  172. #if !defined(BOOT_LICSR1_DEFAULT) || defined(__DOXYGEN__)
  173. #define BOOT_LICSR1_DEFAULT (LICSR1_ICE | LICSR1_ICORG)
  174. #endif
  175. /*
  176. * MSR default settings.
  177. */
  178. #if !defined(BOOT_MSR_DEFAULT) || defined(__DOXYGEN__)
  179. #define BOOT_MSR_DEFAULT (MSR_SPE | MSR_WE | MSR_CE | MSR_ME)
  180. #endif
  181. /*
  182. * Boot default settings.
  183. */
  184. #if !defined(BOOT_PERFORM_CORE_INIT) || defined(__DOXYGEN__)
  185. #define BOOT_PERFORM_CORE_INIT 1
  186. #endif
  187. /*
  188. * VLE mode default settings.
  189. */
  190. #if !defined(BOOT_USE_VLE) || defined(__DOXYGEN__)
  191. #define BOOT_USE_VLE 1
  192. #endif
  193. /*
  194. * RAM relocation flag.
  195. */
  196. #if !defined(BOOT_RELOCATE_IN_RAM) || defined(__DOXYGEN__)
  197. #define BOOT_RELOCATE_IN_RAM 0
  198. #endif
  199. /*===========================================================================*/
  200. /* Derived constants and error checks. */
  201. /*===========================================================================*/
  202. /*===========================================================================*/
  203. /* Module data structures and types. */
  204. /*===========================================================================*/
  205. /*===========================================================================*/
  206. /* Module macros. */
  207. /*===========================================================================*/
  208. /*===========================================================================*/
  209. /* External declarations. */
  210. /*===========================================================================*/
  211. /*===========================================================================*/
  212. /* Module inline functions. */
  213. /*===========================================================================*/
  214. #endif /* BOOT_H */
  215. /** @} */