core_feature_smpcc.h 78 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921
  1. /*
  2. * Copyright (c) 2019 Nuclei Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the License); you may
  7. * not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  14. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. #ifndef __CORE_FEATURE_SMPCC_H__
  19. #define __CORE_FEATURE_SMPCC_H__
  20. /*!
  21. * @file core_feature_smpcc.h
  22. * @brief SMP & Cluster Cache feature API header file for Nuclei N/NX Core
  23. */
  24. /*
  25. * SMP & Cluster Cache Feature Configuration Macro:
  26. *
  27. * 1. __SMPCC_PRESENT: Define whether SMP & Cluster Cache feature is present or not
  28. * * 0: Not present
  29. * * 1: Present
  30. * 2. __SMPCC_BASEADDR: Base address of the SMP & Cluster Cache unit.
  31. *
  32. */
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36. #include "core_feature_base.h"
  37. #if defined(__SMPCC_PRESENT) && (__SMPCC_PRESENT == 1)
  38. /**
  39. * \defgroup NMSIS_Core_SMPCC_Registers Register Define and Type Definitions Of SMPCC
  40. * \ingroup NMSIS_Core_Registers
  41. * \brief Type definitions and defines for smpcc registers.
  42. *
  43. * @{
  44. */
  45. /**
  46. * \brief Union type to access SMP_VER information register.
  47. */
  48. typedef union
  49. {
  50. struct {
  51. __IM uint32_t mic_ver:8; /*!< bit: 0..7 micro version number */
  52. __IM uint32_t min_ver:8; /*!< bit: 8..15 minor version number */
  53. __IM uint32_t maj_ver:8; /*!< bit: 16..23 major version number */
  54. __IM uint32_t _reserved:8; /*!< bit: 24..31 reserved */
  55. } b; /*!< Structure used for bit access */
  56. __IM uint32_t w; /*!< Type used for word access */
  57. } SMP_VER_Type;
  58. /**
  59. * \brief Union type to access SMP_CFG information register.
  60. */
  61. typedef union
  62. {
  63. struct {
  64. __IM uint32_t cc_present:1; /*!< bit: 0 cluster cache present or not */
  65. __IM uint32_t smp_core_num:6; /*!< bit: 1..6 core number in cluster */
  66. __IM uint32_t iocp_num:6; /*!< bit: 7..12 IO coherency port number in the cluster */
  67. __IM uint32_t pmon_num:6; /*!< bit: 13..18 performance monitor number in the cluster */
  68. __IM uint32_t _reserved:13; /*!< bit: 19..31 reserved */
  69. } b; /*!< Structure used for bit access */
  70. __IM uint32_t w; /*!< Type used for word access */
  71. } SMP_CFG_Type;
  72. /**
  73. * \brief Union type to access CC_CFG information register.
  74. */
  75. typedef union
  76. {
  77. struct {
  78. __IM uint32_t cc_set:4; /*!< bit: 0..3 cluster cache set number = 2^(cc_set) */
  79. __IM uint32_t cc_way:4; /*!< bit: 4..7 cluster cache way number = cc_way + 1 */
  80. __IM uint32_t cc_lsize:3; /*!< bit: 8..10 cluster cache line size = 2^(cc_lsize + 2) */
  81. __IM uint32_t cc_ecc:1; /*!< bit: 11 cluster cache ECC supports ECC or not */
  82. __IM uint32_t cc_tcycle:3; /*!< bit: 12..14 L2 tag ram access cycle = cc_tcycle + 1 */
  83. __IM uint32_t cc_dcycle:3; /*!< bit: 15..17 L2 Data sram access cycle = cc_dcycle + 1 */
  84. __IM uint32_t _reserved:14; /*!< bit: 18..31 reserved */
  85. } b; /*!< Structure used for bit access */
  86. uint32_t w; /*!< Type used for word access */
  87. } CC_CFG_Type;
  88. /**
  89. * \brief Union type to access SMP_ENB configure register.
  90. */
  91. typedef union
  92. {
  93. struct {
  94. __IOM uint32_t smp_enable:16; /*!< bit: 0..15 SMP enable bits for clients in cluster */
  95. __IM uint32_t _reserved:16; /*!< bit: 16..31 reserved */
  96. } b; /*!< Structure used for bit access */
  97. uint32_t w; /*!< Type used for word access */
  98. } SMP_ENB_Type;
  99. /**
  100. * \brief Union type to access CC_CTRL configure register.
  101. */
  102. typedef union
  103. {
  104. struct {
  105. __IOM uint32_t cc_en:1; /*!< bit: 0 cluster cache enable bit */
  106. __IOM uint32_t cc_ecc_en:1; /*!< bit: 1 cluster cache ECC enable bit */
  107. __IOM uint32_t ecc_excp_en:1; /*!< bit: 2 cluster cache ECC exception enable bit */
  108. __IOM uint32_t lock_ecc_cfg:1; /*!< bit: 3 lock the cc ecc configuration bit */
  109. __IOM uint32_t lock_ecc_err_inj:1; /*!< bit: 4 lock cc ecc error injection register */
  110. __IOM uint32_t recv_err_irq_en:1; /*!< bit: 5 enable the interrupt when recoverable error count exceeds the threshold */
  111. __IOM uint32_t fatal_err_irq_en:1; /*!< bit: 6 enable the interrupt when fatal error count exceeds the threshold */
  112. __IOM uint32_t bus_err_pend:1; /*!< bit: 7 indicate if there is bus error pending */
  113. __IOM uint32_t bus_err_irq_en:1; /*!< bit: 8 enable the buss error interrupt of cc maintain operation */
  114. __IOM uint32_t sup_cmd_en:1; /*!< bit: 9 enable S mode can operate register CC_sCMD and SMP_PMON_SEL */
  115. __IOM uint32_t use_cmd_en:1; /*!< bit: 10 enable U mode can operate register CC_uCMD and SMP_PMON_SEL */
  116. __IOM uint32_t ecc_chk_en:1; /*!< bit: 11 cc ecc check enable bit */
  117. __IOM uint32_t clm_ecc_en:1; /*!< bit: 12 clm ecc enable bit */
  118. __IOM uint32_t clm_excp_en:1; /*!< bit: 13 clm ecc exception enable bit */
  119. __IOM uint32_t clm_ecc_chk_en:1; /*!< bit: 14 clm ecc check enable bit */
  120. __IOM uint32_t pf_sh_cl_en:1; /*!< bit: 15 enable L1 prefetch to snoop and share cacheline from other cores */
  121. __IOM uint32_t pf_l2_early_en:1; /*!< bit: 16 enable L2 prefetch to initialize external bus read access while lookup the cluster cache */
  122. __IOM uint32_t pf_biu_outs_en:1; /*!< bit: 17 enable the limit of outstanding L2 prefetch to the number of L2 prefetch line-buffer */
  123. __IOM uint32_t i_snoop_d_en:1; /*!< bit: 18 snoop to dcache for icache refill reads enable */
  124. __IOM uint32_t iocc_err:1; /*!< bit: 19 iocc has error */
  125. __IOM uint32_t early_wr_err:1; /*!< bit: 20 early write response has error */
  126. __IOM uint32_t pf_no_wb:1; /*!< bit: 21 enable L2 prefetch to abort and avoid dirty cacheline write back when filling the cluster cache */
  127. __IM uint32_t _reserved:10; /*!< bit: 22..31 reserved */
  128. } b; /*!< Structure used for bit access */
  129. uint32_t w; /*!< Type used for word access */
  130. } CC_CTRL_Type;
  131. #define SMPCC_CTRL_CC_EN_Pos 0U /*!< SMPCC CC_CTRL CC_EN Position */
  132. #define SMPCC_CTRL_CC_EN_Msk (0x1UL << SMPCC_CTRL_CC_EN_Pos) /*!< SMPCC CC_CTRL CC_EN Mask */
  133. #define SMPCC_CTRL_CC_EN_ENABLE 1U /*!< SMPCC CC_CTRL CC_EN Enable */
  134. #define SMPCC_CTRL_CC_EN_DISABLE 0U /*!< SMPCC CC_CTRL CC_EN Disable */
  135. #define SMPCC_CTRL_CC_ECC_EN_Pos 1U /*!< SMPCC CC_CTRL CC_ECC_EN Position */
  136. #define SMPCC_CTRL_CC_ECC_EN_Msk (0x1UL << SMPCC_CTRL_CC_ECC_EN_Pos) /*!< SMPCC CC_CTRL CC_ECC_EN Mask */
  137. #define SMPCC_CTRL_CC_ECC_EN_ENABLE 1U /*!< SMPCC CC_CTRL CC_ECC_EN Enable */
  138. #define SMPCC_CTRL_CC_ECC_EN_DISABLE 0U /*!< SMPCC CC_CTRL CC_ECC_EN Disable */
  139. #define SMPCC_CTRL_CC_ECC_EXCP_EN_Pos 2U /*!< SMPCC CC_CTRL ECC_EXCP_EN Position */
  140. #define SMPCC_CTRL_CC_ECC_EXCP_EN_Msk (0x1UL << SMPCC_CTRL_CC_ECC_EXCP_EN_Pos) /*!< SMPCC CC_CTRL ECC_EXCP_EN Mask */
  141. #define SMPCC_CTRL_CC_ECC_EXCP_EN_ENABLE 1U /*!< SMPCC CC_CTRL ECC_EXCP_EN Enable */
  142. #define SMPCC_CTRL_CC_ECC_EXCP_EN_DISABLE 0U /*!< SMPCC CC_CTRL ECC_EXCP_EN Disable */
  143. #define SMPCC_CTRL_LOCK_ECC_CFG_Pos 3U /*!< SMPCC CC_CTRL LOCK_ECC_CFG Position */
  144. #define SMPCC_CTRL_LOCK_ECC_CFG_Msk (0x1UL << SMPCC_CTRL_LOCK_ECC_CFG_Pos) /*!< SMPCC CC_CTRL LOCK_ECC_CFG Mask */
  145. #define SMPCC_CTRL_LOCK_ECC_CFG_LOCK 1U /*!< SMPCC CC_CTRL LOCK_ECC_CFG Lock */
  146. #define SMPCC_CTRL_LOCK_ECC_ERR_INJ_Pos 4U /*!< SMPCC CC_CTRL LOCK_ECC_ERR_INJ Position */
  147. #define SMPCC_CTRL_LOCK_ECC_ERR_INJ_Msk (0x1UL << SMPCC_CTRL_LOCK_ECC_ERR_INJ_Pos) /*!< SMPCC CC_CTRL LOCK_ECC_ERR_INJ Mask */
  148. #define SMPCC_CTRL_LOCK_ECC_ERR_INJ_LOCK 1U /*!< SMPCC CC_CTRL LOCK_ECC_ERR_INJ Lock */
  149. #define SMPCC_CTRL_RECV_ERR_IRQ_EN_Pos 5U /*!< SMPCC CC_CTRL RECV_ERR_IRQ_EN Position */
  150. #define SMPCC_CTRL_RECV_ERR_IRQ_EN_Msk (0x1UL << SMPCC_CTRL_RECV_ERR_IRQ_EN_Pos) /*!< SMPCC CC_CTRL RECV_ERR_IRQ_EN Mask */
  151. #define SMPCC_CTRL_RECV_ERR_IRQ_EN_ENABLE 1U /*!< SMPCC CC_CTRL RECV_ERR_IRQ_EN Enable */
  152. #define SMPCC_CTRL_RECV_ERR_IRQ_EN_DISABLE 0U /*!< SMPCC CC_CTRL RECV_ERR_IRQ_EN Disable */
  153. #define SMPCC_CTRL_FATAL_ERR_IRQ_EN_Pos 6U /*!< SMPCC CC_CTRL FATAL_ERR_IRQ_EN Position */
  154. #define SMPCC_CTRL_FATAL_ERR_IRQ_EN_Msk (0x1UL << SMPCC_CTRL_FATAL_ERR_IRQ_EN_Pos) /*!< SMPCC CC_CTRL FATAL_ERR_IRQ_EN Mask */
  155. #define SMPCC_CTRL_FATAL_ERR_IRQ_EN_ENABLE 1U /*!< SMPCC CC_CTRL FATAL_ERR_IRQ_EN Enable */
  156. #define SMPCC_CTRL_FATAL_ERR_IRQ_EN_DISABLE 0U /*!< SMPCC CC_CTRL FATAL_ERR_IRQ_EN Disable */
  157. #define SMPCC_CTRL_BUS_ERR_PEND_Pos 7U /*!< SMPCC CC_CTRL BUS_ERR_PEND Position */
  158. #define SMPCC_CTRL_BUS_ERR_PEND_Msk (0x1UL << SMPCC_CTRL_BUS_ERR_PEND_Pos) /*!< SMPCC CC_CTRL BUS_ERR_PEND Mask */
  159. #define SMPCC_CTRL_BUS_ERR_IRQ_EN_Pos 8U /*!< SMPCC CC_CTRL BUS_ERR_IRQ_EN Position */
  160. #define SMPCC_CTRL_BUS_ERR_IRQ_EN_Msk (0x1UL << SMPCC_CTRL_BUS_ERR_IRQ_EN_Pos) /*!< SMPCC CC_CTRL BUS_ERR_IRQ_EN Mask */
  161. #define SMPCC_CTRL_BUS_ERR_IRQ_EN_ENABLE 1U /*!< SMPCC CC_CTRL BUS_ERR_IRQ_EN Enable */
  162. #define SMPCC_CTRL_BUS_ERR_IRQ_EN_DISABLE 0U /*!< SMPCC CC_CTRL BUS_ERR_IRQ_EN Disable */
  163. #define SMPCC_CTRL_SUP_CMD_EN_Pos 9U /*!< SMPCC CC_CTRL SUP_CMD_EN Position */
  164. #define SMPCC_CTRL_SUP_CMD_EN_Msk (0x1UL << SMPCC_CTRL_SUP_CMD_EN_Pos) /*!< SMPCC CC_CTRL SUP_CMD_EN Mask */
  165. #define SMPCC_CTRL_SUP_CMD_EN_ENABLE 1U /*!< SMPCC CC_CTRL SUP_CMD_EN Enable */
  166. #define SMPCC_CTRL_SUP_CMD_EN_DISABLE 0U /*!< SMPCC CC_CTRL SUP_CMD_EN Disable */
  167. #define SMPCC_CTRL_USE_CMD_EN_Pos 10U /*!< SMPCC CC_CTRL USE_CMD_EN Position */
  168. #define SMPCC_CTRL_USE_CMD_EN_Msk (0x1UL << SMPCC_CTRL_USE_CMD_EN_Pos) /*!< SMPCC CC_CTRL USE_CMD_EN Mask */
  169. #define SMPCC_CTRL_USE_CMD_EN_ENABLE 1U /*!< SMPCC CC_CTRL USE_CMD_EN Enable */
  170. #define SMPCC_CTRL_USE_CMD_EN_DISABLE 0U /*!< SMPCC CC_CTRL USE_CMD_EN Disable */
  171. #define SMPCC_CTRL_ECC_CHK_EN_Pos 11U /*!< SMPCC CC_CTRL ECC_CHK_EN Position */
  172. #define SMPCC_CTRL_ECC_CHK_EN_Msk (0x1UL << SMPCC_CTRL_ECC_CHK_EN_Pos) /*!< SMPCC CC_CTRL ECC_CHK_EN Mask */
  173. #define SMPCC_CTRL_ECC_CHK_EN_ENABLE 1U /*!< SMPCC CC_CTRL ECC_CHK_EN Enable */
  174. #define SMPCC_CTRL_ECC_CHK_EN_DISABLE 0U /*!< SMPCC CC_CTRL ECC_CHK_EN Disable */
  175. #define SMPCC_CTRL_CLM_ECC_EN_Pos 12U /*!< SMPCC CC_CTRL CLM_ECC_EN Position */
  176. #define SMPCC_CTRL_CLM_ECC_EN_Msk (0x1UL << SMPCC_CTRL_CLM_ECC_EN_Pos) /*!< SMPCC CC_CTRL CLM_ECC_EN Mask */
  177. #define SMPCC_CTRL_CLM_ECC_EN_ENABLE 1U /*!< SMPCC CC_CTRL CLM_ECC_EN Enable */
  178. #define SMPCC_CTRL_CLM_ECC_EN_DISABLE 0U /*!< SMPCC CC_CTRL CLM_ECC_EN Disable */
  179. #define SMPCC_CTRL_CLM_EXCP_EN_Pos 13U /*!< SMPCC CC_CTRL CLM_EXCP_EN Position */
  180. #define SMPCC_CTRL_CLM_EXCP_EN_Msk (0x1UL << SMPCC_CTRL_CLM_EXCP_EN_Pos) /*!< SMPCC CC_CTRL CLM_EXCP_EN Mask */
  181. #define SMPCC_CTRL_CLM_EXCP_EN_ENABLE 1U /*!< SMPCC CC_CTRL CLM_EXCP_EN Enable */
  182. #define SMPCC_CTRL_CLM_EXCP_EN_DISABLE 0U /*!< SMPCC CC_CTRL CLM_EXCP_EN Disable */
  183. #define SMPCC_CTRL_CLM_ECC_CHK_EN_Pos 14U /*!< SMPCC CC_CTRL CLM_ECC_CHK_EN Position */
  184. #define SMPCC_CTRL_CLM_ECC_CHK_EN_Msk (0x1UL << SMPCC_CTRL_CLM_ECC_CHK_EN_Pos) /*!< SMPCC CC_CTRL CLM_ECC_CHK_EN Mask */
  185. #define SMPCC_CTRL_CLM_ECC_CHK_EN_ENABLE 1U /*!< SMPCC CC_CTRL CLM_ECC_CHK_EN Enable */
  186. #define SMPCC_CTRL_CLM_ECC_CHK_EN_DISABLE 0U /*!< SMPCC CC_CTRL CLM_ECC_CHK_EN Disable */
  187. #define SMPCC_CTRL_PF_SH_CL_EN_Pos 15U /*!< SMPCC CC_CTRL PF_SH_CL_EN Position */
  188. #define SMPCC_CTRL_PF_SH_CL_EN_Msk (0x1UL << SMPCC_CTRL_PF_SH_CL_EN_Pos) /*!< SMPCC CC_CTRL PF_SH_CL_EN Mask */
  189. #define SMPCC_CTRL_PF_SH_CL_EN_ENABLE 1U /*!< SMPCC CC_CTRL PF_SH_CL_EN Enable */
  190. #define SMPCC_CTRL_PF_SH_CL_EN_DISABLE 0U /*!< SMPCC CC_CTRL PF_SH_CL_EN Disable */
  191. #define SMPCC_CTRL_PF_L2_EARLY_EN_Pos 16U /*!< SMPCC CC_CTRL PF_L2_EARLY_EN Position */
  192. #define SMPCC_CTRL_PF_L2_EARLY_EN_Msk (0x1UL << SMPCC_CTRL_PF_L2_EARLY_EN_Pos) /*!< SMPCC CC_CTRL PF_L2_EARLY_EN Mask */
  193. #define SMPCC_CTRL_PF_L2_EARLY_EN_ENABLE 1U /*!< SMPCC CC_CTRL PF_L2_EARLY_EN Enable */
  194. #define SMPCC_CTRL_PF_L2_EARLY_EN_DISABLE 0U /*!< SMPCC CC_CTRL PF_L2_EARLY_EN Disable */
  195. #define SMPCC_CTRL_PF_BIU_OUTS_EN_Pos 17U /*!< SMPCC CC_CTRL PF_BIU_OUTS_EN Position */
  196. #define SMPCC_CTRL_PF_BIU_OUTS_EN_Msk (0x1UL << SMPCC_CTRL_PF_BIU_OUTS_EN_Pos) /*!< SMPCC CC_CTRL PF_BIU_OUTS_EN Mask */
  197. #define SMPCC_CTRL_PF_BIU_OUTS_EN_ENABLE 1U /*!< SMPCC CC_CTRL PF_BIU_OUTS_EN Enable */
  198. #define SMPCC_CTRL_PF_BIU_OUTS_EN_DISABLE 0U /*!< SMPCC CC_CTRL PF_BIU_OUTS_EN Disable */
  199. #define SMPCC_CTRL_I_SNOOP_D_EN_Pos 18U /*!< SMPCC CC_CTRL I_SNOOP_D_EN Position */
  200. #define SMPCC_CTRL_I_SNOOP_D_EN_Msk (0x1UL << SMPCC_CTRL_I_SNOOP_D_EN_Pos) /*!< SMPCC CC_CTRL I_SNOOP_D_EN Mask */
  201. #define SMPCC_CTRL_I_SNOOP_D_EN_ENABLE 1U /*!< SMPCC CC_CTRL I_SNOOP_D_EN Enable */
  202. #define SMPCC_CTRL_I_SNOOP_D_EN_DISABLE 0U /*!< SMPCC CC_CTRL I_SNOOP_D_EN Disable */
  203. #define SMPCC_CTRL_IOCC_ERR_Pos 19U /*!< SMPCC CC_CTRL IOCC_ERR Position */
  204. #define SMPCC_CTRL_IOCC_ERR_Msk (0x1UL << SMPCC_CTRL_IOCC_ERR_Pos) /*!< SMPCC CC_CTRL IOCC_ERR Mask */
  205. #define SMPCC_CTRL_EARLY_WR_ERR_Pos 20U /*!< SMPCC CC_CTRL EARLY_WR_ERR Position */
  206. #define SMPCC_CTRL_EARLY_WR_ERR_Msk (0x1UL << SMPCC_CTRL_EARLY_WR_ERR_Pos) /*!< SMPCC CC_CTRL EARLY_WR_ERR Mask */
  207. #define SMPCC_CTRL_PF_NO_WB_Pos 21U /*!< SMPCC CC_CTRL PF_NO_WB Position */
  208. #define SMPCC_CTRL_PF_NO_WB_Msk (0x1UL << SMPCC_CTRL_PF_NO_WB_Pos) /*!< SMPCC CC_CTRL PF_NO_WB Mask */
  209. #define SMPCC_CTRL_PF_NO_WB_ENABLE 1U /*!< SMPCC CC_CTRL PF_NO_WB Enable */
  210. #define SMPCC_CTRL_PF_NO_WB_DISABLE 0U /*!< SMPCC CC_CTRL PF_NO_WB Disable */
  211. /**
  212. * \brief Union type to access CC_CMD register. This type is suitable for all m/s/u mode registers.
  213. */
  214. typedef union
  215. {
  216. struct {
  217. __IOM uint32_t cmd:5; /*!< bit: 0..4 cluster cache maintain command code */
  218. __IM uint32_t _reserved:18; /*!< bit: 5..22 reserved */
  219. __IOM uint32_t reisc:1; /*!< bit: 23 recoverable error interrupt status, write 1 to clean */
  220. __IOM uint32_t feisc:1; /*!< bit: 24 fatal error interrupt status, write 1 to clean */
  221. __IOM uint32_t besc:1; /*!< bit: 25 bus error status, write 1 to clean */
  222. __IM uint32_t result_code:5; /*!< bit: 26..30 result code */
  223. __IM uint32_t complete:1; /*!< bit: 31 completion status */
  224. } b; /*!< Structure used for bit access */
  225. uint32_t w; /*!< Type used for word access */
  226. } CC_CMD_Type;
  227. /**
  228. * \brief Union type to access CC_ERR_INJ register.
  229. */
  230. typedef union
  231. {
  232. struct {
  233. __IOM uint32_t inj_data:1; /*!< bit: 0 ECC error injection to data ram */
  234. __IOM uint32_t inj_tag:1; /*!< bit: 1 ECC error injection to tag ram */
  235. __IOM uint32_t inj_clm:1; /*!< bit: 2 ECC error injection to clm ram */
  236. __IOM uint32_t inj_mode:1; /*!< bit: 3 ECC error injection mode: 0-direct write mode, 1-xor write mode */
  237. __IM uint32_t _reserved0:20; /*!< bit: 4..23 reserved */
  238. /** \brief 24..32 ECC code for injection
  239. * \details Write to this bit field may use `sb` instruction (write only one byte),
  240. * which is not allowed for SMPCC registers. So this bit field is read-only here,
  241. * but actually it can be written. To write this bit field, you should write the
  242. * whole 32-bit register */
  243. __IM uint32_t inj_ecc_code:8;
  244. } b; /*!< Structure used for bit access */
  245. uint32_t w; /*!< Type used for word access */
  246. } CC_ERR_INJ_Type;
  247. #define SMPCC_ERR_INJ_INJDATA_Pos 0U /*!< SMPCC CC_ERR_INJ INJDATA Position */
  248. #define SMPCC_ERR_INJ_INJDATA_Msk (0x1UL << SMPCC_ERR_INJ_INJDATA_Pos) /*!< SMPCC CC_ERR_INJ INJDATA Mask */
  249. #define SMPCC_ERR_INJ_INJDATA_ENABLE 1U /*!< SMPCC CC_ERR_INJ INJDATA Enable */
  250. #define SMPCC_ERR_INJ_INJDATA_DISABLE 0U /*!< SMPCC CC_ERR_INJ INJDATA Disable */
  251. #define SMPCC_ERR_INJ_INJTAG_Pos 1U /*!< SMPCC CC_ERR_INJ INJTAG Position */
  252. #define SMPCC_ERR_INJ_INJTAG_Msk (0x1UL << SMPCC_ERR_INJ_INJTAG_Pos) /*!< SMPCC CC_ERR_INJ INJTAG Mask */
  253. #define SMPCC_ERR_INJ_INJTAG_ENABLE 1U /*!< SMPCC CC_ERR_INJ INJTAG Enable */
  254. #define SMPCC_ERR_INJ_INJTAG_DISABLE 0U /*!< SMPCC CC_ERR_INJ INJTAG Disable */
  255. #define SMPCC_ERR_INJ_INJCLM_Pos 2U /*!< SMPCC CC_ERR_INJ INJCLM Position */
  256. #define SMPCC_ERR_INJ_INJCLM_Msk (0x1UL << SMPCC_ERR_INJ_INJCLM_Pos) /*!< SMPCC CC_ERR_INJ INJCLM Mask */
  257. #define SMPCC_ERR_INJ_INJCLM_ENABLE 1U /*!< SMPCC CC_ERR_INJ INJCLM Enable */
  258. #define SMPCC_ERR_INJ_INJCLM_DISABLE 0U /*!< SMPCC CC_ERR_INJ INJCLM Disable */
  259. #define SMPCC_ERR_INJ_INJMODE_Pos 3U /*!< SMPCC CC_ERR_INJ INJMODE Position */
  260. #define SMPCC_ERR_INJ_INJMODE_Msk (0x1UL << SMPCC_ERR_INJ_INJMODE_Pos) /*!< SMPCC CC_ERR_INJ INJMODE Mask */
  261. #define SMPCC_ERR_INJ_INJMODE_DIRECT 0U /*!< SMPCC CC_ERR_INJ INJMODE Direct write mode */
  262. #define SMPCC_ERR_INJ_INJMODE_XOR 1U /*!< SMPCC CC_ERR_INJ INJMODE XOR write mode */
  263. #define SMPCC_ERR_INJ_INJECCCODE_Pos 24U /*!< SMPCC CC_ERR_INJ INJECCCODE Position */
  264. #define SMPCC_ERR_INJ_INJECCCODE_Msk (0xFFUL << SMPCC_ERR_INJ_INJECCCODE_Pos) /*!< SMPCC CC_ERR_INJ INJECCCODE Mask */
  265. /**
  266. * \brief Union type to access CC_RECV_CNT register.
  267. */
  268. typedef union
  269. {
  270. struct {
  271. __IOM uint32_t cnt:16; /*!< bit: 0..15 count of the recoverable error */
  272. __IM uint32_t _reserved:16; /*!< bit: 16..31 reserved */
  273. } b; /*!< Structure used for bit access */
  274. uint32_t w; /*!< Type used for word access */
  275. } CC_RECV_CNT_Type;
  276. /**
  277. * \brief Union type to access CC_FATAL_CNT register.
  278. */
  279. typedef union
  280. {
  281. struct {
  282. __IOM uint32_t cnt:16; /*!< bit: 0..15 count of the fatal error */
  283. __IM uint32_t _reserved:16; /*!< bit: 16..31 reserved */
  284. } b; /*!< Structure used for bit access */
  285. uint32_t w; /*!< Type used for word access */
  286. } CC_FATAL_CNT_Type;
  287. /**
  288. * \brief Union type to access CC_RECV_THV register.
  289. */
  290. typedef union
  291. {
  292. struct {
  293. __IOM uint32_t cnt:16; /*!< bit: 0..15 count of the recoverable error threshold value */
  294. __IM uint32_t _reserved:16; /*!< bit: 16..31 reserved */
  295. } b; /*!< Structure used for bit access */
  296. uint32_t w; /*!< Type used for word access */
  297. } CC_RECV_THV_Type;
  298. /**
  299. * \brief Union type to access CC_FATAL_THV register.
  300. */
  301. typedef union
  302. {
  303. struct {
  304. __IOM uint32_t cnt:16; /*!< bit: 0..15 count of the fatal error threshold value */
  305. __IM uint32_t _reserved:16; /*!< bit: 16..31 reserved */
  306. } b; /*!< Structure used for bit access */
  307. uint32_t w; /*!< Type used for word access */
  308. } CC_FATAL_THV_Type;
  309. /**
  310. * \brief Type to access CC_BUS_ERR_ADDR register.
  311. */
  312. typedef __IO uint64_t CC_BUS_ERR_ADDR_Type;
  313. /**
  314. * \brief Union type to access CLIENT_ERR_STATUS register.
  315. */
  316. typedef union
  317. {
  318. struct {
  319. __IOM uint32_t read_bus_err:1; /*!< bit: 0 read bus error */
  320. __IOM uint32_t write_bus_err:1; /*!< bit: 1 write bus error */
  321. __IOM uint32_t cc_scu_ecc_err:1; /*!< bit: 2 cc scu ecc error */
  322. __IOM uint32_t iocp_bus_err:1; /*!< bit: 3 iocp bus error */
  323. __IM uint32_t _reserved:28; /*!< bit: 4..31 reserved */
  324. } b; /*!< Structure used for bit access */
  325. uint32_t w; /*!< Type used for word access */
  326. } CLIENT_ERR_STATUS_Type;
  327. #define SMPCC_CLIERRSTS_READ_BUS_ERR_Pos 0U /*!< SMPCC CLIENT ERROR STATUS READ_BUS_ERR Position */
  328. #define SMPCC_CLIERRSTS_READ_BUS_ERR_Msk (0x1UL << SMPCC_CLIERRSTS_READ_BUS_ERR_Pos) /*!< SMPCC CLIENT ERROR STATUS READ_BUS_ERR Mask */
  329. #define SMPCC_CLIERRSTS_WRITE_BUS_ERR_Pos 1U /*!< SMPCC CLIENT ERROR STATUS WRITE_BUS_ERR Position */
  330. #define SMPCC_CLIERRSTS_WRITE_BUS_ERR_Msk (0x1UL << SMPCC_CLIERRSTS_WRITE_BUS_ERR_Pos) /*!< SMPCC CLIENT ERROR STATUS WRITE_BUS_ERR Mask */
  331. #define SMPCC_CLIERRSTS_CC_SCU_ECC_ERR_Pos 2U /*!< SMPCC CLIENT ERROR STATUS CC_SCU_ECC_ERR Position */
  332. #define SMPCC_CLIERRSTS_CC_SCU_ECC_ERR_Msk (0x1UL << SMPCC_CLIERRSTS_CC_SCU_ECC_ERR_Pos) /*!< SMPCC CLIENT ERROR STATUS CC_SCU_ECC_ERR Mask */
  333. #define SMPCC_CLIERRSTS_IOCP_BUS_ERR_Pos 3U /*!< SMPCC CLIENT ERROR STATUS IOCP_BUS_ERR Position */
  334. #define SMPCC_CLIERRSTS_IOCP_BUS_ERR_Msk (0x1UL << SMPCC_CLIERRSTS_IOCP_BUS_ERR_Pos) /*!< SMPCC CLIENT ERROR STATUS IOCP_BUS_ERR Mask */
  335. /**
  336. * \brief Union type to access SNOOP_PENDING register.
  337. */
  338. typedef union
  339. {
  340. struct {
  341. __IM uint32_t snoop_pending:16; /*!< bit: 0..15 snoop pending bit for each client */
  342. __IM uint32_t _reserved:16; /*!< bit: 16..31 reserved */
  343. } b; /*!< Structure used for bit access */
  344. __IM uint32_t w; /*!< Type used for word access */
  345. } SNOOP_PENDING_Type;
  346. /**
  347. * \brief Union type to access TRANS_PENDING register.
  348. */
  349. typedef union
  350. {
  351. struct {
  352. __IM uint32_t trans_pending:16; /*!< bit: 0..15 transaction pending bit for each client */
  353. __IM uint32_t _reserved:15; /*!< bit: 16..30 reserved */
  354. __IM uint32_t ext_trans:1; /*!< bit: 31 external memory bus transaction pending */
  355. } b; /*!< Structure used for bit access */
  356. __IM uint32_t w; /*!< Type used for word access */
  357. } TRANS_PENDING_Type;
  358. /**
  359. * \brief Union type to access CLM_ADDR_BASE register.
  360. */
  361. typedef union
  362. {
  363. struct {
  364. __IOM uint32_t clm_base32;
  365. __IM uint32_t _reserved;
  366. } clm32; /*!< Structure used access only low 32-bits */
  367. uint64_t clm_base64; /*!< Type used access whole 64-bits */
  368. } CLM_ADDR_BASE_Type;
  369. /**
  370. * \brief Union type to access CLM_WAY_EN register.
  371. */
  372. typedef union
  373. {
  374. struct {
  375. __IOM uint32_t ena:16; /*!< bit: 0..15 This way is used as CLM or not */
  376. __IM uint32_t _reserved:16; /*!< bit: 16..31 reserved */
  377. } b; /*!< Structure used for bit access */
  378. uint32_t w; /*!< Type used for word access */
  379. } CLM_WAY_EN_Type;
  380. /**
  381. * \brief Union type to access CC_INVALID_ALL register.
  382. */
  383. typedef union
  384. {
  385. struct {
  386. __IOM uint32_t cs:1; /*!< bit: 0 write 1 to invalid all cluster cache, and hardware auto clean when operation is done */
  387. __IM uint32_t _reserved:31; /*!< bit: 1..31 reserved */
  388. } b; /*!< Structure used for bit access */
  389. uint32_t w; /*!< Type used for word access */
  390. } CC_INVALID_ALL_Type;
  391. /**
  392. * \brief Union type to access STM_CTRL register.
  393. */
  394. typedef union
  395. {
  396. struct {
  397. __IOM uint32_t rd_stm_en:1; /*!< bit: 0 read stream enable */
  398. __IOM uint32_t wr_stm_en:1; /*!< bit: 1 write stream enable */
  399. __IOM uint32_t trans_alloc:1; /*!< bit: 2 translate allocate attribute to non-alloc attribute enable */
  400. __IOM uint32_t rd_merge_en:1; /*!< bit: 3 non-cacheable attribute read merge enable */
  401. __IOM uint32_t cross_en:1; /*!< bit: 4 read stream cross 4k enable */
  402. __IM uint32_t _reserved:27; /*!< bit: 5..31 reserved */
  403. } b; /*!< Structure used for bit access */
  404. uint32_t w; /*!< Type used for word access */
  405. } STM_CTRL_Type;
  406. #define SMPCC_STMCTRL_RD_STM_EN_Pos 0U /*!< SMPCC READ Stream Enable Position */
  407. #define SMPCC_STMCTRL_RD_STM_EN_Msk (0x1UL << SMPCC_STMCTRL_RD_STM_EN_Pos) /*!< SMPCC READ Stream Enable Mask */
  408. #define SMPCC_STMCTRL_RD_STM_EN_ENABLE 1U /*!< SMPCC READ Stream Enable Enable */
  409. #define SMPCC_STMCTRL_RD_STM_EN_DISABLE 0U /*!< SMPCC READ Stream Enable Disable */
  410. #define SMPCC_STMCTRL_WR_STM_EN_Pos 1U /*!< SMPCC WRITE Stream Enable Position */
  411. #define SMPCC_STMCTRL_WR_STM_EN_Msk (0x1UL << SMPCC_STMCTRL_WR_STM_EN_Pos) /*!< SMPCC WRITE Stream Enable Mask */
  412. #define SMPCC_STMCTRL_WR_STM_EN_ENABLE 1U /*!< SMPCC WRITE Stream Enable Enable */
  413. #define SMPCC_STMCTRL_WR_STM_EN_DISABLE 0U /*!< SMPCC WRITE Stream Enable Disable */
  414. #define SMPCC_STMCTRL_TRANS_ALLOC_Pos 2U /*!< SMPCC TRANSLATE ALLOC ATTRIBUTE Enable Position */
  415. #define SMPCC_STMCTRL_TRANS_ALLOC_Msk (0x1UL << SMPCC_STMCTRL_TRANS_ALLOC_Pos) /*!< SMPCC TRANSLATE ALLOC ATTRIBUTE Enable Mask */
  416. #define SMPCC_STMCTRL_TRANS_ALLOC_ENABLE 1U /*!< SMPCC TRANSLATE ALLOC ATTRIBUTE Enable */
  417. #define SMPCC_STMCTRL_TRANS_ALLOC_DISABLE 0U /*!< SMPCC TRANSLATE ALLOC ATTRIBUTE Disable */
  418. #define SMPCC_STMCTRL_RD_MERGE_EN_Pos 3U /*!< SMPCC READ Merge Enable Position */
  419. #define SMPCC_STMCTRL_RD_MERGE_EN_Msk (0x1UL << SMPCC_STMCTRL_RD_MERGE_EN_Pos) /*!< SMPCC READ Merge Enable Mask */
  420. #define SMPCC_STMCTRL_RD_MERGE_EN_ENABLE 1U /*!< SMPCC READ Merge Enable Enable */
  421. #define SMPCC_STMCTRL_RD_MERGE_EN_DISABLE 0U /*!< SMPCC READ Merge Enable Disable */
  422. #define SMPCC_STMCTRL_CROSS_EN_Pos 4U /*!< SMPCC READ STREAM CROSS 4K Enable Position */
  423. #define SMPCC_STMCTRL_CROSS_EN_Msk (0x1UL << SMPCC_STMCTRL_CROSS_EN_Pos) /*!< SMPCC READ STREAM CROSS 4K Enable Mask */
  424. #define SMPCC_STMCTRL_CROSS_EN_ENABLE 1U /*!< SMPCC READ STREAM CROSS 4K Enable */
  425. #define SMPCC_STMCTRL_CROSS_EN_DISABLE 0U /*!< SMPCC READ STREAM CROSS 4K Disable */
  426. /**
  427. * \brief Union type to access STM_CFG register.
  428. */
  429. typedef union
  430. {
  431. struct {
  432. __IOM uint32_t rd_byte_threshold:10; /*!< bit: 0..9 the prefetch number for read stream */
  433. __IM uint32_t _reserved0:2; /*!< bit: 10..11 reserved */
  434. __IOM uint32_t rd_degree:3; /*!< bit: 12..14 the delta between prefetch address and current bus address */
  435. __IM uint32_t _reserved1:1; /*!< bit: 15 reserved */
  436. __IOM uint32_t rd_distance:3; /*!< bit: 16..18 the threshold bytes matching write stream training successfully */
  437. __IM uint32_t _reserved2:1; /*!< bit: 19 reserved */
  438. __IOM uint32_t wr_byte_threshold:10; /*!< bit: 20..29 the line buffer timeout free time when no same cacheline transactions */
  439. __IM uint32_t _reserved3:2; /*!< bit: 30..31 reserved */
  440. } b; /*!< Structure used for bit access */
  441. uint32_t w; /*!< Type used for word access */
  442. } STM_CFG_Type;
  443. #define SMPCC_STMCFG_RD_BYTE_THRE_Pos 0U /*!< SMPCC READ BYTE THRESHOLD Position */
  444. #define SMPCC_STMCFG_RD_BYTE_THRE_Msk (0x3FFUL << SMPCC_STMCFG_RD_BYTE_THRE_Pos) /*!< SMPCC READ BYTE THRESHOLD Mask */
  445. #define SMPCC_STMCFG_RD_DEGREE_Pos 12U /*!< SMPCC READ DEGREE Position */
  446. #define SMPCC_STMCFG_RD_DEGREE_Msk (0x7UL << SMPCC_STMCFG_RD_DEGREE_Pos) /*!< SMPCC READ DEGREE Mask */
  447. #define SMPCC_STMCFG_RD_DISTANCE_Pos 16U /*!< SMPCC READ DISTANCE Position */
  448. #define SMPCC_STMCFG_RD_DISTANCE_Msk (0x7UL << SMPCC_STMCFG_RD_DISTANCE_Pos) /*!< SMPCC READ DISTANCE Mask */
  449. #define SMPCC_STMCFG_WR_BYTE_THRE_Pos 20U /*!< SMPCC WRITE BYTE THRESHOLD Position */
  450. #define SMPCC_STMCFG_WR_BYTE_THRE_Msk (0x7FFUL << SMPCC_STMCFG_WR_BYTE_THRE_Pos) /*!< SMPCC WRITE BYTE THRESHOLD Mask */
  451. /**
  452. * \brief Union type to access STM_TIMEOUT register.
  453. */
  454. typedef union
  455. {
  456. struct {
  457. __IOM uint32_t timeout:11; /*!< bit: 0..10 write streaming wait clk num */
  458. __IM uint32_t _reserved:21; /*!< bit: 11..31 reserved */
  459. } b; /*!< Structure used for bit access */
  460. uint32_t w; /*!< Type used for word access */
  461. } STM_TIMEOUT_Type;
  462. /**
  463. * \brief Union type to access DFF_PROT register.
  464. */
  465. typedef union
  466. {
  467. struct {
  468. __IOM uint32_t chk_en:2; /*!< bit: 0..1 register protect check enable. 2'b01: disable; 2'b10: enable */
  469. __IM uint32_t _reserved:30; /*!< bit: 2..31 reserved */
  470. } b; /*!< Structure used for bit access */
  471. uint32_t w; /*!< Type used for word access */
  472. } DFF_PROT_Type;
  473. #define SMPCC_DFF_PROT_CHK_EN_Pos 0U /*!< SMPCC DFF PROTECT CHECK ENABLE Position */
  474. #define SMPCC_DFF_PROT_CHK_EN_Msk (0x3UL << SMPCC_DFF_PROT_CHK_EN_Pos) /*!< SMPCC DFF PROTECT CHECK ENABLE Mask */
  475. #define SMPCC_DFF_PROT_CHK_EN_ENABLE 2U /*!< SMPCC DFF PROTECT CHECK ENABLE ENABLE */
  476. #define SMPCC_DFF_PROT_CHK_EN_DISABLE 1U /*!< SMPCC DFF PROTECT CHECK ENABLE DISABLE */
  477. /**
  478. * \brief Union type to access ECC_ERR_MSK register.
  479. */
  480. typedef union
  481. {
  482. struct {
  483. __IOM uint32_t cc_l2_err_msk:1; /*!< bit: 0 mask L2 double bit error output */
  484. __IOM uint32_t cc_core_err_mask:1; /*!< bit: 1 mask core double bit error output */
  485. __IM uint32_t _reserved:29; /*!< bit: 2..31 reserved */
  486. } b; /*!< Structure used for bit access */
  487. uint32_t w; /*!< Type used for word access */
  488. } ECC_ERR_MSK_Type;
  489. /**
  490. * \brief Union type to access NS_RG register.
  491. */
  492. typedef union
  493. {
  494. struct {
  495. __IOM uint64_t cfg:2; /*!< bit: 0..1 0x00: disable region; 0x10:NACL; 0x11: NAPOT */
  496. __IOM uint64_t addr_hi:62; /*!< bit: 2..63 address of the region */
  497. } b; /*!< Structure used for bit access */
  498. __IOM uint64_t dw; /*!< Type used for double word access */
  499. } NS_RG_Type;
  500. #define SMPCC_NS_RG_CFG_Pos 0U /*!< SMPCC Non-Shareable Region CFG Position */
  501. #define SMPCC_NS_RG_CFG_Msk (0x3UL << SMPCC_NS_RG_CFG_Pos) /*!< SMPCC Non-Shareable Region CFG Mask */
  502. #define SMPCC_NS_RG_CFG_DISABLE 0x00U /*!< SMPCC Non-Shareable Region CFG DISABLE */
  503. #define SMPCC_NS_RG_CFG_NACL 0x10U /*!< SMPCC Non-Shareable Region CFG NACL */
  504. #define SMPCC_NS_RG_CFG_NAPOT 0x11U /*!< SMPCC Non-Shareable Region CFG NAPOT */
  505. /**
  506. * \brief Union type to access SMP_PMON_SEL register.
  507. */
  508. typedef union
  509. {
  510. struct {
  511. __IOM uint32_t event_sel:16; /*!< bit: 0..15 select the event for this performance monitor counter */
  512. __IOM uint32_t client_sel:5; /*!< bit: 16..20 specify the core in the cluster or external master number hooked to I/O coherency port */
  513. __IM uint32_t _reserved:11; /*!< bit: 21..31 reserved */
  514. } b; /*!< Structure used for bit access */
  515. uint32_t w; /*!< Type used for word access */
  516. } SMP_PMON_SEL_Type;
  517. #define SMPCC_PMON_EVENT_SEL_Pos 0U /*!< SMPCC PMON EVENT SEL Position */
  518. #define SMPCC_PMON_EVENT_SEL_Msk (0xFFFFUL << SMPCC_PMON_EVENT_SEL_Pos) /*!< SMPCC PMON EVENT SEL Mask */
  519. #define SMPCC_PMON_EVENT_DISABLE 0U /*!< SMPCC PMON EVENT DISABLE */
  520. #define SMPCC_PMON_EVENT_DATA_READ_COUNT 1U /*!< SMPCC PMON EVENT DATA READ COUNT */
  521. #define SMPCC_PMON_EVENT_DATA_WRITE_COUNT 2U /*!< SMPCC PMON EVENT DATA WRITE COUNT SABLE */
  522. #define SMPCC_PMON_EVENT_INSTR_READ_COUNT 3U /*!< SMPCC PMON EVENT INSTR READ COUNT */
  523. #define SMPCC_PMON_EVENT_DATA_READ_HIT_COUNT 4U /*!< SMPCC PMON EVENT DATA READ HIT COUNT */
  524. #define SMPCC_PMON_EVENT_DATA_WRITE_REPLACE_COUNT 5U /*!< SMPCC PMON EVENT DATA WRITE REPLACE COUNT */
  525. #define SMPCC_PMON_EVENT_DATA_READ_REPLACE_COUNT 6U /*!< SMPCC PMON EVENT DATA READ REPLACE COUNT */
  526. #define SMPCC_PMON_EVENT_DATA_READ_MISS_COUNT 7U /*!< SMPCC PMON EVENT DATA READ MISS COUNT */
  527. #define SMPCC_PMON_EVENT_INSTR_READ_HIT_COUNT 8U /*!< SMPCC PMON EVENT INSTR READ HIT COUNT */
  528. #define SMPCC_PMON_EVENT_INSTR_READ_MISS_COUNT 9U /*!< SMPCC PMON EVENT INSTR READ MISS COUNT */
  529. #define SMPCC_PMON_EVENT_INSTR_READ_REPLACE_COUNT 10U /*!< SMPCC PMON EVENT INSTR READ REPLACE COUNT */
  530. #define SMPCC_PMON_CLIENT_SEL_Pos 16U /*!< SMPCC PMON CLIENT SEL Position */
  531. #define SMPCC_PMON_CLIENT_SEL_Msk (0x1FUL << SMPCC_PMON_CLIENT_SEL_Pos) /*!< SMPCC PMON CLIENT SEL Mask */
  532. #define SMPCC_PMON_EVENT(event, client) \
  533. (_VAL2FLD(SMPCC_PMON_EVENT_SEL, event) | \
  534. _VAL2FLD(SMPCC_PMON_CLIENT_SEL, client))
  535. /**
  536. * \brief Type to access SMP_PMON_CNT register.
  537. */
  538. typedef __IO uint64_t SMP_PMON_CNT_Type;
  539. /**
  540. * \brief Type to access CLIENT_ERR_ADDR register.
  541. */
  542. typedef __IO uint64_t CLIENT_ERR_ADDR_Type;
  543. /**
  544. * \brief Union type to access CLIENT_WAY_MASK register.
  545. */
  546. typedef union
  547. {
  548. struct {
  549. __IOM uint32_t mask:16; /*!< bit: 0..15 mask this way for the client */
  550. __IM uint32_t _reserved:16; /*!< bit: 16..31 reserved */
  551. } b; /*!< Structure used for bit access */
  552. uint32_t w; /*!< Type used for word access */
  553. } CLIENT_WAY_MASK_Type;
  554. /**
  555. * \brief Access to the structure of SMPCC Memory Map
  556. * \remarks Write to these memory-mapped registers should write with full register width.
  557. */
  558. #pragma pack(4)
  559. typedef struct {
  560. const SMP_VER_Type SMP_VER; /*!< Offset: 0x000 (R) SMP version register */
  561. __IM SMP_CFG_Type SMP_CFG; /*!< Offset: 0x004 (R) SMP Configuration register */
  562. __IM CC_CFG_Type CC_CFG; /*!< Offset: 0x008 (R) CC config register */
  563. __IOM SMP_ENB_Type SMP_ENB; /*!< Offset: 0x00C (R/W) SMP enable register */
  564. __IOM CC_CTRL_Type CC_CTRL; /*!< Offset: 0x010 (R/W) CC control register */
  565. __IOM CC_CMD_Type CC_mCMD; /*!< Offset: 0x014 (R/W) machine mode CC command and status register */
  566. __IOM CC_ERR_INJ_Type CC_ERR_INJ; /*!< Offset: 0x018 (R/W) CC ECC error injection control register */
  567. __IOM CC_RECV_CNT_Type CC_RECV_CNT; /*!< Offset: 0x01C (R/W) CC ECC recoverable error count register */
  568. __IOM CC_FATAL_CNT_Type CC_FATAL_CNT; /*!< Offset: 0x020 (R/W) CC ECC fatal error count register */
  569. __IOM CC_RECV_THV_Type CC_RECV_THV; /*!< Offset: 0x024 (R/W) CC ECC recoverable error threshold register */
  570. __IOM CC_FATAL_THV_Type CC_FATAL_THV; /*!< Offset: 0x028 (R/W) CC ECC fatal error threshold register */
  571. __IOM CC_BUS_ERR_ADDR_Type CC_BUS_ERR_ADDR; /*!< Offset: 0x02C (R/W) CC bus error address register */
  572. __IM uint8_t RESERVED0[12]; /*!< 0x034~0x03F reserved */
  573. __IOM CLIENT_ERR_STATUS_Type CLIENT_ERR_STATUS[32]; /*!< Offset: 0x040 (R/W) client error status register */
  574. __IOM CC_CMD_Type CC_sCMD; /*!< Offset: 0x0C0 (R/W) supervisor mode CC command and status register */
  575. __IOM CC_CMD_Type CC_uCMD; /*!< Offset: 0x0C4 (R/W) user mode CC command and status register */
  576. __IM SNOOP_PENDING_Type SNOOP_PENDING; /*!< Offset: 0x0C8 (R) indicate the core is being snooped or not in SCU */
  577. __IM TRANS_PENDING_Type TRANS_PENDING; /*!< Offset: 0x0CC (R) indicate the core's transaction is finished or not in the SCU */
  578. __IOM CLM_ADDR_BASE_Type CLM_ADDR_BASE; /*!< Offset: 0x0D0 (R/W) Cluster Local Memory base address */
  579. __IOM uint32_t CLM_WAY_EN; /*!< Offset: 0x0D8 (R/W) CC way enable register */
  580. __IOM CC_INVALID_ALL_Type CC_INVALID_ALL; /*!< Offset: 0x0DC (R/W) CC invalidate all register */
  581. __IOM STM_CTRL_Type STM_CTRL; /*!< Offset: 0x0E0 (R/W) Stream read/write control register */
  582. __IOM STM_CFG_Type STM_CFG; /*!< Offset: 0x0E4 (R/W) Stream read/write configuration register */
  583. __IOM STM_TIMEOUT_Type STM_TIMEOUT; /*!< Offset: 0x0E8 (R/W) Stream read/write timeout register */
  584. __IOM DFF_PROT_Type DFF_PROT; /*!< Offset: 0x0EC (R/W) Hardware Register protect Enable register */
  585. __IOM ECC_ERR_MSK_Type ECC_ERR_MSK; /*!< Offset: 0x0F0 (R/W) Mask L2M ECC Error register */
  586. __IM uint8_t RESERVED1[12]; /*!< 0x0F4~0x0FF reserved */
  587. __IOM NS_RG_Type NS_RG[16]; /*!< Offset: 0x100 (R/W) Non-Sharable Memory Region register */
  588. __IOM SMP_PMON_SEL_Type SMP_PMON_SEL[16]; /*!< Offset: 0x180 (R/W) Performance Monitor Event Selector */
  589. __IOM SMP_PMON_CNT_Type SMP_PMON_CNT[16]; /*!< Offset: 0x1C0 (R/W) Performance Monitor Event Counter */
  590. __IM uint8_t RESERVED2[64]; /*!< 0x240~0x27F reserved */
  591. __IOM CLIENT_ERR_ADDR_Type CLIENT_ERR_ADDR[32]; /*!< Offset: 0x280 (R/W) The error address register */
  592. __IOM CLIENT_WAY_MASK_Type CLIENT_WAY_MASK[32]; /*!< Offset: 0x380 (R/W) CC way mask control register */
  593. } SMPCC_Type;
  594. #pragma pack()
  595. #ifndef __SMPCC_BASEADDR
  596. /* Base address of SMPCC(__SMPCC_BASEADDR) should be defined in <Device.h> */
  597. #error "__SMPCC_BASEADDR is not defined, please check!"
  598. #endif
  599. /* SMPCC Memory mapping of Device */
  600. #define SMPCC_BASE __SMPCC_BASEADDR /*!< SMPCC Base Address */
  601. #define SMPCC ((SMPCC_Type *)SMPCC_BASE) /*!< SMPCC configuration struct */
  602. /** @} */ /* end of group NMSIS_Core_SMPCC_Registers */
  603. /**
  604. * \defgroup NMSIS_Core_SMPCC_Functions SMPCC Functions
  605. * \ingroup NMSIS_Core
  606. * \brief SMPCC related functions
  607. *
  608. * @{
  609. */
  610. /**
  611. * \brief Get the SMP version number
  612. * \details
  613. * This function gets the hardware version information from SMP_VER register.
  614. * \return hardware version number in SMP_VER register.
  615. */
  616. __STATIC_FORCEINLINE SMP_VER_Type SMPCC_GetVersion(void)
  617. {
  618. return SMPCC->SMP_VER;
  619. }
  620. /**
  621. * \brief Check if cluster cache is present
  622. * \details
  623. * This function checks if the cluster cache is present in the system.
  624. * \return 1 if cluster cache is present, 0 otherwise
  625. */
  626. __STATIC_FORCEINLINE uint8_t SMPCC_IsCCachePresent(void)
  627. {
  628. return SMPCC->SMP_CFG.b.cc_present;
  629. }
  630. /**
  631. * \brief Get the number of cores in the cluster
  632. * \details
  633. * This function returns the number of cores in the SMP cluster.
  634. * \return Number of cores in the cluster
  635. */
  636. __STATIC_FORCEINLINE uint8_t SMPCC_GetCoreNum(void)
  637. {
  638. return SMPCC->SMP_CFG.b.smp_core_num + 1;
  639. }
  640. /**
  641. * \brief Get the number of IO coherency ports
  642. * \details
  643. * This function returns the number of IO coherency ports in the cluster.
  644. * \return Number of IO coherency ports
  645. */
  646. __STATIC_FORCEINLINE uint8_t SMPCC_GetIOCPNum(void)
  647. {
  648. return SMPCC->SMP_CFG.b.iocp_num;
  649. }
  650. /**
  651. * \brief Get the number of performance monitors
  652. * \details
  653. * This function returns the number of performance monitors in the cluster.
  654. * \return Number of performance monitors
  655. */
  656. __STATIC_FORCEINLINE uint8_t SMPCC_GetPMONNum(void)
  657. {
  658. return SMPCC->SMP_CFG.b.pmon_num;
  659. }
  660. /**
  661. * \brief Get the number of cache sets
  662. * \details
  663. * This function returns the number of cache sets in the cluster cache (2^cc_set).
  664. * \return Number of cache sets
  665. */
  666. __STATIC_FORCEINLINE uint32_t SMPCC_GetCCacheSetNum(void)
  667. {
  668. return 1U << SMPCC->CC_CFG.b.cc_set;
  669. }
  670. /**
  671. * \brief Get the number of cache ways
  672. * \details
  673. * This function returns the number of cache ways in the cluster cache (cc_way + 1).
  674. * \return Number of cache ways
  675. */
  676. __STATIC_FORCEINLINE uint32_t SMPCC_GetCCacheWayNum(void)
  677. {
  678. return SMPCC->CC_CFG.b.cc_way + 1;
  679. }
  680. /**
  681. * \brief Get the cache line size
  682. * \details
  683. * This function returns the cache line size in the cluster cache (2^(cc_lsize + 2)).
  684. * \return Cache line size in bytes
  685. */
  686. __STATIC_FORCEINLINE uint8_t SMPCC_GetCCacheLineSize(void)
  687. {
  688. return 1 << (SMPCC->CC_CFG.b.cc_lsize + 2);
  689. }
  690. /**
  691. * \brief Check if cluster cache supports ECC
  692. * \details
  693. * This function checks if the cluster cache supports ECC functionality.
  694. * \return 1 if ECC is supported, 0 otherwise
  695. */
  696. __STATIC_FORCEINLINE uint8_t SMPCC_IsCCacheSupportECC(void)
  697. {
  698. return SMPCC->CC_CFG.b.cc_ecc;
  699. }
  700. /**
  701. * \brief Enable snoop for specific clients
  702. * \details
  703. * This function enables snoop functionality for specified client mask.
  704. * \param [in] client_msk Client mask to enable snoop for
  705. * \sa
  706. * - \ref SMPCC_DisableSnoop
  707. */
  708. __STATIC_FORCEINLINE void SMPCC_EnableSnoop(uint16_t client_msk)
  709. {
  710. SMPCC->SMP_ENB.b.smp_enable |= client_msk;
  711. }
  712. /**
  713. * \brief Disable snoop for specific clients
  714. * \details
  715. * This function disables snoop functionality for specified client mask.
  716. * \param [in] client_msk Client mask to disable snoop for
  717. * \sa
  718. * - \ref SMPCC_EnableSnoop
  719. */
  720. __STATIC_FORCEINLINE void SMPCC_DisableSnoop(uint16_t client_msk)
  721. {
  722. SMPCC->SMP_ENB.b.smp_enable &= ~client_msk;
  723. }
  724. /**
  725. * \brief Enable cluster cache
  726. * \details
  727. * This function enables the cluster cache.
  728. * \sa
  729. * - \ref SMPCC_DisableCCache
  730. */
  731. __STATIC_FORCEINLINE void SMPCC_EnableCCache(void)
  732. {
  733. SMPCC->CC_CTRL.b.cc_en = SMPCC_CTRL_CC_EN_ENABLE;
  734. }
  735. /**
  736. * \brief Disable cluster cache
  737. * \details
  738. * This function disables the cluster cache.
  739. * \sa
  740. * - \ref SMPCC_EnableCCache
  741. */
  742. __STATIC_FORCEINLINE void SMPCC_DisableCCache(void)
  743. {
  744. SMPCC->CC_CTRL.b.cc_en = SMPCC_CTRL_CC_EN_DISABLE;
  745. }
  746. /**
  747. * \brief Get status of cluster cache
  748. * \details
  749. * This function returns the enable status of the cluster cache.
  750. * \return Return the status of cluster cache (1 - enabled, 0 - disabled)
  751. * \sa
  752. * - \ref SMPCC_EnableCCache
  753. */
  754. __STATIC_FORCEINLINE int32_t SMPCC_IsCCacheEnabled(void)
  755. {
  756. return SMPCC->CC_CTRL.b.cc_en;
  757. }
  758. /**
  759. * \brief Check if any client is being snooped
  760. * \details
  761. * This function checks if any client specified in the mask is currently being snooped.
  762. * \param [in] client_msk Client mask to check
  763. * \return 1 if any client is being snooped, 0 otherwise
  764. */
  765. __STATIC_FORCEINLINE uint8_t SMPCC_IsAnySnoopPending(uint32_t client_msk)
  766. {
  767. return (SMPCC->SNOOP_PENDING.b.snoop_pending & client_msk) != 0;
  768. }
  769. /**
  770. * \brief Check if any transaction is pending for clients
  771. * \details
  772. * This function checks if any transaction is pending for clients specified in the mask.
  773. * \param [in] client_msk Client mask to check
  774. * \return 1 if any transaction is pending, 0 otherwise
  775. */
  776. __STATIC_FORCEINLINE uint8_t SMPCC_IsAnyTransactionPending(uint32_t client_msk)
  777. {
  778. return (SMPCC->TRANS_PENDING.b.trans_pending & client_msk) != 0;
  779. }
  780. /**
  781. * \brief Disable Cluster Local Memory
  782. * \details
  783. * This function disables the Cluster Local Memory functionality.
  784. * \sa
  785. * - \ref SMPCC_EnableCLM
  786. */
  787. __STATIC_FORCEINLINE void SMPCC_DisableCLM(void)
  788. {
  789. SMPCC->CC_CTRL.b.cc_en = SMPCC_CTRL_CC_EN_DISABLE;
  790. }
  791. /**
  792. * \brief Enable Cluster Local Memory
  793. * \details
  794. * This function enables the Cluster Local Memory functionality.
  795. * \sa
  796. * - \ref SMPCC_DisableCLM
  797. */
  798. __STATIC_FORCEINLINE void SMPCC_EnableCLM(void)
  799. {
  800. SMPCC->CC_CTRL.b.cc_en = SMPCC_CTRL_CC_EN_ENABLE;
  801. }
  802. /**
  803. * \brief Set Cluster Local Memory to use all ways
  804. * \details
  805. * This function configures the Cluster Local Memory to use all cache ways at the specified address.
  806. * \param [in] addr Base address for Cluster Local Memory.
  807. * \remarks
  808. * - Access to the \c CLM_ADDR_BASE register depends on the physical address (PA) size.
  809. * If the PA size is not larger than 32 bits, only the low 32 bits of the address can be accessed.
  810. * - Before changing the Cluster Cache to CLM mode, ensure that:
  811. * - The Cluster Cache is disabled,
  812. * - Its contents have been invalidated and flushed to memory.
  813. *
  814. * Example usage:
  815. * \code
  816. * SMPCC_DisableCCache();
  817. * MFlushInvalCCache();
  818. * SMPCC_SetCLMAllWays(addr);
  819. * SMPCC_EnableCLM();
  820. * \endcode
  821. *
  822. * \sa
  823. * - \ref SMPCC_SetCLMNWays
  824. * - \ref SMPCC_SetCLMNoWay
  825. */
  826. __STATIC_FORCEINLINE void SMPCC_SetCLMAllWays(uint64_t addr)
  827. {
  828. #if (__CPU_PA_SIZE > 32)
  829. SMPCC->CLM_ADDR_BASE.clm_base64 = addr;
  830. #else
  831. SMPCC->CLM_ADDR_BASE.clm32.clm_base32 = (uint32_t)addr;
  832. #endif
  833. SMPCC->CLM_WAY_EN = 0xFFFFU;
  834. }
  835. /**
  836. * \brief Set Cluster Local Memory to use specific ways
  837. * \details
  838. * This function configures the Cluster Local Memory to use specific cache ways at the specified address.
  839. * \param [in] addr Base address for Cluster Local Memory
  840. * \param [in] way_msk Way mask to configure
  841. * \remarks
  842. * - Access to the \c CLM_ADDR_BASE register depends on the physical address (PA) size.
  843. * If the PA size is not larger than 32 bits, only the low 32 bits of the address can be accessed.
  844. * - Before changing the Cluster Cache to CLM mode, ensure that:
  845. * - The Cluster Cache is disabled,
  846. * - Its contents have been invalidated and flushed to memory.
  847. *
  848. * Example usage:
  849. * \code
  850. * SMPCC_DisableCCache();
  851. * MFlushInvalCCache();
  852. * SMPCC_SetCLMNWays(addr, way_msk);
  853. * SMPCC_EnableCLM();
  854. * \endcode
  855. *
  856. * \sa
  857. * - \ref SMPCC_SetCLMAllWays
  858. * - \ref SMPCC_SetCLMNoWay
  859. */
  860. __STATIC_FORCEINLINE void SMPCC_SetCLMNWays(uint64_t addr, uint32_t way_msk)
  861. {
  862. #if (__CPU_PA_SIZE > 32)
  863. SMPCC->CLM_ADDR_BASE.clm_base64 = addr;
  864. #else
  865. SMPCC->CLM_ADDR_BASE.clm32.clm_base32 = (uint32_t)addr;
  866. #endif
  867. SMPCC->CLM_WAY_EN = way_msk;
  868. }
  869. /**
  870. * \brief Configure Cluster Local Memory to use no ways
  871. * \details
  872. * This function configures the Cluster Local Memory to not use any cache ways.
  873. * \sa
  874. * - \ref SMPCC_SetCLMAllWays
  875. * - \ref SMPCC_SetCLMNWays
  876. */
  877. __STATIC_FORCEINLINE void SMPCC_SetCLMNoWay(void)
  878. {
  879. SMPCC->CLM_WAY_EN = 0x0000U;
  880. }
  881. /**
  882. * \brief Set Cluster Cache Control register
  883. * \details
  884. * This function sets the value of the Cluster Cache Control register.
  885. * \param [in] val Value to set in the control register
  886. * \sa
  887. * - \ref SMPCC_GetCCacheControl
  888. */
  889. __STATIC_FORCEINLINE void SMPCC_SetCCacheControl(uint32_t val)
  890. {
  891. SMPCC->CC_CTRL.w = val;
  892. }
  893. /**
  894. * \brief Get Cluster Cache Control register value
  895. * \details
  896. * This function returns the current value of the Cluster Cache Control register.
  897. * \return Current value of the control register
  898. * \sa
  899. * - \ref SMPCC_SetCCacheControl
  900. */
  901. __STATIC_FORCEINLINE uint32_t SMPCC_GetCCacheControl(void)
  902. {
  903. return SMPCC->CC_CTRL.w;
  904. }
  905. /**
  906. * \brief Enable Cluster Cache ECC
  907. * \details
  908. * This function enables ECC functionality for the cluster cache.
  909. * \sa
  910. * - \ref SMPCC_DisableCCacheECC
  911. */
  912. __STATIC_FORCEINLINE void SMPCC_EnableCCacheECC(void)
  913. {
  914. SMPCC->CC_CTRL.b.cc_ecc_en = SMPCC_CTRL_CC_ECC_EN_ENABLE;
  915. }
  916. /**
  917. * \brief Disable Cluster Cache ECC
  918. * \details
  919. * This function disables ECC functionality for the cluster cache.
  920. * \sa
  921. * - \ref SMPCC_EnableCCacheECC
  922. */
  923. __STATIC_FORCEINLINE void SMPCC_DisableCCacheECC(void)
  924. {
  925. SMPCC->CC_CTRL.b.cc_ecc_en = SMPCC_CTRL_CC_ECC_EN_DISABLE;
  926. }
  927. /**
  928. * \brief Enable Cluster Cache ECC Exception
  929. * \details
  930. * This function enables ECC exception handling for the cluster cache.
  931. * \sa
  932. * - \ref SMPCC_DisableCCacheECCExcp
  933. */
  934. __STATIC_FORCEINLINE void SMPCC_EnableCCacheECCExcp(void)
  935. {
  936. SMPCC->CC_CTRL.b.ecc_excp_en = SMPCC_CTRL_CC_ECC_EXCP_EN_ENABLE;
  937. }
  938. /**
  939. * \brief Disable Cluster Cache ECC Exception
  940. * \details
  941. * This function disables ECC exception handling for the cluster cache.
  942. * \sa
  943. * - \ref SMPCC_EnableCCacheECCExcp
  944. */
  945. __STATIC_FORCEINLINE void SMPCC_DisableCCacheECCExcp(void)
  946. {
  947. SMPCC->CC_CTRL.b.ecc_excp_en = SMPCC_CTRL_CC_ECC_EXCP_EN_DISABLE;
  948. }
  949. /**
  950. * \brief Lock ECC Configuration
  951. * \details
  952. * This function locks the ECC configuration to prevent further changes.
  953. * \sa
  954. * - \ref SMPCC_LockECCErrInjection
  955. */
  956. __STATIC_FORCEINLINE void SMPCC_LockECCConfig(void)
  957. {
  958. SMPCC->CC_CTRL.b.lock_ecc_cfg = SMPCC_CTRL_LOCK_ECC_CFG_LOCK;
  959. }
  960. /**
  961. * \brief Lock ECC Error Injection Register
  962. * \details
  963. * This function locks the ECC error injection register to prevent further changes.
  964. * \sa
  965. * - \ref SMPCC_LockECCConfig
  966. */
  967. __STATIC_FORCEINLINE void SMPCC_LockECCErrInjection(void)
  968. {
  969. SMPCC->CC_CTRL.b.lock_ecc_err_inj = SMPCC_CTRL_LOCK_ECC_ERR_INJ_LOCK;
  970. }
  971. /**
  972. * \brief Enable Recoverable Error Interrupt
  973. * \details
  974. * This function enables interrupt generation when recoverable error count exceeds the threshold.
  975. * \sa
  976. * - \ref SMPCC_DisableRecvErrIrq
  977. */
  978. __STATIC_FORCEINLINE void SMPCC_EnableRecvErrIrq(void)
  979. {
  980. SMPCC->CC_CTRL.b.recv_err_irq_en = SMPCC_CTRL_RECV_ERR_IRQ_EN_ENABLE;
  981. }
  982. /**
  983. * \brief Disable Recoverable Error Interrupt
  984. * \details
  985. * This function disables interrupt generation when recoverable error count exceeds the threshold.
  986. * \sa
  987. * - \ref SMPCC_EnableRecvErrIrq
  988. */
  989. __STATIC_FORCEINLINE void SMPCC_DisableRecvErrIrq(void)
  990. {
  991. SMPCC->CC_CTRL.b.recv_err_irq_en = SMPCC_CTRL_RECV_ERR_IRQ_EN_DISABLE;
  992. }
  993. /**
  994. * \brief Enable Fatal Error Interrupt
  995. * \details
  996. * This function enables interrupt generation when fatal error count exceeds the threshold.
  997. * \sa
  998. * - \ref SMPCC_DisableFatalErrIrq
  999. */
  1000. __STATIC_FORCEINLINE void SMPCC_EnableFatalErrIrq(void)
  1001. {
  1002. SMPCC->CC_CTRL.b.fatal_err_irq_en = SMPCC_CTRL_FATAL_ERR_IRQ_EN_ENABLE;
  1003. }
  1004. /**
  1005. * \brief Disable Fatal Error Interrupt
  1006. * \details
  1007. * This function disables interrupt generation when fatal error count exceeds the threshold.
  1008. * \sa
  1009. * - \ref SMPCC_EnableFatalErrIrq
  1010. */
  1011. __STATIC_FORCEINLINE void SMPCC_DisableFatalErrIrq(void)
  1012. {
  1013. SMPCC->CC_CTRL.b.fatal_err_irq_en = SMPCC_CTRL_FATAL_ERR_IRQ_EN_DISABLE;
  1014. }
  1015. /**
  1016. * \brief Enable Bus Error Interrupt
  1017. * \details
  1018. * This function enables interrupt generation for bus errors in cluster cache maintenance operations.
  1019. * \sa
  1020. * - \ref SMPCC_DisableBusErrIrq
  1021. */
  1022. __STATIC_FORCEINLINE void SMPCC_EnableBusErrIrq(void)
  1023. {
  1024. SMPCC->CC_CTRL.b.bus_err_irq_en = SMPCC_CTRL_BUS_ERR_IRQ_EN_ENABLE;
  1025. }
  1026. /**
  1027. * \brief Disable Bus Error Interrupt
  1028. * \details
  1029. * This function disables interrupt generation for bus errors in cluster cache maintenance operations.
  1030. * \sa
  1031. * - \ref SMPCC_EnableBusErrIrq
  1032. */
  1033. __STATIC_FORCEINLINE void SMPCC_DisableBusErrIrq(void)
  1034. {
  1035. SMPCC->CC_CTRL.b.bus_err_irq_en = SMPCC_CTRL_BUS_ERR_IRQ_EN_DISABLE;
  1036. }
  1037. /**
  1038. * \brief Enable Supervisor Mode Commands
  1039. * \details
  1040. * This function enables supervisor mode to operate CC_sCMD and SMP_PMON_SEL registers.
  1041. * \sa
  1042. * - \ref SMPCC_DisableSModeCmd
  1043. */
  1044. __STATIC_FORCEINLINE void SMPCC_EnableSModeCmd(void)
  1045. {
  1046. SMPCC->CC_CTRL.b.sup_cmd_en = SMPCC_CTRL_SUP_CMD_EN_ENABLE;
  1047. }
  1048. /**
  1049. * \brief Disable Supervisor Mode Commands
  1050. * \details
  1051. * This function disables supervisor mode from operating CC_sCMD and SMP_PMON_SEL registers.
  1052. * \sa
  1053. * - \ref SMPCC_EnableSModeCmd
  1054. */
  1055. __STATIC_FORCEINLINE void SMPCC_DisableSModeCmd(void)
  1056. {
  1057. SMPCC->CC_CTRL.b.sup_cmd_en = SMPCC_CTRL_SUP_CMD_EN_DISABLE;
  1058. }
  1059. /**
  1060. * \brief Enable User Mode Commands
  1061. * \details
  1062. * This function enables user mode to operate CC_uCMD and SMP_PMON_SEL registers.
  1063. * \sa
  1064. * - \ref SMPCC_DisableUModeCmd
  1065. */
  1066. __STATIC_FORCEINLINE void SMPCC_EnableUModeCmd(void)
  1067. {
  1068. SMPCC->CC_CTRL.b.use_cmd_en = SMPCC_CTRL_USE_CMD_EN_ENABLE;
  1069. }
  1070. /**
  1071. * \brief Disable User Mode Commands
  1072. * \details
  1073. * This function disables user mode from operating CC_uCMD and SMP_PMON_SEL registers.
  1074. * \sa
  1075. * - \ref SMPCC_EnableUModeCmd
  1076. */
  1077. __STATIC_FORCEINLINE void SMPCC_DisableUModeCmd(void)
  1078. {
  1079. SMPCC->CC_CTRL.b.use_cmd_en = SMPCC_CTRL_USE_CMD_EN_DISABLE;
  1080. }
  1081. /**
  1082. * \brief Enable Cluster Cache ECC Check
  1083. * \details
  1084. * This function enables ECC check functionality for the cluster cache.
  1085. * \sa
  1086. * - \ref SMPCC_DisableCCacheECCCheck
  1087. */
  1088. __STATIC_FORCEINLINE void SMPCC_EnableCCacheECCCheck(void)
  1089. {
  1090. SMPCC->CC_CTRL.b.ecc_chk_en = SMPCC_CTRL_ECC_CHK_EN_ENABLE;
  1091. }
  1092. /**
  1093. * \brief Disable Cluster Cache ECC Check
  1094. * \details
  1095. * This function disables ECC check functionality for the cluster cache.
  1096. * \sa
  1097. * - \ref SMPCC_EnableCCacheECCCheck
  1098. */
  1099. __STATIC_FORCEINLINE void SMPCC_DisableCCacheECCCheck(void)
  1100. {
  1101. SMPCC->CC_CTRL.b.ecc_chk_en = SMPCC_CTRL_ECC_CHK_EN_DISABLE;
  1102. }
  1103. /**
  1104. * \brief Enable Cluster Local Memory ECC
  1105. * \details
  1106. * This function enables ECC functionality for the Cluster Local Memory.
  1107. * \sa
  1108. * - \ref SMPCC_DisableCLMECC
  1109. */
  1110. __STATIC_FORCEINLINE void SMPCC_EnableCLMECC(void)
  1111. {
  1112. SMPCC->CC_CTRL.b.clm_ecc_en = SMPCC_CTRL_CLM_ECC_EN_ENABLE;
  1113. }
  1114. /**
  1115. * \brief Disable Cluster Local Memory ECC
  1116. * \details
  1117. * This function disables ECC functionality for the Cluster Local Memory.
  1118. * \sa
  1119. * - \ref SMPCC_EnableCLMECC
  1120. */
  1121. __STATIC_FORCEINLINE void SMPCC_DisableCLMECC(void)
  1122. {
  1123. SMPCC->CC_CTRL.b.clm_ecc_en = SMPCC_CTRL_CLM_ECC_EN_DISABLE;
  1124. }
  1125. /**
  1126. * \brief Enable Cluster Local Memory ECC Check
  1127. * \details
  1128. * This function enables ECC check functionality for the Cluster Local Memory.
  1129. * \sa
  1130. * - \ref SMPCC_DisableCLMCCCheck
  1131. */
  1132. __STATIC_FORCEINLINE void SMPCC_EnableCLMECCCheck(void)
  1133. {
  1134. SMPCC->CC_CTRL.b.clm_ecc_chk_en = SMPCC_CTRL_CLM_ECC_CHK_EN_ENABLE;
  1135. }
  1136. /**
  1137. * \brief Disable Cluster Local Memory ECC Check
  1138. * \details
  1139. * This function disables ECC check functionality for the Cluster Local Memory.
  1140. * \sa
  1141. * - \ref SMPCC_EnableCLMECCCheck
  1142. */
  1143. __STATIC_FORCEINLINE void SMPCC_DisableCLMECCCheck(void)
  1144. {
  1145. SMPCC->CC_CTRL.b.clm_ecc_chk_en = SMPCC_CTRL_CLM_ECC_CHK_EN_DISABLE;
  1146. }
  1147. /**
  1148. * \brief Enable Cluster Local Memory ECC Exception
  1149. * \details
  1150. * This function enables ECC exception handling for the Cluster Local Memory.
  1151. * \sa
  1152. * - \ref SMPCC_DisableCLMECCExcp
  1153. */
  1154. __STATIC_FORCEINLINE void SMPCC_EnableCLMECCExcp(void)
  1155. {
  1156. SMPCC->CC_CTRL.b.clm_excp_en = SMPCC_CTRL_CLM_EXCP_EN_ENABLE;
  1157. }
  1158. /**
  1159. * \brief Disable Cluster Local Memory ECC Exception
  1160. * \details
  1161. * This function disables ECC exception handling for the Cluster Local Memory.
  1162. * \sa
  1163. * - \ref SMPCC_EnableCLMECCExcp
  1164. */
  1165. __STATIC_FORCEINLINE void SMPCC_DisableCLMECCExcp(void)
  1166. {
  1167. SMPCC->CC_CTRL.b.clm_excp_en = SMPCC_CTRL_CLM_EXCP_EN_DISABLE;
  1168. }
  1169. /**
  1170. * \brief Enable L1 Prefetch to Snoop and Share Cacheline
  1171. * \details
  1172. * This function enables L1 prefetch to snoop and share cacheline from other cores.
  1173. * \sa
  1174. * - \ref SMPCC_DisableL1PrefetchShareCacheline
  1175. */
  1176. __STATIC_FORCEINLINE void SMPCC_EnableL1PrefetchShareCacheline(void)
  1177. {
  1178. SMPCC->CC_CTRL.b.pf_sh_cl_en = SMPCC_CTRL_PF_SH_CL_EN_ENABLE;
  1179. }
  1180. /**
  1181. * \brief Disable L1 Prefetch to Snoop and Share Cacheline
  1182. * \details
  1183. * This function disables L1 prefetch to snoop and share cacheline from other cores.
  1184. * \sa
  1185. * - \ref SMPCC_EnableL1PrefetchShareCacheline
  1186. */
  1187. __STATIC_FORCEINLINE void SMPCC_DisableL1PrefetchShareCacheline(void)
  1188. {
  1189. SMPCC->CC_CTRL.b.pf_sh_cl_en = SMPCC_CTRL_PF_SH_CL_EN_DISABLE;
  1190. }
  1191. /**
  1192. * \brief Enable Cluster Cache Early Prefetch
  1193. * \details
  1194. * This function enables L2 prefetch to initialize external bus read access while looking up the cluster cache.
  1195. * \sa
  1196. * - \ref SMPCC_DisableCCacheEarlyPrefetch
  1197. */
  1198. __STATIC_FORCEINLINE void SMPCC_EnableCCacheEarlyPrefetch(void)
  1199. {
  1200. SMPCC->CC_CTRL.b.pf_l2_early_en = SMPCC_CTRL_PF_L2_EARLY_EN_ENABLE;
  1201. }
  1202. /**
  1203. * \brief Disable Cluster Cache Early Prefetch
  1204. * \details
  1205. * This function disables L2 prefetch to initialize external bus read access while looking up the cluster cache.
  1206. * \sa
  1207. * - \ref SMPCC_EnableCCacheEarlyPrefetch
  1208. */
  1209. __STATIC_FORCEINLINE void SMPCC_DisableCCacheEarlyPrefetch(void)
  1210. {
  1211. SMPCC->CC_CTRL.b.pf_l2_early_en = SMPCC_CTRL_PF_L2_EARLY_EN_DISABLE;
  1212. }
  1213. /**
  1214. * \brief Limit Cluster Cache Prefetch Outstanding Number
  1215. * \details
  1216. * This function enables the limit of outstanding L2 prefetch to the number of L2 prefetch line-buffer.
  1217. * \sa
  1218. * - \ref SMPCC_UnlimitCCachePrefetchOutsNum
  1219. */
  1220. __STATIC_FORCEINLINE void SMPCC_LimitCCachePrefetchOutsNum(void)
  1221. {
  1222. SMPCC->CC_CTRL.b.pf_biu_outs_en = SMPCC_CTRL_PF_BIU_OUTS_EN_ENABLE;
  1223. }
  1224. /**
  1225. * \brief Unlimit Cluster Cache Prefetch Outstanding Number
  1226. * \details
  1227. * This function disables the limit of outstanding L2 prefetch to the number of L2 prefetch line-buffer.
  1228. * \sa
  1229. * - \ref SMPCC_LimitCCachePrefetchOutsNum
  1230. */
  1231. __STATIC_FORCEINLINE void SMPCC_UnlimitCCachePrefetchOutsNum(void)
  1232. {
  1233. SMPCC->CC_CTRL.b.pf_biu_outs_en = SMPCC_CTRL_PF_BIU_OUTS_EN_DISABLE;
  1234. }
  1235. /**
  1236. * \brief Enable Cluster Cache Prefetch to Avoid Write Back
  1237. * \details
  1238. * This function enables L2 prefetch to abort and avoid dirty cacheline write back when filling the cluster cache.
  1239. * \sa
  1240. * - \ref SMPCC_DisableCCachePrefetchNoWb
  1241. */
  1242. __STATIC_FORCEINLINE void SMPCC_EnableCCachePrefetchNoWb(void)
  1243. {
  1244. SMPCC->CC_CTRL.b.pf_no_wb = SMPCC_CTRL_PF_NO_WB_ENABLE;
  1245. }
  1246. /**
  1247. * \brief Disable Cluster Cache Prefetch to Avoid Write Back
  1248. * \details
  1249. * This function disables L2 prefetch from aborting and avoiding dirty cacheline write back when filling the cluster cache.
  1250. * \sa
  1251. * - \ref SMPCC_EnableCCachePrefetchNoWb
  1252. */
  1253. __STATIC_FORCEINLINE void SMPCC_DisableCCachePrefetchNoWb(void)
  1254. {
  1255. SMPCC->CC_CTRL.b.pf_no_wb = SMPCC_CTRL_PF_NO_WB_DISABLE;
  1256. }
  1257. /**
  1258. * \brief Enable ICache to Snoop DCache
  1259. * \details
  1260. * This function enables snoop to dcache for icache refill reads.
  1261. * \sa
  1262. * - \ref SMPCC_DisableICacheSnoopDCache
  1263. */
  1264. __STATIC_FORCEINLINE void SMPCC_EnableICacheSnoopDCache(void)
  1265. {
  1266. SMPCC->CC_CTRL.b.i_snoop_d_en = SMPCC_CTRL_I_SNOOP_D_EN_ENABLE;
  1267. }
  1268. /**
  1269. * \brief Disable ICache to Snoop DCache
  1270. * \details
  1271. * This function disables snoop to dcache for icache refill reads.
  1272. * \sa
  1273. * - \ref SMPCC_EnableICacheSnoopDCache
  1274. */
  1275. __STATIC_FORCEINLINE void SMPCC_DisableICacheSnoopDCache(void)
  1276. {
  1277. SMPCC->CC_CTRL.b.i_snoop_d_en = SMPCC_CTRL_I_SNOOP_D_EN_DISABLE;
  1278. }
  1279. /**
  1280. * \brief Get Recoverable Error Count
  1281. * \details
  1282. * This function returns the current count of recoverable errors.
  1283. * \return Current count of recoverable errors
  1284. * \sa
  1285. * - \ref SMPCC_ClearRecvErrCount
  1286. */
  1287. __STATIC_FORCEINLINE uint32_t SMPCC_GetRecvErrCount(void)
  1288. {
  1289. return SMPCC->CC_RECV_CNT.b.cnt;
  1290. }
  1291. /**
  1292. * \brief Clear Recoverable Error Count
  1293. * \details
  1294. * This function clears the recoverable error count register.
  1295. * \sa
  1296. * - \ref SMPCC_GetRecvErrCount
  1297. */
  1298. __STATIC_FORCEINLINE void SMPCC_ClearRecvErrCount(void)
  1299. {
  1300. SMPCC->CC_RECV_CNT.w = 0;
  1301. }
  1302. /**
  1303. * \brief Get Fatal Error Count
  1304. * \details
  1305. * This function returns the current count of fatal errors.
  1306. * \return Current count of fatal errors
  1307. * \sa
  1308. * - \ref SMPCC_ClearFatalErrCount
  1309. */
  1310. __STATIC_FORCEINLINE uint32_t SMPCC_GetFatalErrCount(void)
  1311. {
  1312. return SMPCC->CC_FATAL_CNT.b.cnt;
  1313. }
  1314. /**
  1315. * \brief Clear Fatal Error Count
  1316. * \details
  1317. * This function clears the fatal error count register.
  1318. * \sa
  1319. * - \ref SMPCC_GetFatalErrCount
  1320. */
  1321. __STATIC_FORCEINLINE void SMPCC_ClearFatalErrCount(void)
  1322. {
  1323. SMPCC->CC_FATAL_CNT.w = 0;
  1324. }
  1325. /**
  1326. * \brief Set Recoverable Error Count Threshold
  1327. * \details
  1328. * This function sets the threshold value for recoverable error count.
  1329. * \param [in] threshold Threshold value to set
  1330. * \sa
  1331. * - \ref SMPCC_GetRecvErrCntThreshold
  1332. */
  1333. __STATIC_FORCEINLINE void SMPCC_SetRecvErrCntThreshold(uint16_t threshold)
  1334. {
  1335. SMPCC->CC_RECV_THV.b.cnt = threshold;
  1336. }
  1337. /**
  1338. * \brief Get Recoverable Error Count Threshold
  1339. * \details
  1340. * This function returns the current threshold value for recoverable error count.
  1341. * \return Current threshold value for recoverable error count
  1342. * \sa
  1343. * - \ref SMPCC_SetRecvErrCntThreshold
  1344. */
  1345. __STATIC_FORCEINLINE uint16_t SMPCC_GetRecvErrCntThreshold(void)
  1346. {
  1347. return SMPCC->CC_RECV_THV.b.cnt;
  1348. }
  1349. /**
  1350. * \brief Set Fatal Error Count Threshold
  1351. * \details
  1352. * This function sets the threshold value for fatal error count.
  1353. * \param [in] threshold Threshold value to set
  1354. * \sa
  1355. * - \ref SMPCC_GetFatalErrCntThreshold
  1356. */
  1357. __STATIC_FORCEINLINE void SMPCC_SetFatalErrCntThreshold(uint16_t threshold)
  1358. {
  1359. SMPCC->CC_FATAL_THV.b.cnt = threshold;
  1360. }
  1361. /**
  1362. * \brief Get Fatal Error Count Threshold
  1363. * \details
  1364. * This function returns the current threshold value for fatal error count.
  1365. * \return Current threshold value for fatal error count
  1366. * \sa
  1367. * - \ref SMPCC_SetFatalErrCntThreshold
  1368. */
  1369. __STATIC_FORCEINLINE uint16_t SMPCC_GetFatalErrCntThreshold(void)
  1370. {
  1371. return SMPCC->CC_FATAL_THV.b.cnt;
  1372. }
  1373. /**
  1374. * \brief Get Client Error Status
  1375. * \details
  1376. * This function returns the error status for a specific client.
  1377. * \param [in] client_id ID of the client to get error status for
  1378. * \return Error status of the specified client
  1379. */
  1380. __STATIC_FORCEINLINE uint32_t SMPCC_GetClientErrStatus(uint8_t client_id)
  1381. {
  1382. return SMPCC->CLIENT_ERR_STATUS[client_id].w;
  1383. }
  1384. /**
  1385. * \brief Set Stream Control Register
  1386. * \details
  1387. * This function sets the value of the Stream Control register.
  1388. * \param [in] val Value to set in the stream control register
  1389. * \sa
  1390. * - \ref SMPCC_GetSTMControl
  1391. */
  1392. __STATIC_FORCEINLINE void SMPCC_SetSTMControl(uint32_t val)
  1393. {
  1394. SMPCC->STM_CTRL.w = val;
  1395. }
  1396. /**
  1397. * \brief Get Stream Control Register Value
  1398. * \details
  1399. * This function returns the current value of the Stream Control register.
  1400. * \return Current value of the stream control register
  1401. * \sa
  1402. * - \ref SMPCC_SetSTMControl
  1403. */
  1404. __STATIC_FORCEINLINE uint32_t SMPCC_GetSTMControl(void)
  1405. {
  1406. return SMPCC->STM_CTRL.w;
  1407. }
  1408. /**
  1409. * \brief Enable Stream Read
  1410. * \details
  1411. * This function enables stream read functionality.
  1412. * \sa
  1413. * - \ref SMPCC_DisableStreamRead
  1414. */
  1415. __STATIC_FORCEINLINE void SMPCC_EnableStreamRead(void)
  1416. {
  1417. SMPCC->STM_CTRL.b.rd_stm_en = SMPCC_STMCTRL_RD_STM_EN_ENABLE;
  1418. }
  1419. /**
  1420. * \brief Disable Stream Read
  1421. * \details
  1422. * This function disables stream read functionality.
  1423. * \sa
  1424. * - \ref SMPCC_EnableStreamRead
  1425. */
  1426. __STATIC_FORCEINLINE void SMPCC_DisableStreamRead(void)
  1427. {
  1428. SMPCC->STM_CTRL.b.rd_stm_en = SMPCC_STMCTRL_RD_STM_EN_DISABLE;
  1429. }
  1430. /**
  1431. * \brief Enable Stream Write
  1432. * \details
  1433. * This function enables stream write functionality.
  1434. * \sa
  1435. * - \ref SMPCC_DisableStreamWrite
  1436. */
  1437. __STATIC_FORCEINLINE void SMPCC_EnableStreamWrite(void)
  1438. {
  1439. SMPCC->STM_CTRL.b.wr_stm_en = SMPCC_STMCTRL_WR_STM_EN_ENABLE;
  1440. }
  1441. /**
  1442. * \brief Disable Stream Write
  1443. * \details
  1444. * This function disables stream write functionality.
  1445. * \sa
  1446. * - \ref SMPCC_EnableStreamWrite
  1447. */
  1448. __STATIC_FORCEINLINE void SMPCC_DisableStreamWrite(void)
  1449. {
  1450. SMPCC->STM_CTRL.b.wr_stm_en = SMPCC_STMCTRL_WR_STM_EN_DISABLE;
  1451. }
  1452. /**
  1453. * \brief Enable Stream Translate Allocate
  1454. * \details
  1455. * This function enables translation of allocate attribute to non-alloc attribute.
  1456. * \sa
  1457. * - \ref SMPCC_DisableStreamTransAlloc
  1458. */
  1459. __STATIC_FORCEINLINE void SMPCC_EnableStreamTransAlloc(void)
  1460. {
  1461. SMPCC->STM_CTRL.b.trans_alloc = SMPCC_STMCTRL_TRANS_ALLOC_ENABLE;
  1462. }
  1463. /**
  1464. * \brief Disable Stream Translate Allocate
  1465. * \details
  1466. * This function disables translation of allocate attribute to non-alloc attribute.
  1467. * \sa
  1468. * - \ref SMPCC_EnableStreamTransAlloc
  1469. */
  1470. __STATIC_FORCEINLINE void SMPCC_DisableStreamTransAlloc(void)
  1471. {
  1472. SMPCC->STM_CTRL.b.trans_alloc = SMPCC_STMCTRL_TRANS_ALLOC_DISABLE;
  1473. }
  1474. /**
  1475. * \brief Enable Stream Merge Non-Cacheable Read
  1476. * \details
  1477. * This function enables non-cacheable attribute read merge functionality.
  1478. * \sa
  1479. * - \ref SMPCC_DisableStreamMergeNCRead
  1480. */
  1481. __STATIC_FORCEINLINE void SMPCC_EnableStreamMergeNCRead(void)
  1482. {
  1483. SMPCC->STM_CTRL.b.rd_merge_en = SMPCC_STMCTRL_RD_MERGE_EN_ENABLE;
  1484. }
  1485. /**
  1486. * \brief Disable Stream Merge Non-Cacheable Read
  1487. * \details
  1488. * This function disables non-cacheable attribute read merge functionality.
  1489. * \sa
  1490. * - \ref SMPCC_EnableStreamMergeNCRead
  1491. */
  1492. __STATIC_FORCEINLINE void SMPCC_DisableStreamMergeNCRead(void)
  1493. {
  1494. SMPCC->STM_CTRL.b.rd_merge_en = SMPCC_STMCTRL_RD_MERGE_EN_DISABLE;
  1495. }
  1496. /**
  1497. * \brief Enable Stream Read Cross 4K Boundary
  1498. * \details
  1499. * This function enables read stream to cross 4K boundary.
  1500. * \sa
  1501. * - \ref SMPCC_DisableStreamReadCross4K
  1502. */
  1503. __STATIC_FORCEINLINE void SMPCC_EnableStreamReadCross4K(void)
  1504. {
  1505. SMPCC->STM_CTRL.b.cross_en = SMPCC_STMCTRL_CROSS_EN_ENABLE;
  1506. }
  1507. /**
  1508. * \brief Disable Stream Read Cross 4K Boundary
  1509. * \details
  1510. * This function disables read stream from crossing 4K boundary.
  1511. * \sa
  1512. * - \ref SMPCC_EnableStreamReadCross4K
  1513. */
  1514. __STATIC_FORCEINLINE void SMPCC_DisableStreamReadCross4K(void)
  1515. {
  1516. SMPCC->STM_CTRL.b.cross_en = SMPCC_STMCTRL_CROSS_EN_DISABLE;
  1517. }
  1518. /**
  1519. * \brief Set Non-Shareable Region to NACL
  1520. * \details
  1521. * This function configures a non-shareable region as NACL (NAPOT/CA with length) at the specified address.
  1522. * \param [in] region_id ID of the region to configure
  1523. * \param [in] addr Address for the region
  1524. * \sa
  1525. * - \ref SMPCC_SetNSRegionNAPOT
  1526. * - \ref SMPCC_DisableNSRegion
  1527. */
  1528. __STATIC_FORCEINLINE void SMPCC_SetNSRegionNACL(uint8_t region_id, uint64_t addr)
  1529. {
  1530. SMPCC->NS_RG[region_id].dw = SMPCC_NS_RG_CFG_NACL | addr;
  1531. }
  1532. /**
  1533. * \brief Set Non-Shareable Region to NAPOT
  1534. * \details
  1535. * This function configures a non-shareable region as NAPOT (Naturally Aligned Power of Two) at the specified address.
  1536. * \param [in] region_id ID of the region to configure
  1537. * \param [in] addr Address for the region
  1538. * \sa
  1539. * - \ref SMPCC_SetNSRegionNACL
  1540. * - \ref SMPCC_DisableNSRegion
  1541. */
  1542. __STATIC_FORCEINLINE void SMPCC_SetNSRegionNAPOT(uint8_t region_id, uint64_t addr)
  1543. {
  1544. SMPCC->NS_RG[region_id].dw = SMPCC_NS_RG_CFG_NAPOT | addr;
  1545. }
  1546. /**
  1547. * \brief Disable Non-Shareable Region
  1548. * \details
  1549. * This function disables a non-shareable region.
  1550. * \param [in] region_id ID of the region to disable
  1551. * \sa
  1552. * - \ref SMPCC_SetNSRegionNAPOT
  1553. * - \ref SMPCC_SetNSRegionNACL
  1554. */
  1555. __STATIC_FORCEINLINE void SMPCC_DisableNSRegion(uint8_t region_id)
  1556. {
  1557. SMPCC->NS_RG[region_id].dw = SMPCC_NS_RG_CFG_DISABLE;
  1558. }
  1559. /**
  1560. * \brief Set Performance Monitor Event Selection
  1561. * \details
  1562. * This function configures a performance monitor to select a specific event and client.
  1563. * \param [in] idx Index of the performance monitor
  1564. * \param [in] client_id ID of the client to monitor
  1565. * \param [in] event Event to monitor
  1566. * \sa
  1567. * - \ref SMPCC_GetPMONEventSelect
  1568. * - \ref SMPCC_GetPMONCount
  1569. * - \ref SMPCC_ClearPMONCount
  1570. *
  1571. */
  1572. __STATIC_FORCEINLINE void SMPCC_SetPMONEventSelect(uint8_t idx, uint8_t client_id, uint8_t event)
  1573. {
  1574. SMPCC->SMP_PMON_SEL[idx].w = SMPCC_PMON_EVENT(event, client_id);
  1575. }
  1576. /**
  1577. * \brief Get Performance Monitor Event Selection
  1578. * \details
  1579. * This function gets a performance monitor configuration value.
  1580. * \param [in] idx Index of the performance monitor
  1581. * \return The performance monitor configuration value.
  1582. * \sa
  1583. * - \ref SMPCC_SetPMONEventSelect
  1584. * - \ref SMPCC_GetPMONCount
  1585. * - \ref SMPCC_ClearPMONCount
  1586. *
  1587. */
  1588. __STATIC_FORCEINLINE uint32_t SMPCC_GetPMONEventSelect(uint8_t idx)
  1589. {
  1590. return SMPCC->SMP_PMON_SEL[idx].w;
  1591. }
  1592. /**
  1593. * \brief Get Performance Monitor Count
  1594. * \details
  1595. * This function returns the current count value of a performance monitor.
  1596. * \param [in] idx Index of the performance monitor
  1597. * \return Current count value of the performance monitor
  1598. * \sa
  1599. * - \ref SMPCC_SetPMONEventSelect
  1600. * - \ref SMPCC_GetPMONEventSelect
  1601. * - \ref SMPCC_ClearPMONCount
  1602. */
  1603. __STATIC_FORCEINLINE uint64_t SMPCC_GetPMONCount(uint8_t idx)
  1604. {
  1605. return SMPCC->SMP_PMON_CNT[idx];
  1606. }
  1607. /**
  1608. * \brief Clear Performance Monitor Count
  1609. * \details
  1610. * This function clears the count value of a performance monitor.
  1611. * \param [in] idx Index of the performance monitor to clear
  1612. * \sa
  1613. * - \ref SMPCC_SetPMONEventSelect
  1614. * - \ref SMPCC_GetPMONEventSelect
  1615. * - \ref SMPCC_GetPMONCount
  1616. */
  1617. __STATIC_FORCEINLINE void SMPCC_ClearPMONCount(uint8_t idx)
  1618. {
  1619. SMPCC->SMP_PMON_CNT[idx] = 0;
  1620. }
  1621. /**
  1622. * \brief Get Client Error Address
  1623. * \details
  1624. * This function returns the error address for a specific client.
  1625. * \param [in] client_id ID of the client to get error address for
  1626. * \return Error address of the specified client
  1627. */
  1628. __STATIC_FORCEINLINE uint64_t SMPCC_GetClientErrAddr(uint8_t client_id)
  1629. {
  1630. return SMPCC->CLIENT_ERR_ADDR[client_id];
  1631. }
  1632. /**
  1633. * \brief Mask Client Cluster Cache Ways
  1634. * \details
  1635. * This function masks specific ways in the cluster cache for a specific client.
  1636. * \param [in] client_id ID of the client
  1637. * \param [in] way_msk Way mask to apply
  1638. */
  1639. __STATIC_FORCEINLINE void SMPCC_MaskClientCCacheWays(uint8_t client_id, uint32_t way_msk)
  1640. {
  1641. SMPCC->CLIENT_WAY_MASK[client_id].w = way_msk;
  1642. }
  1643. /**
  1644. * \brief Check if ECC error injection mode is XOR mode
  1645. * \details This function checks which ECC error injection mode is supported.
  1646. * Returns 1 if XOR mode is supported, 0 if direct write mode is supported.
  1647. * \return 1 if XOR mode is supported, 0 if direct write mode is supported
  1648. */
  1649. __STATIC_FORCEINLINE int32_t SMPCC_IsXorErrorInjectMode(void)
  1650. {
  1651. return SMPCC->CC_ERR_INJ.b.inj_mode;
  1652. }
  1653. /**
  1654. * \brief Set ECC code for error injection
  1655. * \details This function sets the ECC code to be used for error injection.
  1656. * \param ecc_code ECC code to be set for error injection
  1657. * \return None
  1658. */
  1659. __STATIC_FORCEINLINE void SMPCC_SetECCCode(uint32_t ecc_code)
  1660. {
  1661. SMPCC->CC_ERR_INJ.w = (SMPCC->CC_ERR_INJ.w & ~SMPCC_ERR_INJ_INJECCCODE_Msk) |
  1662. _VAL2FLD(SMPCC_ERR_INJ_INJECCCODE, ecc_code);
  1663. }
  1664. #if defined(__CCM_PRESENT) && (__CCM_PRESENT == 1)
  1665. /**
  1666. * \brief Inject ECC error to cluster cache tag RAM
  1667. * \details This function injects an ECC error into the cluster cache tag RAM at the specified address.
  1668. * \param ecc_code ECC code to be injected
  1669. * \param addr Address where the error should be injected
  1670. * \return None
  1671. */
  1672. __STATIC_FORCEINLINE void SMPCC_CCacheTramErrInject(uint32_t ecc_code, void *addr)
  1673. {
  1674. SMPCC_SetECCCode(ecc_code);
  1675. SMPCC_DisableCCacheECCCheck();
  1676. MInvalICacheLine((unsigned long)addr);
  1677. MFlushInvalDCacheCCacheLine((unsigned long)addr);
  1678. __RWMB();
  1679. SMPCC->CC_ERR_INJ.b.inj_tag = SMPCC_ERR_INJ_INJTAG_ENABLE;
  1680. MLockCCacheLine((unsigned long)addr);
  1681. SMPCC->CC_ERR_INJ.b.inj_tag = SMPCC_ERR_INJ_INJTAG_DISABLE;
  1682. __RWMB();
  1683. SMPCC_EnableCCacheECCCheck();
  1684. }
  1685. /**
  1686. * \brief Inject ECC error to cluster cache data RAM
  1687. * \details This function injects an ECC error into the cluster cache data RAM at the specified address.
  1688. * \param ecc_code ECC code to be injected
  1689. * \param addr Address where the error should be injected
  1690. * \return None
  1691. */
  1692. __STATIC_FORCEINLINE void SMPCC_CCacheDramErrInject(uint32_t ecc_code, void *addr)
  1693. {
  1694. SMPCC_SetECCCode(ecc_code);
  1695. SMPCC_DisableCCacheECCCheck();
  1696. MInvalICacheLine((unsigned long)addr);
  1697. MFlushInvalDCacheCCacheLine((unsigned long)addr);
  1698. __RWMB();
  1699. SMPCC->CC_ERR_INJ.b.inj_data = SMPCC_ERR_INJ_INJDATA_ENABLE;
  1700. MLockCCacheLine((unsigned long)addr);
  1701. SMPCC->CC_ERR_INJ.b.inj_data = SMPCC_ERR_INJ_INJDATA_DISABLE;
  1702. __RWMB();
  1703. SMPCC_EnableCCacheECCCheck();
  1704. }
  1705. /**
  1706. * \brief Inject ECC error to CLM (Cluster Local Memory)
  1707. * \details This function injects an ECC error into the CLM at the specified address.
  1708. * Only the ecc code can be injected, the data will keep as it is.
  1709. * \param ecc_code ECC code to be injected
  1710. * \param addr Address where the error should be injected
  1711. * \return None
  1712. */
  1713. __STATIC_FORCEINLINE void SMPCC_CLMErrInject(uint32_t ecc_code, void *addr)
  1714. {
  1715. SMPCC_SetECCCode(ecc_code);
  1716. SMPCC_DisableCLMECCCheck();
  1717. uint32_t val = __LW(addr);
  1718. __RWMB();
  1719. SMPCC->CC_ERR_INJ.b.inj_clm = SMPCC_ERR_INJ_INJCLM_ENABLE;
  1720. __SW(addr, val);
  1721. SMPCC->CC_ERR_INJ.b.inj_clm = SMPCC_ERR_INJ_INJCLM_DISABLE;
  1722. __RWMB();
  1723. SMPCC_EnableCLMECCCheck();
  1724. }
  1725. /**
  1726. * \brief Restore cluster cache after error injection
  1727. * \details This function restores the cluster cache after an error injection operation.
  1728. * \param addr Address to be restored
  1729. * \return None
  1730. */
  1731. __STATIC_FORCEINLINE void SMPCC_CCacheErrRestore(void *addr)
  1732. {
  1733. SMPCC_DisableCCacheECCCheck();
  1734. MInvalICacheLine((unsigned long)addr);
  1735. MFlushInvalDCacheCCacheLine((unsigned long)addr);
  1736. MLockCCacheLine((unsigned long)addr);
  1737. SMPCC_EnableCCacheECCCheck();
  1738. }
  1739. #endif /* #if defined(__CCM_PRESENT) && (__CCM_PRESENT == 1) */
  1740. /** @} */ /* End of Doxygen Group NMSIS_Core_SMPCC_Functions */
  1741. #endif /* #if defined(__SMPCC_PRESENT) && (__SMPCC_PRESENT == 1) */
  1742. #ifdef __cplusplus
  1743. }
  1744. #endif
  1745. #endif /* __CORE_FEATURE_SMPCC_H__ */