Menu Toggle
v2.3.1 (RP2350)
Toggle main menu visibility
Loading...
Searching...
No Matches
xip_cache.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2024 Raspberry Pi Ltd.
3
*
4
* SPDX-License-Identifier: BSD-3-Clause
5
*/
6
7
#ifndef _HARDWARE_XIP_CACHE_H
8
#define _HARDWARE_XIP_CACHE_H
9
10
#include "
pico.h
"
11
#include "hardware/regs/addressmap.h"
12
57
58
// PICO_CONFIG: PARAM_ASSERTIONS_ENABLED_HARDWARE_XIP_CACHE, Enable/disable assertions in the hardware_xip_cache module, type=bool, default=0, group=hardware_xip_cache
59
#ifndef PARAM_ASSERTIONS_ENABLED_HARDWARE_XIP_CACHE
60
#define PARAM_ASSERTIONS_ENABLED_HARDWARE_XIP_CACHE 0
61
#endif
62
63
#define XIP_CACHE_LINE_SIZE _u(8)
64
65
#define XIP_CACHE_SIZE (_u(16) * _u(1024))
66
67
#if PICO_RP2040
68
#define XIP_CACHE_ADDRESS_SPACE_SIZE (_u(16) * _u(1024) * _u(1024))
69
#else
70
#define XIP_CACHE_ADDRESS_SPACE_SIZE (XIP_END - XIP_BASE)
71
#endif
72
73
// A read-only cache never requires cleaning (you can still call the functions, they are just no-ops)
74
#if PICO_RP2040
75
#define XIP_CACHE_IS_READ_ONLY 1
76
#else
77
#define XIP_CACHE_IS_READ_ONLY 0
78
#endif
79
80
#ifndef __ASSEMBLER__
81
82
#ifdef __cplusplus
83
extern
"C"
{
84
#endif
85
103
void
xip_cache_invalidate_all
(
void
);
104
125
void
xip_cache_invalidate_range
(uintptr_t start_offset, uintptr_t size_bytes);
126
127
#if !XIP_CACHE_IS_READ_ONLY || PICO_COMBINED_DOCS
128
151
void
xip_cache_clean_all
(
void
);
152
169
void
xip_cache_clean_range
(uintptr_t start_offset, uintptr_t size_bytes);
170
171
#else
172
// Stub these out inline to avoid generating a call to an empty function when they are no-ops
173
static
inline
void
xip_cache_clean_all
(
void
) {}
174
static
inline
void
xip_cache_clean_range
(uintptr_t start_offset, uintptr_t size_bytes) {
175
(void)start_offset;
176
(void)size_bytes;
177
}
178
#endif
179
180
#if !PICO_RP2040 || PICO_COMBINED_DOCS
181
201
void
xip_cache_pin_range
(uintptr_t start_offset, uintptr_t size_bytes);
202
#endif
203
204
#ifdef __cplusplus
205
}
206
#endif
207
208
#endif
// !__ASSEMBLER__
209
210
#endif
// !_HARDWARE_XIP_CACHE_H
xip_cache_invalidate_all
void xip_cache_invalidate_all(void)
Invalidate the cache for the entire XIP address space.
Definition
xip_cache.c:54
xip_cache_invalidate_range
void xip_cache_invalidate_range(uintptr_t start_offset, uintptr_t size_bytes)
Invalidate a range of offsets within the XIP address space.
Definition
xip_cache.c:65
xip_cache_clean_range
void xip_cache_clean_range(uintptr_t start_offset, uintptr_t size_bytes)
Clean a range of offsets within the XIP address space.
Definition
xip_cache.c:98
xip_cache_pin_range
void xip_cache_pin_range(uintptr_t start_offset, uintptr_t size_bytes)
Pin a range of offsets within the XIP address space.
Definition
xip_cache.c:104
xip_cache_clean_all
void xip_cache_clean_all(void)
Clean the cache for the entire XIP address space.
Definition
xip_cache.c:88
pico.h