drivers: add description of cache

This commit is contained in:
zzy 2022-04-30 11:52:14 +08:00
parent 1b55242411
commit fbb668f993
2 changed files with 18 additions and 5 deletions

View File

@ -3,6 +3,19 @@
#include <pmp.h>
#include <klib.h>
// these functions are interface for cache
// uintptr_t _l1cache_op_read(int op_idx): return value in the cache cop csr
// uintptr_t _l1cache_data_read(int data_idx): return data in the cache data csr
// void _l1cache_op_write(int op_idx, uintptr_t val): set value in the cache cop csr
// void _l1cache_data_write(int data_idx, uintptr_t val): set data in the cache data csr
// when testing, can use these interface in nexus-am/tests/amtest/src/tests/cache.c
// void _l3cache_tag(int tag): set value of tag in l3chache
// void _l3cache_set(int set): set value of tag in l3chache
// void _l3cache_cmd(int cmd): set value of tag in l3chache
// when testing, can use these interface in nexus-am/tests/dualcoretest/tests/huancunop.c
uintptr_t _l1cache_op_read(int op_idx) {
uintptr_t op;
switch(op_idx){

View File

@ -2,11 +2,11 @@
#include <pmp.h>
#include <klib.h>
// this functions are interface for pma
// _pma_get_addr(int addr_idx): return value in the pmpaddr csr
// _pma_get_cfg(int cfg_idx): return value in the pmpefg csr
// _pma_set_addr(int addr_idx, uintptr_t val): modify value in the pmpaddr csr
// _pma_set_cfg(int cfg_idx, uintptr_t val): modify value in the pmpcfg csr
// these functions are interface for pma
// uintptr_t _pma_get_addr(int addr_idx): return value in the pmpaddr csr
// uintptr_t _pma_get_cfg(int cfg_idx): return value in the pmpefg csr
// void _pma_set_addr(int addr_idx, uintptr_t val): modify value in the pmpaddr csr
// void _pma_set_cfg(int cfg_idx, uintptr_t val): modify value in the pmpcfg csr
// when testing pma:
// firstly, using _cfg = _pma_get_cfg(cfg_idx), get the value of cfg
// secondly, using _cfg = _cfg | PMP_W, or using _cfg = _cfg & ~PMP_W, to set the permission