NMSIS-Core  Version 1.6.0
NMSIS-Core support for Nuclei processor-based devices
D-Cache Functions

Functions that configure Data Cache. More...

Macros

#define MInvalDCacheCCacheLine(addr)   MInvalDCacheLine(addr)
 Invalidate one D-Cache and Cluster Cache line specified by address in M-Mode. More...
 
#define MInvalDCacheCCacheLines(addr, cnt)   MInvalDCacheLines(addr, cnt)
 Invalidate several D-Cache and Cluster Cache lines specified by address in M-Mode. More...
 
#define SInvalDCacheCCacheLine(addr)   SInvalDCacheLine(addr)
 Invalidate one D-Cache and Cluster Cache line specified by address in S-Mode. More...
 
#define SInvalDCacheCCacheLines(addr, cnt)   SInvalDCacheLines(addr, cnt)
 Invalidate several D-Cache and Cluster Cache lines specified by address in S-Mode. More...
 
#define UInvalDCacheCCacheLine(addr)   UInvalDCacheLine(addr)
 Invalidate one D-Cache and Cluster Cache line specified by address in U-Mode. More...
 
#define UInvalDCacheCCacheLines(addr, cnt)   UInvalDCacheLines(addr, cnt)
 Invalidate several D-Cache and Cluster Cache lines specified by address in U-Mode. More...
 
#define MFlushDCacheCCacheLine(addr)   MFlushDCacheLine(addr)
 Flush one D-Cache and Cluster Cache line specified by address in M-Mode. More...
 
#define MFlushDCacheCCacheLines(addr, cnt)   MFlushDCacheLines(addr, cnt)
 Flush several D-Cache and Cluster Cache lines specified by address in M-Mode. More...
 
#define SFlushDCacheCCacheLine(addr)   SFlushDCacheLine(addr)
 Flush one D-Cache and Cluster Cache line specified by address in S-Mode. More...
 
#define SFlushDCacheCCacheLines(addr, cnt)   SFlushDCacheLines(addr, cnt)
 Flush several D-Cache and Cluster Cache lines specified by address in S-Mode. More...
 
#define UFlushDCacheCCacheLine(addr)   UFlushDCacheLine(addr)
 Flush one D-Cache and Cluster Cache line specified by address in U-Mode. More...
 
#define UFlushDCacheCCacheLines(addr, cnt)   UFlushDCacheLines(addr, cnt)
 Flush several D-Cache and Cluster Cache lines specified by address in U-Mode. More...
 
#define MFlushInvalDCacheCCacheLine(addr)   MFlushInvalDCacheLine(addr)
 Flush and invalidate one D-Cache and Cluster Cache line specified by address in M-Mode. More...
 
#define MFlushInvalDCacheCCacheLines(addr, cnt)   MFlushInvalDCacheLines(addr, cnt)
 Flush and invalidate several D-Cache and Cluster Cache lines specified by address in M-Mode. More...
 
#define SFlushInvalDCacheCCacheLine(addr)   SFlushInvalDCacheLine(addr)
 Flush and invalidate one D-Cache and Cluster Cache line specified by address in S-Mode. More...
 
#define SFlushInvalDCacheCCacheLines(addr, cnt)   SFlushInvalDCacheLines(addr, cnt)
 Flush and invalidate several D-Cache and Cluster Cache lines specified by address in S-Mode. More...
 
#define UFlushInvalDCacheCCacheLine(addr)   UFlushInvalDCacheLine(addr)
 Flush and invalidate one D-Cache and Cluster Cache line specified by address in U-Mode. More...
 
#define UFlushInvalDCacheCCacheLines(addr, cnt)   UFlushInvalDCacheLines(addr, cnt)
 Flush and invalidate several D-Cache and Cluster Cache lines specified by address in U-Mode. More...
 

Functions

__STATIC_INLINE int32_t DCachePresent (void)
 Check DCache Unit Present or Not. More...
 
__STATIC_FORCEINLINE void EnableDCache (void)
 Enable DCache. More...
 
__STATIC_FORCEINLINE void DisableDCache (void)
 Disable DCache. More...
 
__STATIC_FORCEINLINE void EnableDCacheECC (void)
 Enable DCache ECC. More...
 
__STATIC_FORCEINLINE void DisableDCacheECC (void)
 Disable DCache ECC. More...
 
__STATIC_INLINE int32_t GetDCacheInfo (CacheInfo_Type *info)
 Get D-Cache Information. More...
 
__STATIC_INLINE void MInvalDCacheLine (unsigned long addr)
 Invalidate one D-Cache line specified by address in M-Mode. More...
 
__STATIC_INLINE void MInvalDCacheLines (unsigned long addr, unsigned long cnt)
 Invalidate several D-Cache lines specified by address in M-Mode. More...
 
__STATIC_INLINE void SInvalDCacheLine (unsigned long addr)
 Invalidate one D-Cache line specified by address in S-Mode. More...
 
__STATIC_INLINE void SInvalDCacheLines (unsigned long addr, unsigned long cnt)
 Invalidate several D-Cache lines specified by address in S-Mode. More...
 
__STATIC_INLINE void UInvalDCacheLine (unsigned long addr)
 Invalidate one D-Cache line specified by address in U-Mode. More...
 
__STATIC_INLINE void UInvalDCacheLines (unsigned long addr, unsigned long cnt)
 Invalidate several D-Cache lines specified by address in U-Mode. More...
 
__STATIC_INLINE void MFlushDCacheLine (unsigned long addr)
 Flush one D-Cache line specified by address in M-Mode. More...
 
__STATIC_INLINE void MFlushDCacheLines (unsigned long addr, unsigned long cnt)
 Flush several D-Cache lines specified by address in M-Mode. More...
 
__STATIC_INLINE void SFlushDCacheLine (unsigned long addr)
 Flush one D-Cache line specified by address in S-Mode. More...
 
__STATIC_INLINE void SFlushDCacheLines (unsigned long addr, unsigned long cnt)
 Flush several D-Cache lines specified by address in S-Mode. More...
 
__STATIC_INLINE void UFlushDCacheLine (unsigned long addr)
 Flush one D-Cache line specified by address in U-Mode. More...
 
__STATIC_INLINE void UFlushDCacheLines (unsigned long addr, unsigned long cnt)
 Flush several D-Cache lines specified by address in U-Mode. More...
 
__STATIC_INLINE void MFlushInvalDCacheLine (unsigned long addr)
 Flush and invalidate one D-Cache line specified by address in M-Mode. More...
 
__STATIC_INLINE void MFlushInvalDCacheLines (unsigned long addr, unsigned long cnt)
 Flush and invalidate several D-Cache lines specified by address in M-Mode. More...
 
__STATIC_INLINE void SFlushInvalDCacheLine (unsigned long addr)
 Flush and invalidate one D-Cache line specified by address in S-Mode. More...
 
__STATIC_INLINE void SFlushInvalDCacheLines (unsigned long addr, unsigned long cnt)
 Flush and invalidate several D-Cache lines specified by address in S-Mode. More...
 
__STATIC_INLINE void UFlushInvalDCacheLine (unsigned long addr)
 Flush and invalidate one D-Cache line specified by address in U-Mode. More...
 
__STATIC_INLINE void UFlushInvalDCacheLines (unsigned long addr, unsigned long cnt)
 Flush and invalidate several D-Cache lines specified by address in U-Mode. More...
 
__STATIC_INLINE unsigned long MLockDCacheLine (unsigned long addr)
 Lock one D-Cache line specified by address in M-Mode. More...
 
__STATIC_INLINE unsigned long MLockDCacheLines (unsigned long addr, unsigned long cnt)
 Lock several D-Cache lines specified by address in M-Mode. More...
 
__STATIC_INLINE unsigned long SLockDCacheLine (unsigned long addr)
 Lock one D-Cache line specified by address in S-Mode. More...
 
__STATIC_INLINE unsigned long SLockDCacheLines (unsigned long addr, unsigned long cnt)
 Lock several D-Cache lines specified by address in S-Mode. More...
 
__STATIC_INLINE unsigned long ULockDCacheLine (unsigned long addr)
 Lock one D-Cache line specified by address in U-Mode. More...
 
__STATIC_INLINE unsigned long ULockDCacheLines (unsigned long addr, unsigned long cnt)
 Lock several D-Cache lines specified by address in U-Mode. More...
 
__STATIC_INLINE void MUnlockDCacheLine (unsigned long addr)
 Unlock one D-Cache line specified by address in M-Mode. More...
 
__STATIC_INLINE void MUnlockDCacheLines (unsigned long addr, unsigned long cnt)
 Unlock several D-Cache lines specified by address in M-Mode. More...
 
__STATIC_INLINE void SUnlockDCacheLine (unsigned long addr)
 Unlock one D-Cache line specified by address in S-Mode. More...
 
__STATIC_INLINE void SUnlockDCacheLines (unsigned long addr, unsigned long cnt)
 Unlock several D-Cache lines specified by address in S-Mode. More...
 
__STATIC_INLINE void UUnlockDCacheLine (unsigned long addr)
 Unlock one D-Cache line specified by address in U-Mode. More...
 
__STATIC_INLINE void UUnlockDCacheLines (unsigned long addr, unsigned long cnt)
 Unlock several D-Cache lines specified by address in U-Mode. More...
 
__STATIC_INLINE void MInvalDCache (void)
 Invalidate all D-Cache lines in M-Mode. More...
 
__STATIC_INLINE void SInvalDCache (void)
 Invalidate all D-Cache lines in S-Mode. More...
 
__STATIC_INLINE void UInvalDCache (void)
 Invalidate all D-Cache lines in U-Mode. More...
 
__STATIC_INLINE void MFlushDCache (void)
 Flush all D-Cache lines in M-Mode. More...
 
__STATIC_INLINE void SFlushDCache (void)
 Flush all D-Cache lines in S-Mode. More...
 
__STATIC_INLINE void UFlushDCache (void)
 Flush all D-Cache lines in U-Mode. More...
 
__STATIC_INLINE void MFlushInvalDCache (void)
 Flush and invalidate all D-Cache lines in M-Mode. More...
 
__STATIC_INLINE void SFlushInvalDCache (void)
 Flush and invalidate all D-Cache lines in S-Mode. More...
 
__STATIC_INLINE void UFlushInvalDCache (void)
 Flush and invalidate all D-Cache lines in U-Mode. More...
 
__STATIC_INLINE int32_t MFlushCCache (void)
 Flush all Cluster Cache in M-Mode. More...
 
__STATIC_INLINE int32_t SFlushCCache (void)
 Flush all Cluster Cache in S-Mode. More...
 
__STATIC_INLINE int32_t UFlushCCache (void)
 Flush all Cluster Cache in U-Mode. More...
 
__STATIC_INLINE int32_t MFlushInvalCCache (void)
 Flush and invalidate all Cluster Cache in M-Mode. More...
 
__STATIC_INLINE int32_t SFlushInvalCCache (void)
 Flush and invalidate all Cluster Cache in S-Mode. More...
 
__STATIC_INLINE int32_t UFlushInvalCCache (void)
 Flush and invalidate all Cluster Cache in U-Mode. More...
 
__STATIC_INLINE void MInvalDCacheCCache (void)
 Invalidate all D-Cache and Cluster Cache in M-Mode. More...
 
__STATIC_INLINE void SInvalDCacheCCache (void)
 Invalidate all D-Cache and Cluster Cache in S-Mode. More...
 
__STATIC_INLINE void UInvalDCacheCCache (void)
 Invalidate all D-Cache and Cluster Cache in U-Mode. More...
 
__STATIC_INLINE int32_t MFlushDCacheCCache (void)
 Flush all D-Cache and Cluster Cache in M-Mode. More...
 
__STATIC_INLINE int32_t SFlushDCacheCCache (void)
 Flush all D-Cache and Cluster Cache in S-Mode. More...
 
__STATIC_INLINE int32_t UFlushDCacheCCache (void)
 Flush all D-Cache and Cluster Cache in U-Mode. More...
 
__STATIC_INLINE int32_t MFlushInvalDCacheCCache (void)
 Flush and invalidate all D-Cache and Cluster Cache in M-Mode. More...
 
__STATIC_INLINE int32_t SFlushInvalDCacheCCache (void)
 Flush and invalidate all D-Cache and Cluster Cache in S-Mode. More...
 
__STATIC_INLINE int32_t UFlushInvalDCacheCCache (void)
 Flush and invalidate all D-Cache and Cluster Cache in U-Mode. More...
 

Detailed Description

Functions that configure Data Cache.

Macro Definition Documentation

◆ MFlushDCacheCCacheLine

#define MFlushDCacheCCacheLine (   addr)    MFlushDCacheLine(addr)

Flush one D-Cache and Cluster Cache line specified by address in M-Mode.

This macro is an alias for MFlushDCacheLine. D-Cache CCM operations are also effective for Cluster Cache.

Remarks
This macro must be executed in M-Mode only.
Parameters
[in]addrstart address to be flushed

Definition at line 1884 of file core_feature_cache.h.

◆ MFlushDCacheCCacheLines

#define MFlushDCacheCCacheLines (   addr,
  cnt 
)    MFlushDCacheLines(addr, cnt)

Flush several D-Cache and Cluster Cache lines specified by address in M-Mode.

This macro is an alias for MFlushDCacheLines. D-Cache CCM operations are also effective for Cluster Cache.

Remarks
This macro must be executed in M-Mode only.
Parameters
[in]addrstart address to be flushed
[in]cntcount of cache lines to be flushed

Definition at line 1895 of file core_feature_cache.h.

◆ MFlushInvalDCacheCCacheLine

#define MFlushInvalDCacheCCacheLine (   addr)    MFlushInvalDCacheLine(addr)

Flush and invalidate one D-Cache and Cluster Cache line specified by address in M-Mode.

This macro is an alias for MFlushInvalDCacheLine. D-Cache CCM operations are also effective for Cluster Cache.

Remarks
This macro must be executed in M-Mode only.
Parameters
[in]addrstart address to be flushed and invalidated

Definition at line 1946 of file core_feature_cache.h.

◆ MFlushInvalDCacheCCacheLines

#define MFlushInvalDCacheCCacheLines (   addr,
  cnt 
)    MFlushInvalDCacheLines(addr, cnt)

Flush and invalidate several D-Cache and Cluster Cache lines specified by address in M-Mode.

This macro is an alias for MFlushInvalDCacheLines. D-Cache CCM operations are also effective for Cluster Cache.

Remarks
This macro must be executed in M-Mode only.
Parameters
[in]addrstart address to be flushed and invalidated
[in]cntcount of cache lines to be flushed and invalidated

Definition at line 1957 of file core_feature_cache.h.

◆ MInvalDCacheCCacheLine

#define MInvalDCacheCCacheLine (   addr)    MInvalDCacheLine(addr)

Invalidate one D-Cache and Cluster Cache line specified by address in M-Mode.

This macro is an alias for MInvalDCacheLine. D-Cache CCM operations are also effective for Cluster Cache.

Remarks
This macro must be executed in M-Mode only.
Parameters
[in]addrstart address to be invalidated

Definition at line 1822 of file core_feature_cache.h.

◆ MInvalDCacheCCacheLines

#define MInvalDCacheCCacheLines (   addr,
  cnt 
)    MInvalDCacheLines(addr, cnt)

Invalidate several D-Cache and Cluster Cache lines specified by address in M-Mode.

This macro is an alias for MInvalDCacheLines. D-Cache CCM operations are also effective for Cluster Cache.

Remarks
This macro must be executed in M-Mode only.
Parameters
[in]addrstart address to be invalidated
[in]cntcount of cache lines to be invalidated

Definition at line 1833 of file core_feature_cache.h.

◆ SFlushDCacheCCacheLine

#define SFlushDCacheCCacheLine (   addr)    SFlushDCacheLine(addr)

Flush one D-Cache and Cluster Cache line specified by address in S-Mode.

This macro is an alias for SFlushDCacheLine. D-Cache CCM operations are also effective for Cluster Cache.

Remarks
This macro must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be flushed

Definition at line 1905 of file core_feature_cache.h.

◆ SFlushDCacheCCacheLines

#define SFlushDCacheCCacheLines (   addr,
  cnt 
)    SFlushDCacheLines(addr, cnt)

Flush several D-Cache and Cluster Cache lines specified by address in S-Mode.

This macro is an alias for SFlushDCacheLines. D-Cache CCM operations are also effective for Cluster Cache.

Remarks
This macro must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be flushed
[in]cntcount of cache lines to be flushed

Definition at line 1916 of file core_feature_cache.h.

◆ SFlushInvalDCacheCCacheLine

#define SFlushInvalDCacheCCacheLine (   addr)    SFlushInvalDCacheLine(addr)

Flush and invalidate one D-Cache and Cluster Cache line specified by address in S-Mode.

This macro is an alias for SFlushInvalDCacheLine. D-Cache CCM operations are also effective for Cluster Cache.

Remarks
This macro must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be flushed and invalidated

Definition at line 1967 of file core_feature_cache.h.

◆ SFlushInvalDCacheCCacheLines

#define SFlushInvalDCacheCCacheLines (   addr,
  cnt 
)    SFlushInvalDCacheLines(addr, cnt)

Flush and invalidate several D-Cache and Cluster Cache lines specified by address in S-Mode.

This macro is an alias for SFlushInvalDCacheLines. D-Cache CCM operations are also effective for Cluster Cache.

Remarks
This macro must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be flushed and invalidated
[in]cntcount of cache lines to be flushed and invalidated

Definition at line 1978 of file core_feature_cache.h.

◆ SInvalDCacheCCacheLine

#define SInvalDCacheCCacheLine (   addr)    SInvalDCacheLine(addr)

Invalidate one D-Cache and Cluster Cache line specified by address in S-Mode.

This macro is an alias for SInvalDCacheLine. D-Cache CCM operations are also effective for Cluster Cache.

Remarks
This macro must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be invalidated

Definition at line 1843 of file core_feature_cache.h.

◆ SInvalDCacheCCacheLines

#define SInvalDCacheCCacheLines (   addr,
  cnt 
)    SInvalDCacheLines(addr, cnt)

Invalidate several D-Cache and Cluster Cache lines specified by address in S-Mode.

This macro is an alias for SInvalDCacheLines. D-Cache CCM operations are also effective for Cluster Cache.

Remarks
This macro must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be invalidated
[in]cntcount of cache lines to be invalidated

Definition at line 1854 of file core_feature_cache.h.

◆ UFlushDCacheCCacheLine

#define UFlushDCacheCCacheLine (   addr)    UFlushDCacheLine(addr)

Flush one D-Cache and Cluster Cache line specified by address in U-Mode.

This macro is an alias for UFlushDCacheLine. D-Cache CCM operations are also effective for Cluster Cache.

Remarks
This macro must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be flushed

Definition at line 1926 of file core_feature_cache.h.

◆ UFlushDCacheCCacheLines

#define UFlushDCacheCCacheLines (   addr,
  cnt 
)    UFlushDCacheLines(addr, cnt)

Flush several D-Cache and Cluster Cache lines specified by address in U-Mode.

This macro is an alias for UFlushDCacheLines. D-Cache CCM operations are also effective for Cluster Cache.

Remarks
This macro must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be flushed
[in]cntcount of cache lines to be flushed

Definition at line 1937 of file core_feature_cache.h.

◆ UFlushInvalDCacheCCacheLine

#define UFlushInvalDCacheCCacheLine (   addr)    UFlushInvalDCacheLine(addr)

Flush and invalidate one D-Cache and Cluster Cache line specified by address in U-Mode.

This macro is an alias for UFlushInvalDCacheLine. D-Cache CCM operations are also effective for Cluster Cache.

Remarks
This macro must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be flushed and invalidated

Definition at line 1988 of file core_feature_cache.h.

◆ UFlushInvalDCacheCCacheLines

#define UFlushInvalDCacheCCacheLines (   addr,
  cnt 
)    UFlushInvalDCacheLines(addr, cnt)

Flush and invalidate several D-Cache and Cluster Cache lines specified by address in U-Mode.

This macro is an alias for UFlushInvalDCacheLines. D-Cache CCM operations are also effective for Cluster Cache.

Remarks
This macro must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be flushed and invalidated
[in]cntcount of cache lines to be flushed and invalidated

Definition at line 1999 of file core_feature_cache.h.

◆ UInvalDCacheCCacheLine

#define UInvalDCacheCCacheLine (   addr)    UInvalDCacheLine(addr)

Invalidate one D-Cache and Cluster Cache line specified by address in U-Mode.

This macro is an alias for UInvalDCacheLine. D-Cache CCM operations are also effective for Cluster Cache.

Remarks
This macro must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be invalidated

Definition at line 1864 of file core_feature_cache.h.

◆ UInvalDCacheCCacheLines

#define UInvalDCacheCCacheLines (   addr,
  cnt 
)    UInvalDCacheLines(addr, cnt)

Invalidate several D-Cache and Cluster Cache lines specified by address in U-Mode.

This macro is an alias for UInvalDCacheLines. D-Cache CCM operations are also effective for Cluster Cache.

Remarks
This macro must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be invalidated
[in]cntcount of cache lines to be invalidated

Definition at line 1875 of file core_feature_cache.h.

Function Documentation

◆ DCachePresent()

__STATIC_INLINE int32_t DCachePresent ( void  )

Check DCache Unit Present or Not.

This function check dcache unit present or not via mcfg_info csr

Remarks
  • This function might not work for some old nuclei processors
  • Please make sure the version of your nuclei processor contain DCACHE bit in mcfg_info
Returns
1 if present otherwise 0

Definition at line 1344 of file core_feature_cache.h.

1345 {
1347  return 1;
1348  }
1349  return 0;
1350 }

References __RV_CSR_READ, CSR_MCFG_INFO, and MCFG_INFO_DCACHE.

Referenced by _premain_init().

◆ DisableDCache()

__STATIC_FORCEINLINE void DisableDCache ( void  )

Disable DCache.

This function Disable D-Cache

Remarks
  • This function can be called in M-Mode only.
  • This CSR_MCACHE_CTL register control D Cache enable.
See also

Definition at line 1377 of file core_feature_cache.h.

1378 {
1380 }

References __RV_CSR_CLEAR, CSR_MCACHE_CTL, and MCACHE_CTL_DC_EN.

◆ DisableDCacheECC()

__STATIC_FORCEINLINE void DisableDCacheECC ( void  )

Disable DCache ECC.

This function disable D-Cache ECC

Remarks
  • This function can be called in M-Mode only.
  • This CSR_MCACHE_CTL register control D Cache ECC enable.
See also

Definition at line 1407 of file core_feature_cache.h.

References __RV_CSR_CLEAR, CSR_MCACHE_CTL, and MCACHE_CTL_DC_ECC_EN.

◆ EnableDCache()

__STATIC_FORCEINLINE void EnableDCache ( void  )

Enable DCache.

This function enable D-Cache

Remarks
  • This function can be called in M-Mode only.
  • This CSR_MCACHE_CTL register control D Cache enable.
See also

Definition at line 1362 of file core_feature_cache.h.

1363 {
1365 }

References __RV_CSR_SET, CSR_MCACHE_CTL, and MCACHE_CTL_DC_EN.

Referenced by _premain_init().

◆ EnableDCacheECC()

__STATIC_FORCEINLINE void EnableDCacheECC ( void  )

Enable DCache ECC.

This function enable D-Cache ECC

Remarks
  • This function can be called in M-Mode only.
  • This CSR_MCACHE_CTL register control D Cache ECC enable.
See also

Definition at line 1392 of file core_feature_cache.h.

References __RV_CSR_SET, CSR_MCACHE_CTL, and MCACHE_CTL_DC_ECC_EN.

◆ GetDCacheInfo()

__STATIC_INLINE int32_t GetDCacheInfo ( CacheInfo_Type *  info)

Get D-Cache Information.

This function get D-Cache Information

Remarks
  • This function can be called in M-Mode only.
  • You can use this function in combination with cache lines operations
See also

Definition at line 1423 of file core_feature_cache.h.

1424 {
1425  if (info == NULL) {
1426  return -1;
1427  }
1428  CSR_MDCFGINFO_Type csr_ccfg;
1429  csr_ccfg.d = __RV_CSR_READ(CSR_MDCFG_INFO);
1430  info->setperway = (1UL << csr_ccfg.b.set) << 3;
1431  info->ways = (1 + csr_ccfg.b.way);
1432  if (csr_ccfg.b.lsize == 0) {
1433  info->linesize = 0;
1434  } else {
1435  info->linesize = (1UL << (csr_ccfg.b.lsize - 1)) << 3;
1436  }
1437  info->size = info->setperway * info->ways * info->linesize;
1438  return 0;
1439 }

References __RV_CSR_READ, CSR_MDCFGINFO_Type::b, CSR_MDCFG_INFO, CSR_MDCFGINFO_Type::d, CSR_MDCFGINFO_Type::lsize, CSR_MDCFGINFO_Type::set, and CSR_MDCFGINFO_Type::way.

◆ MFlushCCache()

__STATIC_INLINE int32_t MFlushCCache ( void  )

Flush all Cluster Cache in M-Mode.

This function flush all Cluster Cache. Command SMPCC_CMD_WB_ALL is written to SMPCC CMD register.

Remarks
This function must be executed in M-Mode only.
Returns
Operation result, see enum SMPCC_CMD_RESULT

Definition at line 2431 of file core_feature_cache.h.

2432 {
2433  /* Clear pending error status before issuing the Cluster Cache command.
2434  * RESC/FESC/BESC are write-1-to-clear bits, so read the status and write it back. */
2435  SMPCC_CMD->CC_mCMD = (SMPCC_CMD->CC_mCMD & SMPCC_CMD_xCMD_STATUS_Msk);
2436  SMPCC_CMD->CC_mCMD = (SMPCC_CMD->CC_mCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2437  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WB_ALL);
2438  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_mCMD) == 0);
2439  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_mCMD);
2440  __RWMB();
2441  return res;
2442 }

References __RWMB, _FLD2VAL, _VAL2FLD, SMPCC_CMD, SMPCC_CMD_xCMD_CMD_Msk, SMPCC_CMD_xCMD_CMD_WB_ALL, and SMPCC_CMD_xCMD_STATUS_Msk.

◆ MFlushDCache()

__STATIC_INLINE void MFlushDCache ( void  )

Flush all D-Cache lines in M-Mode.

This function flush all D-Cache lines. Command CCM_DC_WB_ALL is written to CSR CSR_CCM_MCOMMAND.

Remarks
This function must be executed in M-Mode only.
Parameters
[in]addrstart address to be flushed

Definition at line 2334 of file core_feature_cache.h.

2335 {
2337  FlushPipeCCM();
2338  __RWMB();
2339 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_WB_ALL, CSR_CCM_MCOMMAND, and FlushPipeCCM().

◆ MFlushDCacheCCache()

__STATIC_INLINE int32_t MFlushDCacheCCache ( void  )

Flush all D-Cache and Cluster Cache in M-Mode.

This function flush all D-Cache and Cluster Cache. Command CCM_DC_WB_ALL is written to CSR CSR_CCM_MCOMMAND.

Remarks
This function must be executed in M-Mode only.
Returns
Operation result, see enum SMPCC_CMD_RESULT

Definition at line 2605 of file core_feature_cache.h.

2606 {
2608  FlushPipeCCM();
2609  SMPCC_CMD->CC_mCMD = (SMPCC_CMD->CC_mCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2610  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WB_ALL);
2611  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_mCMD) == 0);
2612  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_mCMD);
2613  __RWMB();
2614  return res;
2615 }

References __RV_CSR_WRITE, __RWMB, _FLD2VAL, _VAL2FLD, CCM_DC_WB_ALL, CSR_CCM_MCOMMAND, FlushPipeCCM(), SMPCC_CMD, SMPCC_CMD_xCMD_CMD_Msk, and SMPCC_CMD_xCMD_CMD_WB_ALL.

◆ MFlushDCacheLine()

__STATIC_INLINE void MFlushDCacheLine ( unsigned long  addr)

Flush one D-Cache line specified by address in M-Mode.

This function flush one D-Cache line specified by the address. Command CCM_DC_WB is written to CSR CSR_CCM_MCOMMAND.

Remarks
This function must be executed in M-Mode only.
Parameters
[in]addrstart address to be flushed

Definition at line 1576 of file core_feature_cache.h.

1577 {
1580  FlushPipeCCM();
1581  __RWMB();
1582 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_WB, CSR_CCM_MBEGINADDR, CSR_CCM_MCOMMAND, and FlushPipeCCM().

Referenced by __ECLIC_SetVector().

◆ MFlushDCacheLines()

__STATIC_INLINE void MFlushDCacheLines ( unsigned long  addr,
unsigned long  cnt 
)

Flush several D-Cache lines specified by address in M-Mode.

This function flush several D-Cache lines specified by the address and line count. Command CCM_DC_WB is written to CSR CSR_CCM_MCOMMAND.

Remarks
This function must be executed in M-Mode only.
Parameters
[in]addrstart address to be flushed
[in]cntcount of cache lines to be flushed

Definition at line 1595 of file core_feature_cache.h.

1596 {
1597  if (cnt > 0) {
1598  unsigned long i;
1600  for (i = 0; i < cnt; i++) {
1602  }
1603  FlushPipeCCM();
1604  __RWMB();
1605  }
1606 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_WB, CSR_CCM_MBEGINADDR, CSR_CCM_MCOMMAND, and FlushPipeCCM().

◆ MFlushInvalCCache()

__STATIC_INLINE int32_t MFlushInvalCCache ( void  )

Flush and invalidate all Cluster Cache in M-Mode.

This function flush and invalidate all Cluster Cache. Command SMPCC_CMD_WBINVAL_ALL is written to SMPCC CMD register.

Remarks
This function must be executed in M-Mode only.
Returns
Operation result, see enum SMPCC_CMD_RESULT

Definition at line 2497 of file core_feature_cache.h.

2498 {
2499  SMPCC_CMD->CC_mCMD = (SMPCC_CMD->CC_mCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2500  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WBINVAL_ALL);
2501  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_mCMD) == 0);
2502  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_mCMD);
2503  __RWMB();
2504  return res;
2505 }

References __RWMB, _FLD2VAL, _VAL2FLD, SMPCC_CMD, SMPCC_CMD_xCMD_CMD_Msk, and SMPCC_CMD_xCMD_CMD_WBINVAL_ALL.

◆ MFlushInvalDCache()

__STATIC_INLINE void MFlushInvalDCache ( void  )

Flush and invalidate all D-Cache lines in M-Mode.

This function flush and invalidate all D-Cache lines. Command CCM_DC_WBINVAL_ALL is written to CSR CSR_CCM_MCOMMAND.

Remarks
This function must be executed in M-Mode only.
Parameters
[in]addrstart address to be flushed and locked

Definition at line 2382 of file core_feature_cache.h.

2383 {
2385  FlushPipeCCM();
2386  __RWMB();
2387 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_WBINVAL_ALL, CSR_CCM_MCOMMAND, and FlushPipeCCM().

◆ MFlushInvalDCacheCCache()

__STATIC_INLINE int32_t MFlushInvalDCacheCCache ( void  )

Flush and invalidate all D-Cache and Cluster Cache in M-Mode.

This function flush and invalidate all D-Cache and Cluster Cache. Command CCM_DC_WBINVAL_ALL is written to CSR CSR_CCM_MCOMMAND.

Remarks
This function must be executed in M-Mode only.
Returns
Operation result, see enum SMPCC_CMD_RESULT

Definition at line 2668 of file core_feature_cache.h.

2669 {
2671  FlushPipeCCM();
2672  SMPCC_CMD->CC_mCMD = (SMPCC_CMD->CC_mCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2673  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WBINVAL_ALL);
2674  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_mCMD) == 0);
2675  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_mCMD);
2676  __RWMB();
2677  return res;
2678 }

References __RV_CSR_WRITE, __RWMB, _FLD2VAL, _VAL2FLD, CCM_DC_WBINVAL_ALL, CSR_CCM_MCOMMAND, FlushPipeCCM(), SMPCC_CMD, SMPCC_CMD_xCMD_CMD_Msk, and SMPCC_CMD_xCMD_CMD_WBINVAL_ALL.

◆ MFlushInvalDCacheLine()

__STATIC_INLINE void MFlushInvalDCacheLine ( unsigned long  addr)

Flush and invalidate one D-Cache line specified by address in M-Mode.

This function flush and invalidate one D-Cache line specified by the address. Command CCM_DC_WBINVAL is written to CSR CSR_CCM_MCOMMAND.

Remarks
This function must be executed in M-Mode only.
Parameters
[in]addrstart address to be flushed and invalidated

Definition at line 1699 of file core_feature_cache.h.

1700 {
1703  FlushPipeCCM();
1704  __RWMB();
1705 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_WBINVAL, CSR_CCM_MBEGINADDR, CSR_CCM_MCOMMAND, and FlushPipeCCM().

Referenced by ECC_DCacheDRamErrInject(), ECC_DCacheErrRestore(), and ECC_DCacheTRamErrInject().

◆ MFlushInvalDCacheLines()

__STATIC_INLINE void MFlushInvalDCacheLines ( unsigned long  addr,
unsigned long  cnt 
)

Flush and invalidate several D-Cache lines specified by address in M-Mode.

This function flush and invalidate several D-Cache lines specified by the address and line count. Command CCM_DC_WBINVAL is written to CSR CSR_CCM_MCOMMAND.

Remarks
This function must be executed in M-Mode only.
Parameters
[in]addrstart address to be flushed and invalidated
[in]cntcount of cache lines to be flushed and invalidated

Definition at line 1718 of file core_feature_cache.h.

1719 {
1720  if (cnt > 0) {
1721  unsigned long i;
1723  for (i = 0; i < cnt; i++) {
1725  }
1726  FlushPipeCCM();
1727  __RWMB();
1728  }
1729 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_WBINVAL, CSR_CCM_MBEGINADDR, CSR_CCM_MCOMMAND, and FlushPipeCCM().

◆ MInvalDCache()

__STATIC_INLINE void MInvalDCache ( void  )

Invalidate all D-Cache lines in M-Mode.

This function invalidate all D-Cache lines. Command CCM_DC_INVAL_ALL is written to CSR CSR_CCM_MCOMMAND.

Remarks
This function must be executed in M-Mode only.
Parameters
[in]addrstart address to be invalidated

Definition at line 2284 of file core_feature_cache.h.

2285 {
2287  FlushPipeCCM();
2288  __RWMB();
2289 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_INVAL_ALL, CSR_CCM_MCOMMAND, and FlushPipeCCM().

◆ MInvalDCacheCCache()

__STATIC_INLINE void MInvalDCacheCCache ( void  )

Invalidate all D-Cache and Cluster Cache in M-Mode.

This function unlock and invalidate all D-Cache and Cluster Cache. Command CCM_DC_INVAL_ALL is written to CSR CSR_CCM_MCOMMAND.

Remarks
This function must be executed in M-Mode only.

Definition at line 2553 of file core_feature_cache.h.

2554 {
2556  FlushPipeCCM();
2557  SMPCC_CMD->CC_INVALID_ALL = _VAL2FLD(SMPCC_CMD_INVALID_ALL, 1);
2558  while(_FLD2VAL(SMPCC_CMD_INVALID_ALL, SMPCC_CMD->CC_INVALID_ALL));
2559  __RWMB();
2560 }

References __RV_CSR_WRITE, __RWMB, _FLD2VAL, _VAL2FLD, CCM_DC_INVAL_ALL, CSR_CCM_MCOMMAND, FlushPipeCCM(), and SMPCC_CMD.

◆ MInvalDCacheLine()

__STATIC_INLINE void MInvalDCacheLine ( unsigned long  addr)

Invalidate one D-Cache line specified by address in M-Mode.

This function unlock and invalidate one D-Cache line specified by the address. Command CCM_DC_INVAL is written to CSR CSR_CCM_MCOMMAND.

Remarks
This function must be executed in M-Mode only.
Parameters
[in]addrstart address to be invalidated

Definition at line 1451 of file core_feature_cache.h.

1452 {
1455  FlushPipeCCM();
1456  __RWMB();
1457 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_INVAL, CSR_CCM_MBEGINADDR, CSR_CCM_MCOMMAND, and FlushPipeCCM().

◆ MInvalDCacheLines()

__STATIC_INLINE void MInvalDCacheLines ( unsigned long  addr,
unsigned long  cnt 
)

Invalidate several D-Cache lines specified by address in M-Mode.

This function unlock and invalidate several D-Cache lines specified by the address and line count. Command CCM_DC_INVAL is written to CSR CSR_CCM_MCOMMAND.

Remarks
This function must be executed in M-Mode only.
Parameters
[in]addrstart address to be invalidated
[in]cntcount of cache lines to be invalidated

Definition at line 1470 of file core_feature_cache.h.

1471 {
1472  if (cnt > 0) {
1473  unsigned long i;
1475  for (i = 0; i < cnt; i++) {
1477  }
1478  FlushPipeCCM();
1479  __RWMB();
1480  }
1481 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_INVAL, CSR_CCM_MBEGINADDR, CSR_CCM_MCOMMAND, and FlushPipeCCM().

◆ MLockDCacheLine()

__STATIC_INLINE unsigned long MLockDCacheLine ( unsigned long  addr)

Lock one D-Cache line specified by address in M-Mode.

This function lock one D-Cache line specified by the address. Command CCM_DC_LOCK is written to CSR CSR_CCM_MCOMMAND.

Remarks
This function must be executed in M-Mode only.
Parameters
[in]addrstart address to be locked
Returns
result of CCM lock operation, see enum CCM_OP_FINFO

Definition at line 2012 of file core_feature_cache.h.

2013 {
2016  FlushPipeCCM();
2017  __RWMB();
2018  return __RV_CSR_READ(CSR_CCM_MDATA);
2019 }

References __RV_CSR_READ, __RV_CSR_WRITE, __RWMB, CCM_DC_LOCK, CSR_CCM_MBEGINADDR, CSR_CCM_MCOMMAND, CSR_CCM_MDATA, and FlushPipeCCM().

Referenced by ECC_DCacheErrRestore().

◆ MLockDCacheLines()

__STATIC_INLINE unsigned long MLockDCacheLines ( unsigned long  addr,
unsigned long  cnt 
)

Lock several D-Cache lines specified by address in M-Mode.

This function lock several D-Cache lines specified by the address and line count. Command CCM_DC_LOCK is written to CSR CSR_CCM_MCOMMAND.

Remarks
This function must be executed in M-Mode only.
Parameters
[in]addrstart address to be locked
[in]cntcount of cache lines to be locked
Returns
result of CCM lock operation, see enum CCM_OP_FINFO

Definition at line 2033 of file core_feature_cache.h.

2034 {
2035  if (cnt > 0) {
2036  unsigned long i;
2037  unsigned long fail_info = CCM_OP_SUCCESS;
2039  for (i = 0; i < cnt; i++) {
2041  FlushPipeCCM();
2042  __RWMB();
2043  fail_info = __RV_CSR_READ(CSR_CCM_MDATA);
2044  if (CCM_OP_SUCCESS != fail_info) {
2045  return fail_info;
2046  }
2047  }
2048  }
2049  return CCM_OP_SUCCESS;
2050 }

References __RV_CSR_READ, __RV_CSR_WRITE, __RWMB, CCM_DC_LOCK, CCM_OP_SUCCESS, CSR_CCM_MBEGINADDR, CSR_CCM_MCOMMAND, CSR_CCM_MDATA, and FlushPipeCCM().

◆ MUnlockDCacheLine()

__STATIC_INLINE void MUnlockDCacheLine ( unsigned long  addr)

Unlock one D-Cache line specified by address in M-Mode.

This function unlock one D-Cache line specified by the address. Command CCM_DC_UNLOCK is written to CSR CSR_CCM_MCOMMAND.

Remarks
This function must be executed in M-Mode only.
Parameters
[in]addrstart address to be unlocked

Definition at line 2161 of file core_feature_cache.h.

2162 {
2165  FlushPipeCCM();
2166  __RWMB();
2167 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_UNLOCK, CSR_CCM_MBEGINADDR, CSR_CCM_MCOMMAND, and FlushPipeCCM().

◆ MUnlockDCacheLines()

__STATIC_INLINE void MUnlockDCacheLines ( unsigned long  addr,
unsigned long  cnt 
)

Unlock several D-Cache lines specified by address in M-Mode.

This function unlock several D-Cache lines specified by the address and line count. Command CCM_DC_UNLOCK is written to CSR CSR_CCM_MCOMMAND.

Remarks
This function must be executed in M-Mode only.
Parameters
[in]addrstart address to be unlocked
[in]cntcount of cache lines to be unlocked

Definition at line 2180 of file core_feature_cache.h.

2181 {
2182  if (cnt > 0) {
2183  unsigned long i;
2185  for (i = 0; i < cnt; i++) {
2187  }
2188  FlushPipeCCM();
2189  __RWMB();
2190  }
2191 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_UNLOCK, CSR_CCM_MBEGINADDR, CSR_CCM_MCOMMAND, and FlushPipeCCM().

◆ SFlushCCache()

__STATIC_INLINE int32_t SFlushCCache ( void  )

Flush all Cluster Cache in S-Mode.

This function flush all Cluster Cache. Command SMPCC_CMD_WB_ALL is written to SMPCC CMD register.

Remarks
This function must be executed in M/S-Mode only.
Returns
Operation result, see enum SMPCC_CMD_RESULT

Definition at line 2453 of file core_feature_cache.h.

2454 {
2455  /* Clear pending error status before issuing the Cluster Cache command.
2456  * RESC/FESC/BESC are write-1-to-clear bits, so read the status and write it back. */
2457  SMPCC_CMD->CC_sCMD = (SMPCC_CMD->CC_sCMD & SMPCC_CMD_xCMD_STATUS_Msk);
2458  SMPCC_CMD->CC_sCMD = (SMPCC_CMD->CC_sCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2459  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WB_ALL);
2460  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_sCMD) == 0);
2461  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_sCMD);
2462  __RWMB();
2463  return res;
2464 }

References __RWMB, _FLD2VAL, _VAL2FLD, SMPCC_CMD, SMPCC_CMD_xCMD_CMD_Msk, SMPCC_CMD_xCMD_CMD_WB_ALL, and SMPCC_CMD_xCMD_STATUS_Msk.

◆ SFlushDCache()

__STATIC_INLINE void SFlushDCache ( void  )

Flush all D-Cache lines in S-Mode.

This function flush all D-Cache lines. Command CCM_DC_WB_ALL is written to CSR CSR_CCM_SCOMMAND.

Remarks
This function must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be flushed

Definition at line 2350 of file core_feature_cache.h.

2351 {
2353  FlushPipeCCM();
2354  __RWMB();
2355 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_WB_ALL, CSR_CCM_SCOMMAND, and FlushPipeCCM().

◆ SFlushDCacheCCache()

__STATIC_INLINE int32_t SFlushDCacheCCache ( void  )

Flush all D-Cache and Cluster Cache in S-Mode.

This function flush all D-Cache and Cluster Cache. Command CCM_DC_WB_ALL is written to CSR CSR_CCM_SCOMMAND.

Remarks
This function must be executed in M/S-Mode only.
Returns
Operation result, see enum SMPCC_CMD_RESULT

Definition at line 2626 of file core_feature_cache.h.

2627 {
2629  FlushPipeCCM();
2630  SMPCC_CMD->CC_sCMD = (SMPCC_CMD->CC_sCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2631  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WB_ALL);
2632  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_sCMD) == 0);
2633  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_sCMD);
2634  __RWMB();
2635  return res;
2636 }

References __RV_CSR_WRITE, __RWMB, _FLD2VAL, _VAL2FLD, CCM_DC_WB_ALL, CSR_CCM_SCOMMAND, FlushPipeCCM(), SMPCC_CMD, SMPCC_CMD_xCMD_CMD_Msk, and SMPCC_CMD_xCMD_CMD_WB_ALL.

◆ SFlushDCacheLine()

__STATIC_INLINE void SFlushDCacheLine ( unsigned long  addr)

Flush one D-Cache line specified by address in S-Mode.

This function flush one D-Cache line specified by the address. Command CCM_DC_WB is written to CSR CSR_CCM_SCOMMAND.

Remarks
This function must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be flushed

Definition at line 1617 of file core_feature_cache.h.

1618 {
1621  FlushPipeCCM();
1622  __RWMB();
1623 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_WB, CSR_CCM_SBEGINADDR, CSR_CCM_SCOMMAND, and FlushPipeCCM().

Referenced by __ECLIC_SetVector_S().

◆ SFlushDCacheLines()

__STATIC_INLINE void SFlushDCacheLines ( unsigned long  addr,
unsigned long  cnt 
)

Flush several D-Cache lines specified by address in S-Mode.

This function flush several D-Cache lines specified by the address and line count. Command CCM_DC_WB is written to CSR CSR_CCM_SCOMMAND.

Remarks
This function must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be flushed
[in]cntcount of cache lines to be flushed

Definition at line 1636 of file core_feature_cache.h.

1637 {
1638  if (cnt > 0) {
1639  unsigned long i;
1641  for (i = 0; i < cnt; i++) {
1643  }
1644  FlushPipeCCM();
1645  __RWMB();
1646  }
1647 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_WB, CSR_CCM_SBEGINADDR, CSR_CCM_SCOMMAND, and FlushPipeCCM().

◆ SFlushInvalCCache()

__STATIC_INLINE int32_t SFlushInvalCCache ( void  )

Flush and invalidate all Cluster Cache in S-Mode.

This function flush and invalidate all Cluster Cache. Command SMPCC_CMD_WBINVAL_ALL is written to SMPCC CMD register.

Remarks
This function must be executed in M/S-Mode only.
Returns
Operation result, see enum SMPCC_CMD_RESULT

Definition at line 2516 of file core_feature_cache.h.

2517 {
2518  SMPCC_CMD->CC_sCMD = (SMPCC_CMD->CC_sCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2519  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WBINVAL_ALL);
2520  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_sCMD) == 0);
2521  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_sCMD);
2522  __RWMB();
2523  return res;
2524 }

References __RWMB, _FLD2VAL, _VAL2FLD, SMPCC_CMD, SMPCC_CMD_xCMD_CMD_Msk, and SMPCC_CMD_xCMD_CMD_WBINVAL_ALL.

◆ SFlushInvalDCache()

__STATIC_INLINE void SFlushInvalDCache ( void  )

Flush and invalidate all D-Cache lines in S-Mode.

This function flush and invalidate all D-Cache lines. Command CCM_DC_WBINVAL_ALL is written to CSR CSR_CCM_SCOMMAND.

Remarks
This function must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be flushed and locked

Definition at line 2398 of file core_feature_cache.h.

2399 {
2401  FlushPipeCCM();
2402  __RWMB();
2403 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_WBINVAL_ALL, CSR_CCM_SCOMMAND, and FlushPipeCCM().

◆ SFlushInvalDCacheCCache()

__STATIC_INLINE int32_t SFlushInvalDCacheCCache ( void  )

Flush and invalidate all D-Cache and Cluster Cache in S-Mode.

This function flush and invalidate all D-Cache and Cluster Cache. Command CCM_DC_WBINVAL_ALL is written to CSR CSR_CCM_SCOMMAND.

Remarks
This function must be executed in M/S-Mode only.
Returns
Operation result, see enum SMPCC_CMD_RESULT

Definition at line 2689 of file core_feature_cache.h.

2690 {
2692  FlushPipeCCM();
2693  SMPCC_CMD->CC_sCMD = (SMPCC_CMD->CC_sCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2694  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WBINVAL_ALL);
2695  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_sCMD) == 0);
2696  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_sCMD);
2697  __RWMB();
2698  return res;
2699 }

References __RV_CSR_WRITE, __RWMB, _FLD2VAL, _VAL2FLD, CCM_DC_WBINVAL_ALL, CSR_CCM_SCOMMAND, FlushPipeCCM(), SMPCC_CMD, SMPCC_CMD_xCMD_CMD_Msk, and SMPCC_CMD_xCMD_CMD_WBINVAL_ALL.

◆ SFlushInvalDCacheLine()

__STATIC_INLINE void SFlushInvalDCacheLine ( unsigned long  addr)

Flush and invalidate one D-Cache line specified by address in S-Mode.

This function flush and invalidate one D-Cache line specified by the address. Command CCM_DC_WBINVAL is written to CSR CSR_CCM_SCOMMAND.

Remarks
This function must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be flushed and invalidated

Definition at line 1740 of file core_feature_cache.h.

1741 {
1744  FlushPipeCCM();
1745  __RWMB();
1746 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_WBINVAL, CSR_CCM_SBEGINADDR, CSR_CCM_SCOMMAND, and FlushPipeCCM().

◆ SFlushInvalDCacheLines()

__STATIC_INLINE void SFlushInvalDCacheLines ( unsigned long  addr,
unsigned long  cnt 
)

Flush and invalidate several D-Cache lines specified by address in S-Mode.

This function flush and invalidate several D-Cache lines specified by the address and line count. Command CCM_DC_WBINVAL is written to CSR CSR_CCM_SCOMMAND.

Remarks
This function must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be flushed and invalidated
[in]cntcount of cache lines to be flushed and invalidated

Definition at line 1759 of file core_feature_cache.h.

1760 {
1761  if (cnt > 0) {
1762  unsigned long i;
1764  for (i = 0; i < cnt; i++) {
1766  }
1767  FlushPipeCCM();
1768  __RWMB();
1769  }
1770 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_WBINVAL, CSR_CCM_SBEGINADDR, CSR_CCM_SCOMMAND, and FlushPipeCCM().

◆ SInvalDCache()

__STATIC_INLINE void SInvalDCache ( void  )

Invalidate all D-Cache lines in S-Mode.

This function invalidate all D-Cache lines. Command CCM_DC_INVAL_ALL is written to CSR CSR_CCM_SCOMMAND.

Remarks
This function must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be invalidated

Definition at line 2300 of file core_feature_cache.h.

2301 {
2303  FlushPipeCCM();
2304  __RWMB();
2305 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_INVAL_ALL, CSR_CCM_SCOMMAND, and FlushPipeCCM().

◆ SInvalDCacheCCache()

__STATIC_INLINE void SInvalDCacheCCache ( void  )

Invalidate all D-Cache and Cluster Cache in S-Mode.

This function unlock and invalidate all D-Cache and Cluster Cache. Command CCM_DC_INVAL_ALL is written to CSR CSR_CCM_SCOMMAND.

Remarks
This function must be executed in M/S-Mode only.

Definition at line 2570 of file core_feature_cache.h.

2571 {
2573  FlushPipeCCM();
2574  SMPCC_CMD->CC_INVALID_ALL = _VAL2FLD(SMPCC_CMD_INVALID_ALL, 1);
2575  while(_FLD2VAL(SMPCC_CMD_INVALID_ALL, SMPCC_CMD->CC_INVALID_ALL));
2576  __RWMB();
2577 }

References __RV_CSR_WRITE, __RWMB, _FLD2VAL, _VAL2FLD, CCM_DC_INVAL_ALL, CSR_CCM_SCOMMAND, FlushPipeCCM(), and SMPCC_CMD.

◆ SInvalDCacheLine()

__STATIC_INLINE void SInvalDCacheLine ( unsigned long  addr)

Invalidate one D-Cache line specified by address in S-Mode.

This function unlock and invalidate one D-Cache line specified by the address. Command CCM_DC_INVAL is written to CSR CSR_CCM_MCOMMAND.

Remarks
This function must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be invalidated

Definition at line 1493 of file core_feature_cache.h.

1494 {
1497  FlushPipeCCM();
1498  __RWMB();
1499 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_INVAL, CSR_CCM_SBEGINADDR, CSR_CCM_SCOMMAND, and FlushPipeCCM().

◆ SInvalDCacheLines()

__STATIC_INLINE void SInvalDCacheLines ( unsigned long  addr,
unsigned long  cnt 
)

Invalidate several D-Cache lines specified by address in S-Mode.

This function unlock and invalidate several D-Cache lines specified by the address and line count. Command CCM_DC_INVAL is written to CSR CSR_CCM_SCOMMAND.

Remarks
This function must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be invalidated
[in]cntcount of cache lines to be invalidated

Definition at line 1512 of file core_feature_cache.h.

1513 {
1514  if (cnt > 0) {
1515  unsigned long i;
1517  for (i = 0; i < cnt; i++) {
1519  }
1520  FlushPipeCCM();
1521  __RWMB();
1522  }
1523 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_INVAL, CSR_CCM_SBEGINADDR, CSR_CCM_SCOMMAND, and FlushPipeCCM().

◆ SLockDCacheLine()

__STATIC_INLINE unsigned long SLockDCacheLine ( unsigned long  addr)

Lock one D-Cache line specified by address in S-Mode.

This function lock one D-Cache line specified by the address. Command CCM_DC_LOCK is written to CSR CSR_CCM_SCOMMAND.

Remarks
This function must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be locked
Returns
result of CCM lock operation, see enum CCM_OP_FINFO

Definition at line 2062 of file core_feature_cache.h.

2063 {
2066  FlushPipeCCM();
2067  __RWMB();
2068  return __RV_CSR_READ(CSR_CCM_SDATA);
2069 }

References __RV_CSR_READ, __RV_CSR_WRITE, __RWMB, CCM_DC_LOCK, CSR_CCM_SBEGINADDR, CSR_CCM_SCOMMAND, CSR_CCM_SDATA, and FlushPipeCCM().

◆ SLockDCacheLines()

__STATIC_INLINE unsigned long SLockDCacheLines ( unsigned long  addr,
unsigned long  cnt 
)

Lock several D-Cache lines specified by address in S-Mode.

This function lock several D-Cache lines specified by the address and line count. Command CCM_DC_LOCK is written to CSR CSR_CCM_SCOMMAND.

Remarks
This function must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be locked
[in]cntcount of cache lines to be locked
Returns
result of CCM lock operation, see enum CCM_OP_FINFO

Definition at line 2083 of file core_feature_cache.h.

2084 {
2085  if (cnt > 0) {
2086  unsigned long i;
2087  unsigned long fail_info = CCM_OP_SUCCESS;
2089  for (i = 0; i < cnt; i++) {
2091  FlushPipeCCM();
2092  __RWMB();
2093  fail_info = __RV_CSR_READ(CSR_CCM_SDATA);
2094  if (CCM_OP_SUCCESS != fail_info) {
2095  return fail_info;
2096  }
2097  }
2098  }
2099  return CCM_OP_SUCCESS;
2100 }

References __RV_CSR_READ, __RV_CSR_WRITE, __RWMB, CCM_DC_LOCK, CCM_OP_SUCCESS, CSR_CCM_SBEGINADDR, CSR_CCM_SCOMMAND, CSR_CCM_SDATA, and FlushPipeCCM().

◆ SUnlockDCacheLine()

__STATIC_INLINE void SUnlockDCacheLine ( unsigned long  addr)

Unlock one D-Cache line specified by address in S-Mode.

This function unlock one D-Cache line specified by the address. Command CCM_DC_UNLOCK is written to CSR CSR_CCM_SCOMMAND.

Remarks
This function must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be unlocked

Definition at line 2202 of file core_feature_cache.h.

2203 {
2206  FlushPipeCCM();
2207  __RWMB();
2208 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_UNLOCK, CSR_CCM_SBEGINADDR, CSR_CCM_SCOMMAND, and FlushPipeCCM().

◆ SUnlockDCacheLines()

__STATIC_INLINE void SUnlockDCacheLines ( unsigned long  addr,
unsigned long  cnt 
)

Unlock several D-Cache lines specified by address in S-Mode.

This function unlock several D-Cache lines specified by the address and line count. Command CCM_DC_UNLOCK is written to CSR CSR_CCM_SCOMMAND.

Remarks
This function must be executed in M/S-Mode only.
Parameters
[in]addrstart address to be unlocked
[in]cntcount of cache lines to be unlocked

Definition at line 2221 of file core_feature_cache.h.

2222 {
2223  if (cnt > 0) {
2224  unsigned long i;
2226  for (i = 0; i < cnt; i++) {
2228  }
2229  FlushPipeCCM();
2230  __RWMB();
2231  }
2232 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_UNLOCK, CSR_CCM_SBEGINADDR, CSR_CCM_SCOMMAND, and FlushPipeCCM().

◆ UFlushCCache()

__STATIC_INLINE int32_t UFlushCCache ( void  )

Flush all Cluster Cache in U-Mode.

This function flush all Cluster Cache. Command SMPCC_CMD_WB_ALL is written to SMPCC CMD register.

Remarks
This function must be executed in M/S/U-Mode only.
Returns
Operation result, see enum SMPCC_CMD_RESULT

Definition at line 2475 of file core_feature_cache.h.

2476 {
2477  /* Clear pending error status before issuing the Cluster Cache command.
2478  * RESC/FESC/BESC are write-1-to-clear bits, so read the status and write it back. */
2479  SMPCC_CMD->CC_uCMD = (SMPCC_CMD->CC_uCMD & SMPCC_CMD_xCMD_STATUS_Msk);
2480  SMPCC_CMD->CC_uCMD = (SMPCC_CMD->CC_uCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2481  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WB_ALL);
2482  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_uCMD) == 0);
2483  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_uCMD);
2484  __RWMB();
2485  return res;
2486 }

References __RWMB, _FLD2VAL, _VAL2FLD, SMPCC_CMD, SMPCC_CMD_xCMD_CMD_Msk, SMPCC_CMD_xCMD_CMD_WB_ALL, and SMPCC_CMD_xCMD_STATUS_Msk.

◆ UFlushDCache()

__STATIC_INLINE void UFlushDCache ( void  )

Flush all D-Cache lines in U-Mode.

This function flush all D-Cache lines. Command CCM_DC_WB_ALL is written to CSR CSR_CCM_UCOMMAND.

Remarks
This function must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be flushed

Definition at line 2366 of file core_feature_cache.h.

2367 {
2369  FlushPipeCCM();
2370  __RWMB();
2371 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_WB_ALL, CSR_CCM_UCOMMAND, and FlushPipeCCM().

◆ UFlushDCacheCCache()

__STATIC_INLINE int32_t UFlushDCacheCCache ( void  )

Flush all D-Cache and Cluster Cache in U-Mode.

This function flush all D-Cache and Cluster Cache. Command CCM_DC_WB_ALL is written to CSR CSR_CCM_UCOMMAND.

Remarks
This function must be executed in M/S/U-Mode only.
Returns
Operation result, see enum SMPCC_CMD_RESULT

Definition at line 2647 of file core_feature_cache.h.

2648 {
2650  FlushPipeCCM();
2651  SMPCC_CMD->CC_uCMD = (SMPCC_CMD->CC_uCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2652  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WB_ALL);
2653  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_uCMD) == 0);
2654  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_uCMD);
2655  __RWMB();
2656  return res;
2657 }

References __RV_CSR_WRITE, __RWMB, _FLD2VAL, _VAL2FLD, CCM_DC_WB_ALL, CSR_CCM_UCOMMAND, FlushPipeCCM(), SMPCC_CMD, SMPCC_CMD_xCMD_CMD_Msk, and SMPCC_CMD_xCMD_CMD_WB_ALL.

◆ UFlushDCacheLine()

__STATIC_INLINE void UFlushDCacheLine ( unsigned long  addr)

Flush one D-Cache line specified by address in U-Mode.

This function flush one D-Cache line specified by the address. Command CCM_DC_WB is written to CSR CSR_CCM_UCOMMAND.

Remarks
This function must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be flushed

Definition at line 1658 of file core_feature_cache.h.

1659 {
1662  FlushPipeCCM();
1663  __RWMB();
1664 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_WB, CSR_CCM_UBEGINADDR, CSR_CCM_UCOMMAND, and FlushPipeCCM().

◆ UFlushDCacheLines()

__STATIC_INLINE void UFlushDCacheLines ( unsigned long  addr,
unsigned long  cnt 
)

Flush several D-Cache lines specified by address in U-Mode.

This function flush several D-Cache lines specified by the address and line count. Command CCM_DC_WB is written to CSR CSR_CCM_UCOMMAND.

Remarks
This function must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be flushed
[in]cntcount of cache lines to be flushed

Definition at line 1677 of file core_feature_cache.h.

1678 {
1679  if (cnt > 0) {
1680  unsigned long i;
1682  for (i = 0; i < cnt; i++) {
1684  }
1685  FlushPipeCCM();
1686  __RWMB();
1687  }
1688 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_WB, CSR_CCM_UBEGINADDR, CSR_CCM_UCOMMAND, and FlushPipeCCM().

◆ UFlushInvalCCache()

__STATIC_INLINE int32_t UFlushInvalCCache ( void  )

Flush and invalidate all Cluster Cache in U-Mode.

This function flush and invalidate all Cluster Cache. Command SMPCC_CMD_WBINVAL_ALL is written to SMPCC CMD register.

Remarks
This function must be executed in M/S/U-Mode only.
Returns
Operation result, see enum SMPCC_CMD_RESULT

Definition at line 2535 of file core_feature_cache.h.

2536 {
2537  SMPCC_CMD->CC_uCMD = (SMPCC_CMD->CC_uCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2538  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WBINVAL_ALL);
2539  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_uCMD) == 0);
2540  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_uCMD);
2541  __RWMB();
2542  return res;
2543 }

References __RWMB, _FLD2VAL, _VAL2FLD, SMPCC_CMD, SMPCC_CMD_xCMD_CMD_Msk, and SMPCC_CMD_xCMD_CMD_WBINVAL_ALL.

◆ UFlushInvalDCache()

__STATIC_INLINE void UFlushInvalDCache ( void  )

Flush and invalidate all D-Cache lines in U-Mode.

This function flush and invalidate all D-Cache lines. Command CCM_DC_WBINVAL_ALL is written to CSR CSR_CCM_UCOMMAND.

Remarks
This function must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be flushed and locked

Definition at line 2414 of file core_feature_cache.h.

2415 {
2417  FlushPipeCCM();
2418  __RWMB();
2419 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_WBINVAL_ALL, CSR_CCM_UCOMMAND, and FlushPipeCCM().

◆ UFlushInvalDCacheCCache()

__STATIC_INLINE int32_t UFlushInvalDCacheCCache ( void  )

Flush and invalidate all D-Cache and Cluster Cache in U-Mode.

This function flush and invalidate all D-Cache and Cluster Cache. Command CCM_DC_WBINVAL_ALL is written to CSR CSR_CCM_UCOMMAND.

Remarks
This function must be executed in M/S/U-Mode only.
Returns
Operation result, see enum SMPCC_CMD_RESULT

Definition at line 2710 of file core_feature_cache.h.

2711 {
2713  FlushPipeCCM();
2714  SMPCC_CMD->CC_uCMD = (SMPCC_CMD->CC_uCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2715  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WBINVAL_ALL);
2716  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_uCMD) == 0);
2717  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_uCMD);
2718  __RWMB();
2719  return res;
2720 }

References __RV_CSR_WRITE, __RWMB, _FLD2VAL, _VAL2FLD, CCM_DC_WBINVAL_ALL, CSR_CCM_UCOMMAND, FlushPipeCCM(), SMPCC_CMD, SMPCC_CMD_xCMD_CMD_Msk, and SMPCC_CMD_xCMD_CMD_WBINVAL_ALL.

◆ UFlushInvalDCacheLine()

__STATIC_INLINE void UFlushInvalDCacheLine ( unsigned long  addr)

Flush and invalidate one D-Cache line specified by address in U-Mode.

This function flush and invalidate one D-Cache line specified by the address. Command CCM_DC_WBINVAL is written to CSR CSR_CCM_UCOMMAND.

Remarks
This function must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be flushed and invalidated

Definition at line 1781 of file core_feature_cache.h.

1782 {
1785  FlushPipeCCM();
1786  __RWMB();
1787 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_WBINVAL, CSR_CCM_UBEGINADDR, CSR_CCM_UCOMMAND, and FlushPipeCCM().

◆ UFlushInvalDCacheLines()

__STATIC_INLINE void UFlushInvalDCacheLines ( unsigned long  addr,
unsigned long  cnt 
)

Flush and invalidate several D-Cache lines specified by address in U-Mode.

This function flush and invalidate several D-Cache lines specified by the address and line count. Command CCM_DC_WBINVAL is written to CSR CSR_CCM_UCOMMAND.

Remarks
This function must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be flushed and invalidated
[in]cntcount of cache lines to be flushed and invalidated

Definition at line 1800 of file core_feature_cache.h.

1801 {
1802  if (cnt > 0) {
1803  unsigned long i;
1805  for (i = 0; i < cnt; i++) {
1807  }
1808  FlushPipeCCM();
1809  __RWMB();
1810  }
1811 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_WBINVAL, CSR_CCM_UBEGINADDR, CSR_CCM_UCOMMAND, and FlushPipeCCM().

◆ UInvalDCache()

__STATIC_INLINE void UInvalDCache ( void  )

Invalidate all D-Cache lines in U-Mode.

This function invalidate all D-Cache lines. In U-Mode, this operation will be automatically translated to flush and invalidate operations by hardware. Command CCM_DC_INVAL_ALL is written to CSR CSR_CCM_UCOMMAND.

Remarks
This function must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be invalidated

Definition at line 2318 of file core_feature_cache.h.

2319 {
2321  FlushPipeCCM();
2322  __RWMB();
2323 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_INVAL_ALL, CSR_CCM_UCOMMAND, and FlushPipeCCM().

◆ UInvalDCacheCCache()

__STATIC_INLINE void UInvalDCacheCCache ( void  )

Invalidate all D-Cache and Cluster Cache in U-Mode.

This function unlock and invalidate all D-Cache and Cluster Cache. Command CCM_DC_INVAL_ALL is written to CSR CSR_CCM_UCOMMAND.

Remarks
This function must be executed in M/S/U-Mode only.

Definition at line 2587 of file core_feature_cache.h.

2588 {
2590  FlushPipeCCM();
2591  SMPCC_CMD->CC_INVALID_ALL = _VAL2FLD(SMPCC_CMD_INVALID_ALL, 1);
2592  while(_FLD2VAL(SMPCC_CMD_INVALID_ALL, SMPCC_CMD->CC_INVALID_ALL));
2593  __RWMB();
2594 }

References __RV_CSR_WRITE, __RWMB, _FLD2VAL, _VAL2FLD, CCM_DC_INVAL_ALL, CSR_CCM_UCOMMAND, FlushPipeCCM(), and SMPCC_CMD.

◆ UInvalDCacheLine()

__STATIC_INLINE void UInvalDCacheLine ( unsigned long  addr)

Invalidate one D-Cache line specified by address in U-Mode.

This function unlock and invalidate one D-Cache line specified by the address. Command CCM_DC_INVAL is written to CSR CSR_CCM_UCOMMAND.

Remarks
This function must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be invalidated

Definition at line 1535 of file core_feature_cache.h.

1536 {
1539  FlushPipeCCM();
1540  __RWMB();
1541 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_INVAL, CSR_CCM_UBEGINADDR, CSR_CCM_UCOMMAND, and FlushPipeCCM().

◆ UInvalDCacheLines()

__STATIC_INLINE void UInvalDCacheLines ( unsigned long  addr,
unsigned long  cnt 
)

Invalidate several D-Cache lines specified by address in U-Mode.

This function unlock and invalidate several D-Cache lines specified by the address and line count. Command CCM_DC_INVAL is written to CSR CSR_CCM_UCOMMAND.

Remarks
This function must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be invalidated
[in]cntcount of cache lines to be invalidated

Definition at line 1554 of file core_feature_cache.h.

1555 {
1556  if (cnt > 0) {
1557  unsigned long i;
1559  for (i = 0; i < cnt; i++) {
1561  }
1562  FlushPipeCCM();
1563  __RWMB();
1564  }
1565 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_INVAL, CSR_CCM_UBEGINADDR, CSR_CCM_UCOMMAND, and FlushPipeCCM().

◆ ULockDCacheLine()

__STATIC_INLINE unsigned long ULockDCacheLine ( unsigned long  addr)

Lock one D-Cache line specified by address in U-Mode.

This function lock one D-Cache line specified by the address. Command CCM_DC_LOCK is written to CSR CSR_CCM_UCOMMAND.

Remarks
This function must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be locked
Returns
result of CCM lock operation, see enum CCM_OP_FINFO

Definition at line 2112 of file core_feature_cache.h.

2113 {
2116  FlushPipeCCM();
2117  __RWMB();
2118  return __RV_CSR_READ(CSR_CCM_UDATA);
2119 }

References __RV_CSR_READ, __RV_CSR_WRITE, __RWMB, CCM_DC_LOCK, CSR_CCM_UBEGINADDR, CSR_CCM_UCOMMAND, CSR_CCM_UDATA, and FlushPipeCCM().

◆ ULockDCacheLines()

__STATIC_INLINE unsigned long ULockDCacheLines ( unsigned long  addr,
unsigned long  cnt 
)

Lock several D-Cache lines specified by address in U-Mode.

This function lock several D-Cache lines specified by the address and line count. Command CCM_DC_LOCK is written to CSR CSR_CCM_UCOMMAND.

Remarks
This function must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be locked
[in]cntcount of cache lines to be locked
Returns
result of CCM lock operation, see enum CCM_OP_FINFO

Definition at line 2133 of file core_feature_cache.h.

2134 {
2135  if (cnt > 0) {
2136  unsigned long i;
2137  unsigned long fail_info = CCM_OP_SUCCESS;
2139  for (i = 0; i < cnt; i++) {
2141  FlushPipeCCM();
2142  __RWMB();
2143  fail_info = __RV_CSR_READ(CSR_CCM_UDATA);
2144  if (CCM_OP_SUCCESS != fail_info) {
2145  return fail_info;
2146  }
2147  }
2148  }
2149  return CCM_OP_SUCCESS;
2150 }

References __RV_CSR_READ, __RV_CSR_WRITE, __RWMB, CCM_DC_LOCK, CCM_OP_SUCCESS, CSR_CCM_UBEGINADDR, CSR_CCM_UCOMMAND, CSR_CCM_UDATA, and FlushPipeCCM().

◆ UUnlockDCacheLine()

__STATIC_INLINE void UUnlockDCacheLine ( unsigned long  addr)

Unlock one D-Cache line specified by address in U-Mode.

This function unlock one D-Cache line specified by the address. Command CCM_DC_UNLOCK is written to CSR CSR_CCM_UCOMMAND.

Remarks
This function must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be unlocked

Definition at line 2243 of file core_feature_cache.h.

2244 {
2247  FlushPipeCCM();
2248  __RWMB();
2249 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_UNLOCK, CSR_CCM_UBEGINADDR, CSR_CCM_UCOMMAND, and FlushPipeCCM().

◆ UUnlockDCacheLines()

__STATIC_INLINE void UUnlockDCacheLines ( unsigned long  addr,
unsigned long  cnt 
)

Unlock several D-Cache lines specified by address in U-Mode.

This function unlock several D-Cache lines specified by the address and line count. Command CCM_DC_UNLOCK is written to CSR CSR_CCM_UCOMMAND.

Remarks
This function must be executed in M/S/U-Mode only.
Parameters
[in]addrstart address to be unlocked
[in]cntcount of cache lines to be unlocked

Definition at line 2262 of file core_feature_cache.h.

2263 {
2264  if (cnt > 0) {
2265  unsigned long i;
2267  for (i = 0; i < cnt; i++) {
2269  }
2270  FlushPipeCCM();
2271  __RWMB();
2272  }
2273 }

References __RV_CSR_WRITE, __RWMB, CCM_DC_UNLOCK, CSR_CCM_UBEGINADDR, CSR_CCM_UCOMMAND, and FlushPipeCCM().

CSR_MDCFGINFO_Type::way
rv_csr_t way
bit: 4..6 D-Cache way
Definition: core_feature_base.h:457
CSR_MDCFGINFO_Type::d
rv_csr_t d
Type used for csr data access.
Definition: core_feature_base.h:465
CSR_CCM_MBEGINADDR
#define CSR_CCM_MBEGINADDR
Definition: riscv_encoding.h:1129
__RV_CSR_CLEAR
#define __RV_CSR_CLEAR(csr, val)
CSR operation Macro for csrc instruction.
Definition: core_feature_base.h:799
CCM_DC_LOCK
@ CCM_DC_LOCK
Lock the specific D-Cache line specified by CSR CCM_XBEGINADDR.
Definition: core_feature_cache.h:157
SMPCC_CMD_xCMD_CMD_Msk
#define SMPCC_CMD_xCMD_CMD_Msk
SMPCC_CMD register xCMD field CMD Mask.
Definition: core_feature_cache.h:84
CSR_MDCFGINFO_Type
Union type to access MDCFG_INFO CSR register.
Definition: core_feature_base.h:454
CSR_MCFG_INFO
#define CSR_MCFG_INFO
Definition: riscv_encoding.h:1111
__RV_CSR_WRITE
#define __RV_CSR_WRITE(csr, val)
CSR operation Macro for csrw instruction.
Definition: core_feature_base.h:725
SMPCC_CMD_xCMD_CMD_WBINVAL_ALL
#define SMPCC_CMD_xCMD_CMD_WBINVAL_ALL
SMPCC_CMD xCMD CMD WBINVAL_ALL.
Definition: core_feature_cache.h:86
SMPCC_CMD_xCMD_STATUS_Msk
#define SMPCC_CMD_xCMD_STATUS_Msk
SMPCC_CMD register xCMD field RESC/FESC/BESC Mask.
Definition: core_feature_cache.h:89
FlushPipeCCM
__STATIC_FORCEINLINE void FlushPipeCCM(void)
Flush pipeline after CCM operation.
Definition: core_feature_cache.h:236
CSR_CCM_SDATA
#define CSR_CCM_SDATA
Definition: riscv_encoding.h:1135
CSR_CCM_UDATA
#define CSR_CCM_UDATA
Definition: riscv_encoding.h:1138
SMPCC_CMD
#define SMPCC_CMD
SMPCC CMD configuration struct.
Definition: core_feature_cache.h:112
_FLD2VAL
#define _FLD2VAL(field, value)
Mask and shift a register value to extract a bit filed value.
Definition: nmsis_compiler.h:99
CCM_DC_WBINVAL_ALL
@ CCM_DC_WBINVAL_ALL
Unlock and flush and invalidate all the valid and dirty D-Cache lines.
Definition: core_feature_cache.h:159
CCM_OP_SUCCESS
@ CCM_OP_SUCCESS
Lock Succeed.
Definition: core_feature_cache.h:143
CSR_CCM_MDATA
#define CSR_CCM_MDATA
Definition: riscv_encoding.h:1131
CCM_DC_UNLOCK
@ CCM_DC_UNLOCK
Unlock the specific D-Cache line specified by CSR CCM_XBEGINADDR.
Definition: core_feature_cache.h:158
CCM_DC_WB_ALL
@ CCM_DC_WB_ALL
Flush all the valid and dirty D-Cache lines.
Definition: core_feature_cache.h:160
CSR_MCACHE_CTL
#define CSR_MCACHE_CTL
Definition: riscv_encoding.h:1020
MCACHE_CTL_DC_ECC_EN
#define MCACHE_CTL_DC_ECC_EN
Definition: riscv_encoding.h:302
CSR_CCM_SBEGINADDR
#define CSR_CCM_SBEGINADDR
Definition: riscv_encoding.h:1133
CSR_MDCFGINFO_Type::set
rv_csr_t set
bit: 0..3 D-Cache sets per way
Definition: core_feature_base.h:456
__RV_CSR_READ
#define __RV_CSR_READ(csr)
CSR operation Macro for csrr instruction.
Definition: core_feature_base.h:707
CSR_CCM_SCOMMAND
#define CSR_CCM_SCOMMAND
Definition: riscv_encoding.h:1134
CCM_DC_WB
@ CCM_DC_WB
Flush the specific D-Cache line and Cluster Cache line specified by CSR CCM_XBEGINADDR.
Definition: core_feature_cache.h:155
__RV_CSR_SET
#define __RV_CSR_SET(csr, val)
CSR operation Macro for csrs instruction.
Definition: core_feature_base.h:762
CSR_MDCFGINFO_Type::b
struct CSR_MDCFGINFO_Type::@16 b
Structure used for bit access.
SMPCC_CMD_xCMD_CMD_WB_ALL
#define SMPCC_CMD_xCMD_CMD_WB_ALL
SMPCC_CMD xCMD CMD WB_ALL.
Definition: core_feature_cache.h:85
CCM_DC_INVAL_ALL
@ CCM_DC_INVAL_ALL
Unlock and invalidate all the D-Cache lines.
Definition: core_feature_cache.h:161
_VAL2FLD
#define _VAL2FLD(field, value)
Mask and shift a bit field value for use in a register bit range.
Definition: nmsis_compiler.h:84
CCM_DC_WBINVAL
@ CCM_DC_WBINVAL
Unlock, flush and invalidate the specific D-Cache line and Cluster Cache line specified by CSR CCM_XB...
Definition: core_feature_cache.h:156
CSR_CCM_MCOMMAND
#define CSR_CCM_MCOMMAND
Definition: riscv_encoding.h:1130
CCM_DC_INVAL
@ CCM_DC_INVAL
Unlock and invalidate D-Cache line and Cluster Cache line specified by CSR CCM_XBEGINADDR.
Definition: core_feature_cache.h:154
CSR_MDCFG_INFO
#define CSR_MDCFG_INFO
Definition: riscv_encoding.h:1110
CSR_CCM_UCOMMAND
#define CSR_CCM_UCOMMAND
Definition: riscv_encoding.h:1137
__RWMB
#define __RWMB()
Read & Write Memory barrier.
Definition: core_feature_base.h:850
MCACHE_CTL_DC_EN
#define MCACHE_CTL_DC_EN
Definition: riscv_encoding.h:301
CSR_CCM_UBEGINADDR
#define CSR_CCM_UBEGINADDR
Definition: riscv_encoding.h:1136
MCFG_INFO_DCACHE
#define MCFG_INFO_DCACHE
Definition: riscv_encoding.h:324
CSR_MDCFGINFO_Type::lsize
rv_csr_t lsize
bit: 7..9 D-Cache line size
Definition: core_feature_base.h:458