Rename rtc functions

This commit is contained in:
Imbus 2025-10-01 03:38:46 +02:00
parent 76037c1c18
commit e8b2c1ae56
3 changed files with 11 additions and 5 deletions

View file

@ -21,12 +21,17 @@ static inline void mmio_write32(uintptr_t addr, uint32_t value) {
*(volatile uint32_t *)addr = value;
}
uint64_t rtc_read_time(void) {
uint64_t rtc_time_read(void) {
uint32_t low = mmio_read32(VIRT_RTC_BASE + RTC_TIME_LOW);
uint32_t high = mmio_read32(VIRT_RTC_BASE + RTC_TIME_HIGH);
return ((uint64_t)high << 32) | low;
}
void rtc_time_set(uint64_t ns) {
mmio_write32(VIRT_RTC_BASE + RTC_TIME_LOW, ns);
mmio_write32(VIRT_RTC_BASE + RTC_TIME_HIGH, ns);
}
void rtc_alarm_set(uint64_t ns) {
mmio_write32(VIRT_RTC_BASE + RTC_ALARM_HIGH, ns >> 32);
mmio_write32(VIRT_RTC_BASE + RTC_ALARM_LOW, ns & 0xffffffff);