]> granicus.if.org Git - esp-idf/commitdiff
newlib: fix register used for DPORT/RTC bug workaround
authorIvan Grokhotkov <ivan@espressif.com>
Wed, 18 Jan 2017 14:49:41 +0000 (22:49 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Wed, 18 Jan 2017 16:36:30 +0000 (00:36 +0800)
While there was no register at DR_REG_FRC_TIMER_BASE + 0x60, due to
peripheral address space wraparound this write actually affected one of
FRC2 registers, which is used by WiFi stack to implement legacy
ets_timer APIs.
This change uses FRC_TIMER_LOAD_REG(0) instead, which can be set to
known value safely.

components/newlib/time.c

index 30c7ca7f40e628faf759ee99914dda9c06e7e264..7595ab82b8d6e3c30e4bfc6e962c983011f10307 100644 (file)
@@ -85,9 +85,8 @@ static void IRAM_ATTR frc_timer_isr()
 {
     // Write to FRC_TIMER_INT_REG may not take effect in some cases (root cause TBD)
     // This extra write works around this issue.
-    // There is no register at DR_REG_FRC_TIMER_BASE + 0x60 (in fact, any DPORT register address can be used).
-    WRITE_PERI_REG(DR_REG_FRC_TIMER_BASE + 0x60, 0xabababab);
-    // Clear interrupt status
+    // FRC_TIMER_LOAD_REG(0) is used here, but any other DPORT register address can also be used.
+    WRITE_PERI_REG(FRC_TIMER_LOAD_REG(0), FRC_TIMER_LOAD_VALUE(0));
     WRITE_PERI_REG(FRC_TIMER_INT_REG(0), FRC_TIMER_INT_CLR);
     s_microseconds += FRC1_ISR_PERIOD_US;
 }