File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -540,15 +540,20 @@ void hal_cache_disable(void)
540540
541541void hal_cache_invalidate (void )
542542{
543- /* Check if no ongoing operation */
543+ /* 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 */
544548 if ((ICACHE_SR & ICACHE_SR_BUSYF ) == 0 ) {
545- /* Launch cache invalidation */
549+ /* Start invalidate */
546550 ICACHE_CR |= ICACHE_CR_CACHEINV ;
547551 }
548552
553+ /* If cache invalidate is active, wait for busy end flag */
549554 if (ICACHE_SR & ICACHE_SR_BUSYF ) {
550555 while ((ICACHE_SR & ICACHE_SR_BSYENDF ) == 0 );
551556 }
552- /* Clear BSYENDF */
557+ /* Clear busy end flag */
553558 ICACHE_SR |= ICACHE_SR_BSYENDF ;
554559}
You can’t perform that action at this time.
0 commit comments