pub struct Icache<'d> { /* private fields */ }Expand description
Instruction cache driver.
Implementations§
Source§impl<'d> Icache<'d>
impl<'d> Icache<'d>
Sourcepub fn enable_remap_region(
&mut self,
region: u8,
config: RegionConfig,
) -> Result<(), RegionError>
pub fn enable_remap_region( &mut self, region: u8, config: RegionConfig, ) -> Result<(), RegionError>
Configure and enable a memory-remap region.
region must be less than REGION_COUNT (this panics otherwise). The cache must be
disabled, and the region must not already be enabled.
Sourcepub fn disable_remap_region(&mut self, region: u8) -> Result<(), RegionError>
pub fn disable_remap_region(&mut self, region: u8) -> Result<(), RegionError>
Disable a memory-remap region.
region must be less than REGION_COUNT (this panics otherwise). The cache must be
disabled.
Source§impl<'d> Icache<'d>
impl<'d> Icache<'d>
Sourcepub fn new(_peri: Peri<'d, ICACHE>) -> Self
pub fn new(_peri: Peri<'d, ICACHE>) -> Self
Create a new instruction cache driver. The cache is left disabled; call Self::enable()
to turn it on.
Sourcepub fn enable(&mut self)
pub fn enable(&mut self)
Enable the cache.
This always succeeds even if a cache maintenance operation is ongoing: the cache is bypassed until it completes.
Sourcepub fn disable(&mut self)
pub fn disable(&mut self)
Disable the cache.
Disabling automatically triggers a full cache invalidation; this waits for EN to read
back as cleared, but not for that invalidation to finish (call Self::invalidate()
afterwards if you need that guarantee).
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns whether the cache is currently enabled.
Sourcepub fn set_associativity(&mut self, assoc: Associativity) -> bool
pub fn set_associativity(&mut self, assoc: Associativity) -> bool
Set the cache set-associativity.
Only possible while the cache is disabled. Returns false (and does nothing) if the
cache is currently enabled.
Sourcepub fn invalidate(&mut self)
pub fn invalidate(&mut self)
Invalidate the entire cache content, blocking until the operation completes.
Can be called whether the cache is enabled or disabled.
Sourcepub fn start_monitors(&mut self, monitor: Monitor)
pub fn start_monitors(&mut self, monitor: Monitor)
Start the given performance counter(s). Use Self::reset_monitors() first if you want
them to start counting from zero.
Sourcepub fn stop_monitors(&mut self, monitor: Monitor)
pub fn stop_monitors(&mut self, monitor: Monitor)
Stop the given performance counter(s). Their counts are retained.
Sourcepub fn reset_monitors(&mut self, monitor: Monitor)
pub fn reset_monitors(&mut self, monitor: Monitor)
Reset the given performance counter(s) to zero.
Sourcepub fn hit_count(&self) -> u32
pub fn hit_count(&self) -> u32
Current cache hit count. Saturates (does not wrap) at 0xFFFF_FFFF.
Sourcepub fn miss_count(&self) -> u16
pub fn miss_count(&self) -> u16
Current cache miss count. Saturates (does not wrap) at 0xFFFF.
Sourcepub fn take_error(&mut self) -> bool
pub fn take_error(&mut self) -> bool
Returns true and clears the flag if a cache error (invalid maintenance operation) has
occurred since the last call.