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

Functions that configure Data Cache. More...

Functions

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

Detailed Description

Functions that configure Data Cache.

Function Documentation

◆ DCachePresent()

__STATIC_FORCEINLINE int32_t DCachePresent ( void  )

Check DCache Unit Present or Not.

This function check dcache unit present or not via mcfg_info csr

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

Definition at line 742 of file core_feature_cache.h.

743 {
745  return 1;
746  }
747  return 0;
748 }
#define MCFG_INFO_DCACHE
#define __RV_CSR_READ(csr)
CSR operation Macro for csrr instruction.
#define CSR_MCFG_INFO

References __RV_CSR_READ, CSR_MCFG_INFO, and MCFG_INFO_DCACHE.

Referenced by _premain_init().

◆ DisableDCache()

__STATIC_FORCEINLINE void DisableDCache ( void  )

Disable DCache.

This function Disable D-Cache

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

Definition at line 775 of file core_feature_cache.h.

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

References __RV_CSR_CLEAR, CSR_MCACHE_CTL, and MCACHE_CTL_DC_EN.

◆ DisableDCacheECC()

__STATIC_FORCEINLINE void DisableDCacheECC ( void  )

Disable DCache ECC.

This function disable D-Cache ECC

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

Definition at line 805 of file core_feature_cache.h.

806 {
808 }
#define MCACHE_CTL_DC_ECC_EN

References __RV_CSR_CLEAR, CSR_MCACHE_CTL, and MCACHE_CTL_DC_ECC_EN.

◆ EnableDCache()

__STATIC_FORCEINLINE void EnableDCache ( void  )

Enable DCache.

This function enable D-Cache

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

Definition at line 760 of file core_feature_cache.h.

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

References __RV_CSR_SET, CSR_MCACHE_CTL, and MCACHE_CTL_DC_EN.

Referenced by _premain_init().

◆ EnableDCacheECC()

__STATIC_FORCEINLINE void EnableDCacheECC ( void  )

Enable DCache ECC.

This function enable D-Cache ECC

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

Definition at line 790 of file core_feature_cache.h.

References __RV_CSR_SET, CSR_MCACHE_CTL, and MCACHE_CTL_DC_ECC_EN.

◆ GetDCacheInfo()

__STATIC_FORCEINLINE int32_t GetDCacheInfo ( CacheInfo_Type info)

Get D-Cache Information.

This function get D-Cache Information

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

Definition at line 821 of file core_feature_cache.h.

822 {
823  if (info == NULL) {
824  return -1;
825  }
826  CSR_MDCFGINFO_Type csr_ccfg;
827  csr_ccfg.d = __RV_CSR_READ(CSR_MDCFG_INFO);
828  info->setperway = (1UL << csr_ccfg.b.set) << 3;
829  info->ways = (1 + csr_ccfg.b.way);
830  if (csr_ccfg.b.lsize == 0) {
831  info->linesize = 0;
832  } else {
833  info->linesize = (1UL << (csr_ccfg.b.lsize - 1)) << 3;
834  }
835  info->size = info->setperway * info->ways * info->linesize;
836  return 0;
837 }
#define CSR_MDCFG_INFO
uint32_t setperway
Cache set per way.
uint32_t ways
Cache ways.
uint32_t linesize
Cache Line size in bytes.
uint32_t size
Cache total size in bytes.
Union type to access MDCFG_INFO CSR register.
rv_csr_t set
bit: 0..3 D-Cache sets per way
rv_csr_t d
Type used for csr data access.
struct CSR_MDCFGINFO_Type::@15 b
Structure used for bit access.
rv_csr_t lsize
bit: 7..9 D-Cache line size
rv_csr_t way
bit: 4..6 D-Cache way

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

◆ MFlushDCache()

__STATIC_FORCEINLINE void MFlushDCache ( void  )

Flush all D-Cache lines in M-Mode.

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

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

Definition at line 1543 of file core_feature_cache.h.

1544 {
1546  FlushPipeCCM();
1547  __RWMB();
1548 }
#define __RWMB()
Read & Write Memory barrier.
#define __RV_CSR_WRITE(csr, val)
CSR operation Macro for csrw instruction.
#define CSR_CCM_MCOMMAND
__STATIC_FORCEINLINE void FlushPipeCCM(void)
Flush pipeline after CCM operation.
@ CCM_DC_WB_ALL
Flush all the valid and dirty D-Cache lines.

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

◆ MFlushDCacheLine()

__STATIC_FORCEINLINE void MFlushDCacheLine ( unsigned long  addr)

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

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

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

Definition at line 974 of file core_feature_cache.h.

975 {
978  FlushPipeCCM();
979  __RWMB();
980 }
#define CSR_CCM_MBEGINADDR
@ CCM_DC_WB
Flush the specific D-Cache line specified by CSR CCM_XBEGINADDR.

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

Referenced by __ECLIC_SetVector().

◆ MFlushDCacheLines()

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

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

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

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

Definition at line 993 of file core_feature_cache.h.

994 {
995  if (cnt > 0) {
996  unsigned long i;
998  for (i = 0; i < cnt; i++) {
1000  }
1001  FlushPipeCCM();
1002  __RWMB();
1003  }
1004 }

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

◆ MFlushInvalDCache()

__STATIC_FORCEINLINE void MFlushInvalDCache ( void  )

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

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

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

Definition at line 1591 of file core_feature_cache.h.

1592 {
1594  FlushPipeCCM();
1595  __RWMB();
1596 }
@ CCM_DC_WBINVAL_ALL
Unlock and flush and invalidate all the valid and dirty D-Cache lines.

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

◆ MFlushInvalDCacheLine()

__STATIC_FORCEINLINE void MFlushInvalDCacheLine ( unsigned long  addr)

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

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

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

Definition at line 1097 of file core_feature_cache.h.

1098 {
1101  FlushPipeCCM();
1102  __RWMB();
1103 }
@ CCM_DC_WBINVAL
Unlock, flush and invalidate the specific D-Cache line specified by CSR CCM_XBEGINADDR.

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

◆ MFlushInvalDCacheLines()

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

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

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

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

Definition at line 1116 of file core_feature_cache.h.

1117 {
1118  if (cnt > 0) {
1119  unsigned long i;
1121  for (i = 0; i < cnt; i++) {
1123  }
1124  FlushPipeCCM();
1125  __RWMB();
1126  }
1127 }

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

◆ MInvalDCache()

__STATIC_FORCEINLINE void MInvalDCache ( void  )

Invalidate all D-Cache lines in M-Mode.

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

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

Definition at line 1493 of file core_feature_cache.h.

1494 {
1496  FlushPipeCCM();
1497  __RWMB();
1498 }
@ CCM_DC_INVAL_ALL
Unlock and invalidate all the D-Cache lines.

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

◆ MInvalDCacheLine()

__STATIC_FORCEINLINE void MInvalDCacheLine ( unsigned long  addr)

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

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

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

Definition at line 849 of file core_feature_cache.h.

850 {
853  FlushPipeCCM();
854  __RWMB();
855 }
@ CCM_DC_INVAL
Unlock and invalidate D-Cache line specified by CSR CCM_XBEGINADDR.

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

◆ MInvalDCacheLines()

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

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

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

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

Definition at line 868 of file core_feature_cache.h.

869 {
870  if (cnt > 0) {
871  unsigned long i;
873  for (i = 0; i < cnt; i++) {
875  }
876  FlushPipeCCM();
877  __RWMB();
878  }
879 }

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

◆ MLockDCacheLine()

__STATIC_FORCEINLINE unsigned long MLockDCacheLine ( unsigned long  addr)

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

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

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

Definition at line 1221 of file core_feature_cache.h.

1222 {
1225  FlushPipeCCM();
1226  __RWMB();
1227  return __RV_CSR_READ(CSR_CCM_MDATA);
1228 }
#define CSR_CCM_MDATA
@ CCM_DC_LOCK
Lock the specific D-Cache line specified by CSR CCM_XBEGINADDR.

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

◆ MLockDCacheLines()

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

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

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

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

Definition at line 1242 of file core_feature_cache.h.

1243 {
1244  if (cnt > 0) {
1245  unsigned long i;
1246  unsigned long fail_info = CCM_OP_SUCCESS;
1248  for (i = 0; i < cnt; i++) {
1250  FlushPipeCCM();
1251  __RWMB();
1252  fail_info = __RV_CSR_READ(CSR_CCM_MDATA);
1253  if (CCM_OP_SUCCESS != fail_info) {
1254  return fail_info;
1255  }
1256  }
1257  }
1258  return CCM_OP_SUCCESS;
1259 }
@ CCM_OP_SUCCESS
Lock Succeed.

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

◆ MUnlockDCacheLine()

__STATIC_FORCEINLINE void MUnlockDCacheLine ( unsigned long  addr)

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

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

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

Definition at line 1370 of file core_feature_cache.h.

1371 {
1374  FlushPipeCCM();
1375  __RWMB();
1376 }
@ CCM_DC_UNLOCK
Unlock the specific D-Cache line specified by CSR CCM_XBEGINADDR.

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

◆ MUnlockDCacheLines()

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

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

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

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

Definition at line 1389 of file core_feature_cache.h.

1390 {
1391  if (cnt > 0) {
1392  unsigned long i;
1394  for (i = 0; i < cnt; i++) {
1396  }
1397  FlushPipeCCM();
1398  __RWMB();
1399  }
1400 }

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

◆ SFlushDCache()

__STATIC_FORCEINLINE void SFlushDCache ( void  )

Flush all D-Cache lines in S-Mode.

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

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

Definition at line 1559 of file core_feature_cache.h.

1560 {
1562  FlushPipeCCM();
1563  __RWMB();
1564 }
#define CSR_CCM_SCOMMAND

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

◆ SFlushDCacheLine()

__STATIC_FORCEINLINE void SFlushDCacheLine ( unsigned long  addr)

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

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

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

Definition at line 1015 of file core_feature_cache.h.

1016 {
1019  FlushPipeCCM();
1020  __RWMB();
1021 }
#define CSR_CCM_SBEGINADDR

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

Referenced by __ECLIC_SetVector_S().

◆ SFlushDCacheLines()

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

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

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

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

Definition at line 1034 of file core_feature_cache.h.

1035 {
1036  if (cnt > 0) {
1037  unsigned long i;
1039  for (i = 0; i < cnt; i++) {
1041  }
1042  FlushPipeCCM();
1043  __RWMB();
1044  }
1045 }

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

◆ SFlushInvalDCache()

__STATIC_FORCEINLINE void SFlushInvalDCache ( void  )

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

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

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

Definition at line 1607 of file core_feature_cache.h.

1608 {
1610  FlushPipeCCM();
1611  __RWMB();
1612 }

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

◆ SFlushInvalDCacheLine()

__STATIC_FORCEINLINE void SFlushInvalDCacheLine ( unsigned long  addr)

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

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

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

Definition at line 1138 of file core_feature_cache.h.

1139 {
1142  FlushPipeCCM();
1143  __RWMB();
1144 }

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

◆ SFlushInvalDCacheLines()

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

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

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

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

Definition at line 1157 of file core_feature_cache.h.

1158 {
1159  if (cnt > 0) {
1160  unsigned long i;
1162  for (i = 0; i < cnt; i++) {
1164  }
1165  FlushPipeCCM();
1166  __RWMB();
1167  }
1168 }

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

◆ SInvalDCache()

__STATIC_FORCEINLINE void SInvalDCache ( void  )

Invalidate all D-Cache lines in S-Mode.

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

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

Definition at line 1509 of file core_feature_cache.h.

1510 {
1512  FlushPipeCCM();
1513  __RWMB();
1514 }

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

◆ SInvalDCacheLine()

__STATIC_FORCEINLINE void SInvalDCacheLine ( unsigned long  addr)

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

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

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

Definition at line 891 of file core_feature_cache.h.

892 {
895  FlushPipeCCM();
896  __RWMB();
897 }

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

◆ SInvalDCacheLines()

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

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

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

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

Definition at line 910 of file core_feature_cache.h.

911 {
912  if (cnt > 0) {
913  unsigned long i;
915  for (i = 0; i < cnt; i++) {
917  }
918  FlushPipeCCM();
919  __RWMB();
920  }
921 }

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

◆ SLockDCacheLine()

__STATIC_FORCEINLINE unsigned long SLockDCacheLine ( unsigned long  addr)

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

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

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

Definition at line 1271 of file core_feature_cache.h.

1272 {
1275  FlushPipeCCM();
1276  __RWMB();
1277  return __RV_CSR_READ(CSR_CCM_SDATA);
1278 }
#define CSR_CCM_SDATA

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

◆ SLockDCacheLines()

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

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

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

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

Definition at line 1292 of file core_feature_cache.h.

1293 {
1294  if (cnt > 0) {
1295  unsigned long i;
1296  unsigned long fail_info = CCM_OP_SUCCESS;
1298  for (i = 0; i < cnt; i++) {
1300  FlushPipeCCM();
1301  __RWMB();
1302  fail_info = __RV_CSR_READ(CSR_CCM_SDATA);
1303  if (CCM_OP_SUCCESS != fail_info) {
1304  return fail_info;
1305  }
1306  }
1307  }
1308  return CCM_OP_SUCCESS;
1309 }

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

◆ SUnlockDCacheLine()

__STATIC_FORCEINLINE void SUnlockDCacheLine ( unsigned long  addr)

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

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

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

Definition at line 1411 of file core_feature_cache.h.

1412 {
1415  FlushPipeCCM();
1416  __RWMB();
1417 }

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

◆ SUnlockDCacheLines()

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

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

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

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

Definition at line 1430 of file core_feature_cache.h.

1431 {
1432  if (cnt > 0) {
1433  unsigned long i;
1435  for (i = 0; i < cnt; i++) {
1437  }
1438  FlushPipeCCM();
1439  __RWMB();
1440  }
1441 }

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

◆ UFlushDCache()

__STATIC_FORCEINLINE void UFlushDCache ( void  )

Flush all D-Cache lines in U-Mode.

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

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

Definition at line 1575 of file core_feature_cache.h.

1576 {
1578  FlushPipeCCM();
1579  __RWMB();
1580 }
#define CSR_CCM_UCOMMAND

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

◆ UFlushDCacheLine()

__STATIC_FORCEINLINE void UFlushDCacheLine ( unsigned long  addr)

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

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

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

Definition at line 1056 of file core_feature_cache.h.

1057 {
1060  FlushPipeCCM();
1061  __RWMB();
1062 }
#define CSR_CCM_UBEGINADDR

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

◆ UFlushDCacheLines()

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

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

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

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

Definition at line 1075 of file core_feature_cache.h.

1076 {
1077  if (cnt > 0) {
1078  unsigned long i;
1080  for (i = 0; i < cnt; i++) {
1082  }
1083  FlushPipeCCM();
1084  __RWMB();
1085  }
1086 }

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

◆ UFlushInvalDCache()

__STATIC_FORCEINLINE void UFlushInvalDCache ( void  )

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

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

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

Definition at line 1623 of file core_feature_cache.h.

1624 {
1626  FlushPipeCCM();
1627  __RWMB();
1628 }

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

◆ UFlushInvalDCacheLine()

__STATIC_FORCEINLINE void UFlushInvalDCacheLine ( unsigned long  addr)

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

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

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

Definition at line 1179 of file core_feature_cache.h.

1180 {
1183  FlushPipeCCM();
1184  __RWMB();
1185 }

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

◆ UFlushInvalDCacheLines()

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

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

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

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

Definition at line 1198 of file core_feature_cache.h.

1199 {
1200  if (cnt > 0) {
1201  unsigned long i;
1203  for (i = 0; i < cnt; i++) {
1205  }
1206  FlushPipeCCM();
1207  __RWMB();
1208  }
1209 }

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

◆ UInvalDCache()

__STATIC_FORCEINLINE void UInvalDCache ( void  )

Invalidate all D-Cache lines in U-Mode.

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

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

Definition at line 1527 of file core_feature_cache.h.

1528 {
1530  FlushPipeCCM();
1531  __RWMB();
1532 }

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

◆ UInvalDCacheLine()

__STATIC_FORCEINLINE void UInvalDCacheLine ( unsigned long  addr)

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

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

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

Definition at line 933 of file core_feature_cache.h.

934 {
937  FlushPipeCCM();
938  __RWMB();
939 }

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

◆ UInvalDCacheLines()

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

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

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

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

Definition at line 952 of file core_feature_cache.h.

953 {
954  if (cnt > 0) {
955  unsigned long i;
957  for (i = 0; i < cnt; i++) {
959  }
960  FlushPipeCCM();
961  __RWMB();
962  }
963 }

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

◆ ULockDCacheLine()

__STATIC_FORCEINLINE unsigned long ULockDCacheLine ( unsigned long  addr)

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

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

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

Definition at line 1321 of file core_feature_cache.h.

1322 {
1325  FlushPipeCCM();
1326  __RWMB();
1327  return __RV_CSR_READ(CSR_CCM_UDATA);
1328 }
#define CSR_CCM_UDATA

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

◆ ULockDCacheLines()

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

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

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

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

Definition at line 1342 of file core_feature_cache.h.

1343 {
1344  if (cnt > 0) {
1345  unsigned long i;
1346  unsigned long fail_info = CCM_OP_SUCCESS;
1348  for (i = 0; i < cnt; i++) {
1350  FlushPipeCCM();
1351  __RWMB();
1352  fail_info = __RV_CSR_READ(CSR_CCM_UDATA);
1353  if (CCM_OP_SUCCESS != fail_info) {
1354  return fail_info;
1355  }
1356  }
1357  }
1358  return CCM_OP_SUCCESS;
1359 }

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

◆ UUnlockDCacheLine()

__STATIC_FORCEINLINE void UUnlockDCacheLine ( unsigned long  addr)

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

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

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

Definition at line 1452 of file core_feature_cache.h.

1453 {
1456  FlushPipeCCM();
1457  __RWMB();
1458 }

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

◆ UUnlockDCacheLines()

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

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

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

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

Definition at line 1471 of file core_feature_cache.h.

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

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