Cache Functions

General

enum CCM_OP_FINFO_Type

Values:

enumerator CCM_OP_SUCCESS
enumerator CCM_OP_EXCEED_ERR
enumerator CCM_OP_PERM_CHECK_ERR
enumerator CCM_OP_REFILL_BUS_ERR
enumerator CCM_OP_ECC_ERR
enum CCM_CMD_Type

Values:

enumerator CCM_DC_INVAL
enumerator CCM_DC_WB
enumerator CCM_DC_WBINVAL
enumerator CCM_DC_LOCK
enumerator CCM_DC_UNLOCK
enumerator CCM_DC_WBINVAL_ALL
enumerator CCM_DC_WB_ALL
enumerator CCM_DC_INVAL_ALL
enumerator CCM_IC_INVAL
enumerator CCM_IC_LOCK
enumerator CCM_IC_UNLOCK
enumerator CCM_IC_INVAL_ALL
enumerator CCM_CC_LOCK
enumerator CCM_CC_UNLOCK
__STATIC_FORCEINLINE void EnableSUCCM (void)
__STATIC_FORCEINLINE void DisableSUCCM (void)
__STATIC_FORCEINLINE void FlushPipeCCM (void)
CCM_SUEN_SUEN_Msk (0xFFFFFFFFFFFFFFFFUL)
struct CacheInfo_Type
group Cache Functions

Functions that configure Instruction and Data Cache.

Nuclei provide Cache Control and Maintainence(CCM) for software to control and maintain the internal L1 I/D Cache and Cluster Cache of the RISC-V Core, software can manage the cache flexibly to meet the actual application scenarios.

The CCM operations have 3 types: by single address, by all and flush pipeline. The CCM operations are done via CSR registers, M/S/U mode has its own CSR registers to do CCM operations. By default, CCM operations are not allowed in S/U mode, you can execute EnableSUCCM in M-Mode to enable it.

  • API names started with M<operations>, such as MInvalICacheLine must be called in M-Mode only.

  • API names started with S<operations>, such as SInvalICacheLine should be called in S-Mode.

  • API names started with U<operations>, such as UInvalICacheLine should be called in U-Mode.

Defines

CCM_SUEN_SUEN_Msk (0xFFFFFFFFFFFFFFFFUL)

CSR CCM_SUEN: SUEN Mask.

Enums

enum CCM_OP_FINFO_Type

Cache CCM Operation Fail Info.

Values:

enumerator CCM_OP_SUCCESS

Lock Succeed.

enumerator CCM_OP_EXCEED_ERR

Exceed the the number of lockable ways(N-Way I/D-Cache, lockable is N-1)

enumerator CCM_OP_PERM_CHECK_ERR

PMP/sPMP/Page-Table X(I-Cache)/R(D-Cache) permission check failed, or belong to Device/Non-Cacheable address range.

enumerator CCM_OP_REFILL_BUS_ERR

Refill has Bus Error.

enumerator CCM_OP_ECC_ERR

Deprecated, ECC Error, this error code is removed in later Nuclei CCM RTL design, please don’t use it.

enum CCM_CMD_Type

Cache CCM Command Types.

Values:

enumerator CCM_DC_INVAL

Unlock and invalidate D-Cache line and Cluster Cache line specified by CSR CCM_XBEGINADDR.

enumerator CCM_DC_WB

Flush the specific D-Cache line and Cluster Cache line specified by CSR CCM_XBEGINADDR.

enumerator CCM_DC_WBINVAL

Unlock, flush and invalidate the specific D-Cache line and Cluster Cache line specified by CSR CCM_XBEGINADDR.

enumerator CCM_DC_LOCK

Lock the specific D-Cache line specified by CSR CCM_XBEGINADDR.

enumerator CCM_DC_UNLOCK

Unlock the specific D-Cache line specified by CSR CCM_XBEGINADDR.

enumerator CCM_DC_WBINVAL_ALL

Unlock and flush and invalidate all the valid and dirty D-Cache lines.

enumerator CCM_DC_WB_ALL

Flush all the valid and dirty D-Cache lines.

enumerator CCM_DC_INVAL_ALL

Unlock and invalidate all the D-Cache lines.

enumerator CCM_IC_INVAL

Unlock and invalidate I-Cache line specified by CSR CCM_XBEGINADDR.

enumerator CCM_IC_LOCK

Lock the specific I-Cache line specified by CSR CCM_XBEGINADDR.

enumerator CCM_IC_UNLOCK

Unlock the specific I-Cache line specified by CSR CCM_XBEGINADDR.

enumerator CCM_IC_INVAL_ALL

Unlock and invalidate all the I-Cache lines.

enumerator CCM_CC_LOCK

Lock the specific Cluster Cache line specified by CSR CCM_XBEGINADDR.

enumerator CCM_CC_UNLOCK

Unlock the specific Cluster Cache line specified by CSR CCM_XBEGINADDR.

Functions

__STATIC_FORCEINLINE void EnableSUCCM (void)

Enable CCM operation in Supervisor/User Mode.

This function enable CCM operation in Supervisor/User Mode. If enabled, CCM operations in supervisor/user mode will be allowed. Besides CCM registers, CC_sCMD and CC_uCMD registers which belong to SMPCC module are also allowed.

Remark

  • This function can be called in M-Mode only.

See also

  • DisableSUCCM

__STATIC_FORCEINLINE void DisableSUCCM (void)

Disable CCM operation in Supervisor/User Mode.

This function disable CCM operation in Supervisor/User Mode. If not enabled, CCM operations in supervisor/user mode will trigger a illegal intruction exception, access to CC_sCMD and CC_uCMD register is also forbidden.

Remark

  • This function can be called in M-Mode only.

See also

  • EnableSUCCM

__STATIC_FORCEINLINE void FlushPipeCCM (void)

Flush pipeline after CCM operation.

This function is used to flush pipeline after CCM operations on Cache, it will ensure latest instructions or data can be seen by pipeline.

Remark

  • This function can be called in M/S/U-Mode only.

struct CacheInfo_Type
#include <core_feature_cache.h>

Cache Information Type.

I-Cache Functions

__STATIC_INLINE int32_t ICachePresent (void)
__STATIC_FORCEINLINE void EnableICache (void)
__STATIC_FORCEINLINE void DisableICache (void)
__STATIC_FORCEINLINE void EnableICacheECC (void)
__STATIC_FORCEINLINE void DisableICacheECC (void)
__STATIC_INLINE int32_t GetICacheInfo (CacheInfo_Type *info)
__STATIC_INLINE void MInvalICacheLine (unsigned long addr)
__STATIC_INLINE void MInvalICacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void SInvalICacheLine (unsigned long addr)
__STATIC_INLINE void SInvalICacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void UInvalICacheLine (unsigned long addr)
__STATIC_INLINE void UInvalICacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void MInvalICacheCCacheLine (unsigned long addr)
__STATIC_INLINE void MInvalICacheCCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void SInvalICacheCCacheLine (unsigned long addr)
__STATIC_INLINE void SInvalICacheCCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void UInvalICacheCCacheLine (unsigned long addr)
__STATIC_INLINE void UInvalICacheCCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE unsigned long MLockICacheLine (unsigned long addr)
__STATIC_INLINE unsigned long MLockICacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE unsigned long SLockICacheLine (unsigned long addr)
__STATIC_INLINE unsigned long SLockICacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE unsigned long ULockICacheLine (unsigned long addr)
__STATIC_INLINE unsigned long ULockICacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void MUnlockICacheLine (unsigned long addr)
__STATIC_INLINE void MUnlockICacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void SUnlockICacheLine (unsigned long addr)
__STATIC_INLINE void SUnlockICacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void UUnlockICacheLine (unsigned long addr)
__STATIC_INLINE void UUnlockICacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void MInvalICache (void)
__STATIC_INLINE void SInvalICache (void)
__STATIC_INLINE void UInvalICache (void)
__STATIC_INLINE void MInvalCCache (void)
__STATIC_INLINE void SInvalCCache (void)
__STATIC_INLINE void UInvalCCache (void)
__STATIC_INLINE void MInvalICacheCCache (void)
__STATIC_INLINE void SInvalICacheCCache (void)
__STATIC_INLINE void UInvalICacheCCache (void)
group I-Cache Functions

Functions that configure Instruction Cache.

Functions

__STATIC_INLINE int32_t ICachePresent (void)

Check ICache Unit Present or Not.

This function check icache unit present or not via mcfg_info csr

Remark

  • This function might not work for some old nuclei processors

  • Please make sure the version of your nuclei processor contain ICACHE bit in mcfg_info

Returns:

1 if present otherwise 0

__STATIC_FORCEINLINE void EnableICache (void)

Enable ICache.

This function enable I-Cache

Remark

  • This function can be called in M-Mode only.

  • This CSR_MCACHE_CTL register control I Cache enable.

See also

  • DisableICache

__STATIC_FORCEINLINE void DisableICache (void)

Disable ICache.

This function Disable I-Cache

Remark

  • This function can be called in M-Mode only.

  • This CSR_MCACHE_CTL register control I Cache enable.

See also

  • EnableICache

__STATIC_FORCEINLINE void EnableICacheECC (void)

Enable ICache ECC.

This function enable I-Cache ECC

Remark

  • This function can be called in M-Mode only.

  • This CSR_MCACHE_CTL register control I Cache ECC enable.

See also

  • DisableICacheECC

__STATIC_FORCEINLINE void DisableICacheECC (void)

Disable ICache ECC.

This function disable I-Cache ECC

Remark

  • This function can be called in M-Mode only.

  • This CSR_MCACHE_CTL register control I Cache ECC enable.

See also

  • EnableICacheECC

__STATIC_INLINE int32_t GetICacheInfo (CacheInfo_Type *info)

Get I-Cache Information.

This function get I-Cache Information

Remark

  • This function can be called in M-Mode only.

  • You can use this function in combination with cache lines operations

See also

  • GetDCacheInfo

__STATIC_INLINE void MInvalICacheLine (unsigned long addr)

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

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

Remark

This function must be executed in M-Mode only.

Parameters:

addr[in] start address to be invalidated

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

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

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

Remark

This function must be executed in M-Mode only.

Parameters:
  • addr[in] start address to be invalidated

  • cnt[in] count of cache lines to be invalidated

__STATIC_INLINE void SInvalICacheLine (unsigned long addr)

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

This function unlock and invalidate one I-Cache line specified by the address. Command CCM_IC_INVAL is written to CSR CSR_CCM_SCOMMAND.

Remark

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

Parameters:

addr[in] start address to be invalidated

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

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

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

Remark

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

Parameters:
  • addr[in] start address to be invalidated

  • cnt[in] count of cache lines to be invalidated

__STATIC_INLINE void UInvalICacheLine (unsigned long addr)

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

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

Remark

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

Parameters:

addr[in] start address to be invalidated

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

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

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

Remark

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

Parameters:
  • addr[in] start address to be invalidated

  • cnt[in] count of cache lines to be invalidated

__STATIC_INLINE void MInvalICacheCCacheLine (unsigned long addr)

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

This function unlock and invalidate one I-Cache line and corresponding Cluster Cache line specified by the address. Commands CCM_IC_INVAL and CCM_DC_INVAL are written to CSR CSR_CCM_MCOMMAND.

Remark

This function must be executed in M-Mode only.

Parameters:

addr[in] start address to be invalidated

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

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

This function unlock and invalidate several I-Cache lines and corresponding Cluster Cache lines specified by the address and line count. Commands CCM_IC_INVAL and CCM_DC_INVAL are written to CSR CSR_CCM_MCOMMAND.

Remark

This function must be executed in M-Mode only.

Parameters:
  • addr[in] start address to be invalidated

  • cnt[in] count of cache lines to be invalidated

__STATIC_INLINE void SInvalICacheCCacheLine (unsigned long addr)

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

This function unlock and invalidate one I-Cache line and corresponding Cluster Cache line specified by the address. Commands CCM_IC_INVAL and CCM_DC_INVAL are written to CSR CSR_CCM_SCOMMAND.

Remark

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

Parameters:

addr[in] start address to be invalidated

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

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

This function unlock and invalidate several I-Cache lines and corresponding Cluster Cache lines specified by the address and line count. Commands CCM_IC_INVAL and CCM_DC_INVAL are written to CSR CSR_CCM_SCOMMAND.

Remark

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

Parameters:
  • addr[in] start address to be invalidated

  • cnt[in] count of cache lines to be invalidated

__STATIC_INLINE void UInvalICacheCCacheLine (unsigned long addr)

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

This function unlock and invalidate one I-Cache line and corresponding Cluster Cache line specified by the address. Commands CCM_IC_INVAL and CCM_DC_INVAL are written to CSR CSR_CCM_UCOMMAND.

Remark

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

Parameters:

addr[in] start address to be invalidated

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

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

This function unlock and invalidate several I-Cache lines and corresponding Cluster Cache lines specified by the address and line count. Commands CCM_IC_INVAL and CCM_DC_INVAL are written to CSR CSR_CCM_UCOMMAND.

Remark

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

Parameters:
  • addr[in] start address to be invalidated

  • cnt[in] count of cache lines to be invalidated

__STATIC_INLINE unsigned long MLockICacheLine (unsigned long addr)

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

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

Remark

This function must be executed in M-Mode only.

Parameters:

addr[in] start address to be locked

Returns:

result of CCM lock operation, see enum CCM_OP_FINFO

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

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

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

Remark

This function must be executed in M-Mode only.

Parameters:
  • addr[in] start address to be locked

  • cnt[in] count of cache lines to be locked

Returns:

result of CCM lock operation, see enum CCM_OP_FINFO

__STATIC_INLINE unsigned long SLockICacheLine (unsigned long addr)

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

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

Remark

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

Parameters:

addr[in] start address to be locked

Returns:

result of CCM lock operation, see enum CCM_OP_FINFO

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

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

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

Remark

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

Parameters:
  • addr[in] start address to be locked

  • cnt[in] count of cache lines to be locked

Returns:

result of CCM lock operation, see enum CCM_OP_FINFO

__STATIC_INLINE unsigned long ULockICacheLine (unsigned long addr)

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

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

Remark

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

Parameters:

addr[in] start address to be locked

Returns:

result of CCM lock operation, see enum CCM_OP_FINFO

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

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

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

Remark

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

Parameters:
  • addr[in] start address to be locked

  • cnt[in] count of cache lines to be locked

Returns:

result of CCM lock operation, see enum CCM_OP_FINFO

__STATIC_INLINE void MUnlockICacheLine (unsigned long addr)

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

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

Remark

This function must be executed in M-Mode only.

Parameters:

addr[in] start address to be unlocked

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

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

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

Remark

This function must be executed in M-Mode only.

Parameters:
  • addr[in] start address to be unlocked

  • cnt[in] count of cache lines to be unlocked

__STATIC_INLINE void SUnlockICacheLine (unsigned long addr)

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

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

Remark

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

Parameters:

addr[in] start address to be unlocked

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

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

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

Remark

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

Parameters:
  • addr[in] start address to be unlocked

  • cnt[in] count of cache lines to be unlocked

__STATIC_INLINE void UUnlockICacheLine (unsigned long addr)

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

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

Remark

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

Parameters:

addr[in] start address to be unlocked

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

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

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

Remark

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

Parameters:
  • addr[in] start address to be unlocked

  • cnt[in] count of cache lines to be unlocked

__STATIC_INLINE void MInvalICache (void)

Invalidate all I-Cache lines in M-Mode.

This function invalidate all I-Cache lines. Command CCM_IC_INVAL_ALL is written to CSR CSR_CCM_MCOMMAND.

Remark

This function must be executed in M-Mode only.

Parameters:

addr[in] start address to be invalidated

__STATIC_INLINE void SInvalICache (void)

Invalidate all I-Cache lines in S-Mode.

This function invalidate all I-Cache lines. Command CCM_IC_INVAL_ALL is written to CSR CSR_CCM_SCOMMAND.

Remark

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

Parameters:

addr[in] start address to be invalidated

__STATIC_INLINE void UInvalICache (void)

Invalidate all I-Cache lines in U-Mode.

This function invalidate all I-Cache lines. Command CCM_IC_INVAL_ALL is written to CSR CSR_CCM_UCOMMAND.

Remark

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

Parameters:

addr[in] start address to be invalidated

__STATIC_INLINE void MInvalCCache (void)

Invalidate all Cluster Cache in M-Mode.

This function invalidate all Cluster Cache.

Remark

This function must be executed in M-Mode only.

__STATIC_INLINE void SInvalCCache (void)

Invalidate all Cluster Cache in S-Mode.

This function invalidate all Cluster Cache.

Remark

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

__STATIC_INLINE void UInvalCCache (void)

Invalidate all Cluster Cache in U-Mode.

This function invalidate all Cluster Cache.

Remark

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

__STATIC_INLINE void MInvalICacheCCache (void)

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

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

Remark

This function must be executed in M-Mode only.

__STATIC_INLINE void SInvalICacheCCache (void)

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

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

Remark

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

__STATIC_INLINE void UInvalICacheCCache (void)

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

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

Remark

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

D-Cache Functions

__STATIC_INLINE int32_t DCachePresent (void)
__STATIC_FORCEINLINE void EnableDCache (void)
__STATIC_FORCEINLINE void DisableDCache (void)
__STATIC_FORCEINLINE void EnableDCacheECC (void)
__STATIC_FORCEINLINE void DisableDCacheECC (void)
__STATIC_INLINE int32_t GetDCacheInfo (CacheInfo_Type *info)
__STATIC_INLINE void MInvalDCacheLine (unsigned long addr)
__STATIC_INLINE void MInvalDCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void SInvalDCacheLine (unsigned long addr)
__STATIC_INLINE void SInvalDCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void UInvalDCacheLine (unsigned long addr)
__STATIC_INLINE void UInvalDCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void MFlushDCacheLine (unsigned long addr)
__STATIC_INLINE void MFlushDCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void SFlushDCacheLine (unsigned long addr)
__STATIC_INLINE void SFlushDCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void UFlushDCacheLine (unsigned long addr)
__STATIC_INLINE void UFlushDCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void MFlushInvalDCacheLine (unsigned long addr)
__STATIC_INLINE void MFlushInvalDCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void SFlushInvalDCacheLine (unsigned long addr)
__STATIC_INLINE void SFlushInvalDCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void UFlushInvalDCacheLine (unsigned long addr)
__STATIC_INLINE void UFlushInvalDCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE unsigned long MLockDCacheLine (unsigned long addr)
__STATIC_INLINE unsigned long MLockDCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE unsigned long SLockDCacheLine (unsigned long addr)
__STATIC_INLINE unsigned long SLockDCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE unsigned long ULockDCacheLine (unsigned long addr)
__STATIC_INLINE unsigned long ULockDCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void MUnlockDCacheLine (unsigned long addr)
__STATIC_INLINE void MUnlockDCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void SUnlockDCacheLine (unsigned long addr)
__STATIC_INLINE void SUnlockDCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void UUnlockDCacheLine (unsigned long addr)
__STATIC_INLINE void UUnlockDCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void MInvalDCache (void)
__STATIC_INLINE void SInvalDCache (void)
__STATIC_INLINE void UInvalDCache (void)
__STATIC_INLINE void MFlushDCache (void)
__STATIC_INLINE void SFlushDCache (void)
__STATIC_INLINE void UFlushDCache (void)
__STATIC_INLINE void MFlushInvalDCache (void)
__STATIC_INLINE void SFlushInvalDCache (void)
__STATIC_INLINE void UFlushInvalDCache (void)
__STATIC_INLINE int32_t MFlushCCache (void)
__STATIC_INLINE int32_t SFlushCCache (void)
__STATIC_INLINE int32_t UFlushCCache (void)
__STATIC_INLINE int32_t MFlushInvalCCache (void)
__STATIC_INLINE int32_t SFlushInvalCCache (void)
__STATIC_INLINE int32_t UFlushInvalCCache (void)
__STATIC_INLINE void MInvalDCacheCCache (void)
__STATIC_INLINE void SInvalDCacheCCache (void)
__STATIC_INLINE void UInvalDCacheCCache (void)
__STATIC_INLINE int32_t MFlushDCacheCCache (void)
__STATIC_INLINE int32_t SFlushDCacheCCache (void)
__STATIC_INLINE int32_t UFlushDCacheCCache (void)
__STATIC_INLINE int32_t MFlushInvalDCacheCCache (void)
__STATIC_INLINE int32_t SFlushInvalDCacheCCache (void)
__STATIC_INLINE int32_t UFlushInvalDCacheCCache (void)
MInvalDCacheCCacheLine(addr) MInvalDCacheLine(addr)
MInvalDCacheCCacheLines(addr, cnt) MInvalDCacheLines(addr, cnt)
SInvalDCacheCCacheLine(addr) SInvalDCacheLine(addr)
SInvalDCacheCCacheLines(addr, cnt) SInvalDCacheLines(addr, cnt)
UInvalDCacheCCacheLine(addr) UInvalDCacheLine(addr)
UInvalDCacheCCacheLines(addr, cnt) UInvalDCacheLines(addr, cnt)
MFlushDCacheCCacheLine(addr) MFlushDCacheLine(addr)
MFlushDCacheCCacheLines(addr, cnt) MFlushDCacheLines(addr, cnt)
SFlushDCacheCCacheLine(addr) SFlushDCacheLine(addr)
SFlushDCacheCCacheLines(addr, cnt) SFlushDCacheLines(addr, cnt)
UFlushDCacheCCacheLine(addr) UFlushDCacheLine(addr)
UFlushDCacheCCacheLines(addr, cnt) UFlushDCacheLines(addr, cnt)
MFlushInvalDCacheCCacheLine(addr) MFlushInvalDCacheLine(addr)
MFlushInvalDCacheCCacheLines(addr, cnt) MFlushInvalDCacheLines(addr, cnt)
SFlushInvalDCacheCCacheLine(addr) SFlushInvalDCacheLine(addr)
SFlushInvalDCacheCCacheLines(addr, cnt) SFlushInvalDCacheLines(addr, cnt)
UFlushInvalDCacheCCacheLine(addr) UFlushInvalDCacheLine(addr)
UFlushInvalDCacheCCacheLines(addr, cnt) UFlushInvalDCacheLines(addr, cnt)
group D-Cache Functions

Functions that configure Data Cache.

Defines

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.

Remark

This macro must be executed in M-Mode only.

Parameters:
  • addr[in] start address to be invalidated

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.

Remark

This macro must be executed in M-Mode only.

Parameters:
  • addr[in] start address to be invalidated

  • cnt[in] count of cache lines to be invalidated

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.

Remark

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

Parameters:
  • addr[in] start address to be invalidated

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.

Remark

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

Parameters:
  • addr[in] start address to be invalidated

  • cnt[in] count of cache lines to be invalidated

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.

Remark

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

Parameters:
  • addr[in] start address to be invalidated

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.

Remark

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

Parameters:
  • addr[in] start address to be invalidated

  • cnt[in] count of cache lines to be invalidated

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.

Remark

This macro must be executed in M-Mode only.

Parameters:
  • addr[in] start address to be flushed

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.

Remark

This macro must be executed in M-Mode only.

Parameters:
  • addr[in] start address to be flushed

  • cnt[in] count of cache lines to be flushed

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.

Remark

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

Parameters:
  • addr[in] start address to be flushed

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.

Remark

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

Parameters:
  • addr[in] start address to be flushed

  • cnt[in] count of cache lines to be flushed

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.

Remark

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

Parameters:
  • addr[in] start address to be flushed

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.

Remark

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

Parameters:
  • addr[in] start address to be flushed

  • cnt[in] count of cache lines to be flushed

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.

Remark

This macro must be executed in M-Mode only.

Parameters:
  • addr[in] start address to be flushed and invalidated

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.

Remark

This macro must be executed in M-Mode only.

Parameters:
  • addr[in] start address to be flushed and invalidated

  • cnt[in] count of cache lines to be flushed and invalidated

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.

Remark

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

Parameters:
  • addr[in] start address to be flushed and invalidated

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.

Remark

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

Parameters:
  • addr[in] start address to be flushed and invalidated

  • cnt[in] count of cache lines to be flushed and invalidated

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.

Remark

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

Parameters:
  • addr[in] start address to be flushed and invalidated

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.

Remark

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

Parameters:
  • addr[in] start address to be flushed and invalidated

  • cnt[in] count of cache lines to be flushed and invalidated

Functions

__STATIC_INLINE int32_t DCachePresent (void)

Check DCache Unit Present or Not.

This function check dcache unit present or not via mcfg_info csr

Remark

  • 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

__STATIC_FORCEINLINE void EnableDCache (void)

Enable DCache.

This function enable D-Cache

Remark

  • This function can be called in M-Mode only.

  • This CSR_MCACHE_CTL register control D Cache enable.

See also

  • DisableDCache

__STATIC_FORCEINLINE void DisableDCache (void)

Disable DCache.

This function Disable D-Cache

Remark

  • This function can be called in M-Mode only.

  • This CSR_MCACHE_CTL register control D Cache enable.

See also

  • EnableDCache

__STATIC_FORCEINLINE void EnableDCacheECC (void)

Enable DCache ECC.

This function enable D-Cache ECC

Remark

  • This function can be called in M-Mode only.

  • This CSR_MCACHE_CTL register control D Cache ECC enable.

See also

  • DisableDCacheECC

__STATIC_FORCEINLINE void DisableDCacheECC (void)

Disable DCache ECC.

This function disable D-Cache ECC

Remark

  • This function can be called in M-Mode only.

  • This CSR_MCACHE_CTL register control D Cache ECC enable.

See also

  • EnableDCacheECC

__STATIC_INLINE int32_t GetDCacheInfo (CacheInfo_Type *info)

Get D-Cache Information.

This function get D-Cache Information

Remark

  • This function can be called in M-Mode only.

  • You can use this function in combination with cache lines operations

See also

  • GetICacheInfo

__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.

Remark

This function must be executed in M-Mode only.

Parameters:

addr[in] start address to be invalidated

__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.

Remark

This function must be executed in M-Mode only.

Parameters:
  • addr[in] start address to be invalidated

  • cnt[in] count of cache lines to be invalidated

__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.

Remark

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

Parameters:

addr[in] start address to be invalidated

__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.

Remark

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

Parameters:
  • addr[in] start address to be invalidated

  • cnt[in] count of cache lines to be invalidated

__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.

Remark

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

Parameters:

addr[in] start address to be invalidated

__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.

Remark

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

Parameters:
  • addr[in] start address to be invalidated

  • cnt[in] count of cache lines to be invalidated

__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.

Remark

This function must be executed in M-Mode only.

Parameters:

addr[in] start address to be flushed

__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.

Remark

This function must be executed in M-Mode only.

Parameters:
  • addr[in] start address to be flushed

  • cnt[in] count of cache lines to be flushed

__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.

Remark

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

Parameters:

addr[in] start address to be flushed

__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.

Remark

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

Parameters:
  • addr[in] start address to be flushed

  • cnt[in] count of cache lines to be flushed

__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.

Remark

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

Parameters:

addr[in] start address to be flushed

__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.

Remark

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

Parameters:
  • addr[in] start address to be flushed

  • cnt[in] count of cache lines to be flushed

__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.

Remark

This function must be executed in M-Mode only.

Parameters:

addr[in] start address to be flushed and invalidated

__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.

Remark

This function must be executed in M-Mode only.

Parameters:
  • addr[in] start address to be flushed and invalidated

  • cnt[in] count of cache lines to be flushed and invalidated

__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.

Remark

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

Parameters:

addr[in] start address to be flushed and invalidated

__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.

Remark

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

Parameters:
  • addr[in] start address to be flushed and invalidated

  • cnt[in] count of cache lines to be flushed and invalidated

__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.

Remark

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

Parameters:

addr[in] start address to be flushed and invalidated

__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.

Remark

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

Parameters:
  • addr[in] start address to be flushed and invalidated

  • cnt[in] count of cache lines to be flushed and invalidated

__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.

Remark

This function must be executed in M-Mode only.

Parameters:

addr[in] start address to be locked

Returns:

result of CCM lock operation, see enum CCM_OP_FINFO

__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.

Remark

This function must be executed in M-Mode only.

Parameters:
  • addr[in] start address to be locked

  • cnt[in] count of cache lines to be locked

Returns:

result of CCM lock operation, see enum CCM_OP_FINFO

__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.

Remark

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

Parameters:

addr[in] start address to be locked

Returns:

result of CCM lock operation, see enum CCM_OP_FINFO

__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.

Remark

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

Parameters:
  • addr[in] start address to be locked

  • cnt[in] count of cache lines to be locked

Returns:

result of CCM lock operation, see enum CCM_OP_FINFO

__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.

Remark

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

Parameters:

addr[in] start address to be locked

Returns:

result of CCM lock operation, see enum CCM_OP_FINFO

__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.

Remark

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

Parameters:
  • addr[in] start address to be locked

  • cnt[in] count of cache lines to be locked

Returns:

result of CCM lock operation, see enum CCM_OP_FINFO

__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.

Remark

This function must be executed in M-Mode only.

Parameters:

addr[in] start address to be unlocked

__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.

Remark

This function must be executed in M-Mode only.

Parameters:
  • addr[in] start address to be unlocked

  • cnt[in] count of cache lines to be unlocked

__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.

Remark

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

Parameters:

addr[in] start address to be unlocked

__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.

Remark

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

Parameters:
  • addr[in] start address to be unlocked

  • cnt[in] count of cache lines to be unlocked

__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.

Remark

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

Parameters:

addr[in] start address to be unlocked

__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.

Remark

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

Parameters:
  • addr[in] start address to be unlocked

  • cnt[in] count of cache lines to be unlocked

__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.

Remark

This function must be executed in M-Mode only.

Parameters:

addr[in] start address to be invalidated

__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.

Remark

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

Parameters:

addr[in] start address to be invalidated

__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.

Remark

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

Parameters:

addr[in] start address to be invalidated

__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.

Remark

This function must be executed in M-Mode only.

Parameters:

addr[in] start address to be flushed

__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.

Remark

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

Parameters:

addr[in] start address to be flushed

__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.

Remark

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

Parameters:

addr[in] start address to be flushed

__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.

Remark

This function must be executed in M-Mode only.

Parameters:

addr[in] start address to be flushed and locked

__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.

Remark

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

Parameters:

addr[in] start address to be flushed and locked

__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.

Remark

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

Parameters:

addr[in] start address to be flushed and locked

__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.

Remark

This function must be executed in M-Mode only.

Returns:

Operation result, see enum SMPCC_CMD_RESULT

__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.

Remark

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

Returns:

Operation result, see enum SMPCC_CMD_RESULT

__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.

Remark

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

Returns:

Operation result, see enum SMPCC_CMD_RESULT

__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.

Remark

This function must be executed in M-Mode only.

Returns:

Operation result, see enum SMPCC_CMD_RESULT

__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.

Remark

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

Returns:

Operation result, see enum SMPCC_CMD_RESULT

__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.

Remark

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

Returns:

Operation result, see enum SMPCC_CMD_RESULT

__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.

Remark

This function must be executed in M-Mode only.

__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.

Remark

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

__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.

Remark

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

__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.

Remark

This function must be executed in M-Mode only.

Returns:

Operation result, see enum SMPCC_CMD_RESULT

__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.

Remark

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

Returns:

Operation result, see enum SMPCC_CMD_RESULT

__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.

Remark

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

Returns:

Operation result, see enum SMPCC_CMD_RESULT

__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.

Remark

This function must be executed in M-Mode only.

Returns:

Operation result, see enum SMPCC_CMD_RESULT

__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.

Remark

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

Returns:

Operation result, see enum SMPCC_CMD_RESULT

__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.

Remark

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

Returns:

Operation result, see enum SMPCC_CMD_RESULT

Cluster-Cache Functions

__STATIC_INLINE unsigned long MLockCCacheLine (unsigned long addr)
__STATIC_INLINE unsigned long MLockCCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE unsigned long SLockCCacheLine (unsigned long addr)
__STATIC_INLINE unsigned long SLockCCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE unsigned long ULockCCacheLine (unsigned long addr)
__STATIC_INLINE unsigned long ULockCCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void MUnlockCCacheLine (unsigned long addr)
__STATIC_INLINE void MUnlockCCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void SUnlockCCacheLine (unsigned long addr)
__STATIC_INLINE void SUnlockCCacheLines (unsigned long addr, unsigned long cnt)
__STATIC_INLINE void UUnlockCCacheLine (unsigned long addr)
__STATIC_INLINE void UUnlockCCacheLines (unsigned long addr, unsigned long cnt)
SMPCC_CMD_CTRL_SUP_EN_Pos 9U
SMPCC_CMD_CTRL_SUP_EN_Msk (0x1UL << SMPCC_CMD_CTRL_SUP_EN_Pos)
SMPCC_CMD_CTRL_SUP_EN_ENABLE 1U
SMPCC_CMD_CTRL_SUP_EN_DISABLE 0U
SMPCC_CMD_CTRL_USE_EN_Pos 10U
SMPCC_CMD_CTRL_USE_EN_Msk (0x1UL << SMPCC_CMD_CTRL_USE_EN_Pos)
SMPCC_CMD_CTRL_USE_EN_ENABLE 1U
SMPCC_CMD_CTRL_USE_EN_DISABLE 0U
SMPCC_CMD_xCMD_CMD_Pos 0U
SMPCC_CMD_xCMD_CMD_Msk (0x1FUL << SMPCC_CMD_xCMD_CMD_Pos)
SMPCC_CMD_xCMD_CMD_WB_ALL 0x7U
SMPCC_CMD_xCMD_CMD_WBINVAL_ALL 0x6U
SMPCC_CMD_xCMD_RESULT_Pos 26U
SMPCC_CMD_xCMD_RESULT_Msk (0x1FUL << SMPCC_CMD_xCMD_RESULT_Pos)
SMPCC_CMD_xCMD_RESULT_SUCCESS 0x0U
SMPCC_CMD_xCMD_RESULT_ENTRY_EXCEED_LIMIT 0x1U
SMPCC_CMD_xCMD_RESULT_REFILL_BUS_ERROR 0x3U
SMPCC_CMD_xCMD_RESULT_ECC_ERROR 0x4U
SMPCC_CMD_xCMD_RESULT_CPBACK_BUS_ERROR 0x5U
SMPCC_CMD_xCMD_COMPLETE_Pos 31U
SMPCC_CMD_xCMD_COMPLETE_Msk (0x1UL << SMPCC_CMD_xCMD_COMPLETE_Pos)
SMPCC_CMD_INVALID_ALL_Pos 0U
SMPCC_CMD_INVALID_ALL_Msk (0x1UL << SMPCC_CMD_INVALID_ALL_Pos)
SMPCC_CMD_BASE __SMPCC_BASEADDR
SMPCC_CMD ((SMPCC_CMD_Type *)SMPCC_CMD_BASE)
struct SMPCC_CMD_Type
group Cluster-Cache Functions

Functions that configure Cluster Cache by CCM.

Unnamed Group

__STATIC_INLINE unsigned long MLockCCacheLine (unsigned long addr)

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

This function lock one Cluster Cache line specified by the address. Command CCM_CC_LOCK is written to CSR CSR_CCM_MCOMMAND.

Remark

This function must be executed in M-Mode only.

Parameters:

addr[in] start address to be locked

Returns:

result of CCM lock operation, see enum CCM_OP_FINFO

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

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

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

Remark

This function must be executed in M-Mode only.

Parameters:
  • addr[in] start address to be locked

  • cnt[in] count of cache lines to be locked

Returns:

result of CCM lock operation, see enum CCM_OP_FINFO

__STATIC_INLINE unsigned long SLockCCacheLine (unsigned long addr)

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

This function lock one Cluster Cache line specified by the address. Command CCM_CC_LOCK is written to CSR CSR_CCM_SCOMMAND.

Remark

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

Parameters:

addr[in] start address to be locked

Returns:

result of CCM lock operation, see enum CCM_OP_FINFO

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

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

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

Remark

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

Parameters:
  • addr[in] start address to be locked

  • cnt[in] count of cache lines to be locked

Returns:

result of CCM lock operation, see enum CCM_OP_FINFO

__STATIC_INLINE unsigned long ULockCCacheLine (unsigned long addr)

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

This function lock one Cluster Cache line specified by the address. Command CCM_CC_LOCK is written to CSR CSR_CCM_UCOMMAND.

Remark

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

Parameters:

addr[in] start address to be locked

Returns:

result of CCM lock operation, see enum CCM_OP_FINFO

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

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

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

Remark

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

Parameters:
  • addr[in] start address to be locked

  • cnt[in] count of cache lines to be locked

Returns:

result of CCM lock operation, see enum CCM_OP_FINFO

__STATIC_INLINE void MUnlockCCacheLine (unsigned long addr)

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

This function unlock one Cluster Cache line specified by the address. Command CCM_CC_UNLOCK is written to CSR CSR_CCM_MCOMMAND.

Remark

This function must be executed in M-Mode only.

Parameters:

addr[in] start address to be unlocked

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

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

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

Remark

This function must be executed in M-Mode only.

Parameters:
  • addr[in] start address to be unlocked

  • cnt[in] count of cache lines to be unlocked

__STATIC_INLINE void SUnlockCCacheLine (unsigned long addr)

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

This function unlock one Cluster Cache line specified by the address. Command CCM_CC_UNLOCK is written to CSR CSR_CCM_SCOMMAND.

Remark

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

Parameters:

addr[in] start address to be unlocked

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

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

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

Remark

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

Parameters:
  • addr[in] start address to be unlocked

  • cnt[in] count of cache lines to be unlocked

__STATIC_INLINE void UUnlockCCacheLine (unsigned long addr)

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

This function unlock one Cluster Cache line specified by the address. Command CCM_CC_UNLOCK is written to CSR CSR_CCM_UCOMMAND.

Remark

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

Parameters:

addr[in] start address to be unlocked

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

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

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

Remark

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

Parameters:
  • addr[in] start address to be unlocked

  • cnt[in] count of cache lines to be unlocked

Defines

SMPCC_CMD_CTRL_SUP_EN_Pos 9U

SMPCC_CMD CC_CTRL SUP_EN Position.

SMPCC_CMD_CTRL_SUP_EN_Msk (0x1UL << SMPCC_CMD_CTRL_SUP_EN_Pos)

SMPCC_CMD CC_CTRL SUP_EN Mask.

SMPCC_CMD_CTRL_SUP_EN_ENABLE 1U

SMPCC_CMD CC_CTRL SUP_EN Enable.

SMPCC_CMD_CTRL_SUP_EN_DISABLE 0U

SMPCC_CMD CC_CTRL SUP_EN Disable.

SMPCC_CMD_CTRL_USE_EN_Pos 10U

SMPCC_CMD CC_CTRL USE_EN Position.

SMPCC_CMD_CTRL_USE_EN_Msk (0x1UL << SMPCC_CMD_CTRL_USE_EN_Pos)

SMPCC_CMD CC_CTRL USE_EN Mask.

SMPCC_CMD_CTRL_USE_EN_ENABLE 1U

SMPCC_CMD CC_CTRL USE_EN Enable.

SMPCC_CMD_CTRL_USE_EN_DISABLE 0U

SMPCC_CMD CC_CTRL USE_EN Disable.

SMPCC_CMD_xCMD_CMD_Pos 0U

SMPCC_CMD register xCMD field CMD Position.

SMPCC_CMD_xCMD_CMD_Msk (0x1FUL << SMPCC_CMD_xCMD_CMD_Pos)

SMPCC_CMD register xCMD field CMD Mask.

SMPCC_CMD_xCMD_CMD_WB_ALL 0x7U

SMPCC_CMD xCMD CMD WB_ALL.

SMPCC_CMD_xCMD_CMD_WBINVAL_ALL 0x6U

SMPCC_CMD xCMD CMD WBINVAL_ALL.

SMPCC_CMD_xCMD_RESULT_Pos 26U

SMPCC_CMD xCMD RESULT Position.

SMPCC_CMD_xCMD_RESULT_Msk (0x1FUL << SMPCC_CMD_xCMD_RESULT_Pos)

SMPCC_CMD xCMD RESULT Mask.

SMPCC_CMD_xCMD_RESULT_SUCCESS 0x0U

SMPCC_CMD xCMD RESULT Success.

SMPCC_CMD_xCMD_RESULT_ENTRY_EXCEED_LIMIT 0x1U

SMPCC_CMD xCMD RESULT Exceed the upper entry num of lockable way.

SMPCC_CMD_xCMD_RESULT_REFILL_BUS_ERROR 0x3U

SMPCC_CMD xCMD RESULT Refill Bus Error.

SMPCC_CMD_xCMD_RESULT_ECC_ERROR 0x4U

SMPCC_CMD xCMD RESULT ECC Error.

SMPCC_CMD_xCMD_RESULT_CPBACK_BUS_ERROR 0x5U

SMPCC_CMD xCMD RESULT Copy Back Bus Error.

SMPCC_CMD_xCMD_COMPLETE_Pos 31U

SMPCC_CMD xCMD COMPLETE Position.

SMPCC_CMD_xCMD_COMPLETE_Msk (0x1UL << SMPCC_CMD_xCMD_COMPLETE_Pos)

SMPCC_CMD xCMD COMPLETE Mask.

SMPCC_CMD_INVALID_ALL_Pos 0U

SMPCC_CMD INVALID_ALL Position.

SMPCC_CMD_INVALID_ALL_Msk (0x1UL << SMPCC_CMD_INVALID_ALL_Pos)

SMPCC_CMD INVALID_ALL Mask.

SMPCC_CMD_BASE __SMPCC_BASEADDR

SMPCC CMD Base Address.

SMPCC_CMD ((SMPCC_CMD_Type *)SMPCC_CMD_BASE)

SMPCC CMD configuration struct.

struct SMPCC_CMD_Type
#include <core_feature_cache.h>

Cluster Cache Control and Command Registers.

Remark

This structure only holds a part of SMPCC registers, which are related to Cluster Cache CCM operations. Other more registers of SMPCC are listed in core_feature_smpcc.h