Skip to content

Commit

Permalink
goldfish: use goldfish timer
Browse files Browse the repository at this point in the history
Signed-off-by: ligd <[email protected]>
  • Loading branch information
GUIDINGLI authored and xiaoxiang781216 committed Oct 8, 2024
1 parent 39bfdb9 commit e7094ec
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions arch/arm/src/goldfish/goldfish_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
****************************************************************************/

#include <nuttx/timers/arch_alarm.h>
#include <nuttx/fdt.h>

#include "arm_timer.h"

Expand All @@ -32,5 +33,20 @@

void up_timer_initialize(void)
{
#if defined(CONFIG_GOLDFISH_TIMER) && defined(CONFIG_LIBC_FDT)
FAR struct oneshot_lowerhalf_s *lower;
const void *fdt = fdt_get();

DEBUGASSERT(fdt != NULL);

lower = goldfish_timer_initialize(
fdt_get_reg_base_by_path(fdt, "/goldfish_rtc"),
fdt_get_irq_by_path(fdt, "/goldfish_rtc"), QEMU_SPI_IRQ_BASE);

DEBUGASSERT(lower != NULL);

up_alarm_set_lowerhalf(lower);
#else
up_alarm_set_lowerhalf(arm_timer_initialize(0));
#endif
}

0 comments on commit e7094ec

Please sign in to comment.