Added tls_is_rtc_running function telling if the RTC ip is alive or not

This commit is contained in:
Anatole SCHRAMM 2025-07-31 16:09:16 +02:00
parent fe879e300a
commit 1affef42cf
2 changed files with 19 additions and 0 deletions

View File

@ -58,6 +58,16 @@ void tls_set_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
*

View File

@ -82,6 +82,15 @@ void tls_get_rtc(struct tm *tblock)
tblock->tm_sec = ctrl1 & 0x0000003f;
}
/** NOT PART OF THE OFFICIAL SDK **/
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)
{
tls_reg_write32(HR_PMU_INTERRUPT_SRC, BIT(4)); /* clear rtc interrupt */