Loading ...
Sorry, an error occurred while loading the content.

Lock Setting Procedure

Expand Messages
  • flaretom
    Hi, everybody! I encountered a problem with the locking of a cache way. First i set the flags in the cache control register: ldr r11,=CACHE_BASE ldr
    Message 1 of 3 , Dec 23, 2006
    • 0 Attachment
      Hi, everybody!
      I encountered a problem with the locking of a cache way.
      First i set the flags in the cache control register:
      ldr r11,=CACHE_BASE
      ldr r12,=CON_WAY0|CON_LOAD
      str r12,[r11,#0x1c] ; flush
      str r12,[r11,#4] ; load forcible into way0
      Then i load the the code of my irq handler into the selected way0 (
      size of that handler aprox. 200bytes).
      After doing this i try to lock the way0:
      ldr r10,=CON_LOCK1
      str r10,[r11,#4] ; resume normal cache mode and lock way0
      But the last instruction causes an Undef exception.
      If i increase the size of the loaded handler to 2K everything works
      fine. In the oki-manual (9-10) one can read:
      ... , make sure that the total number of bytes is 2kB or less
      including the data before and after the starting address ...
      So whats about "or less"? Any suggestions?

      Happy Christmas!
      Tom
    • flaretom
      ... I was wrong, even with 2k length of loaded code the Undef occurs.
      Message 2 of 3 , Dec 23, 2006
      • 0 Attachment
        --- In OKI-ARM-mcus@yahoogroups.com, "flaretom" <thorn@...> wrote:
        >
        > Hi, everybody!
        > I encountered a problem with the locking of a cache way.
        > First i set the flags in the cache control register:
        > ldr r11,=CACHE_BASE
        > ldr r12,=CON_WAY0|CON_LOAD
        > str r12,[r11,#0x1c] ; flush
        > str r12,[r11,#4] ; load forcible into way0
        > Then i load the the code of my irq handler into the selected way0 (
        > size of that handler aprox. 200bytes).
        > After doing this i try to lock the way0:
        > ldr r10,=CON_LOCK1
        > str r10,[r11,#4] ; resume normal cache mode and lock way0
        > But the last instruction causes an Undef exception.
        > If i increase the size of the loaded handler to 2K everything works
        > fine. In the oki-manual (9-10) one can read:
        > ... , make sure that the total number of bytes is 2kB or less
        > including the data before and after the starting address ...
        > So whats about "or less"? Any suggestions?
        >
        > Happy Christmas!
        > Tom
        >
        I was wrong, even with 2k length of loaded code the "Undef" occurs.
      • kendwyer
        Hi Tom, The Cache Way size is 2kbytes so you the amount of code you lock in a Way can be up to 2kbytes - this is what is meant by or less When you are
        Message 3 of 3 , Jan 3, 2007
        • 0 Attachment
          Hi Tom,

          The Cache "Way" size is 2kbytes so you the amount of code you lock in
          a Way can be up to 2kbytes - this is what is meant by "or less"

          When you are locking the code in cache, ensure that Interrupts are
          disabled.
          Here is some C code for locking code into a Way in cache:

          ...

          init_cache();
          cache_on(CACHE_BANK24); /* DRAM BANK : Cache enable */
          put_wvalue(CON, CON_WAY0 | CON_LOAD | CON_LOCK0);
          /* Set Load mode to Way0 */
          data_read(0xC0004000, 0x800); /* dummy data read (2Kbytes) */
          put_wvalue(CON, CON_LOCK1); /* One Way locked */

          ...

          Regards,
          Ken

          --- In OKI-ARM-mcus@yahoogroups.com, "flaretom" <thorn@...> wrote:
          >
          > --- In OKI-ARM-mcus@yahoogroups.com, "flaretom" <thorn@> wrote:
          > >
          > > Hi, everybody!
          > > I encountered a problem with the locking of a cache way.
          > > First i set the flags in the cache control register:
          > > ldr r11,=CACHE_BASE
          > > ldr r12,=CON_WAY0|CON_LOAD
          > > str r12,[r11,#0x1c] ; flush
          > > str r12,[r11,#4] ; load forcible into way0
          > > Then i load the the code of my irq handler into the selected way0 (
          > > size of that handler aprox. 200bytes).
          > > After doing this i try to lock the way0:
          > > ldr r10,=CON_LOCK1
          > > str r10,[r11,#4] ; resume normal cache mode and lock way0
          > > But the last instruction causes an Undef exception.
          > > If i increase the size of the loaded handler to 2K everything works
          > > fine. In the oki-manual (9-10) one can read:
          > > ... , make sure that the total number of bytes is 2kB or less
          > > including the data before and after the starting address ...
          > > So whats about "or less"? Any suggestions?
          > >
          > > Happy Christmas!
          > > Tom
          > >
          > I was wrong, even with 2k length of loaded code the "Undef" occurs.
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.