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

Functions that configure Instruction Cache. More...

Functions

__STATIC_FORCEINLINE 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_FORCEINLINE int32_t GetICacheInfo (CacheInfo_Type *info)
 Get I-Cache Information. More...
 
__STATIC_FORCEINLINE void MInvalICacheLine (unsigned long addr)
 Invalidate one I-Cache line specified by address in M-Mode. More...
 
__STATIC_FORCEINLINE void MInvalICacheLines (unsigned long addr, unsigned long cnt)
 Invalidate several I-Cache lines specified by address in M-Mode. More...
 
__STATIC_FORCEINLINE void SInvalICacheLine (unsigned long addr)
 Invalidate one I-Cache line specified by address in S-Mode. More...
 
__STATIC_FORCEINLINE void SInvalICacheLines (unsigned long addr, unsigned long cnt)
 Invalidate several I-Cache lines specified by address in S-Mode. More...
 
__STATIC_FORCEINLINE void UInvalICacheLine (unsigned long addr)
 Invalidate one I-Cache line specified by address in U-Mode. More...
 
__STATIC_FORCEINLINE void UInvalICacheLines (unsigned long addr, unsigned long cnt)
 Invalidate several I-Cache lines specified by address in U-Mode. More...
 
__STATIC_FORCEINLINE unsigned long MLockICacheLine (unsigned long addr)
 Lock one I-Cache line specified by address in M-Mode. More...
 
__STATIC_FORCEINLINE unsigned long MLockICacheLines (unsigned long addr, unsigned long cnt)
 Lock several I-Cache lines specified by address in M-Mode. More...
 
__STATIC_FORCEINLINE unsigned long SLockICacheLine (unsigned long addr)
 Lock one I-Cache line specified by address in S-Mode. More...
 
__STATIC_FORCEINLINE unsigned long SLockICacheLines (unsigned long addr, unsigned long cnt)
 Lock several I-Cache lines specified by address in S-Mode. More...
 
__STATIC_FORCEINLINE unsigned long ULockICacheLine (unsigned long addr)
 Lock one I-Cache line specified by address in U-Mode. More...
 
__STATIC_FORCEINLINE unsigned long ULockICacheLines (unsigned long addr, unsigned long cnt)
 Lock several I-Cache lines specified by address in U-Mode. More...
 
__STATIC_FORCEINLINE void MUnlockICacheLine (unsigned long addr)
 Unlock one I-Cache line specified by address in M-Mode. More...
 
__STATIC_FORCEINLINE void MUnlockICacheLines (unsigned long addr, unsigned long cnt)
 Unlock several I-Cache lines specified by address in M-Mode. More...
 
__STATIC_FORCEINLINE void SUnlockICacheLine (unsigned long addr)
 Unlock one I-Cache line specified by address in S-Mode. More...
 
__STATIC_FORCEINLINE void SUnlockICacheLines (unsigned long addr, unsigned long cnt)
 Unlock several I-Cache lines specified by address in S-Mode. More...
 
__STATIC_FORCEINLINE void UUnlockICacheLine (unsigned long addr)
 Unlock one I-Cache line specified by address in U-Mode. More...
 
__STATIC_FORCEINLINE void UUnlockICacheLines (unsigned long addr, unsigned long cnt)
 Unlock several I-Cache lines specified by address in U-Mode. More...
 
__STATIC_FORCEINLINE void MInvalICache (void)
 Invalidate all I-Cache lines in M-Mode. More...
 
__STATIC_FORCEINLINE void SInvalICache (void)
 Invalidate all I-Cache lines in S-Mode. More...
 
__STATIC_FORCEINLINE void UInvalICache (void)
 Invalidate all I-Cache lines 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 211 of file core_feature_cache.h.

212 {
214 }
#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 241 of file core_feature_cache.h.

242 {
244 }
#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 196 of file core_feature_cache.h.

197 {
199 }
#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 226 of file core_feature_cache.h.

References __RV_CSR_SET, CSR_MCACHE_CTL, and MCACHE_CTL_IC_ECC_EN.

◆ GetICacheInfo()

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

258 {
259  if (info == NULL) {
260  return -1;
261  }
262  CSR_MICFGINFO_Type csr_ccfg;
263  csr_ccfg.d = __RV_CSR_READ(CSR_MICFG_INFO);
264  info->setperway = (1UL << csr_ccfg.b.set) << 3;
265  info->ways = (1 + csr_ccfg.b.way);
266  if (csr_ccfg.b.lsize == 0) {
267  info->linesize = 0;
268  } else {
269  info->linesize = (1UL << (csr_ccfg.b.lsize - 1)) << 3;
270  }
271  info->size = info->setperway * info->ways * info->linesize;
272  return 0;
273 }
#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
struct CSR_MICFGINFO_Type::@14 b
Structure used for bit access.
rv_csr_t lsize
bit: 7..9 I-Cache line size
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_FORCEINLINE 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 178 of file core_feature_cache.h.

179 {
181  return 1;
182  }
183  return 0;
184 }
#define MCFG_INFO_ICACHE
#define CSR_MCFG_INFO

References __RV_CSR_READ, CSR_MCFG_INFO, and MCFG_INFO_ICACHE.

Referenced by _premain_init().

◆ MInvalICache()

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

684 {
686  FlushPipeCCM();
687  __RWMB();
688 }
#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_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().

◆ MInvalICacheLine()

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

286 {
289  FlushPipeCCM();
290  __RWMB();
291 }
#define CSR_CCM_MBEGINADDR
@ CCM_IC_INVAL
Unlock and invalidate I-Cache line specified by CSR CCM_XBEGINADDR.

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

Referenced by __ECLIC_SetVector().

◆ MInvalICacheLines()

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

305 {
306  if (cnt > 0) {
307  unsigned long i;
309  for (i = 0; i < cnt; i++) {
311  }
312  FlushPipeCCM();
313  __RWMB();
314  }
315 }

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

◆ MLockICacheLine()

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

412 {
415  FlushPipeCCM();
416  __RWMB();
418 }
#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().

◆ MLockICacheLines()

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

433 {
434  if (cnt > 0) {
435  unsigned long i;
436  unsigned long fail_info = CCM_OP_SUCCESS;
438  for (i = 0; i < cnt; i++) {
440  FlushPipeCCM();
441  __RWMB();
442  fail_info = __RV_CSR_READ(CSR_CCM_MDATA);
443  if (CCM_OP_SUCCESS != fail_info) {
444  return fail_info;
445  }
446  }
447  }
448  return CCM_OP_SUCCESS;
449 }
@ 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_FORCEINLINE 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 560 of file core_feature_cache.h.

561 {
564  FlushPipeCCM();
565  __RWMB();
566 }
@ 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_FORCEINLINE 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 579 of file core_feature_cache.h.

580 {
581  if (cnt > 0) {
582  unsigned long i;
584  for (i = 0; i < cnt; i++) {
586  }
587  FlushPipeCCM();
588  __RWMB();
589  }
590 }

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

◆ SInvalICache()

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

700 {
702  FlushPipeCCM();
703  __RWMB();
704 }
#define CSR_CCM_SCOMMAND

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

◆ SInvalICacheLine()

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

328 {
331  FlushPipeCCM();
332  __RWMB();
333 }
#define CSR_CCM_SBEGINADDR

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

Referenced by __ECLIC_SetVector_S().

◆ SInvalICacheLines()

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

347 {
348  if (cnt > 0) {
349  unsigned long i;
351  for (i = 0; i < cnt; i++) {
353  }
354  FlushPipeCCM();
355  __RWMB();
356  }
357 }

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

◆ SLockICacheLine()

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

462 {
465  FlushPipeCCM();
466  __RWMB();
468 }
#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_FORCEINLINE 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 482 of file core_feature_cache.h.

483 {
484  if (cnt > 0) {
485  unsigned long i;
486  unsigned long fail_info = CCM_OP_SUCCESS;
488  for (i = 0; i < cnt; i++) {
490  FlushPipeCCM();
491  __RWMB();
492  fail_info = __RV_CSR_READ(CSR_CCM_SDATA);
493  if (CCM_OP_SUCCESS != fail_info) {
494  return fail_info;
495  }
496  }
497  }
498  return CCM_OP_SUCCESS;
499 }

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

602 {
605  FlushPipeCCM();
606  __RWMB();
607 }

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

◆ SUnlockICacheLines()

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

621 {
622  if (cnt > 0) {
623  unsigned long i;
625  for (i = 0; i < cnt; i++) {
627  }
628  FlushPipeCCM();
629  __RWMB();
630  }
631 }

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

◆ UInvalICache()

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

716 {
718  FlushPipeCCM();
719  __RWMB();
720 }
#define CSR_CCM_UCOMMAND

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

◆ UInvalICacheLine()

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

370 {
373  FlushPipeCCM();
374  __RWMB();
375 }
#define CSR_CCM_UBEGINADDR

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

◆ UInvalICacheLines()

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

389 {
390  if (cnt > 0) {
391  unsigned long i;
393  for (i = 0; i < cnt; i++) {
395  }
396  FlushPipeCCM();
397  __RWMB();
398  }
399 }

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

◆ ULockICacheLine()

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

512 {
515  FlushPipeCCM();
516  __RWMB();
518 }
#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_FORCEINLINE 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 532 of file core_feature_cache.h.

533 {
534  if (cnt > 0) {
535  unsigned long i;
536  unsigned long fail_info = CCM_OP_SUCCESS;
538  for (i = 0; i < cnt; i++) {
540  FlushPipeCCM();
541  __RWMB();
542  fail_info = __RV_CSR_READ(CSR_CCM_UDATA);
543  if (CCM_OP_SUCCESS != fail_info) {
544  return fail_info;
545  }
546  }
547  }
548  return CCM_OP_SUCCESS;
549 }

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

643 {
646  FlushPipeCCM();
647  __RWMB();
648 }

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

◆ UUnlockICacheLines()

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

662 {
663  if (cnt > 0) {
664  unsigned long i;
666  for (i = 0; i < cnt; i++) {
668  }
669  FlushPipeCCM();
670  __RWMB();
671  }
672 }

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