NMSIS-Core  Version 1.5.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 1882 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 1893 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 1944 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 1955 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 1820 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 1831 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 1903 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 1914 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 1965 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 1976 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 1841 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 1852 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 1924 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 1935 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 1986 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 1997 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 1862 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 1873 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 1342 of file core_feature_cache.h.

1343 {
1345  return 1;
1346  }
1347  return 0;
1348 }
#define MCFG_INFO_DCACHE
#define __RV_CSR_READ(csr)
CSR operation Macro for csrr instruction.
#define CSR_MCFG_INFO

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 1375 of file core_feature_cache.h.

1376 {
1378 }
#define MCACHE_CTL_DC_EN
#define __RV_CSR_CLEAR(csr, val)
CSR operation Macro for csrc instruction.
#define CSR_MCACHE_CTL

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 1405 of file core_feature_cache.h.

1406 {
1408 }
#define MCACHE_CTL_DC_ECC_EN

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 1360 of file core_feature_cache.h.

1361 {
1363 }
#define __RV_CSR_SET(csr, val)
CSR operation Macro for csrs instruction.

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 1390 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 1421 of file core_feature_cache.h.

1422 {
1423  if (info == NULL) {
1424  return -1;
1425  }
1426  CSR_MDCFGINFO_Type csr_ccfg;
1427  csr_ccfg.d = __RV_CSR_READ(CSR_MDCFG_INFO);
1428  info->setperway = (1UL << csr_ccfg.b.set) << 3;
1429  info->ways = (1 + csr_ccfg.b.way);
1430  if (csr_ccfg.b.lsize == 0) {
1431  info->linesize = 0;
1432  } else {
1433  info->linesize = (1UL << (csr_ccfg.b.lsize - 1)) << 3;
1434  }
1435  info->size = info->setperway * info->ways * info->linesize;
1436  return 0;
1437 }
#define CSR_MDCFG_INFO
uint32_t setperway
Cache set per way.
uint32_t ways
Cache ways.
uint32_t linesize
Cache Line size in bytes.
uint32_t size
Cache total size in bytes.
Union type to access MDCFG_INFO CSR register.
rv_csr_t set
bit: 0..3 D-Cache sets per way
struct CSR_MDCFGINFO_Type::@16 b
Structure used for bit access.
rv_csr_t d
Type used for csr data access.
rv_csr_t lsize
bit: 7..9 D-Cache line size
rv_csr_t way
bit: 4..6 D-Cache way

References __RV_CSR_READ, CSR_MDCFGINFO_Type::b, CSR_MDCFG_INFO, CSR_MDCFGINFO_Type::d, CacheInfo_Type::linesize, CSR_MDCFGINFO_Type::lsize, CSR_MDCFGINFO_Type::set, CacheInfo_Type::setperway, CacheInfo_Type::size, CSR_MDCFGINFO_Type::way, and CacheInfo_Type::ways.

◆ 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 2429 of file core_feature_cache.h.

2430 {
2431  SMPCC_CMD->CC_mCMD = (SMPCC_CMD->CC_mCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2432  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WB_ALL);
2433  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_mCMD) == 0);
2434  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_mCMD);
2435  __RWMB();
2436  return res;
2437 }
#define SMPCC_CMD
SMPCC CMD configuration struct.
#define SMPCC_CMD_xCMD_CMD_WB_ALL
SMPCC_CMD xCMD CMD WB_ALL.
#define SMPCC_CMD_xCMD_CMD_Msk
SMPCC_CMD register xCMD field CMD Mask.
#define __RWMB()
Read & Write Memory barrier.
#define _FLD2VAL(field, value)
Mask and shift a register value to extract a bit filed value.
#define _VAL2FLD(field, value)
Mask and shift a bit field value for use in a register bit range.

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

◆ 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 2332 of file core_feature_cache.h.

2333 {
2335  FlushPipeCCM();
2336  __RWMB();
2337 }
#define __RV_CSR_WRITE(csr, val)
CSR operation Macro for csrw instruction.
#define CSR_CCM_MCOMMAND
__STATIC_FORCEINLINE void FlushPipeCCM(void)
Flush pipeline after CCM operation.
@ CCM_DC_WB_ALL
Flush all the valid and dirty D-Cache lines.

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 2594 of file core_feature_cache.h.

2595 {
2597  FlushPipeCCM();
2598  SMPCC_CMD->CC_mCMD = (SMPCC_CMD->CC_mCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2599  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WB_ALL);
2600  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_mCMD) == 0);
2601  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_mCMD);
2602  __RWMB();
2603  return res;
2604 }

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 1574 of file core_feature_cache.h.

1575 {
1578  FlushPipeCCM();
1579  __RWMB();
1580 }
#define CSR_CCM_MBEGINADDR
@ CCM_DC_WB
Flush the specific D-Cache line and Cluster Cache line specified by CSR CCM_XBEGINADDR.

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 1593 of file core_feature_cache.h.

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

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 2486 of file core_feature_cache.h.

2487 {
2488  SMPCC_CMD->CC_mCMD = (SMPCC_CMD->CC_mCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2489  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WBINVAL_ALL);
2490  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_mCMD) == 0);
2491  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_mCMD);
2492  __RWMB();
2493  return res;
2494 }
#define SMPCC_CMD_xCMD_CMD_WBINVAL_ALL
SMPCC_CMD xCMD CMD WBINVAL_ALL.

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 2380 of file core_feature_cache.h.

2381 {
2383  FlushPipeCCM();
2384  __RWMB();
2385 }
@ CCM_DC_WBINVAL_ALL
Unlock and flush and invalidate all the valid and dirty D-Cache lines.

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 2657 of file core_feature_cache.h.

2658 {
2660  FlushPipeCCM();
2661  SMPCC_CMD->CC_mCMD = (SMPCC_CMD->CC_mCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2662  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WBINVAL_ALL);
2663  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_mCMD) == 0);
2664  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_mCMD);
2665  __RWMB();
2666  return res;
2667 }

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 1697 of file core_feature_cache.h.

1698 {
1701  FlushPipeCCM();
1702  __RWMB();
1703 }
@ CCM_DC_WBINVAL
Unlock, flush and invalidate the specific D-Cache line and Cluster Cache line specified by CSR CCM_XB...

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 1716 of file core_feature_cache.h.

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

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 2282 of file core_feature_cache.h.

2283 {
2285  FlushPipeCCM();
2286  __RWMB();
2287 }
@ CCM_DC_INVAL_ALL
Unlock and invalidate all the D-Cache lines.

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 2542 of file core_feature_cache.h.

2543 {
2545  FlushPipeCCM();
2546  SMPCC_CMD->CC_INVALID_ALL = _VAL2FLD(SMPCC_CMD_INVALID_ALL, 1);
2547  while(_FLD2VAL(SMPCC_CMD_INVALID_ALL, SMPCC_CMD->CC_INVALID_ALL));
2548  __RWMB();
2549 }

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 1449 of file core_feature_cache.h.

1450 {
1453  FlushPipeCCM();
1454  __RWMB();
1455 }
@ CCM_DC_INVAL
Unlock and invalidate D-Cache line and Cluster Cache line specified by CSR CCM_XBEGINADDR.

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 1468 of file core_feature_cache.h.

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

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 2010 of file core_feature_cache.h.

2011 {
2014  FlushPipeCCM();
2015  __RWMB();
2016  return __RV_CSR_READ(CSR_CCM_MDATA);
2017 }
#define CSR_CCM_MDATA
@ CCM_DC_LOCK
Lock the specific D-Cache line specified by CSR CCM_XBEGINADDR.

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_DCacheDRamErrInject(), ECC_DCacheErrRestore(), and ECC_DCacheTRamErrInject().

◆ 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 2031 of file core_feature_cache.h.

2032 {
2033  if (cnt > 0) {
2034  unsigned long i;
2035  unsigned long fail_info = CCM_OP_SUCCESS;
2037  for (i = 0; i < cnt; i++) {
2039  FlushPipeCCM();
2040  __RWMB();
2041  fail_info = __RV_CSR_READ(CSR_CCM_MDATA);
2042  if (CCM_OP_SUCCESS != fail_info) {
2043  return fail_info;
2044  }
2045  }
2046  }
2047  return CCM_OP_SUCCESS;
2048 }
@ CCM_OP_SUCCESS
Lock Succeed.

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 2159 of file core_feature_cache.h.

2160 {
2163  FlushPipeCCM();
2164  __RWMB();
2165 }
@ CCM_DC_UNLOCK
Unlock the specific D-Cache line specified by CSR CCM_XBEGINADDR.

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 2178 of file core_feature_cache.h.

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

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 2448 of file core_feature_cache.h.

2449 {
2450  SMPCC_CMD->CC_sCMD = (SMPCC_CMD->CC_sCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2451  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WB_ALL);
2452  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_sCMD) == 0);
2453  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_sCMD);
2454  __RWMB();
2455  return res;
2456 }

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

◆ 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 2348 of file core_feature_cache.h.

2349 {
2351  FlushPipeCCM();
2352  __RWMB();
2353 }
#define CSR_CCM_SCOMMAND

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 2615 of file core_feature_cache.h.

2616 {
2618  FlushPipeCCM();
2619  SMPCC_CMD->CC_sCMD = (SMPCC_CMD->CC_sCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2620  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WB_ALL);
2621  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_sCMD) == 0);
2622  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_sCMD);
2623  __RWMB();
2624  return res;
2625 }

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 1615 of file core_feature_cache.h.

1616 {
1619  FlushPipeCCM();
1620  __RWMB();
1621 }
#define CSR_CCM_SBEGINADDR

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 1634 of file core_feature_cache.h.

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

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 2505 of file core_feature_cache.h.

2506 {
2507  SMPCC_CMD->CC_sCMD = (SMPCC_CMD->CC_sCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2508  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WBINVAL_ALL);
2509  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_sCMD) == 0);
2510  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_sCMD);
2511  __RWMB();
2512  return res;
2513 }

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 2396 of file core_feature_cache.h.

2397 {
2399  FlushPipeCCM();
2400  __RWMB();
2401 }

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 2678 of file core_feature_cache.h.

2679 {
2681  FlushPipeCCM();
2682  SMPCC_CMD->CC_sCMD = (SMPCC_CMD->CC_sCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2683  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WBINVAL_ALL);
2684  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_sCMD) == 0);
2685  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_sCMD);
2686  __RWMB();
2687  return res;
2688 }

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 1738 of file core_feature_cache.h.

1739 {
1742  FlushPipeCCM();
1743  __RWMB();
1744 }

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 1757 of file core_feature_cache.h.

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

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 2298 of file core_feature_cache.h.

2299 {
2301  FlushPipeCCM();
2302  __RWMB();
2303 }

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 2559 of file core_feature_cache.h.

2560 {
2562  FlushPipeCCM();
2563  SMPCC_CMD->CC_INVALID_ALL = _VAL2FLD(SMPCC_CMD_INVALID_ALL, 1);
2564  while(_FLD2VAL(SMPCC_CMD_INVALID_ALL, SMPCC_CMD->CC_INVALID_ALL));
2565  __RWMB();
2566 }

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 1491 of file core_feature_cache.h.

1492 {
1495  FlushPipeCCM();
1496  __RWMB();
1497 }

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 1510 of file core_feature_cache.h.

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

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 2060 of file core_feature_cache.h.

2061 {
2064  FlushPipeCCM();
2065  __RWMB();
2066  return __RV_CSR_READ(CSR_CCM_SDATA);
2067 }
#define CSR_CCM_SDATA

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 2081 of file core_feature_cache.h.

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

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 2200 of file core_feature_cache.h.

2201 {
2204  FlushPipeCCM();
2205  __RWMB();
2206 }

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 2219 of file core_feature_cache.h.

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

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 2467 of file core_feature_cache.h.

2468 {
2469  SMPCC_CMD->CC_uCMD = (SMPCC_CMD->CC_uCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2470  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WB_ALL);
2471  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_uCMD) == 0);
2472  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_uCMD);
2473  __RWMB();
2474  return res;
2475 }

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

◆ 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 2364 of file core_feature_cache.h.

2365 {
2367  FlushPipeCCM();
2368  __RWMB();
2369 }
#define CSR_CCM_UCOMMAND

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 2636 of file core_feature_cache.h.

2637 {
2639  FlushPipeCCM();
2640  SMPCC_CMD->CC_uCMD = (SMPCC_CMD->CC_uCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2641  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WB_ALL);
2642  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_uCMD) == 0);
2643  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_uCMD);
2644  __RWMB();
2645  return res;
2646 }

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 1656 of file core_feature_cache.h.

1657 {
1660  FlushPipeCCM();
1661  __RWMB();
1662 }
#define CSR_CCM_UBEGINADDR

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 1675 of file core_feature_cache.h.

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

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 2524 of file core_feature_cache.h.

2525 {
2526  SMPCC_CMD->CC_uCMD = (SMPCC_CMD->CC_uCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2527  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WBINVAL_ALL);
2528  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_uCMD) == 0);
2529  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_uCMD);
2530  __RWMB();
2531  return res;
2532 }

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 2412 of file core_feature_cache.h.

2413 {
2415  FlushPipeCCM();
2416  __RWMB();
2417 }

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 2699 of file core_feature_cache.h.

2700 {
2702  FlushPipeCCM();
2703  SMPCC_CMD->CC_uCMD = (SMPCC_CMD->CC_uCMD & ~SMPCC_CMD_xCMD_CMD_Msk) |
2704  _VAL2FLD(SMPCC_CMD_xCMD_CMD, SMPCC_CMD_xCMD_CMD_WBINVAL_ALL);
2705  while(_FLD2VAL(SMPCC_CMD_xCMD_COMPLETE, SMPCC_CMD->CC_uCMD) == 0);
2706  int32_t res = _FLD2VAL(SMPCC_CMD_xCMD_RESULT, SMPCC_CMD->CC_uCMD);
2707  __RWMB();
2708  return res;
2709 }

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 1779 of file core_feature_cache.h.

1780 {
1783  FlushPipeCCM();
1784  __RWMB();
1785 }

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 1798 of file core_feature_cache.h.

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

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 2316 of file core_feature_cache.h.

2317 {
2319  FlushPipeCCM();
2320  __RWMB();
2321 }

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 2576 of file core_feature_cache.h.

2577 {
2579  FlushPipeCCM();
2580  SMPCC_CMD->CC_INVALID_ALL = _VAL2FLD(SMPCC_CMD_INVALID_ALL, 1);
2581  while(_FLD2VAL(SMPCC_CMD_INVALID_ALL, SMPCC_CMD->CC_INVALID_ALL));
2582  __RWMB();
2583 }

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 1533 of file core_feature_cache.h.

1534 {
1537  FlushPipeCCM();
1538  __RWMB();
1539 }

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 1552 of file core_feature_cache.h.

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

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 2110 of file core_feature_cache.h.

2111 {
2114  FlushPipeCCM();
2115  __RWMB();
2116  return __RV_CSR_READ(CSR_CCM_UDATA);
2117 }
#define CSR_CCM_UDATA

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 2131 of file core_feature_cache.h.

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

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 2241 of file core_feature_cache.h.

2242 {
2245  FlushPipeCCM();
2246  __RWMB();
2247 }

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 2260 of file core_feature_cache.h.

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

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