> compile NEMU
221220000 张三 Linux zzy 5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux 12:55:29 up 2 days, 3:09, 1 user, load average: 0.55, 0.48, 0.44
This commit is contained in:
@ -19,13 +19,12 @@
|
|||||||
|
|
||||||
static uint32_t *rtc_port_base = NULL;
|
static uint32_t *rtc_port_base = NULL;
|
||||||
|
|
||||||
__attribute_noinline__
|
|
||||||
static void rtc_io_handler(uint32_t offset, int len, bool is_write) {
|
static void rtc_io_handler(uint32_t offset, int len, bool is_write) {
|
||||||
assert(offset == 0 || offset == 4);
|
assert(offset == 0 || offset == 4);
|
||||||
if (!is_write && offset == 4) {
|
if (!is_write && offset == 4) {
|
||||||
uint64_t us = get_time();
|
uint64_t us = get_time();
|
||||||
((volatile uint32_t*)rtc_port_base)[0] = (uint32_t)us;
|
rtc_port_base[0] = (uint32_t)us;
|
||||||
((volatile uint32_t*)rtc_port_base)[1] = us >> 32;
|
rtc_port_base[1] = us >> 32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,6 +39,7 @@ static void timer_intr() {
|
|||||||
|
|
||||||
void init_timer() {
|
void init_timer() {
|
||||||
rtc_port_base = (uint32_t *)new_space(8);
|
rtc_port_base = (uint32_t *)new_space(8);
|
||||||
|
get_time();
|
||||||
#ifdef CONFIG_HAS_PORT_IO
|
#ifdef CONFIG_HAS_PORT_IO
|
||||||
add_pio_map ("rtc", CONFIG_RTC_PORT, rtc_port_base, 8, rtc_io_handler);
|
add_pio_map ("rtc", CONFIG_RTC_PORT, rtc_port_base, 8, rtc_io_handler);
|
||||||
#else
|
#else
|
||||||
|
Reference in New Issue
Block a user