AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
rtc.c
Go to the documentation of this file.
1
5
6#include <core/system.h>
7#include <core/types.h>
8#include <cpu/io.h>
9#include <platform/virt.h>
10
11#define RTC_DR 0x000 /* data: the seconds */
12
13/*
14 * Reads the real time clock.
15 */
16int arch_time_get(struct timespec *ts)
17{
18 ts->tv_sec = mmio_read32(VIRT_REG(VIRT_RTC) + RTC_DR);
19 ts->tv_nsec = 0;
20 return 0;
21}
int arch_time_get(struct timespec *ts)
Reads the date and time from the real time clock.
Definition rtc.c:16
#define RTC_DR
Definition rtc.c:11
uint32_t tv_nsec
Definition types.h:32
time_t tv_sec
Definition types.h:31
#define VIRT_RTC
Definition virt.h:16
#define VIRT_REG(base)
Definition virt.h:30