partition_ARMCM23.h 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832
  1. /**************************************************************************//**
  2. * @file partition_ARMCM23.h
  3. * @brief CMSIS-CORE Initial Setup for Secure / Non-Secure Zones for ARMCM23
  4. * @version V5.3.1
  5. * @date 09. July 2018
  6. ******************************************************************************/
  7. /*
  8. * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
  9. *
  10. * SPDX-License-Identifier: Apache-2.0
  11. *
  12. * Licensed under the Apache License, Version 2.0 (the License); you may
  13. * not use this file except in compliance with the License.
  14. * You may obtain a copy of the License at
  15. *
  16. * www.apache.org/licenses/LICENSE-2.0
  17. *
  18. * Unless required by applicable law or agreed to in writing, software
  19. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  20. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  21. * See the License for the specific language governing permissions and
  22. * limitations under the License.
  23. */
  24. #ifndef PARTITION_ARMCM23_H
  25. #define PARTITION_ARMCM23_H
  26. /*
  27. //-------- <<< Use Configuration Wizard in Context Menu >>> -----------------
  28. */
  29. /*
  30. // <e>Initialize Security Attribution Unit (SAU) CTRL register
  31. */
  32. #define SAU_INIT_CTRL 1
  33. /*
  34. // <q> Enable SAU
  35. // <i> Value for SAU->CTRL register bit ENABLE
  36. */
  37. #define SAU_INIT_CTRL_ENABLE 1
  38. /*
  39. // <o> When SAU is disabled
  40. // <0=> All Memory is Secure
  41. // <1=> All Memory is Non-Secure
  42. // <i> Value for SAU->CTRL register bit ALLNS
  43. // <i> When all Memory is Non-Secure (ALLNS is 1), IDAU can override memory map configuration.
  44. */
  45. #define SAU_INIT_CTRL_ALLNS 0
  46. /*
  47. // </e>
  48. */
  49. /*
  50. // <h>Initialize Security Attribution Unit (SAU) Address Regions
  51. // <i>SAU configuration specifies regions to be one of:
  52. // <i> - Secure and Non-Secure Callable
  53. // <i> - Non-Secure
  54. // <i>Note: All memory regions not configured by SAU are Secure
  55. */
  56. #define SAU_REGIONS_MAX 8 /* Max. number of SAU regions */
  57. /*
  58. // <e>Initialize SAU Region 0
  59. // <i> Setup SAU Region 0 memory attributes
  60. */
  61. #define SAU_INIT_REGION0 1
  62. /*
  63. // <o>Start Address <0-0xFFFFFFE0>
  64. */
  65. #define SAU_INIT_START0 0x00000000 /* start address of SAU region 0 */
  66. /*
  67. // <o>End Address <0x1F-0xFFFFFFFF>
  68. */
  69. #define SAU_INIT_END0 0x001FFFFF /* end address of SAU region 0 */
  70. /*
  71. // <o>Region is
  72. // <0=>Non-Secure
  73. // <1=>Secure, Non-Secure Callable
  74. */
  75. #define SAU_INIT_NSC0 1
  76. /*
  77. // </e>
  78. */
  79. /*
  80. // <e>Initialize SAU Region 1
  81. // <i> Setup SAU Region 1 memory attributes
  82. */
  83. #define SAU_INIT_REGION1 1
  84. /*
  85. // <o>Start Address <0-0xFFFFFFE0>
  86. */
  87. #define SAU_INIT_START1 0x00200000
  88. /*
  89. // <o>End Address <0x1F-0xFFFFFFFF>
  90. */
  91. #define SAU_INIT_END1 0x003FFFFF
  92. /*
  93. // <o>Region is
  94. // <0=>Non-Secure
  95. // <1=>Secure, Non-Secure Callable
  96. */
  97. #define SAU_INIT_NSC1 0
  98. /*
  99. // </e>
  100. */
  101. /*
  102. // <e>Initialize SAU Region 2
  103. // <i> Setup SAU Region 2 memory attributes
  104. */
  105. #define SAU_INIT_REGION2 1
  106. /*
  107. // <o>Start Address <0-0xFFFFFFE0>
  108. */
  109. #define SAU_INIT_START2 0x20200000
  110. /*
  111. // <o>End Address <0x1F-0xFFFFFFFF>
  112. */
  113. #define SAU_INIT_END2 0x203FFFFF
  114. /*
  115. // <o>Region is
  116. // <0=>Non-Secure
  117. // <1=>Secure, Non-Secure Callable
  118. */
  119. #define SAU_INIT_NSC2 0
  120. /*
  121. // </e>
  122. */
  123. /*
  124. // <e>Initialize SAU Region 3
  125. // <i> Setup SAU Region 3 memory attributes
  126. */
  127. #define SAU_INIT_REGION3 1
  128. /*
  129. // <o>Start Address <0-0xFFFFFFE0>
  130. */
  131. #define SAU_INIT_START3 0x40000000
  132. /*
  133. // <o>End Address <0x1F-0xFFFFFFFF>
  134. */
  135. #define SAU_INIT_END3 0x40040000
  136. /*
  137. // <o>Region is
  138. // <0=>Non-Secure
  139. // <1=>Secure, Non-Secure Callable
  140. */
  141. #define SAU_INIT_NSC3 0
  142. /*
  143. // </e>
  144. */
  145. /*
  146. // <e>Initialize SAU Region 4
  147. // <i> Setup SAU Region 4 memory attributes
  148. */
  149. #define SAU_INIT_REGION4 0
  150. /*
  151. // <o>Start Address <0-0xFFFFFFE0>
  152. */
  153. #define SAU_INIT_START4 0x00000000 /* start address of SAU region 4 */
  154. /*
  155. // <o>End Address <0x1F-0xFFFFFFFF>
  156. */
  157. #define SAU_INIT_END4 0x00000000 /* end address of SAU region 4 */
  158. /*
  159. // <o>Region is
  160. // <0=>Non-Secure
  161. // <1=>Secure, Non-Secure Callable
  162. */
  163. #define SAU_INIT_NSC4 0
  164. /*
  165. // </e>
  166. */
  167. /*
  168. // <e>Initialize SAU Region 5
  169. // <i> Setup SAU Region 5 memory attributes
  170. */
  171. #define SAU_INIT_REGION5 0
  172. /*
  173. // <o>Start Address <0-0xFFFFFFE0>
  174. */
  175. #define SAU_INIT_START5 0x00000000
  176. /*
  177. // <o>End Address <0x1F-0xFFFFFFFF>
  178. */
  179. #define SAU_INIT_END5 0x00000000
  180. /*
  181. // <o>Region is
  182. // <0=>Non-Secure
  183. // <1=>Secure, Non-Secure Callable
  184. */
  185. #define SAU_INIT_NSC5 0
  186. /*
  187. // </e>
  188. */
  189. /*
  190. // <e>Initialize SAU Region 6
  191. // <i> Setup SAU Region 6 memory attributes
  192. */
  193. #define SAU_INIT_REGION6 0
  194. /*
  195. // <o>Start Address <0-0xFFFFFFE0>
  196. */
  197. #define SAU_INIT_START6 0x00000000
  198. /*
  199. // <o>End Address <0x1F-0xFFFFFFFF>
  200. */
  201. #define SAU_INIT_END6 0x00000000
  202. /*
  203. // <o>Region is
  204. // <0=>Non-Secure
  205. // <1=>Secure, Non-Secure Callable
  206. */
  207. #define SAU_INIT_NSC6 0
  208. /*
  209. // </e>
  210. */
  211. /*
  212. // <e>Initialize SAU Region 7
  213. // <i> Setup SAU Region 7 memory attributes
  214. */
  215. #define SAU_INIT_REGION7 0
  216. /*
  217. // <o>Start Address <0-0xFFFFFFE0>
  218. */
  219. #define SAU_INIT_START7 0x00000000
  220. /*
  221. // <o>End Address <0x1F-0xFFFFFFFF>
  222. */
  223. #define SAU_INIT_END7 0x00000000
  224. /*
  225. // <o>Region is
  226. // <0=>Non-Secure
  227. // <1=>Secure, Non-Secure Callable
  228. */
  229. #define SAU_INIT_NSC7 0
  230. /*
  231. // </e>
  232. */
  233. /*
  234. // </h>
  235. */
  236. /*
  237. // <e>Setup behaviour of Sleep and Exception Handling
  238. */
  239. #define SCB_CSR_AIRCR_INIT 1
  240. /*
  241. // <o> Deep Sleep can be enabled by
  242. // <0=>Secure and Non-Secure state
  243. // <1=>Secure state only
  244. // <i> Value for SCB->CSR register bit DEEPSLEEPS
  245. */
  246. #define SCB_CSR_DEEPSLEEPS_VAL 1
  247. /*
  248. // <o>System reset request accessible from
  249. // <0=> Secure and Non-Secure state
  250. // <1=> Secure state only
  251. // <i> Value for SCB->AIRCR register bit SYSRESETREQS
  252. */
  253. #define SCB_AIRCR_SYSRESETREQS_VAL 1
  254. /*
  255. // <o>Priority of Non-Secure exceptions is
  256. // <0=> Not altered
  257. // <1=> Lowered to 0x80-0xFF
  258. // <i> Value for SCB->AIRCR register bit PRIS
  259. */
  260. #define SCB_AIRCR_PRIS_VAL 1
  261. /*
  262. // <o>BusFault, HardFault, and NMI target
  263. // <0=> Secure state
  264. // <1=> Non-Secure state
  265. // <i> Value for SCB->AIRCR register bit BFHFNMINS
  266. */
  267. #define SCB_AIRCR_BFHFNMINS_VAL 0
  268. /*
  269. // </e>
  270. */
  271. /*
  272. // <e>Setup behaviour of single SysTick
  273. */
  274. #define SCB_ICSR_INIT 0
  275. /*
  276. // <o> in a single SysTick implementation, SysTick is
  277. // <0=>Secure
  278. // <1=>Non-Secure
  279. // <i> Value for SCB->ICSR register bit STTNS
  280. // <i> only for single SysTick implementation
  281. */
  282. #define SCB_ICSR_STTNS_VAL 0
  283. /*
  284. // </e>
  285. */
  286. /*
  287. // <h>Setup Interrupt Target
  288. */
  289. /*
  290. // <e>Initialize ITNS 0 (Interrupts 0..31)
  291. */
  292. #define NVIC_INIT_ITNS0 1
  293. /*
  294. // Interrupts 0..31
  295. // <o.0> Interrupt 0 <0=> Secure state <1=> Non-Secure state
  296. // <o.1> Interrupt 1 <0=> Secure state <1=> Non-Secure state
  297. // <o.2> Interrupt 2 <0=> Secure state <1=> Non-Secure state
  298. // <o.3> Interrupt 3 <0=> Secure state <1=> Non-Secure state
  299. // <o.4> Interrupt 4 <0=> Secure state <1=> Non-Secure state
  300. // <o.5> Interrupt 5 <0=> Secure state <1=> Non-Secure state
  301. // <o.6> Interrupt 6 <0=> Secure state <1=> Non-Secure state
  302. // <o.7> Interrupt 7 <0=> Secure state <1=> Non-Secure state
  303. // <o.8> Interrupt 8 <0=> Secure state <1=> Non-Secure state
  304. // <o.9> Interrupt 9 <0=> Secure state <1=> Non-Secure state
  305. // <o.10> Interrupt 10 <0=> Secure state <1=> Non-Secure state
  306. // <o.11> Interrupt 11 <0=> Secure state <1=> Non-Secure state
  307. // <o.12> Interrupt 12 <0=> Secure state <1=> Non-Secure state
  308. // <o.13> Interrupt 13 <0=> Secure state <1=> Non-Secure state
  309. // <o.14> Interrupt 14 <0=> Secure state <1=> Non-Secure state
  310. // <o.15> Interrupt 15 <0=> Secure state <1=> Non-Secure state
  311. // <o.16> Interrupt 16 <0=> Secure state <1=> Non-Secure state
  312. // <o.17> Interrupt 17 <0=> Secure state <1=> Non-Secure state
  313. // <o.18> Interrupt 18 <0=> Secure state <1=> Non-Secure state
  314. // <o.19> Interrupt 19 <0=> Secure state <1=> Non-Secure state
  315. // <o.20> Interrupt 20 <0=> Secure state <1=> Non-Secure state
  316. // <o.21> Interrupt 21 <0=> Secure state <1=> Non-Secure state
  317. // <o.22> Interrupt 22 <0=> Secure state <1=> Non-Secure state
  318. // <o.23> Interrupt 23 <0=> Secure state <1=> Non-Secure state
  319. // <o.24> Interrupt 24 <0=> Secure state <1=> Non-Secure state
  320. // <o.25> Interrupt 25 <0=> Secure state <1=> Non-Secure state
  321. // <o.26> Interrupt 26 <0=> Secure state <1=> Non-Secure state
  322. // <o.27> Interrupt 27 <0=> Secure state <1=> Non-Secure state
  323. // <o.28> Interrupt 28 <0=> Secure state <1=> Non-Secure state
  324. // <o.29> Interrupt 29 <0=> Secure state <1=> Non-Secure state
  325. // <o.30> Interrupt 30 <0=> Secure state <1=> Non-Secure state
  326. // <o.31> Interrupt 31 <0=> Secure state <1=> Non-Secure state
  327. */
  328. #define NVIC_INIT_ITNS0_VAL 0x00000000
  329. /*
  330. // </e>
  331. */
  332. /*
  333. // <e>Initialize ITNS 1 (Interrupts 32..63)
  334. */
  335. #define NVIC_INIT_ITNS1 1
  336. /*
  337. // Interrupts 32..63
  338. // <o.0> Interrupt 32 <0=> Secure state <1=> Non-Secure state
  339. // <o.1> Interrupt 33 <0=> Secure state <1=> Non-Secure state
  340. // <o.2> Interrupt 34 <0=> Secure state <1=> Non-Secure state
  341. // <o.3> Interrupt 35 <0=> Secure state <1=> Non-Secure state
  342. // <o.4> Interrupt 36 <0=> Secure state <1=> Non-Secure state
  343. // <o.5> Interrupt 37 <0=> Secure state <1=> Non-Secure state
  344. // <o.6> Interrupt 38 <0=> Secure state <1=> Non-Secure state
  345. // <o.7> Interrupt 39 <0=> Secure state <1=> Non-Secure state
  346. // <o.8> Interrupt 40 <0=> Secure state <1=> Non-Secure state
  347. // <o.9> Interrupt 41 <0=> Secure state <1=> Non-Secure state
  348. // <o.10> Interrupt 42 <0=> Secure state <1=> Non-Secure state
  349. // <o.11> Interrupt 43 <0=> Secure state <1=> Non-Secure state
  350. // <o.12> Interrupt 44 <0=> Secure state <1=> Non-Secure state
  351. // <o.13> Interrupt 45 <0=> Secure state <1=> Non-Secure state
  352. // <o.14> Interrupt 46 <0=> Secure state <1=> Non-Secure state
  353. // <o.15> Interrupt 47 <0=> Secure state <1=> Non-Secure state
  354. // <o.16> Interrupt 48 <0=> Secure state <1=> Non-Secure state
  355. // <o.17> Interrupt 49 <0=> Secure state <1=> Non-Secure state
  356. // <o.18> Interrupt 50 <0=> Secure state <1=> Non-Secure state
  357. // <o.19> Interrupt 51 <0=> Secure state <1=> Non-Secure state
  358. // <o.20> Interrupt 52 <0=> Secure state <1=> Non-Secure state
  359. // <o.21> Interrupt 53 <0=> Secure state <1=> Non-Secure state
  360. // <o.22> Interrupt 54 <0=> Secure state <1=> Non-Secure state
  361. // <o.23> Interrupt 55 <0=> Secure state <1=> Non-Secure state
  362. // <o.24> Interrupt 56 <0=> Secure state <1=> Non-Secure state
  363. // <o.25> Interrupt 57 <0=> Secure state <1=> Non-Secure state
  364. // <o.26> Interrupt 58 <0=> Secure state <1=> Non-Secure state
  365. // <o.27> Interrupt 59 <0=> Secure state <1=> Non-Secure state
  366. // <o.28> Interrupt 60 <0=> Secure state <1=> Non-Secure state
  367. // <o.29> Interrupt 61 <0=> Secure state <1=> Non-Secure state
  368. // <o.30> Interrupt 62 <0=> Secure state <1=> Non-Secure state
  369. // <o.31> Interrupt 63 <0=> Secure state <1=> Non-Secure state
  370. */
  371. #define NVIC_INIT_ITNS1_VAL 0x00000000
  372. /*
  373. // </e>
  374. */
  375. /*
  376. // <e>Initialize ITNS 2 (Interrupts 64..95)
  377. */
  378. #define NVIC_INIT_ITNS2 0
  379. /*
  380. // Interrupts 64..95
  381. // <o.0> Interrupt 64 <0=> Secure state <1=> Non-Secure state
  382. // <o.1> Interrupt 65 <0=> Secure state <1=> Non-Secure state
  383. // <o.2> Interrupt 66 <0=> Secure state <1=> Non-Secure state
  384. // <o.3> Interrupt 67 <0=> Secure state <1=> Non-Secure state
  385. // <o.4> Interrupt 68 <0=> Secure state <1=> Non-Secure state
  386. // <o.5> Interrupt 69 <0=> Secure state <1=> Non-Secure state
  387. // <o.6> Interrupt 70 <0=> Secure state <1=> Non-Secure state
  388. // <o.7> Interrupt 71 <0=> Secure state <1=> Non-Secure state
  389. // <o.8> Interrupt 72 <0=> Secure state <1=> Non-Secure state
  390. // <o.9> Interrupt 73 <0=> Secure state <1=> Non-Secure state
  391. // <o.10> Interrupt 74 <0=> Secure state <1=> Non-Secure state
  392. // <o.11> Interrupt 75 <0=> Secure state <1=> Non-Secure state
  393. // <o.12> Interrupt 76 <0=> Secure state <1=> Non-Secure state
  394. // <o.13> Interrupt 77 <0=> Secure state <1=> Non-Secure state
  395. // <o.14> Interrupt 78 <0=> Secure state <1=> Non-Secure state
  396. // <o.15> Interrupt 79 <0=> Secure state <1=> Non-Secure state
  397. // <o.16> Interrupt 80 <0=> Secure state <1=> Non-Secure state
  398. // <o.17> Interrupt 81 <0=> Secure state <1=> Non-Secure state
  399. // <o.18> Interrupt 82 <0=> Secure state <1=> Non-Secure state
  400. // <o.19> Interrupt 83 <0=> Secure state <1=> Non-Secure state
  401. // <o.20> Interrupt 84 <0=> Secure state <1=> Non-Secure state
  402. // <o.21> Interrupt 85 <0=> Secure state <1=> Non-Secure state
  403. // <o.22> Interrupt 86 <0=> Secure state <1=> Non-Secure state
  404. // <o.23> Interrupt 87 <0=> Secure state <1=> Non-Secure state
  405. // <o.24> Interrupt 88 <0=> Secure state <1=> Non-Secure state
  406. // <o.25> Interrupt 89 <0=> Secure state <1=> Non-Secure state
  407. // <o.26> Interrupt 90 <0=> Secure state <1=> Non-Secure state
  408. // <o.27> Interrupt 91 <0=> Secure state <1=> Non-Secure state
  409. // <o.28> Interrupt 92 <0=> Secure state <1=> Non-Secure state
  410. // <o.29> Interrupt 93 <0=> Secure state <1=> Non-Secure state
  411. // <o.30> Interrupt 94 <0=> Secure state <1=> Non-Secure state
  412. // <o.31> Interrupt 95 <0=> Secure state <1=> Non-Secure state
  413. */
  414. #define NVIC_INIT_ITNS2_VAL 0x00000000
  415. /*
  416. // </e>
  417. */
  418. /*
  419. // <e>Initialize ITNS 3 (Interrupts 96..127)
  420. */
  421. #define NVIC_INIT_ITNS3 0
  422. /*
  423. // Interrupts 96..127
  424. // <o.0> Interrupt 96 <0=> Secure state <1=> Non-Secure state
  425. // <o.1> Interrupt 97 <0=> Secure state <1=> Non-Secure state
  426. // <o.2> Interrupt 98 <0=> Secure state <1=> Non-Secure state
  427. // <o.3> Interrupt 99 <0=> Secure state <1=> Non-Secure state
  428. // <o.4> Interrupt 100 <0=> Secure state <1=> Non-Secure state
  429. // <o.5> Interrupt 101 <0=> Secure state <1=> Non-Secure state
  430. // <o.6> Interrupt 102 <0=> Secure state <1=> Non-Secure state
  431. // <o.7> Interrupt 103 <0=> Secure state <1=> Non-Secure state
  432. // <o.8> Interrupt 104 <0=> Secure state <1=> Non-Secure state
  433. // <o.9> Interrupt 105 <0=> Secure state <1=> Non-Secure state
  434. // <o.10> Interrupt 106 <0=> Secure state <1=> Non-Secure state
  435. // <o.11> Interrupt 107 <0=> Secure state <1=> Non-Secure state
  436. // <o.12> Interrupt 108 <0=> Secure state <1=> Non-Secure state
  437. // <o.13> Interrupt 109 <0=> Secure state <1=> Non-Secure state
  438. // <o.14> Interrupt 110 <0=> Secure state <1=> Non-Secure state
  439. // <o.15> Interrupt 111 <0=> Secure state <1=> Non-Secure state
  440. // <o.16> Interrupt 112 <0=> Secure state <1=> Non-Secure state
  441. // <o.17> Interrupt 113 <0=> Secure state <1=> Non-Secure state
  442. // <o.18> Interrupt 114 <0=> Secure state <1=> Non-Secure state
  443. // <o.19> Interrupt 115 <0=> Secure state <1=> Non-Secure state
  444. // <o.20> Interrupt 116 <0=> Secure state <1=> Non-Secure state
  445. // <o.21> Interrupt 117 <0=> Secure state <1=> Non-Secure state
  446. // <o.22> Interrupt 118 <0=> Secure state <1=> Non-Secure state
  447. // <o.23> Interrupt 119 <0=> Secure state <1=> Non-Secure state
  448. // <o.24> Interrupt 120 <0=> Secure state <1=> Non-Secure state
  449. // <o.25> Interrupt 121 <0=> Secure state <1=> Non-Secure state
  450. // <o.26> Interrupt 122 <0=> Secure state <1=> Non-Secure state
  451. // <o.27> Interrupt 123 <0=> Secure state <1=> Non-Secure state
  452. // <o.28> Interrupt 124 <0=> Secure state <1=> Non-Secure state
  453. // <o.29> Interrupt 125 <0=> Secure state <1=> Non-Secure state
  454. // <o.30> Interrupt 126 <0=> Secure state <1=> Non-Secure state
  455. // <o.31> Interrupt 127 <0=> Secure state <1=> Non-Secure state
  456. */
  457. #define NVIC_INIT_ITNS3_VAL 0x00000000
  458. /*
  459. // </e>
  460. */
  461. /*
  462. // <e>Initialize ITNS 4 (Interrupts 128..159)
  463. */
  464. #define NVIC_INIT_ITNS4 0
  465. /*
  466. // Interrupts 128..159
  467. // <o.0> Interrupt 128 <0=> Secure state <1=> Non-Secure state
  468. // <o.1> Interrupt 129 <0=> Secure state <1=> Non-Secure state
  469. // <o.2> Interrupt 130 <0=> Secure state <1=> Non-Secure state
  470. // <o.3> Interrupt 131 <0=> Secure state <1=> Non-Secure state
  471. // <o.4> Interrupt 132 <0=> Secure state <1=> Non-Secure state
  472. // <o.5> Interrupt 133 <0=> Secure state <1=> Non-Secure state
  473. // <o.6> Interrupt 134 <0=> Secure state <1=> Non-Secure state
  474. // <o.7> Interrupt 135 <0=> Secure state <1=> Non-Secure state
  475. // <o.8> Interrupt 136 <0=> Secure state <1=> Non-Secure state
  476. // <o.9> Interrupt 137 <0=> Secure state <1=> Non-Secure state
  477. // <o.10> Interrupt 138 <0=> Secure state <1=> Non-Secure state
  478. // <o.11> Interrupt 139 <0=> Secure state <1=> Non-Secure state
  479. // <o.12> Interrupt 140 <0=> Secure state <1=> Non-Secure state
  480. // <o.13> Interrupt 141 <0=> Secure state <1=> Non-Secure state
  481. // <o.14> Interrupt 142 <0=> Secure state <1=> Non-Secure state
  482. // <o.15> Interrupt 143 <0=> Secure state <1=> Non-Secure state
  483. // <o.16> Interrupt 144 <0=> Secure state <1=> Non-Secure state
  484. // <o.17> Interrupt 145 <0=> Secure state <1=> Non-Secure state
  485. // <o.18> Interrupt 146 <0=> Secure state <1=> Non-Secure state
  486. // <o.19> Interrupt 147 <0=> Secure state <1=> Non-Secure state
  487. // <o.20> Interrupt 148 <0=> Secure state <1=> Non-Secure state
  488. // <o.21> Interrupt 149 <0=> Secure state <1=> Non-Secure state
  489. // <o.22> Interrupt 150 <0=> Secure state <1=> Non-Secure state
  490. // <o.23> Interrupt 151 <0=> Secure state <1=> Non-Secure state
  491. // <o.24> Interrupt 152 <0=> Secure state <1=> Non-Secure state
  492. // <o.25> Interrupt 153 <0=> Secure state <1=> Non-Secure state
  493. // <o.26> Interrupt 154 <0=> Secure state <1=> Non-Secure state
  494. // <o.27> Interrupt 155 <0=> Secure state <1=> Non-Secure state
  495. // <o.28> Interrupt 156 <0=> Secure state <1=> Non-Secure state
  496. // <o.29> Interrupt 157 <0=> Secure state <1=> Non-Secure state
  497. // <o.30> Interrupt 158 <0=> Secure state <1=> Non-Secure state
  498. // <o.31> Interrupt 159 <0=> Secure state <1=> Non-Secure state
  499. */
  500. #define NVIC_INIT_ITNS4_VAL 0x00000000
  501. /*
  502. // </e>
  503. */
  504. /*
  505. // <e>Initialize ITNS 5 (Interrupts 160..191)
  506. */
  507. #define NVIC_INIT_ITNS5 0
  508. /*
  509. // Interrupts 160..191
  510. // <o.0> Interrupt 160 <0=> Secure state <1=> Non-Secure state
  511. // <o.1> Interrupt 161 <0=> Secure state <1=> Non-Secure state
  512. // <o.2> Interrupt 162 <0=> Secure state <1=> Non-Secure state
  513. // <o.3> Interrupt 163 <0=> Secure state <1=> Non-Secure state
  514. // <o.4> Interrupt 164 <0=> Secure state <1=> Non-Secure state
  515. // <o.5> Interrupt 165 <0=> Secure state <1=> Non-Secure state
  516. // <o.6> Interrupt 166 <0=> Secure state <1=> Non-Secure state
  517. // <o.7> Interrupt 167 <0=> Secure state <1=> Non-Secure state
  518. // <o.8> Interrupt 168 <0=> Secure state <1=> Non-Secure state
  519. // <o.9> Interrupt 169 <0=> Secure state <1=> Non-Secure state
  520. // <o.10> Interrupt 170 <0=> Secure state <1=> Non-Secure state
  521. // <o.11> Interrupt 171 <0=> Secure state <1=> Non-Secure state
  522. // <o.12> Interrupt 172 <0=> Secure state <1=> Non-Secure state
  523. // <o.13> Interrupt 173 <0=> Secure state <1=> Non-Secure state
  524. // <o.14> Interrupt 174 <0=> Secure state <1=> Non-Secure state
  525. // <o.15> Interrupt 175 <0=> Secure state <1=> Non-Secure state
  526. // <o.16> Interrupt 176 <0=> Secure state <1=> Non-Secure state
  527. // <o.17> Interrupt 177 <0=> Secure state <1=> Non-Secure state
  528. // <o.18> Interrupt 178 <0=> Secure state <1=> Non-Secure state
  529. // <o.19> Interrupt 179 <0=> Secure state <1=> Non-Secure state
  530. // <o.20> Interrupt 180 <0=> Secure state <1=> Non-Secure state
  531. // <o.21> Interrupt 181 <0=> Secure state <1=> Non-Secure state
  532. // <o.22> Interrupt 182 <0=> Secure state <1=> Non-Secure state
  533. // <o.23> Interrupt 183 <0=> Secure state <1=> Non-Secure state
  534. // <o.24> Interrupt 184 <0=> Secure state <1=> Non-Secure state
  535. // <o.25> Interrupt 185 <0=> Secure state <1=> Non-Secure state
  536. // <o.26> Interrupt 186 <0=> Secure state <1=> Non-Secure state
  537. // <o.27> Interrupt 187 <0=> Secure state <1=> Non-Secure state
  538. // <o.28> Interrupt 188 <0=> Secure state <1=> Non-Secure state
  539. // <o.29> Interrupt 189 <0=> Secure state <1=> Non-Secure state
  540. // <o.30> Interrupt 190 <0=> Secure state <1=> Non-Secure state
  541. // <o.31> Interrupt 191 <0=> Secure state <1=> Non-Secure state
  542. */
  543. #define NVIC_INIT_ITNS5_VAL 0x00000000
  544. /*
  545. // </e>
  546. */
  547. /*
  548. // <e>Initialize ITNS 6 (Interrupts 192..223)
  549. */
  550. #define NVIC_INIT_ITNS6 0
  551. /*
  552. // Interrupts 192..223
  553. // <o.0> Interrupt 192 <0=> Secure state <1=> Non-Secure state
  554. // <o.1> Interrupt 193 <0=> Secure state <1=> Non-Secure state
  555. // <o.2> Interrupt 194 <0=> Secure state <1=> Non-Secure state
  556. // <o.3> Interrupt 195 <0=> Secure state <1=> Non-Secure state
  557. // <o.4> Interrupt 196 <0=> Secure state <1=> Non-Secure state
  558. // <o.5> Interrupt 197 <0=> Secure state <1=> Non-Secure state
  559. // <o.6> Interrupt 198 <0=> Secure state <1=> Non-Secure state
  560. // <o.7> Interrupt 199 <0=> Secure state <1=> Non-Secure state
  561. // <o.8> Interrupt 200 <0=> Secure state <1=> Non-Secure state
  562. // <o.9> Interrupt 201 <0=> Secure state <1=> Non-Secure state
  563. // <o.10> Interrupt 202 <0=> Secure state <1=> Non-Secure state
  564. // <o.11> Interrupt 203 <0=> Secure state <1=> Non-Secure state
  565. // <o.12> Interrupt 204 <0=> Secure state <1=> Non-Secure state
  566. // <o.13> Interrupt 205 <0=> Secure state <1=> Non-Secure state
  567. // <o.14> Interrupt 206 <0=> Secure state <1=> Non-Secure state
  568. // <o.15> Interrupt 207 <0=> Secure state <1=> Non-Secure state
  569. // <o.16> Interrupt 208 <0=> Secure state <1=> Non-Secure state
  570. // <o.17> Interrupt 209 <0=> Secure state <1=> Non-Secure state
  571. // <o.18> Interrupt 210 <0=> Secure state <1=> Non-Secure state
  572. // <o.19> Interrupt 211 <0=> Secure state <1=> Non-Secure state
  573. // <o.20> Interrupt 212 <0=> Secure state <1=> Non-Secure state
  574. // <o.21> Interrupt 213 <0=> Secure state <1=> Non-Secure state
  575. // <o.22> Interrupt 214 <0=> Secure state <1=> Non-Secure state
  576. // <o.23> Interrupt 215 <0=> Secure state <1=> Non-Secure state
  577. // <o.24> Interrupt 216 <0=> Secure state <1=> Non-Secure state
  578. // <o.25> Interrupt 217 <0=> Secure state <1=> Non-Secure state
  579. // <o.26> Interrupt 218 <0=> Secure state <1=> Non-Secure state
  580. // <o.27> Interrupt 219 <0=> Secure state <1=> Non-Secure state
  581. // <o.28> Interrupt 220 <0=> Secure state <1=> Non-Secure state
  582. // <o.29> Interrupt 221 <0=> Secure state <1=> Non-Secure state
  583. // <o.30> Interrupt 222 <0=> Secure state <1=> Non-Secure state
  584. // <o.31> Interrupt 223 <0=> Secure state <1=> Non-Secure state
  585. */
  586. #define NVIC_INIT_ITNS6_VAL 0x00000000
  587. /*
  588. // </e>
  589. */
  590. /*
  591. // <e>Initialize ITNS 7 (Interrupts 224..255)
  592. */
  593. #define NVIC_INIT_ITNS7 0
  594. /*
  595. // Interrupts 224..255
  596. // <o.0> Interrupt 224 <0=> Secure state <1=> Non-Secure state
  597. // <o.1> Interrupt 225 <0=> Secure state <1=> Non-Secure state
  598. // <o.2> Interrupt 226 <0=> Secure state <1=> Non-Secure state
  599. // <o.3> Interrupt 227 <0=> Secure state <1=> Non-Secure state
  600. // <o.4> Interrupt 228 <0=> Secure state <1=> Non-Secure state
  601. // <o.5> Interrupt 229 <0=> Secure state <1=> Non-Secure state
  602. // <o.6> Interrupt 230 <0=> Secure state <1=> Non-Secure state
  603. // <o.7> Interrupt 231 <0=> Secure state <1=> Non-Secure state
  604. // <o.8> Interrupt 232 <0=> Secure state <1=> Non-Secure state
  605. // <o.9> Interrupt 233 <0=> Secure state <1=> Non-Secure state
  606. // <o.10> Interrupt 234 <0=> Secure state <1=> Non-Secure state
  607. // <o.11> Interrupt 235 <0=> Secure state <1=> Non-Secure state
  608. // <o.12> Interrupt 236 <0=> Secure state <1=> Non-Secure state
  609. // <o.13> Interrupt 237 <0=> Secure state <1=> Non-Secure state
  610. // <o.14> Interrupt 238 <0=> Secure state <1=> Non-Secure state
  611. // <o.15> Interrupt 239 <0=> Secure state <1=> Non-Secure state
  612. // <o.16> Interrupt 240 <0=> Secure state <1=> Non-Secure state
  613. // <o.17> Interrupt 241 <0=> Secure state <1=> Non-Secure state
  614. // <o.18> Interrupt 242 <0=> Secure state <1=> Non-Secure state
  615. // <o.19> Interrupt 243 <0=> Secure state <1=> Non-Secure state
  616. // <o.20> Interrupt 244 <0=> Secure state <1=> Non-Secure state
  617. // <o.21> Interrupt 245 <0=> Secure state <1=> Non-Secure state
  618. // <o.22> Interrupt 246 <0=> Secure state <1=> Non-Secure state
  619. // <o.23> Interrupt 247 <0=> Secure state <1=> Non-Secure state
  620. // <o.24> Interrupt 248 <0=> Secure state <1=> Non-Secure state
  621. // <o.25> Interrupt 249 <0=> Secure state <1=> Non-Secure state
  622. // <o.26> Interrupt 250 <0=> Secure state <1=> Non-Secure state
  623. // <o.27> Interrupt 251 <0=> Secure state <1=> Non-Secure state
  624. // <o.28> Interrupt 252 <0=> Secure state <1=> Non-Secure state
  625. // <o.29> Interrupt 253 <0=> Secure state <1=> Non-Secure state
  626. // <o.30> Interrupt 254 <0=> Secure state <1=> Non-Secure state
  627. // <o.31> Interrupt 255 <0=> Secure state <1=> Non-Secure state
  628. */
  629. #define NVIC_INIT_ITNS7_VAL 0x00000000
  630. /*
  631. // </e>
  632. */
  633. /*
  634. // </h>
  635. */
  636. /*
  637. max 128 SAU regions.
  638. SAU regions are defined in partition.h
  639. */
  640. #define SAU_INIT_REGION(n) \
  641. SAU->RNR = (n & SAU_RNR_REGION_Msk); \
  642. SAU->RBAR = (SAU_INIT_START##n & SAU_RBAR_BADDR_Msk); \
  643. SAU->RLAR = (SAU_INIT_END##n & SAU_RLAR_LADDR_Msk) | \
  644. ((SAU_INIT_NSC##n << SAU_RLAR_NSC_Pos) & SAU_RLAR_NSC_Msk) | 1U
  645. /**
  646. \brief Setup a SAU Region
  647. \details Writes the region information contained in SAU_Region to the
  648. registers SAU_RNR, SAU_RBAR, and SAU_RLAR
  649. */
  650. __STATIC_INLINE void TZ_SAU_Setup (void)
  651. {
  652. #if defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U)
  653. #if defined (SAU_INIT_REGION0) && (SAU_INIT_REGION0 == 1U)
  654. SAU_INIT_REGION(0);
  655. #endif
  656. #if defined (SAU_INIT_REGION1) && (SAU_INIT_REGION1 == 1U)
  657. SAU_INIT_REGION(1);
  658. #endif
  659. #if defined (SAU_INIT_REGION2) && (SAU_INIT_REGION2 == 1U)
  660. SAU_INIT_REGION(2);
  661. #endif
  662. #if defined (SAU_INIT_REGION3) && (SAU_INIT_REGION3 == 1U)
  663. SAU_INIT_REGION(3);
  664. #endif
  665. #if defined (SAU_INIT_REGION4) && (SAU_INIT_REGION4 == 1U)
  666. SAU_INIT_REGION(4);
  667. #endif
  668. #if defined (SAU_INIT_REGION5) && (SAU_INIT_REGION5 == 1U)
  669. SAU_INIT_REGION(5);
  670. #endif
  671. #if defined (SAU_INIT_REGION6) && (SAU_INIT_REGION6 == 1U)
  672. SAU_INIT_REGION(6);
  673. #endif
  674. #if defined (SAU_INIT_REGION7) && (SAU_INIT_REGION7 == 1U)
  675. SAU_INIT_REGION(7);
  676. #endif
  677. /* repeat this for all possible SAU regions */
  678. #endif /* defined (__SAUREGION_PRESENT) && (__SAUREGION_PRESENT == 1U) */
  679. #if defined (SAU_INIT_CTRL) && (SAU_INIT_CTRL == 1U)
  680. SAU->CTRL = ((SAU_INIT_CTRL_ENABLE << SAU_CTRL_ENABLE_Pos) & SAU_CTRL_ENABLE_Msk) |
  681. ((SAU_INIT_CTRL_ALLNS << SAU_CTRL_ALLNS_Pos) & SAU_CTRL_ALLNS_Msk) ;
  682. #endif
  683. #if defined (SCB_CSR_AIRCR_INIT) && (SCB_CSR_AIRCR_INIT == 1U)
  684. SCB->SCR = (SCB->SCR & ~(SCB_SCR_SLEEPDEEPS_Msk )) |
  685. ((SCB_CSR_DEEPSLEEPS_VAL << SCB_SCR_SLEEPDEEPS_Pos) & SCB_SCR_SLEEPDEEPS_Msk);
  686. SCB->AIRCR = (SCB->AIRCR & ~(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_SYSRESETREQS_Msk |
  687. SCB_AIRCR_BFHFNMINS_Msk | SCB_AIRCR_PRIS_Msk) ) |
  688. ((0x05FAU << SCB_AIRCR_VECTKEY_Pos) & SCB_AIRCR_VECTKEY_Msk) |
  689. ((SCB_AIRCR_SYSRESETREQS_VAL << SCB_AIRCR_SYSRESETREQS_Pos) & SCB_AIRCR_SYSRESETREQS_Msk) |
  690. ((SCB_AIRCR_PRIS_VAL << SCB_AIRCR_PRIS_Pos) & SCB_AIRCR_PRIS_Msk) |
  691. ((SCB_AIRCR_BFHFNMINS_VAL << SCB_AIRCR_BFHFNMINS_Pos) & SCB_AIRCR_BFHFNMINS_Msk);
  692. #endif /* defined (SCB_CSR_AIRCR_INIT) && (SCB_CSR_AIRCR_INIT == 1U) */
  693. #if defined (SCB_ICSR_INIT) && (SCB_ICSR_INIT == 1U)
  694. SCB->ICSR = (SCB->ICSR & ~(SCB_ICSR_STTNS_Msk )) |
  695. ((SCB_ICSR_STTNS_VAL << SCB_ICSR_STTNS_Pos) & SCB_ICSR_STTNS_Msk);
  696. #endif /* defined (SCB_ICSR_INIT) && (SCB_ICSR_INIT == 1U) */
  697. #if defined (NVIC_INIT_ITNS0) && (NVIC_INIT_ITNS0 == 1U)
  698. NVIC->ITNS[0] = NVIC_INIT_ITNS0_VAL;
  699. #endif
  700. #if defined (NVIC_INIT_ITNS1) && (NVIC_INIT_ITNS1 == 1U)
  701. NVIC->ITNS[1] = NVIC_INIT_ITNS1_VAL;
  702. #endif
  703. #if defined (NVIC_INIT_ITNS2) && (NVIC_INIT_ITNS2 == 1U)
  704. NVIC->ITNS[2] = NVIC_INIT_ITNS2_VAL;
  705. #endif
  706. #if defined (NVIC_INIT_ITNS3) && (NVIC_INIT_ITNS3 == 1U)
  707. NVIC->ITNS[3] = NVIC_INIT_ITNS3_VAL;
  708. #endif
  709. #if defined (NVIC_INIT_ITNS4) && (NVIC_INIT_ITNS4 == 1U)
  710. NVIC->ITNS[4] = NVIC_INIT_ITNS4_VAL;
  711. #endif
  712. #if defined (NVIC_INIT_ITNS5) && (NVIC_INIT_ITNS5 == 1U)
  713. NVIC->ITNS[5] = NVIC_INIT_ITNS5_VAL;
  714. #endif
  715. #if defined (NVIC_INIT_ITNS6) && (NVIC_INIT_ITNS6 == 1U)
  716. NVIC->ITNS[6] = NVIC_INIT_ITNS6_VAL;
  717. #endif
  718. #if defined (NVIC_INIT_ITNS7) && (NVIC_INIT_ITNS7 == 1U)
  719. NVIC->ITNS[7] = NVIC_INIT_ITNS7_VAL;
  720. #endif
  721. /* repeat this for all possible ITNS elements */
  722. }
  723. #endif /* PARTITION_ARMCM23_H */