core_feature_smpcc.h 78 KB

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