P1010 L1 CACHE

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

P1010 L1 CACHE

687 Views
tsybezoff
Contributor II

Please, i need help!

I wanna to use L1 cache with L2 cache in my project at p1010. I set up L2, but have a some questions about L1.
1. Can i use L1 Cache in RAM, or only in ROM
2. How to setup L1 Cache??? anybody have an example????
Example in P1010RDB_init.c doesn't work in my project((((

Labels (2)
Tags (2)
0 Kudos
2 Replies

463 Views
alexander_yakov
NXP Employee
NXP Employee

1. Yes you can use L1 cache for both ROM and RAM

2. L1 cache initialization is quite simple - you need only to enable and invalidate. Below is a part of L1 cache initialization from cache.c file distributed with our CodeWarrior

void l1_cache_init()

{

// Enable and Invalidate L1 DataCache

  asm("mfspr r5,1010");  /* Read in L1CSR0 spr contents  */

  asm("ori  r5,r5,0x0003");  /* Set CE and CFI bit */

  asm("andi. r6,r5,0xFFFD");  /* Clear the CFI bit for the final store */

  asm("mtspr 1010,r5");

  asm("isync");

  asm("isync");

  asm("mtspr 1010,r6");        /* Store the final value */

  asm("isync");

  asm("isync");

//Enable and Invalidate Inst Cache

  asm("mfspr r5,1011");  /* Read in L1CSR1 spr contents  */

  asm("ori  r5,r5,0x0003");  /* Set ICE and ICFI bit */

  asm("andi. r6,r5,0xFFFD");  /* Clear the CFI bit for the final store */

  asm("mtspr 1011,r5");

  asm("isync");

  asm("isync");

  asm("mtspr 1011,r6");        /* Store the final value */

  asm("isync");

  asm("isync");

}


Have a great day,
Alexander

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

463 Views
tsybezoff
Contributor II

Спасибо, Александр)
твой код работает у меня в RAM,но не работает в ROM. Я так понимаю, это из-за неправильной моей настройки TLB, MMU и тд. Можешь прикрепить твой файл с настройками под ROM, где есть функция usr_init, по-моему. Там как раз идет описание MMU, TLB, CCRSBAR, DDR.

0 Kudos