Added the tls_is_rtc_running function which is not part of the official SDK. This allows to start the RTC after a reset and to know when it stopped running.
This commit is contained in:
parent
061fdb729b
commit
b31cc96c10
@ -58,6 +58,18 @@ void tls_set_rtc(struct tm *tblock);
|
|||||||
*/
|
*/
|
||||||
void tls_get_rtc(struct tm *tblock);
|
void tls_get_rtc(struct tm *tblock);
|
||||||
|
|
||||||
|
/** NOT PART OF THE OFFICIAL SDK **/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if the RTC peripheral is running or not
|
||||||
|
*
|
||||||
|
* @return true
|
||||||
|
* @return false
|
||||||
|
*/
|
||||||
|
bool tls_is_rtc_running(void);
|
||||||
|
|
||||||
|
/**********************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function is used to register pmu rtc interrupt
|
* @brief This function is used to register pmu rtc interrupt
|
||||||
*
|
*
|
||||||
|
@ -82,6 +82,13 @@ void tls_get_rtc(struct tm *tblock)
|
|||||||
tblock->tm_sec = ctrl1 & 0x0000003f;
|
tblock->tm_sec = ctrl1 & 0x0000003f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool tls_is_rtc_running(void)
|
||||||
|
{
|
||||||
|
int ctrl2 = tls_reg_read32(HR_PMU_RTC_CTRL2);
|
||||||
|
|
||||||
|
return ctrl2 & (1 << 16) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
void PMU_RTC_IRQHandler(void)
|
void PMU_RTC_IRQHandler(void)
|
||||||
{
|
{
|
||||||
tls_reg_write32(HR_PMU_INTERRUPT_SRC, BIT(4)); /* clear rtc interrupt */
|
tls_reg_write32(HR_PMU_INTERRUPT_SRC, BIT(4)); /* clear rtc interrupt */
|
||||||
|
Loading…
Reference in New Issue
Block a user