AquilaOS documentation
How it works, and its code
Toggle main menu visibility
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
*/
16
int
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
}
system.h
io.h
arch_time_get
int arch_time_get(struct timespec *ts)
Reads the date and time from the real time clock.
Definition
rtc.c:16
RTC_DR
#define RTC_DR
Definition
rtc.c:11
timespec
Definition
types.h:30
timespec::tv_nsec
uint32_t tv_nsec
Definition
types.h:32
timespec::tv_sec
time_t tv_sec
Definition
types.h:31
types.h
virt.h
VIRT_RTC
#define VIRT_RTC
Definition
virt.h:16
VIRT_REG
#define VIRT_REG(base)
Definition
virt.h:30
kernel
arch
aarch64
platform
virt
rtc.c
Generated by
1.18.0