mirror of https://github.com/wolfSSL/wolfBoot.git
STM32U5: Only try and invalidate cache if enabled.
parent
a92c1b9ad9
commit
1967cc2670
|
@ -540,15 +540,20 @@ void hal_cache_disable(void)
|
||||||
|
|
||||||
void hal_cache_invalidate(void)
|
void hal_cache_invalidate(void)
|
||||||
{
|
{
|
||||||
/* Check if no ongoing operation */
|
/* only try and invalidate cache if enabled */
|
||||||
|
if ((ICACHE_CR & ICACHE_CR_CEN) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* If cache invalidate not in progress, start it */
|
||||||
if ((ICACHE_SR & ICACHE_SR_BUSYF) == 0) {
|
if ((ICACHE_SR & ICACHE_SR_BUSYF) == 0) {
|
||||||
/* Launch cache invalidation */
|
/* Start invalidate */
|
||||||
ICACHE_CR |= ICACHE_CR_CACHEINV;
|
ICACHE_CR |= ICACHE_CR_CACHEINV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If cache invalidate is active, wait for busy end flag */
|
||||||
if (ICACHE_SR & ICACHE_SR_BUSYF) {
|
if (ICACHE_SR & ICACHE_SR_BUSYF) {
|
||||||
while ((ICACHE_SR & ICACHE_SR_BSYENDF) == 0);
|
while ((ICACHE_SR & ICACHE_SR_BSYENDF) == 0);
|
||||||
}
|
}
|
||||||
/* Clear BSYENDF */
|
/* Clear busy end flag */
|
||||||
ICACHE_SR |= ICACHE_SR_BSYENDF;
|
ICACHE_SR |= ICACHE_SR_BSYENDF;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue