Coherency of the CPU caches with memory other bus masters or the instruction fetch see.
More...
Coherency of the CPU caches with memory other bus masters or the instruction fetch see.
A flush writes dirty lines back to memory and keeps them cached; an invalidate discards lines so the next access reads memory. Flush a buffer before a DMA engine reads it, and invalidate it after a DMA engine wrote it. To run code that was written as data, flush the data cache and invalidate the instruction cache over it.
Range operations cover every line the range touches, and are inline so code running while the flash is unreadable can use them. Invalidating discards writes to whatever else shares those lines, so buffers that get invalidated are aligned to PBL_DCACHE_LINE_SIZE and sized with PBL_DCACHE_ROUND_UP():
#define PBL_DCACHE_LINE_SIZE
Data cache line size in bytes, 1 without a data cache.
Definition cache.h:40
#define PBL_DCACHE_ROUND_UP(size)
size rounded up to whole data cache lines.
Definition cache.h:46
static void pbl_dcache_invalidate_range(void *addr, size_t size)
Invalidate the data cache lines covering a range.
Definition cache.h:65
#define PBL_ALIGNED(bytes)
Align the symbol or type.
Definition compiler.h:87
Without the cache an operation targets, it does nothing. The whole-cache operations exist only on CPUs that select CPU_HAS_ICACHE or CPU_HAS_DCACHE.
◆ PBL_DCACHE_LINE_SIZE
| #define PBL_DCACHE_LINE_SIZE ARCH_DCACHE_LINE_SIZE |
Data cache line size in bytes, 1 without a data cache.
◆ PBL_DCACHE_ROUND_UP
size rounded up to whole data cache lines.
◆ PBL_ICACHE_LINE_SIZE
| #define PBL_ICACHE_LINE_SIZE ARCH_ICACHE_LINE_SIZE |
Instruction cache line size in bytes, 1 without an instruction cache.
◆ pbl_dcache_flush_invalidate_range()
| static void pbl_dcache_flush_invalidate_range |
( |
void * |
addr, |
|
|
size_t |
size |
|
) |
| |
|
static |
Flush, then invalidate the data cache lines covering a range.
- Parameters
-
| addr | Start of the range. |
| size | Size of the range in bytes. |
◆ pbl_dcache_flush_range()
| static void pbl_dcache_flush_range |
( |
const void * |
addr, |
|
|
size_t |
size |
|
) |
| |
|
static |
Flush the data cache lines covering a range.
- Parameters
-
| addr | Start of the range. |
| size | Size of the range in bytes. |
◆ pbl_dcache_invalidate_range()
| static void pbl_dcache_invalidate_range |
( |
void * |
addr, |
|
|
size_t |
size |
|
) |
| |
|
static |
Invalidate the data cache lines covering a range.
- Parameters
-
| addr | Start of the range. |
| size | Size of the range in bytes. |
◆ pbl_icache_invalidate_range()
| static void pbl_icache_invalidate_range |
( |
const void * |
addr, |
|
|
size_t |
size |
|
) |
| |
|
static |
Invalidate the instruction cache lines covering a range.
- Parameters
-
| addr | Start of the range. |
| size | Size of the range in bytes. |