0.3.1
|
Data Structures | |
struct | cpu_cache_data_line |
Cache data line representing the data read from the cache. More... | |
struct | cpu_cache_data_way |
Cache data way. More... | |
Macros | |
#define | CPU_CACHE 0x00000000UL |
Partition designated for using the cache. | |
#define | CPU_CACHE_THROUGH 0x20000000UL |
Partition designated for bypassing the cache. | |
#define | CPU_CACHE_PURGE 0x40000000UL |
Partition designated for purging a specific line. | |
#define | CPU_CACHE_ADDRESS_RW 0x60000000UL |
Partition designated for accessing the address cache array directly. | |
#define | CPU_CACHE_DATA_RW 0xC0000000UL |
Partition designated for accessing the cache data directly. | |
#define | CPU_CACHE_IO 0xF0000000UL |
Partition designated for bypassing the cache (I/O area). | |
#define | CPU_ADDRESS_PARTITION_MASK 0xF0000000UL |
Partition address mask. | |
#define | CPU_CACHE_WAY_0_ADDR 0xC0000000UL |
Address for when accessing cache data directly. | |
#define | CPU_CACHE_WAY_1_ADDR 0xC0000400UL |
Address for when accessing cache data directly. | |
#define | CPU_CACHE_WAY_2_ADDR 0xC0000800UL |
Address for when accessing cache data directly. | |
#define | CPU_CACHE_WAY_3_ADDR 0xC0000C00UL |
Address for when accessing cache data directly. | |
#define | CPU_CACHE_WAY_SIZE (CPU_CACHE_WAY_1_ADDR - CPU_CACHE_WAY_0_ADDR) |
The size in bytes of a cache way. | |
#define | CPU_CACHE_2_WAY_SIZE (CPU_CACHE_WAY_2_ADDR - CPU_CACHE_WAY_0_ADDR) |
The size in bytes of the 2KiB RAM. | |
#define | CPU_CACHE_LINE_SIZE 16UL |
The size of a cache line in bytes. | |
#define | CPU_CACHE_TAG_ADDRESS(x) ((uint32_t)(x) >> 10) |
Given the tag bits from cpu_cache_data_line, convert to a physical address. | |
#define | __uncached __section(".uncached") |
Specify variable to be uncached. | |
#define | __uncached_function __section(".uncached.function") |
Specify function to be uncached. | |
Typedefs | |
typedef enum cpu_cache_mode | cpu_cache_mode_t |
Cache mode. | |
typedef enum cpu_cache_type | cpu_cache_type_t |
Cache type. | |
typedef struct cpu_cache_data_line | cpu_cache_data_line_t |
Cache data line representing the data read from the cache. | |
typedef struct cpu_cache_data_way | cpu_cache_data_way_t |
Cache data way. | |
Enumerations | |
enum | cpu_cache_mode |
Cache mode. More... | |
enum | cpu_cache_type |
Cache type. More... | |
Functions | |
static void | cpu_cache_enable (void) |
Enable cache. | |
static void | cpu_cache_disable (void) |
Disable cache. | |
static void | cpu_cache_repl_enable (cpu_cache_type_t type) |
Enable type replacement. | |
static void | cpu_cache_repl_disable (cpu_cache_type_t type) |
Disable type replacement in the cache. | |
static void | cpu_cache_way_mode_set (cpu_cache_mode_t mode) |
Change the mode the cache operates. | |
void | cpu_cache_line_purge (void *address) __uncached_function |
Cache line of the specified address is purged. | |
void | cpu_cache_area_purge (void *address, uint32_t len) __uncached_function |
Cache lines of the specified address are purged. | |
void | cpu_cache_purge (void) __no_reorder __uncached_function |
Purge the entire cache. | |
void | cpu_cache_data_way_read (uint8_t way, cpu_cache_data_way_t *data_way) __uncached_function |
Walk one of the 4 ways the CPU cache and dump cache state bits. | |
Description goes here.
struct cpu_cache_data_line |
struct cpu_cache_data_way |
Cache data way.
Data Fields | ||
---|---|---|
cpu_cache_data_line_t | data[CPU_CACHE_WAY_SIZE/CPU_CACHE_LINE_SIZE] | Data. |
#define CPU_CACHE_2_WAY_SIZE (CPU_CACHE_WAY_2_ADDR - CPU_CACHE_WAY_0_ADDR) |
The size in bytes of the 2KiB RAM.
#define CPU_CACHE_TAG_ADDRESS | ( | x | ) | ((uint32_t)(x) >> 10) |
Given the tag bits from cpu_cache_data_line, convert to a physical address.
x | The 32-bit address value. |
enum cpu_cache_mode |
enum cpu_cache_type |
|
inlinestatic |
Enable type replacement.
When either instruction and/or data is fetched from memory, the cache data is written.
type | The cache type(s) to enable. |
|
inlinestatic |
Disable type replacement in the cache.
When either an instruction or data is fetched from memory, cache data is not written to the cache even if there is a cache miss.
type | The cache type(s) to disable. |
|
inlinestatic |
Change the mode the cache operates.
The cache can be set to operate as a four-way set associative cache, or as a two-way associative cache and 2KiB RAM.
In the two-way mode, ways 0
and 1
are RAM.
mode | Mode. |
void cpu_cache_line_purge | ( | void * | address | ) |
Cache line of the specified address is purged.
The starting address to purge does not to be cache-line aligned. Calling this function will not pollute the cache.
address | The address associated with cache line. |
void cpu_cache_area_purge | ( | void * | address, |
uint32_t | len | ||
) |
Cache lines of the specified address are purged.
The starting address to purge does not to be cache-line aligned. The area to cache purge does not have to be in multiples of the cache line size. Calling this function will not pollute the cache.
address | The starting address. |
len | The area in bytes. |
void cpu_cache_purge | ( | void | ) |
Purge the entire cache.
All cache entries and all valid bits and LRU bits of all ways are initialized to 0
. Calling this function will not pollute the cache.
void cpu_cache_data_way_read | ( | uint8_t | way, |
cpu_cache_data_way_t * | data_way | ||
) |
Walk one of the 4 ways the CPU cache and dump cache state bits.
It's imperative that the function that calls cpu_cache_data_way_read must be uncached so that it doesn't taint the cache itself.
way | The cache way to read from. | |
[in] | data_way | The cache way buffer to write to. |