NMSIS-Core  Version 1.5.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 575 of file core_feature_cache.h.

576 {
578 }
#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 605 of file core_feature_cache.h.

606 {
608 }
#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 560 of file core_feature_cache.h.

561 {
563 }
#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 590 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 621 of file core_feature_cache.h.

622 {
623  if (info == NULL) {
624  return -1;
625  }
626  CSR_MICFGINFO_Type csr_ccfg;
627  csr_ccfg.d = __RV_CSR_READ(CSR_MICFG_INFO);
628  info->setperway = (1UL << csr_ccfg.b.set) << 3;
629  info->ways = (1 + csr_ccfg.b.way);
630  if (csr_ccfg.b.lsize == 0) {
631  info->linesize = 0;
632  } else {
633  info->linesize = (1UL << (csr_ccfg.b.lsize - 1)) << 3;
634  }
635  info->size = info->setperway * info->ways * info->linesize;
636  return 0;
637 }
#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 542 of file core_feature_cache.h.

543 {
545  return 1;
546  }
547  return 0;
548 }
#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 1234 of file core_feature_cache.h.

1235 {
1236  SMPCC_CMD->CC_INVALID_ALL = _VAL2FLD(SMPCC_CMD_INVALID_ALL, 1);
1237  while(_FLD2VAL(SMPCC_CMD_INVALID_ALL, SMPCC_CMD->CC_INVALID_ALL));
1238  __RWMB();
1239 }
#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 1187 of file core_feature_cache.h.

1188 {
1190  FlushPipeCCM();
1191  __RWMB();
1192 }
#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 1277 of file core_feature_cache.h.

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

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

777 {
780  /* Trigger Cluster Cache invalidation by DC_INVAL */
782  FlushPipeCCM();
783  __RWMB();
784 }
#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 797 of file core_feature_cache.h.

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

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

650 {
653  FlushPipeCCM();
654  __RWMB();
655 }

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

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

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

916 {
919  FlushPipeCCM();
920  __RWMB();
922 }
#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 936 of file core_feature_cache.h.

937 {
938  if (cnt > 0) {
939  unsigned long i;
940  unsigned long fail_info = CCM_OP_SUCCESS;
942  for (i = 0; i < cnt; i++) {
944  FlushPipeCCM();
945  __RWMB();
946  fail_info = __RV_CSR_READ(CSR_CCM_MDATA);
947  if (CCM_OP_SUCCESS != fail_info) {
948  return fail_info;
949  }
950  }
951  }
952  return CCM_OP_SUCCESS;
953 }
@ 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 1064 of file core_feature_cache.h.

1065 {
1068  FlushPipeCCM();
1069  __RWMB();
1070 }
@ 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 1083 of file core_feature_cache.h.

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

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

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

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

1204 {
1206  FlushPipeCCM();
1207  __RWMB();
1208 }
#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 1294 of file core_feature_cache.h.

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

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

823 {
826  /* Trigger Cluster Cache invalidation by DC_INVAL */
828  FlushPipeCCM();
829  __RWMB();
830 }
#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 843 of file core_feature_cache.h.

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

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

692 {
695  FlushPipeCCM();
696  __RWMB();
697 }

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

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

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

966 {
969  FlushPipeCCM();
970  __RWMB();
972 }
#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 986 of file core_feature_cache.h.

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

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

1106 {
1109  FlushPipeCCM();
1110  __RWMB();
1111 }

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

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

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

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

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

1220 {
1222  FlushPipeCCM();
1223  __RWMB();
1224 }
#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 1311 of file core_feature_cache.h.

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

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

869 {
872  /* Trigger Cluster Cache invalidation by DC_INVAL */
874  FlushPipeCCM();
875  __RWMB();
876 }
#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 889 of file core_feature_cache.h.

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

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

734 {
737  FlushPipeCCM();
738  __RWMB();
739 }

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

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

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

1016 {
1019  FlushPipeCCM();
1020  __RWMB();
1021  return __RV_CSR_READ(CSR_CCM_UDATA);
1022 }
#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 1036 of file core_feature_cache.h.

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

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

1147 {
1150  FlushPipeCCM();
1151  __RWMB();
1152 }

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

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

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