NMSIS-Core  Version 1.4.0
NMSIS-Core support for Nuclei processor-based devices
core_feature_cache.h
1 /*
2  * Copyright (c) 2019 Nuclei Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Licensed under the Apache License, Version 2.0 (the License); you may
7  * not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #ifndef __CORE_FEATURE_CACHE_H__
19 #define __CORE_FEATURE_CACHE_H__
24 /*
25  * Cache Feature Configuration Macro:
26  * 1. __ICACHE_PRESENT: Define whether I-Cache Unit is present or not.
27  * * 0: Not present
28  * * 1: Present
29  * 2. __DCACHE_PRESENT: Define whether D-Cache Unit is present or not.
30  * * 0: Not present
31  * * 1: Present
32  * 3. __CCM_PRESENT: Define whether Nuclei Cache Control and Maintainence(CCM) Unit is present or not.
33  * * 0: Not present
34  * * 1: Present
35  */
36 #ifdef __cplusplus
37  extern "C" {
38 #endif
39 
40 #include "core_feature_base.h"
41 
42 
43 #if defined(__CCM_PRESENT) && (__CCM_PRESENT == 1)
44 
45 /* ########################## Cache functions #################################### */
70 typedef enum CCM_OP_FINFO {
75  CCM_OP_ECC_ERR = 0x4
77 
81 typedef enum CCM_CMD {
82  CCM_DC_INVAL = 0x0,
83  CCM_DC_WB = 0x1,
85  CCM_DC_LOCK = 0x3,
86  CCM_DC_UNLOCK = 0x4,
88  CCM_DC_WB_ALL = 0x7,
90  CCM_IC_INVAL = 0x8,
91  CCM_IC_LOCK = 0xb,
92  CCM_IC_UNLOCK = 0xc,
93  CCM_IC_INVAL_ALL = 0xd
95 
99 typedef struct CacheInfo {
100  uint32_t linesize;
101  uint32_t ways;
102  uint32_t setperway;
103  uint32_t size;
105 
106 #if __riscv_xlen == 32
107 #define CCM_SUEN_SUEN_Msk (0xFFFFFFFFUL)
108 #else
109 #define CCM_SUEN_SUEN_Msk (0xFFFFFFFFFFFFFFFFUL)
110 #endif
111 
124 {
126 }
127 
140 {
142 }
143 
154 {
156 } /* End of Doxygen Group NMSIS_Core_Cache */
158 #endif
159 
160 #if defined(__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1)
161 
179 {
181  return 1;
182  }
183  return 0;
184 }
185 
197 {
199 }
200 
212 {
214 }
215 
227 {
229 }
230 
242 {
244 }
245 
246 #if defined(__CCM_PRESENT) && (__CCM_PRESENT == 1)
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 }
274 
285 __STATIC_FORCEINLINE void MInvalICacheLine(unsigned long addr)
286 {
289  FlushPipeCCM();
290  __RWMB();
291 }
292 
304 __STATIC_FORCEINLINE void MInvalICacheLines(unsigned long addr, unsigned long cnt)
305 {
306  if (cnt > 0) {
307  unsigned long i;
309  for (i = 0; i < cnt; i++) {
311  }
312  FlushPipeCCM();
313  __RWMB();
314  }
315 }
316 
327 __STATIC_FORCEINLINE void SInvalICacheLine(unsigned long addr)
328 {
331  FlushPipeCCM();
332  __RWMB();
333 }
334 
346 __STATIC_FORCEINLINE void SInvalICacheLines(unsigned long addr, unsigned long cnt)
347 {
348  if (cnt > 0) {
349  unsigned long i;
351  for (i = 0; i < cnt; i++) {
353  }
354  FlushPipeCCM();
355  __RWMB();
356  }
357 }
358 
369 __STATIC_FORCEINLINE void UInvalICacheLine(unsigned long addr)
370 {
373  FlushPipeCCM();
374  __RWMB();
375 }
376 
388 __STATIC_FORCEINLINE void UInvalICacheLines(unsigned long addr, unsigned long cnt)
389 {
390  if (cnt > 0) {
391  unsigned long i;
393  for (i = 0; i < cnt; i++) {
395  }
396  FlushPipeCCM();
397  __RWMB();
398  }
399 }
400 
411 __STATIC_FORCEINLINE unsigned long MLockICacheLine(unsigned long addr)
412 {
415  FlushPipeCCM();
416  __RWMB();
418 }
419 
432 __STATIC_FORCEINLINE unsigned long MLockICacheLines(unsigned long addr, unsigned long cnt)
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 }
450 
461 __STATIC_FORCEINLINE unsigned long SLockICacheLine(unsigned long addr)
462 {
465  FlushPipeCCM();
466  __RWMB();
468 }
469 
482 __STATIC_FORCEINLINE unsigned long SLockICacheLines(unsigned long addr, unsigned long cnt)
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 }
500 
511 __STATIC_FORCEINLINE unsigned long ULockICacheLine(unsigned long addr)
512 {
515  FlushPipeCCM();
516  __RWMB();
518 }
519 
532 __STATIC_FORCEINLINE unsigned long ULockICacheLines(unsigned long addr, unsigned long cnt)
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 }
550 
560 __STATIC_FORCEINLINE void MUnlockICacheLine(unsigned long addr)
561 {
564  FlushPipeCCM();
565  __RWMB();
566 }
567 
579 __STATIC_FORCEINLINE void MUnlockICacheLines(unsigned long addr, unsigned long cnt)
580 {
581  if (cnt > 0) {
582  unsigned long i;
584  for (i = 0; i < cnt; i++) {
586  }
587  FlushPipeCCM();
588  __RWMB();
589  }
590 }
591 
601 __STATIC_FORCEINLINE void SUnlockICacheLine(unsigned long addr)
602 {
605  FlushPipeCCM();
606  __RWMB();
607 }
608 
620 __STATIC_FORCEINLINE void SUnlockICacheLines(unsigned long addr, unsigned long cnt)
621 {
622  if (cnt > 0) {
623  unsigned long i;
625  for (i = 0; i < cnt; i++) {
627  }
628  FlushPipeCCM();
629  __RWMB();
630  }
631 }
632 
642 __STATIC_FORCEINLINE void UUnlockICacheLine(unsigned long addr)
643 {
646  FlushPipeCCM();
647  __RWMB();
648 }
649 
661 __STATIC_FORCEINLINE void UUnlockICacheLines(unsigned long addr, unsigned long cnt)
662 {
663  if (cnt > 0) {
664  unsigned long i;
666  for (i = 0; i < cnt; i++) {
668  }
669  FlushPipeCCM();
670  __RWMB();
671  }
672 }
673 
684 {
686  FlushPipeCCM();
687  __RWMB();
688 }
689 
700 {
702  FlushPipeCCM();
703  __RWMB();
704 }
705 
716 {
718  FlushPipeCCM();
719  __RWMB();
720 }
721 #endif /* defined(__CCM_PRESENT) && (__CCM_PRESENT == 1) */ /* End of Doxygen Group NMSIS_Core_ICache */
723 #endif /* defined(__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1) */
724 
725 #if defined(__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1)
743 {
745  return 1;
746  }
747  return 0;
748 }
749 
761 {
763 }
764 
776 {
778 }
779 
791 {
793 }
794 
806 {
808 }
809 
810 #if defined(__CCM_PRESENT) && (__CCM_PRESENT == 1)
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 }
838 
849 __STATIC_FORCEINLINE void MInvalDCacheLine(unsigned long addr)
850 {
853  FlushPipeCCM();
854  __RWMB();
855 }
856 
868 __STATIC_FORCEINLINE void MInvalDCacheLines(unsigned long addr, unsigned long cnt)
869 {
870  if (cnt > 0) {
871  unsigned long i;
873  for (i = 0; i < cnt; i++) {
875  }
876  FlushPipeCCM();
877  __RWMB();
878  }
879 }
880 
891 __STATIC_FORCEINLINE void SInvalDCacheLine(unsigned long addr)
892 {
895  FlushPipeCCM();
896  __RWMB();
897 }
898 
910 __STATIC_FORCEINLINE void SInvalDCacheLines(unsigned long addr, unsigned long cnt)
911 {
912  if (cnt > 0) {
913  unsigned long i;
915  for (i = 0; i < cnt; i++) {
917  }
918  FlushPipeCCM();
919  __RWMB();
920  }
921 }
922 
933 __STATIC_FORCEINLINE void UInvalDCacheLine(unsigned long addr)
934 {
937  FlushPipeCCM();
938  __RWMB();
939 }
940 
952 __STATIC_FORCEINLINE void UInvalDCacheLines(unsigned long addr, unsigned long cnt)
953 {
954  if (cnt > 0) {
955  unsigned long i;
957  for (i = 0; i < cnt; i++) {
959  }
960  FlushPipeCCM();
961  __RWMB();
962  }
963 }
964 
974 __STATIC_FORCEINLINE void MFlushDCacheLine(unsigned long addr)
975 {
978  FlushPipeCCM();
979  __RWMB();
980 }
981 
993 __STATIC_FORCEINLINE void MFlushDCacheLines(unsigned long addr, unsigned long cnt)
994 {
995  if (cnt > 0) {
996  unsigned long i;
998  for (i = 0; i < cnt; i++) {
1000  }
1001  FlushPipeCCM();
1002  __RWMB();
1003  }
1004 }
1005 
1015 __STATIC_FORCEINLINE void SFlushDCacheLine(unsigned long addr)
1016 {
1019  FlushPipeCCM();
1020  __RWMB();
1021 }
1022 
1034 __STATIC_FORCEINLINE void SFlushDCacheLines(unsigned long addr, unsigned long cnt)
1035 {
1036  if (cnt > 0) {
1037  unsigned long i;
1039  for (i = 0; i < cnt; i++) {
1041  }
1042  FlushPipeCCM();
1043  __RWMB();
1044  }
1045 }
1046 
1056 __STATIC_FORCEINLINE void UFlushDCacheLine(unsigned long addr)
1057 {
1060  FlushPipeCCM();
1061  __RWMB();
1062 }
1063 
1075 __STATIC_FORCEINLINE void UFlushDCacheLines(unsigned long addr, unsigned long cnt)
1076 {
1077  if (cnt > 0) {
1078  unsigned long i;
1080  for (i = 0; i < cnt; i++) {
1082  }
1083  FlushPipeCCM();
1084  __RWMB();
1085  }
1086 }
1087 
1098 {
1101  FlushPipeCCM();
1102  __RWMB();
1103 }
1104 
1116 __STATIC_FORCEINLINE void MFlushInvalDCacheLines(unsigned long addr, unsigned long cnt)
1117 {
1118  if (cnt > 0) {
1119  unsigned long i;
1121  for (i = 0; i < cnt; i++) {
1123  }
1124  FlushPipeCCM();
1125  __RWMB();
1126  }
1127 }
1128 
1139 {
1142  FlushPipeCCM();
1143  __RWMB();
1144 }
1145 
1157 __STATIC_FORCEINLINE void SFlushInvalDCacheLines(unsigned long addr, unsigned long cnt)
1158 {
1159  if (cnt > 0) {
1160  unsigned long i;
1162  for (i = 0; i < cnt; i++) {
1164  }
1165  FlushPipeCCM();
1166  __RWMB();
1167  }
1168 }
1169 
1180 {
1183  FlushPipeCCM();
1184  __RWMB();
1185 }
1186 
1198 __STATIC_FORCEINLINE void UFlushInvalDCacheLines(unsigned long addr, unsigned long cnt)
1199 {
1200  if (cnt > 0) {
1201  unsigned long i;
1203  for (i = 0; i < cnt; i++) {
1205  }
1206  FlushPipeCCM();
1207  __RWMB();
1208  }
1209 }
1210 
1221 __STATIC_FORCEINLINE unsigned long MLockDCacheLine(unsigned long addr)
1222 {
1225  FlushPipeCCM();
1226  __RWMB();
1227  return __RV_CSR_READ(CSR_CCM_MDATA);
1228 }
1229 
1242 __STATIC_FORCEINLINE unsigned long MLockDCacheLines(unsigned long addr, unsigned long cnt)
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 }
1260 
1271 __STATIC_FORCEINLINE unsigned long SLockDCacheLine(unsigned long addr)
1272 {
1275  FlushPipeCCM();
1276  __RWMB();
1277  return __RV_CSR_READ(CSR_CCM_SDATA);
1278 }
1279 
1292 __STATIC_FORCEINLINE unsigned long SLockDCacheLines(unsigned long addr, unsigned long cnt)
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 }
1310 
1321 __STATIC_FORCEINLINE unsigned long ULockDCacheLine(unsigned long addr)
1322 {
1325  FlushPipeCCM();
1326  __RWMB();
1327  return __RV_CSR_READ(CSR_CCM_UDATA);
1328 }
1329 
1342 __STATIC_FORCEINLINE unsigned long ULockDCacheLines(unsigned long addr, unsigned long cnt)
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 }
1360 
1370 __STATIC_FORCEINLINE void MUnlockDCacheLine(unsigned long addr)
1371 {
1374  FlushPipeCCM();
1375  __RWMB();
1376 }
1377 
1389 __STATIC_FORCEINLINE void MUnlockDCacheLines(unsigned long addr, unsigned long cnt)
1390 {
1391  if (cnt > 0) {
1392  unsigned long i;
1394  for (i = 0; i < cnt; i++) {
1396  }
1397  FlushPipeCCM();
1398  __RWMB();
1399  }
1400 }
1401 
1411 __STATIC_FORCEINLINE void SUnlockDCacheLine(unsigned long addr)
1412 {
1415  FlushPipeCCM();
1416  __RWMB();
1417 }
1418 
1430 __STATIC_FORCEINLINE void SUnlockDCacheLines(unsigned long addr, unsigned long cnt)
1431 {
1432  if (cnt > 0) {
1433  unsigned long i;
1435  for (i = 0; i < cnt; i++) {
1437  }
1438  FlushPipeCCM();
1439  __RWMB();
1440  }
1441 }
1442 
1452 __STATIC_FORCEINLINE void UUnlockDCacheLine(unsigned long addr)
1453 {
1456  FlushPipeCCM();
1457  __RWMB();
1458 }
1459 
1471 __STATIC_FORCEINLINE void UUnlockDCacheLines(unsigned long addr, unsigned long cnt)
1472 {
1473  if (cnt > 0) {
1474  unsigned long i;
1476  for (i = 0; i < cnt; i++) {
1478  }
1479  FlushPipeCCM();
1480  __RWMB();
1481  }
1482 }
1483 
1494 {
1496  FlushPipeCCM();
1497  __RWMB();
1498 }
1499 
1510 {
1512  FlushPipeCCM();
1513  __RWMB();
1514 }
1515 
1528 {
1530  FlushPipeCCM();
1531  __RWMB();
1532 }
1533 
1544 {
1546  FlushPipeCCM();
1547  __RWMB();
1548 }
1549 
1560 {
1562  FlushPipeCCM();
1563  __RWMB();
1564 }
1565 
1576 {
1578  FlushPipeCCM();
1579  __RWMB();
1580 }
1581 
1592 {
1594  FlushPipeCCM();
1595  __RWMB();
1596 }
1597 
1608 {
1610  FlushPipeCCM();
1611  __RWMB();
1612 }
1613 
1624 {
1626  FlushPipeCCM();
1627  __RWMB();
1628 }
1629 #endif /* defined(__CCM_PRESENT) && (__CCM_PRESENT == 1) */
1630  /* End of Doxygen Group NMSIS_Core_DCache */
1632 #endif /* defined(__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1) */
1633 
1634 #ifdef __cplusplus
1635 }
1636 #endif
1637 #endif /* __CORE_FEATURE_CACHE_H__ */
#define __RWMB()
Read & Write Memory barrier.
#define MCACHE_CTL_IC_EN
#define MCACHE_CTL_DC_ECC_EN
#define MCFG_INFO_DCACHE
#define MCACHE_CTL_IC_ECC_EN
#define MCFG_INFO_ICACHE
#define MCACHE_CTL_DC_EN
#define __RV_CSR_CLEAR(csr, val)
CSR operation Macro for csrc instruction.
#define __RV_CSR_READ(csr)
CSR operation Macro for csrr instruction.
#define __RV_CSR_WRITE(csr, val)
CSR operation Macro for csrw instruction.
#define __RV_CSR_SET(csr, val)
CSR operation Macro for csrs instruction.
#define CSR_CCM_MCOMMAND
#define CSR_CCM_SCOMMAND
#define CSR_MICFG_INFO
#define CSR_CCM_MBEGINADDR
#define CSR_CCM_UCOMMAND
#define CSR_CCM_SDATA
#define CSR_CCM_SUEN
#define CSR_CCM_MDATA
#define CSR_MCACHE_CTL
#define CSR_CCM_FPIPE
#define CSR_MCFG_INFO
#define CSR_CCM_SBEGINADDR
#define CSR_CCM_UBEGINADDR
#define CSR_MDCFG_INFO
#define CSR_CCM_UDATA
CCM_OP_FINFO_Type
Cache CCM Operation Fail Info.
__STATIC_FORCEINLINE void FlushPipeCCM(void)
Flush pipeline after CCM operation.
CCM_CMD_Type
Cache CCM Command Types.
__STATIC_FORCEINLINE void DisableSUCCM(void)
Disable CCM operation in Supervisor/User Mode.
#define CCM_SUEN_SUEN_Msk
CSR CCM_SUEN: SUEN Mask.
__STATIC_FORCEINLINE void EnableSUCCM(void)
Enable CCM operation in Supervisor/User Mode.
@ CCM_OP_REFILL_BUS_ERR
Refill has Bus Error.
@ CCM_OP_ECC_ERR
Deprecated, ECC Error, this error code is removed in later Nuclei CCM RTL design, please don't use it...
@ CCM_OP_PERM_CHECK_ERR
PMP/sPMP/Page-Table X(I-Cache)/R(D-Cache) permission check failed, or belong to Device/Non-Cacheable ...
@ CCM_OP_SUCCESS
Lock Succeed.
@ CCM_OP_EXCEED_ERR
Exceed the the number of lockable ways(N-Way I/D-Cache, lockable is N-1)
@ CCM_DC_WB
Flush the specific D-Cache line specified by CSR CCM_XBEGINADDR.
@ CCM_DC_INVAL
Unlock and invalidate D-Cache line specified by CSR CCM_XBEGINADDR.
@ CCM_DC_WBINVAL
Unlock, flush and invalidate the specific D-Cache line specified by CSR CCM_XBEGINADDR.
@ CCM_DC_LOCK
Lock the specific D-Cache line specified by CSR CCM_XBEGINADDR.
@ CCM_IC_INVAL
Unlock and invalidate I-Cache line specified by CSR CCM_XBEGINADDR.
@ CCM_IC_LOCK
Lock the specific I-Cache line specified by CSR CCM_XBEGINADDR.
@ CCM_DC_WB_ALL
Flush all the valid and dirty D-Cache lines.
@ CCM_DC_INVAL_ALL
Unlock and invalidate all the D-Cache lines.
@ CCM_IC_INVAL_ALL
Unlock and invalidate all the I-Cache lines.
@ CCM_DC_WBINVAL_ALL
Unlock and flush and invalidate all the valid and dirty D-Cache lines.
@ CCM_DC_UNLOCK
Unlock the specific D-Cache line specified by CSR CCM_XBEGINADDR.
@ CCM_IC_UNLOCK
Unlock the specific I-Cache line specified by CSR CCM_XBEGINADDR.
#define __STATIC_FORCEINLINE
Define a static function that should be always inlined by the compiler.
Definition: nmsis_gcc.h:70
__STATIC_FORCEINLINE void UFlushInvalDCache(void)
Flush and invalidate all D-Cache lines in U-Mode.
__STATIC_FORCEINLINE void UFlushDCache(void)
Flush all D-Cache lines in U-Mode.
__STATIC_FORCEINLINE void SInvalDCacheLine(unsigned long addr)
Invalidate one D-Cache line specified by address in S-Mode.
__STATIC_FORCEINLINE void SInvalDCache(void)
Invalidate all D-Cache lines in S-Mode.
__STATIC_FORCEINLINE unsigned long SLockDCacheLines(unsigned long addr, unsigned long cnt)
Lock several D-Cache lines specified by address in S-Mode.
__STATIC_FORCEINLINE void MInvalDCacheLines(unsigned long addr, unsigned long cnt)
Invalidate several D-Cache lines specified by address in M-Mode.
__STATIC_FORCEINLINE void UUnlockDCacheLines(unsigned long addr, unsigned long cnt)
Unlock several D-Cache lines specified by address in U-Mode.
__STATIC_FORCEINLINE void MFlushInvalDCacheLines(unsigned long addr, unsigned long cnt)
Flush and invalidate several D-Cache lines specified by address in M-Mode.
__STATIC_FORCEINLINE void UFlushInvalDCacheLine(unsigned long addr)
Flush and invalidate one D-Cache line specified by address in U-Mode.
__STATIC_FORCEINLINE void UFlushInvalDCacheLines(unsigned long addr, unsigned long cnt)
Flush and invalidate several D-Cache lines specified by address in U-Mode.
__STATIC_FORCEINLINE unsigned long MLockDCacheLines(unsigned long addr, unsigned long cnt)
Lock several D-Cache lines specified by address in M-Mode.
__STATIC_FORCEINLINE void MUnlockDCacheLines(unsigned long addr, unsigned long cnt)
Unlock several D-Cache lines specified by address in M-Mode.
__STATIC_FORCEINLINE unsigned long MLockDCacheLine(unsigned long addr)
Lock one D-Cache line specified by address in M-Mode.
__STATIC_FORCEINLINE void SFlushInvalDCache(void)
Flush and invalidate all D-Cache lines in S-Mode.
__STATIC_FORCEINLINE void SFlushDCacheLine(unsigned long addr)
Flush one D-Cache line specified by address in S-Mode.
__STATIC_FORCEINLINE void SFlushInvalDCacheLines(unsigned long addr, unsigned long cnt)
Flush and invalidate several D-Cache lines specified by address in S-Mode.
__STATIC_FORCEINLINE void EnableDCacheECC(void)
Enable DCache ECC.
__STATIC_FORCEINLINE void MFlushDCacheLine(unsigned long addr)
Flush one D-Cache line specified by address in M-Mode.
__STATIC_FORCEINLINE unsigned long ULockDCacheLines(unsigned long addr, unsigned long cnt)
Lock several D-Cache lines specified by address in U-Mode.
__STATIC_FORCEINLINE int32_t DCachePresent(void)
Check DCache Unit Present or Not.
__STATIC_FORCEINLINE void SFlushDCache(void)
Flush all D-Cache lines in S-Mode.
__STATIC_FORCEINLINE void MFlushDCacheLines(unsigned long addr, unsigned long cnt)
Flush several D-Cache lines specified by address in M-Mode.
__STATIC_FORCEINLINE void SFlushDCacheLines(unsigned long addr, unsigned long cnt)
Flush several D-Cache lines specified by address in S-Mode.
__STATIC_FORCEINLINE void MFlushInvalDCache(void)
Flush and invalidate all D-Cache lines in M-Mode.
__STATIC_FORCEINLINE void SFlushInvalDCacheLine(unsigned long addr)
Flush and invalidate one D-Cache line specified by address in S-Mode.
__STATIC_FORCEINLINE void MInvalDCacheLine(unsigned long addr)
Invalidate one D-Cache line specified by address in M-Mode.
__STATIC_FORCEINLINE void DisableDCache(void)
Disable DCache.
__STATIC_FORCEINLINE void SUnlockDCacheLine(unsigned long addr)
Unlock one D-Cache line specified by address in S-Mode.
__STATIC_FORCEINLINE void UFlushDCacheLine(unsigned long addr)
Flush one D-Cache line specified by address in U-Mode.
__STATIC_FORCEINLINE void SUnlockDCacheLines(unsigned long addr, unsigned long cnt)
Unlock several D-Cache lines specified by address in S-Mode.
__STATIC_FORCEINLINE void MFlushDCache(void)
Flush all D-Cache lines in M-Mode.
__STATIC_FORCEINLINE void SInvalDCacheLines(unsigned long addr, unsigned long cnt)
Invalidate several D-Cache lines specified by address in S-Mode.
__STATIC_FORCEINLINE void DisableDCacheECC(void)
Disable DCache ECC.
__STATIC_FORCEINLINE void UFlushDCacheLines(unsigned long addr, unsigned long cnt)
Flush several D-Cache lines specified by address in U-Mode.
__STATIC_FORCEINLINE void UInvalDCacheLines(unsigned long addr, unsigned long cnt)
Invalidate several D-Cache lines specified by address in U-Mode.
__STATIC_FORCEINLINE int32_t GetDCacheInfo(CacheInfo_Type *info)
Get D-Cache Information.
__STATIC_FORCEINLINE unsigned long SLockDCacheLine(unsigned long addr)
Lock one D-Cache line specified by address in S-Mode.
__STATIC_FORCEINLINE unsigned long ULockDCacheLine(unsigned long addr)
Lock one D-Cache line specified by address in U-Mode.
__STATIC_FORCEINLINE void MFlushInvalDCacheLine(unsigned long addr)
Flush and invalidate one D-Cache line specified by address in M-Mode.
__STATIC_FORCEINLINE void MInvalDCache(void)
Invalidate all D-Cache lines in M-Mode.
__STATIC_FORCEINLINE void UInvalDCache(void)
Invalidate all D-Cache lines in U-Mode.
__STATIC_FORCEINLINE void UUnlockDCacheLine(unsigned long addr)
Unlock one D-Cache line specified by address in U-Mode.
__STATIC_FORCEINLINE void UInvalDCacheLine(unsigned long addr)
Invalidate one D-Cache line specified by address in U-Mode.
__STATIC_FORCEINLINE void MUnlockDCacheLine(unsigned long addr)
Unlock one D-Cache line specified by address in M-Mode.
__STATIC_FORCEINLINE void EnableDCache(void)
Enable DCache.
__STATIC_FORCEINLINE void SInvalICacheLines(unsigned long addr, unsigned long cnt)
Invalidate several I-Cache lines specified by address in S-Mode.
__STATIC_FORCEINLINE void UUnlockICacheLine(unsigned long addr)
Unlock one I-Cache line specified by address in U-Mode.
__STATIC_FORCEINLINE void SInvalICache(void)
Invalidate all I-Cache lines in S-Mode.
__STATIC_FORCEINLINE int32_t ICachePresent(void)
Check ICache Unit Present or Not.
__STATIC_FORCEINLINE void UInvalICacheLines(unsigned long addr, unsigned long cnt)
Invalidate several I-Cache lines specified by address in U-Mode.
__STATIC_FORCEINLINE void UUnlockICacheLines(unsigned long addr, unsigned long cnt)
Unlock several I-Cache lines specified by address in U-Mode.
__STATIC_FORCEINLINE void DisableICache(void)
Disable ICache.
__STATIC_FORCEINLINE void UInvalICacheLine(unsigned long addr)
Invalidate one I-Cache line specified by address in U-Mode.
__STATIC_FORCEINLINE unsigned long MLockICacheLines(unsigned long addr, unsigned long cnt)
Lock several I-Cache lines specified by address in M-Mode.
__STATIC_FORCEINLINE void UInvalICache(void)
Invalidate all I-Cache lines in U-Mode.
__STATIC_FORCEINLINE int32_t GetICacheInfo(CacheInfo_Type *info)
Get I-Cache Information.
__STATIC_FORCEINLINE void MUnlockICacheLines(unsigned long addr, unsigned long cnt)
Unlock several I-Cache lines specified by address in M-Mode.
__STATIC_FORCEINLINE void SUnlockICacheLines(unsigned long addr, unsigned long cnt)
Unlock several I-Cache lines specified by address in S-Mode.
__STATIC_FORCEINLINE void EnableICache(void)
Enable ICache.
__STATIC_FORCEINLINE unsigned long ULockICacheLine(unsigned long addr)
Lock one I-Cache line specified by address in U-Mode.
__STATIC_FORCEINLINE unsigned long SLockICacheLine(unsigned long addr)
Lock one I-Cache line specified by address in S-Mode.
__STATIC_FORCEINLINE void SInvalICacheLine(unsigned long addr)
Invalidate one I-Cache line specified by address in S-Mode.
__STATIC_FORCEINLINE void EnableICacheECC(void)
Enable ICache ECC.
__STATIC_FORCEINLINE unsigned long MLockICacheLine(unsigned long addr)
Lock one I-Cache line specified by address in M-Mode.
__STATIC_FORCEINLINE void DisableICacheECC(void)
Disable ICache ECC.
__STATIC_FORCEINLINE void MInvalICache(void)
Invalidate all I-Cache lines in M-Mode.
__STATIC_FORCEINLINE unsigned long SLockICacheLines(unsigned long addr, unsigned long cnt)
Lock several I-Cache lines specified by address in S-Mode.
__STATIC_FORCEINLINE void MUnlockICacheLine(unsigned long addr)
Unlock one I-Cache line specified by address in M-Mode.
__STATIC_FORCEINLINE void MInvalICacheLine(unsigned long addr)
Invalidate one I-Cache line specified by address in M-Mode.
__STATIC_FORCEINLINE void SUnlockICacheLine(unsigned long addr)
Unlock one I-Cache line specified by address in S-Mode.
__STATIC_FORCEINLINE unsigned long ULockICacheLines(unsigned long addr, unsigned long cnt)
Lock several I-Cache lines specified by address in U-Mode.
__STATIC_FORCEINLINE void MInvalICacheLines(unsigned long addr, unsigned long cnt)
Invalidate several I-Cache lines specified by address in M-Mode.
Cache Information Type.
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
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