cwespressif commented on a change in pull request #3794:
URL: https://github.com/apache/incubator-nuttx/pull/3794#discussion_r647922914
##########
File path: arch/risc-v/src/esp32c3/esp32c3_rtc.c
##########
@@ -2135,3 +2246,415 @@ void IRAM_ATTR
esp32c3_rtc_sleep_set_wakeup_time(uint64_t t)
modifyreg32(RTC_CNTL_INT_CLR_REG, 0, RTC_CNTL_MAIN_TIMER_INT_CLR_M);
modifyreg32(RTC_CNTL_SLP_TIMER1_REG, 0, RTC_CNTL_MAIN_TIMER_ALARM_EN_M);
}
+
+/****************************************************************************
+ * Name: esp32c3_rtc_set_boot_time
+ *
+ * Description:
+ * Set time to RTC register to replace the original boot time.
+ *
+ * Input Parameters:
+ * time_us - set time in microseconds.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+void IRAM_ATTR esp32c3_rtc_set_boot_time(uint64_t time_us)
+{
+ putreg32((uint32_t)(time_us & 0xffffffff), RTC_BOOT_TIME_LOW_REG);
+ putreg32((uint32_t)(time_us >> 32), RTC_BOOT_TIME_HIGH_REG);
+}
+
+/****************************************************************************
+ * Name: esp32c3_rtc_get_boot_time
+ *
+ * Description:
+ * Get time of RTC register to indicate the original boot time.
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * time_us - get time in microseconds.
+ *
+ ****************************************************************************/
+
+uint64_t IRAM_ATTR esp32c3_rtc_get_boot_time(void)
+{
+ return ((uint64_t)getreg32(RTC_BOOT_TIME_LOW_REG))
+ + (((uint64_t)getreg32(RTC_BOOT_TIME_HIGH_REG)) << 32);
+}
+
+#ifdef CONFIG_RTC_DRIVER
+
+/****************************************************************************
+ * Name: up_rtc_time
+ *
+ * Description:
+ * Get the current time in seconds. This is similar to the standard time()
+ * function. This interface is only required if the low-resolution
+ * RTC/counter hardware implementation selected. It is only used by the
+ * RTOS during initialization to set up the system time when CONFIG_RTC is
+ * set but neither CONFIG_RTC_HIRES nor CONFIG_RTC_DATETIME are set.
+ *
+ * Input Parameters:
+ * None
+ *
+ * Returned Value:
+ * The current time in seconds
+ *
+ ****************************************************************************/
+
+#ifndef CONFIG_RTC_HIRES
Review comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]