UM10208_2
© NXP B.V. 2007. All rights reserved.
User manual
Rev. 02 — 1 June 2007
24 of 362
NXP Semiconductors
UM10208
Chapter 4: LPC2800 Cache
6.
Cache programming procedures
6.1 Cache initialization
1. Clear the cache:
Set and reset the CACHE_RST bit in the CACHE_SETTINGS register (one clock
cycle is sufficient).
The status flag CACHE_RST_STAT in the CACHE_STATUS indicates whether a
cache reset is ongoing. Software should poll this bit before the cache is enabled.
2. Program the virtual address for each page, if needed:
Software can enable those parts of the memory map that are to be cacheable, by
setting the appropriate bits in the CACHE_PAGE_CTRL register.
Each bit represents one page (2 megabytes) of memory space:
–
bit 0 enables 0x0000_0000 to 0x0020_0000 as cached (page 0),
–
bit 1 enables 0x0020_0000 to 0x0040_0000 as cached (page 1),
–
bit 2 enables 0x0040_0000 to 0x0060_0000 as cached (page 2),
–
etc.
3. Program the virtual address for each page, if needed:
The 11 bits programmed for each page represents the top 11 bits of a 32-bit address
that will be put on the AHB bus. This allows any part of the entire 32-bit address range
to be remapped into the bottom 32 megabytes of space, in pages of 2 megabytes.
The PAGE_ADDRESS registers DO NOT reset to a value such that remapping is not
in force, so they should always be initialized even if remapping is not needed in the
application.
Example:
Say address location 0x10400000 (in on-chip Flash) must be mapped for page 3.
That can be done this way:
*PAGE_ADDRESS_3 = (0x10400000 >> 21); // = 0x082;
If the CPU reads address 0x00600004 (an address inside page 3) , then address
0x10400004 is provided to the AHB bus.
Note: care must be taken if remapping a page from which the code is currently
running, or a page that is being used for data, stack or heap storage.
4. Enable the cache for data and /or instructions:
Table 11.
CPU Clock Gate control (CPU_CLK_GATE, 0x8010 4058)
Bit
Symbol
Description
Reset
value
0
CPU_CLK_GATE
This bit controls clock gating to the CPU. When clock gating is
enabled, power is saved by not clocking the CPU when it is
stalled waiting for bus access.
0: The CPU clock is running continuously.
1: The CPU clock is gated off while the CPU is stalled.
0
31:1
-
Reserved. Do not write 1s to reserved bits. The values read
from reserved bits is not defined.
-