kernel/arch_real_time_clock: implement for riscv64
Change-Id: I3a50b3343e00ef45ef9391d463939abba9e666a0 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4072 Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
This commit is contained in:
parent
95d6ecf25d
commit
9d2cc33a64
@ -1,12 +1,29 @@
|
||||
/*
|
||||
* Copyright 2021 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include <arch/real_time_clock.h>
|
||||
#include <boot/kernel_args.h>
|
||||
|
||||
#include <real_time_clock.h>
|
||||
#include <real_time_data.h>
|
||||
|
||||
#include <Htif.h>
|
||||
|
||||
|
||||
status_t
|
||||
arch_rtc_init(kernel_args *args, struct real_time_data *data)
|
||||
{
|
||||
/*
|
||||
data->arch_data.system_time_conversion_factor
|
||||
= (1LL << 32) * 1000000LL / args->arch_args.timerFrequrency;
|
||||
|
||||
dprintf("timerFrequrency: %" B_PRIu64 "\n",
|
||||
args->arch_args.timerFrequrency);
|
||||
dprintf("system_time_conversion_factor: %" B_PRIu64 "\n",
|
||||
data->arch_data.system_time_conversion_factor);
|
||||
*/
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -14,7 +31,7 @@ arch_rtc_init(kernel_args *args, struct real_time_data *data)
|
||||
uint32
|
||||
arch_rtc_get_hw_time(void)
|
||||
{
|
||||
return 0;
|
||||
return (uint32)(HtifCmd(2, 0, 0) / 1000000);
|
||||
}
|
||||
|
||||
|
||||
@ -27,11 +44,12 @@ arch_rtc_set_hw_time(uint32 seconds)
|
||||
void
|
||||
arch_rtc_set_system_time_offset(struct real_time_data *data, bigtime_t offset)
|
||||
{
|
||||
atomic_set64(&data->arch_data.system_time_offset, offset);
|
||||
}
|
||||
|
||||
|
||||
bigtime_t
|
||||
arch_rtc_get_system_time_offset(struct real_time_data *data)
|
||||
{
|
||||
return 0;
|
||||
return atomic_get64(&data->arch_data.system_time_offset);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user