Andes Workshop

It is currently Thu Mar 28, 2024 11:25 pm

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: How to use cache(如何使用cache)
PostPosted: Thu Dec 20, 2012 6:15 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
cache的使用方法
1. 先設定地址為cacheable。請看暫存器$mr0的說明。
2. 將cache enable,請看暫存器$mr8的說明。

請參考demo-cache這個example code,看main-cache.c。

1. 將NTC0設為2,即Cacheable/Write-Back
/* Cacheable/Write-Back for NTC0 */
mmu_ctl = __nds32__mfsr(NDS32_SR_MMU_CTL);
mmu_ctl |= 0x2 << 1;
__nds32__mtsr(mmu_ctl, NDS32_SR_MMU_CTL);

2.
Enable i-cache
cache_ctl = __nds32__mfsr(NDS32_SR_CACHE_CTL);
cache_ctl |= 0x1;
/* Enable I Cache */
__nds32__mtsr(cache_ctl, NDS32_SR_CACHE_CTL);

Enable d-cache
cache_ctl = __nds32__mfsr(NDS32_SR_CACHE_CTL);
cache_ctl |= 0x2;
/* Enable D Cache */
__nds32__mtsr(cache_ctl, NDS32_SR_CACHE_CTL);


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group