RTC tests
This commit is contained in:
parent
3e94e11212
commit
31ecdffa7e
1 changed files with 14 additions and 10 deletions
24
kern/start.c
24
kern/start.c
|
|
@ -83,16 +83,20 @@ void start() {
|
|||
buddy_free(mem);
|
||||
}
|
||||
{
|
||||
uint64_t time = rtc_time_read();
|
||||
time = rtc_time_read();
|
||||
rtc_alarm_set(time + 3000000000);
|
||||
uint64_t alrm = rtc_alarm_read();
|
||||
assert(alrm > time);
|
||||
uint32_t astatus = rtc_alarm_status();
|
||||
assert(astatus == 0);
|
||||
rtc_alarm_enable();
|
||||
astatus = rtc_alarm_status();
|
||||
assert(astatus == 1);
|
||||
const uint64_t time = rtc_time_read();
|
||||
|
||||
/* Set alarm and check that its correct */
|
||||
rtc_alarm_set(time + MS_TO_NS(1000));
|
||||
const uint64_t alrm = rtc_alarm_read();
|
||||
assert(alrm == time + MS_TO_NS(1000));
|
||||
|
||||
/* Should be one provided alarm is not elapsed */
|
||||
assert(rtc_alarm_status() == 1);
|
||||
rtc_alarm_clear();
|
||||
assert(rtc_alarm_status() == 0);
|
||||
|
||||
/* Time should have passed */
|
||||
assert(time != rtc_time_read());
|
||||
}
|
||||
{
|
||||
uint64_t rn = badrand();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue