We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a92c1b9 commit 1967cc2Copy full SHA for 1967cc2
1 file changed
hal/stm32u5.c
@@ -540,15 +540,20 @@ void hal_cache_disable(void)
540
541
void hal_cache_invalidate(void)
542
{
543
- /* Check if no ongoing operation */
+ /* only try and invalidate cache if enabled */
544
+ if ((ICACHE_CR & ICACHE_CR_CEN) == 0)
545
+ return;
546
+
547
+ /* If cache invalidate not in progress, start it */
548
if ((ICACHE_SR & ICACHE_SR_BUSYF) == 0) {
- /* Launch cache invalidation */
549
+ /* Start invalidate */
550
ICACHE_CR |= ICACHE_CR_CACHEINV;
551
}
552
553
+ /* If cache invalidate is active, wait for busy end flag */
554
if (ICACHE_SR & ICACHE_SR_BUSYF) {
555
while ((ICACHE_SR & ICACHE_SR_BSYENDF) == 0);
556
- /* Clear BSYENDF */
557
+ /* Clear busy end flag */
558
ICACHE_SR |= ICACHE_SR_BSYENDF;
559
0 commit comments