|
KallistiOS git master
Independent SDK for the Sega Dreamcast
|
Driver and API for managing the SH4's cache More...
Files | |
| file | cache.h |
| Cache management functionality. | |
Macros | |
| #define | CACHE_L1_ICACHE_SIZE 8 * 1024 |
| Level 1 instruction cache size. | |
| #define | CACHE_L1_ICACHE_ASSOC 1 |
| Level 1 instruction cache associativity. | |
| #define | CACHE_L1_ICACHE_LINESIZE 32 |
| L1 instruction cache line size. | |
| #define | CACHE_L1_DCACHE_SIZE 16 * 1024 |
| Level 1 data cache size. | |
| #define | CACHE_L1_DCACHE_ASSOC 1 |
| Level 1 data cache associativity. | |
| #define | CACHE_L1_DCACHE_LINESIZE 32 |
| L1 data cache line size. | |
| #define | CACHE_L2_CACHE_SIZE 0 |
| Level 2 cache size. | |
| #define | CACHE_L2_CACHE_ASSOC 0 |
| Level 2 cache associativity. | |
| #define | CACHE_L2_CACHE_LINESIZE 0 |
| Level 2 cache line size. | |
Functions | |
| void | icache_flush_range (uintptr_t start, size_t count) |
| Flush the instruction cache. | |
| void | dcache_inval_range (uintptr_t start, size_t count) |
| Invalidate the data/operand cache. | |
| void | dcache_flush_range (uintptr_t start, size_t count) |
| Flush the data/operand cache. | |
| void | dcache_flush_all (void) |
| Flush all the data/operand cache. | |
| void | dcache_purge_range (uintptr_t start, size_t count) |
| Purge the data/operand cache. | |
| void | dcache_purge_all (void) |
| Purge all the data/operand cache. | |
| void | dcache_purge_all_with_buffer (uintptr_t start, size_t count) |
| Purge all the data/operand cache with buffer. | |
| static __always_inline void | dcache_pref_block (const void *src) |
| Prefetch one block to the data/operand cache. | |
| static __always_inline void | dcache_wback_sq (void *src) |
| Write-back Store Queue buffer to external memory. | |
| static __always_inline void | dcache_alloc_block (void *src, uint32_t value) |
| Allocate one block of the data/operand cache. | |
Driver and API for managing the SH4's cache
| #define CACHE_L1_DCACHE_ASSOC 1 |
Level 1 data cache associativity.
Number of ways in the L1 data cache.
| #define CACHE_L1_DCACHE_LINESIZE 32 |
L1 data cache line size.
The size of each cache line in the L1 data cache.
| #define CACHE_L1_DCACHE_SIZE 16 * 1024 |
Level 1 data cache size.
The capacity of the L1 data cache in bytes.
| #define CACHE_L1_ICACHE_ASSOC 1 |
Level 1 instruction cache associativity.
Number of ways in the L1 instruction cache.
| #define CACHE_L1_ICACHE_LINESIZE 32 |
L1 instruction cache line size.
The size of each cache line in the L1 instruction cache.
| #define CACHE_L1_ICACHE_SIZE 8 * 1024 |
Level 1 instruction cache size.
The capacity of the L1 instruction cache in bytes.
| #define CACHE_L2_CACHE_ASSOC 0 |
Level 2 cache associativity.
Number of ways in the L2 cache.
| #define CACHE_L2_CACHE_LINESIZE 0 |
Level 2 cache line size.
The size of each cache line in the L2 cache.
| #define CACHE_L2_CACHE_SIZE 0 |
Level 2 cache size.
The capacity of the L2 cache in bytes.
|
static |
Allocate one block of the data/operand cache.
This function allocate a block of the data/operand cache.
| src | The address to allocate (32-byte aligned) |
| value | The value written to first 4-byte. |
References uint32_t().
| void dcache_flush_all | ( | void | ) |
Flush all the data/operand cache.
This function flushes all the data/operand cache, forcing a write- back on all of the cache blocks that are marked as dirty.
| void dcache_flush_range | ( | uintptr_t | start, |
| size_t | count ) |
Flush the data/operand cache.
This function flushes a range of the data/operand cache, forcing a write- back on all of the data in the specified range. This does not invalidate the cache in the process (meaning the blocks will still be in the cache, just not marked as dirty after this has completed). If you wish to invalidate the cache as well, call dcache_inval_range() after calling this function or use dcache_purge_range() instead of dcache_flush_range().
| start | The physical address to begin flushing at. |
| count | The number of bytes to flush. |
| void dcache_inval_range | ( | uintptr_t | start, |
| size_t | count ) |
Invalidate the data/operand cache.
This function invalidates a range of the data/operand cache. If you care about the contents of the cache that have not been written back yet, use dcache_flush_range() before using this function.
| start | The physical address to begin invalidating at. |
| count | The number of bytes to invalidate. |
|
static |
Prefetch one block to the data/operand cache.
This function prefetch a block of the data/operand cache.
| src | The physical address to prefetch. |
| void dcache_purge_all | ( | void | ) |
Purge all the data/operand cache.
This function flushes the entire data/operand cache, ensuring that all cache blocks marked as dirty are written back to memory and all cache entries are invalidated. It does not require an additional buffer and is preferred when memory resources are constrained.
| void dcache_purge_all_with_buffer | ( | uintptr_t | start, |
| size_t | count ) |
Purge all the data/operand cache with buffer.
This function performs a purge of all data/operand cache blocks by utilizing an external buffer to speed up the write-back and invalidation process. It is always faster than dcache_purge_all() and is recommended where maximum speed is required.
| start | The physical address for temporary buffer (32-byte aligned) |
| count | The size of the temporary buffer, which can be either 8 KB or 16 KB, depending on cache configuration - 8 KB buffer with OCRAM enabled, otherwise 16 KB. |
| void dcache_purge_range | ( | uintptr_t | start, |
| size_t | count ) |
Purge the data/operand cache.
This function flushes a range of the data/operand cache, forcing a write- back and then invalidates all of the data in the specified range.
| start | The physical address to begin purging at. |
| count | The number of bytes to purge. |
|
static |
Write-back Store Queue buffer to external memory.
This function initiates write-back for one Store Queue.
| src | The SQ mapped address to write-back. |
| void icache_flush_range | ( | uintptr_t | start, |
| size_t | count ) |
Flush the instruction cache.
This function flushes a range of the instruction cache.
| start | The physical address to begin flushing at. |
| count | The number of bytes to flush. |