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

Functions that configure Instruction Cache. More...

Functions

__STATIC_INLINE int32_t ICachePresent (void)
 Check ICache Unit Present or Not. More...
 
__STATIC_FORCEINLINE void EnableICache (void)
 Enable ICache. More...
 
__STATIC_FORCEINLINE void DisableICache (void)
 Disable ICache. More...
 
__STATIC_FORCEINLINE void EnableICacheECC (void)
 Enable ICache ECC. More...
 
__STATIC_FORCEINLINE void DisableICacheECC (void)
 Disable ICache ECC. More...
 
__STATIC_INLINE int32_t GetICacheInfo (CacheInfo_Type *info)
 Get I-Cache Information. More...
 
__STATIC_INLINE void MInvalICacheLine (unsigned long addr)
 Invalidate one I-Cache line specified by address in M-Mode. More...
 
__STATIC_INLINE void MInvalICacheLines (unsigned long addr, unsigned long cnt)
 Invalidate several I-Cache lines specified by address in M-Mode. More...
 
__STATIC_INLINE void SInvalICacheLine (unsigned long addr)
 Invalidate one I-Cache line specified by address in S-Mode. More...
 
__STATIC_INLINE void SInvalICacheLines (unsigned long addr, unsigned long cnt)
 Invalidate several I-Cache lines specified by address in S-Mode. More...
 
__STATIC_INLINE void UInvalICacheLine (unsigned long addr)
 Invalidate one I-Cache line specified by address in U-Mode. More...
 
__STATIC_INLINE void UInvalICacheLines (unsigned long addr, unsigned long cnt)
 Invalidate several I-Cache lines specified by address in U-Mode. More...
 
__STATIC_INLINE void MInvalICacheCCacheLine (unsigned long addr)
 Invalidate one I-Cache and Cluster Cache line specified by address in M-Mode. More...
 
__STATIC_INLINE void MInvalICacheCCacheLines (unsigned long addr, unsigned long cnt)
 Invalidate several I-Cache and Cluster Cache lines specified by address in M-Mode. More...
 
__STATIC_INLINE void SInvalICacheCCacheLine (unsigned long addr)
 Invalidate one I-Cache and Cluster Cache line specified by address in S-Mode. More...
 
__STATIC_INLINE void SInvalICacheCCacheLines (unsigned long addr, unsigned long cnt)
 Invalidate several I-Cache and Cluster Cache lines specified by address in S-Mode. More...
 
__STATIC_INLINE void UInvalICacheCCacheLine (unsigned long addr)
 Invalidate one I-Cache and Cluster Cache line specified by address in U-Mode. More...
 
__STATIC_INLINE void UInvalICacheCCacheLines (unsigned long addr, unsigned long cnt)
 Invalidate several I-Cache and Cluster Cache lines specified by address in U-Mode. More...
 
__STATIC_INLINE unsigned long MLockICacheLine (unsigned long addr)
 Lock one I-Cache line specified by address in M-Mode. More...
 
__STATIC_INLINE unsigned long MLockICacheLines (unsigned long addr, unsigned long cnt)
 Lock several I-Cache lines specified by address in M-Mode. More...
 
__STATIC_INLINE unsigned long SLockICacheLine (unsigned long addr)
 Lock one I-Cache line specified by address in S-Mode. More...
 
__STATIC_INLINE unsigned long SLockICacheLines (unsigned long addr, unsigned long cnt)
 Lock several I-Cache lines specified by address in S-Mode. More...
 
__STATIC_INLINE unsigned long ULockICacheLine (unsigned long addr)
 Lock one I-Cache line specified by address in U-Mode. More...
 
__STATIC_INLINE unsigned long ULockICacheLines (unsigned long addr, unsigned long cnt)
 Lock several I-Cache lines specified by address in U-Mode. More...
 
__STATIC_INLINE void MUnlockICacheLine (unsigned long addr)
 Unlock one I-Cache line specified by address in M-Mode. More...
 
__STATIC_INLINE void MUnlockICacheLines (unsigned long addr, unsigned long cnt)
 Unlock several I-Cache lines specified by address in M-Mode. More...
 
__STATIC_INLINE void SUnlockICacheLine (unsigned long addr)
 Unlock one I-Cache line specified by address in S-Mode. More...
 
__STATIC_INLINE void SUnlockICacheLines (unsigned long addr, unsigned long cnt)
 Unlock several I-Cache lines specified by address in S-Mode. More...
 
__STATIC_INLINE void UUnlockICacheLine (unsigned long addr)
 Unlock one I-Cache line specified by address in U-Mode. More...
 
__STATIC_INLINE void UUnlockICacheLines (unsigned long addr, unsigned long cnt)
 Unlock several I-Cache lines specified by address in U-Mode. More...
 
__STATIC_INLINE void MInvalICache (void)
 Invalidate all I-Cache lines in M-Mode. More...
 
__STATIC_INLINE void SInvalICache (void)
 Invalidate all I-Cache lines in S-Mode. More...
 
__STATIC_INLINE void UInvalICache (void)
 Invalidate all I-Cache lines in U-Mode. More...
 
__STATIC_INLINE void MInvalCCache (void)
 Invalidate all Cluster Cache in M-Mode. More...
 
__STATIC_INLINE void SInvalCCache (void)
 Invalidate all Cluster Cache in S-Mode. More...
 
__STATIC_INLINE void UInvalCCache (void)
 Invalidate all Cluster Cache in U-Mode. More...
 
__STATIC_INLINE void MInvalICacheCCache (void)
 Invalidate all I-Cache and Cluster Cache in M-Mode. More...
 
__STATIC_INLINE void SInvalICacheCCache (void)
 Invalidate all I-Cache and Cluster Cache in S-Mode. More...
 
__STATIC_INLINE void UInvalICacheCCache (void)
 Invalidate all I-Cache and Cluster Cache in U-Mode. More...
 

Detailed Description

Functions that configure Instruction Cache.

Function Documentation

◆ DisableICache()

__STATIC_FORCEINLINE void DisableICache ( void  )

Disable ICache.

This function Disable I-Cache

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

Definition at line 577 of file core_feature_cache.h.

578 {
580 }
#define MCACHE_CTL_IC_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_IC_EN.

◆ DisableICacheECC()

__STATIC_FORCEINLINE void DisableICacheECC ( void  )

Disable ICache ECC.

This function disable I-Cache ECC

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

Definition at line 607 of file core_feature_cache.h.

608 {
610 }
#define MCACHE_CTL_IC_ECC_EN

References __RV_CSR_CLEAR, CSR_MCACHE_CTL, and MCACHE_CTL_IC_ECC_EN.

◆ EnableICache()

__STATIC_FORCEINLINE void EnableICache ( void  )

Enable ICache.

This function enable I-Cache

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

Definition at line 562 of file core_feature_cache.h.

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

References __RV_CSR_SET, CSR_MCACHE_CTL, and MCACHE_CTL_IC_EN.

Referenced by _premain_init().

◆ EnableICacheECC()

__STATIC_FORCEINLINE void EnableICacheECC ( void  )

Enable ICache ECC.

This function enable I-Cache ECC

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

Definition at line 592 of file core_feature_cache.h.

References __RV_CSR_SET, CSR_MCACHE_CTL, and MCACHE_CTL_IC_ECC_EN.

◆ GetICacheInfo()

__STATIC_INLINE int32_t GetICacheInfo ( CacheInfo_Type info)

Get I-Cache Information.

This function get I-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 623 of file core_feature_cache.h.

624 {
625  if (info == NULL) {
626  return -1;
627  }
628  CSR_MICFGINFO_Type csr_ccfg;
629  csr_ccfg.d = __RV_CSR_READ(CSR_MICFG_INFO);
630  info->setperway = (1UL << csr_ccfg.b.set) << 3;
631  info->ways = (1 + csr_ccfg.b.way);
632  if (csr_ccfg.b.lsize == 0) {
633  info->linesize = 0;
634  } else {
635  info->linesize = (1UL << (csr_ccfg.b.lsize - 1)) << 3;
636  }
637  info->size = info->setperway * info->ways * info->linesize;
638  return 0;
639 }
#define __RV_CSR_READ(csr)
CSR operation Macro for csrr instruction.
#define CSR_MICFG_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 MICFG_INFO CSR register.
rv_csr_t d
Type used for csr data access.
rv_csr_t set
bit: 0..3 I-Cache sets per way
rv_csr_t lsize
bit: 7..9 I-Cache line size
struct CSR_MICFGINFO_Type::@15 b
Structure used for bit access.
rv_csr_t way
bit: 4..6 I-Cache way

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

◆ ICachePresent()

__STATIC_INLINE int32_t ICachePresent ( void  )

Check ICache Unit Present or Not.

This function check icache 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 ICACHE bit in mcfg_info
Returns
1 if present otherwise 0

Definition at line 544 of file core_feature_cache.h.

545 {
547  return 1;
548  }
549  return 0;
550 }
#define MCFG_INFO_ICACHE
#define CSR_MCFG_INFO

References __RV_CSR_READ, CSR_MCFG_INFO, and MCFG_INFO_ICACHE.

Referenced by _premain_init().

◆ MInvalCCache()

__STATIC_INLINE void MInvalCCache ( void  )

Invalidate all Cluster Cache in M-Mode.

This function invalidate all Cluster Cache.

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

Definition at line 1236 of file core_feature_cache.h.

1237 {
1238  SMPCC_CMD->CC_INVALID_ALL = _VAL2FLD(SMPCC_CMD_INVALID_ALL, 1);
1239  while(_FLD2VAL(SMPCC_CMD_INVALID_ALL, SMPCC_CMD->CC_INVALID_ALL));
1240  __RWMB();
1241 }
#define SMPCC_CMD
SMPCC CMD configuration struct.
#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, and SMPCC_CMD.

◆ MInvalICache()

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

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

Definition at line 1189 of file core_feature_cache.h.

1190 {
1192  FlushPipeCCM();
1193  __RWMB();
1194 }
#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_IC_INVAL_ALL
Unlock and invalidate all the I-Cache lines.

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

◆ MInvalICacheCCache()

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

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

Definition at line 1279 of file core_feature_cache.h.

1280 {
1282  FlushPipeCCM();
1283  SMPCC_CMD->CC_INVALID_ALL = _VAL2FLD(SMPCC_CMD_INVALID_ALL, 1);
1284  while(_FLD2VAL(SMPCC_CMD_INVALID_ALL, SMPCC_CMD->CC_INVALID_ALL));
1285  __RWMB();
1286 }

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

◆ MInvalICacheCCacheLine()

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

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

Definition at line 778 of file core_feature_cache.h.

779 {
782  /* Trigger Cluster Cache invalidation by DC_INVAL */
784  FlushPipeCCM();
785  __RWMB();
786 }
#define CSR_CCM_MBEGINADDR
@ CCM_DC_INVAL
Unlock and invalidate D-Cache line and Cluster Cache line specified by CSR CCM_XBEGINADDR.
@ CCM_IC_INVAL
Unlock and invalidate I-Cache line specified by CSR CCM_XBEGINADDR.

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

◆ MInvalICacheCCacheLines()

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

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

800 {
801  if (cnt > 0) {
802  unsigned long i;
804  for (i = 0; i < cnt; i++) {
806  /* Trigger Cluster Cache invalidation by DC_INVAL */
808  }
809  FlushPipeCCM();
810  __RWMB();
811  }
812 }

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

◆ MInvalICacheLine()

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

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

Definition at line 651 of file core_feature_cache.h.

652 {
655  FlushPipeCCM();
656  __RWMB();
657 }

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

Referenced by __ECLIC_SetVector(), ECC_ICacheDRamErrInject(), ECC_ICacheErrRestore(), ECC_ICacheTRamErrInject(), SMPCC_CCacheDramErrInject(), SMPCC_CCacheErrRestore(), and SMPCC_CCacheTramErrInject().

◆ MInvalICacheLines()

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

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

671 {
672  if (cnt > 0) {
673  unsigned long i;
675  for (i = 0; i < cnt; i++) {
677  }
678  FlushPipeCCM();
679  __RWMB();
680  }
681 }

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

◆ MLockICacheLine()

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

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

918 {
921  FlushPipeCCM();
922  __RWMB();
924 }
#define CSR_CCM_MDATA
@ CCM_IC_LOCK
Lock the specific I-Cache line specified by CSR CCM_XBEGINADDR.

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

Referenced by ECC_ICacheDRamErrInject(), ECC_ICacheErrRestore(), and ECC_ICacheTRamErrInject().

◆ MLockICacheLines()

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

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

939 {
940  if (cnt > 0) {
941  unsigned long i;
942  unsigned long fail_info = CCM_OP_SUCCESS;
944  for (i = 0; i < cnt; i++) {
946  FlushPipeCCM();
947  __RWMB();
948  fail_info = __RV_CSR_READ(CSR_CCM_MDATA);
949  if (CCM_OP_SUCCESS != fail_info) {
950  return fail_info;
951  }
952  }
953  }
954  return CCM_OP_SUCCESS;
955 }
@ CCM_OP_SUCCESS
Lock Succeed.

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

◆ MUnlockICacheLine()

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

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

Definition at line 1066 of file core_feature_cache.h.

1067 {
1070  FlushPipeCCM();
1071  __RWMB();
1072 }
@ CCM_IC_UNLOCK
Unlock the specific I-Cache line specified by CSR CCM_XBEGINADDR.

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

◆ MUnlockICacheLines()

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

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

1086 {
1087  if (cnt > 0) {
1088  unsigned long i;
1090  for (i = 0; i < cnt; i++) {
1092  }
1093  FlushPipeCCM();
1094  __RWMB();
1095  }
1096 }

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

◆ SInvalCCache()

__STATIC_INLINE void SInvalCCache ( void  )

Invalidate all Cluster Cache in S-Mode.

This function invalidate all Cluster Cache.

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

Definition at line 1250 of file core_feature_cache.h.

1251 {
1252  SMPCC_CMD->CC_INVALID_ALL = _VAL2FLD(SMPCC_CMD_INVALID_ALL, 1);
1253  while(_FLD2VAL(SMPCC_CMD_INVALID_ALL, SMPCC_CMD->CC_INVALID_ALL));
1254  __RWMB();
1255 }

References __RWMB, _FLD2VAL, _VAL2FLD, and SMPCC_CMD.

◆ SInvalICache()

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

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

Definition at line 1205 of file core_feature_cache.h.

1206 {
1208  FlushPipeCCM();
1209  __RWMB();
1210 }
#define CSR_CCM_SCOMMAND

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

◆ SInvalICacheCCache()

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

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

Definition at line 1296 of file core_feature_cache.h.

1297 {
1299  FlushPipeCCM();
1300  SMPCC_CMD->CC_INVALID_ALL = _VAL2FLD(SMPCC_CMD_INVALID_ALL, 1);
1301  while(_FLD2VAL(SMPCC_CMD_INVALID_ALL, SMPCC_CMD->CC_INVALID_ALL));
1302  __RWMB();
1303 }

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

◆ SInvalICacheCCacheLine()

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

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

Definition at line 824 of file core_feature_cache.h.

825 {
828  /* Trigger Cluster Cache invalidation by DC_INVAL */
830  FlushPipeCCM();
831  __RWMB();
832 }
#define CSR_CCM_SBEGINADDR

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

◆ SInvalICacheCCacheLines()

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

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

846 {
847  if (cnt > 0) {
848  unsigned long i;
850  for (i = 0; i < cnt; i++) {
852  /* Trigger Cluster Cache invalidation by DC_INVAL */
854  }
855  FlushPipeCCM();
856  __RWMB();
857  }
858 }

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

◆ SInvalICacheLine()

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

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

Definition at line 693 of file core_feature_cache.h.

694 {
697  FlushPipeCCM();
698  __RWMB();
699 }

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

Referenced by __ECLIC_SetVector_S().

◆ SInvalICacheLines()

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

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

713 {
714  if (cnt > 0) {
715  unsigned long i;
717  for (i = 0; i < cnt; i++) {
719  }
720  FlushPipeCCM();
721  __RWMB();
722  }
723 }

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

◆ SLockICacheLine()

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

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

968 {
971  FlushPipeCCM();
972  __RWMB();
974 }
#define CSR_CCM_SDATA

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

◆ SLockICacheLines()

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

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

989 {
990  if (cnt > 0) {
991  unsigned long i;
992  unsigned long fail_info = CCM_OP_SUCCESS;
994  for (i = 0; i < cnt; i++) {
996  FlushPipeCCM();
997  __RWMB();
998  fail_info = __RV_CSR_READ(CSR_CCM_SDATA);
999  if (CCM_OP_SUCCESS != fail_info) {
1000  return fail_info;
1001  }
1002  }
1003  }
1004  return CCM_OP_SUCCESS;
1005 }

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

◆ SUnlockICacheLine()

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

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

Definition at line 1107 of file core_feature_cache.h.

1108 {
1111  FlushPipeCCM();
1112  __RWMB();
1113 }

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

◆ SUnlockICacheLines()

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

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

1127 {
1128  if (cnt > 0) {
1129  unsigned long i;
1131  for (i = 0; i < cnt; i++) {
1133  }
1134  FlushPipeCCM();
1135  __RWMB();
1136  }
1137 }

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

◆ UInvalCCache()

__STATIC_INLINE void UInvalCCache ( void  )

Invalidate all Cluster Cache in U-Mode.

This function invalidate all Cluster Cache.

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

Definition at line 1264 of file core_feature_cache.h.

1265 {
1266  SMPCC_CMD->CC_INVALID_ALL = _VAL2FLD(SMPCC_CMD_INVALID_ALL, 1);
1267  while(_FLD2VAL(SMPCC_CMD_INVALID_ALL, SMPCC_CMD->CC_INVALID_ALL));
1268  __RWMB();
1269 }

References __RWMB, _FLD2VAL, _VAL2FLD, and SMPCC_CMD.

◆ UInvalICache()

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

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

Definition at line 1221 of file core_feature_cache.h.

1222 {
1224  FlushPipeCCM();
1225  __RWMB();
1226 }
#define CSR_CCM_UCOMMAND

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

◆ UInvalICacheCCache()

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

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

Definition at line 1313 of file core_feature_cache.h.

1314 {
1316  FlushPipeCCM();
1317  SMPCC_CMD->CC_INVALID_ALL = _VAL2FLD(SMPCC_CMD_INVALID_ALL, 1);
1318  while(_FLD2VAL(SMPCC_CMD_INVALID_ALL, SMPCC_CMD->CC_INVALID_ALL));
1319  __RWMB();
1320 }

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

◆ UInvalICacheCCacheLine()

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

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

Definition at line 870 of file core_feature_cache.h.

871 {
874  /* Trigger Cluster Cache invalidation by DC_INVAL */
876  FlushPipeCCM();
877  __RWMB();
878 }
#define CSR_CCM_UBEGINADDR

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

◆ UInvalICacheCCacheLines()

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

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

892 {
893  if (cnt > 0) {
894  unsigned long i;
896  for (i = 0; i < cnt; i++) {
898  /* Trigger Cluster Cache invalidation by DC_INVAL */
900  }
901  FlushPipeCCM();
902  __RWMB();
903  }
904 }

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

◆ UInvalICacheLine()

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

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

Definition at line 735 of file core_feature_cache.h.

736 {
739  FlushPipeCCM();
740  __RWMB();
741 }

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

◆ UInvalICacheLines()

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

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

755 {
756  if (cnt > 0) {
757  unsigned long i;
759  for (i = 0; i < cnt; i++) {
761  }
762  FlushPipeCCM();
763  __RWMB();
764  }
765 }

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

◆ ULockICacheLine()

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

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

1018 {
1021  FlushPipeCCM();
1022  __RWMB();
1023  return __RV_CSR_READ(CSR_CCM_UDATA);
1024 }
#define CSR_CCM_UDATA

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

◆ ULockICacheLines()

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

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

1039 {
1040  if (cnt > 0) {
1041  unsigned long i;
1042  unsigned long fail_info = CCM_OP_SUCCESS;
1044  for (i = 0; i < cnt; i++) {
1046  FlushPipeCCM();
1047  __RWMB();
1048  fail_info = __RV_CSR_READ(CSR_CCM_UDATA);
1049  if (CCM_OP_SUCCESS != fail_info) {
1050  return fail_info;
1051  }
1052  }
1053  }
1054  return CCM_OP_SUCCESS;
1055 }

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

◆ UUnlockICacheLine()

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

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

Definition at line 1148 of file core_feature_cache.h.

1149 {
1152  FlushPipeCCM();
1153  __RWMB();
1154 }

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

◆ UUnlockICacheLines()

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

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

1168 {
1169  if (cnt > 0) {
1170  unsigned long i;
1172  for (i = 0; i < cnt; i++) {
1174  }
1175  FlushPipeCCM();
1176  __RWMB();
1177  }
1178 }

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