qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Exynos4: added RTC device


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] Exynos4: added RTC device
Date: Mon, 25 Jun 2012 10:45:54 +0100

On 25 June 2012 08:55, Oleg Ogurtsov <address@hidden> wrote:
> Subject:  [PATCH] Exynos4: added RTC device

"add", please.

>
> Signed-off-by: Oleg Ogurtsov <address@hidden>

(You don't need to send a cover letter for a single patch, by the way.)

> +#define     BCDSEC          0x0070
> +#define     BDCMIN          0x0074

typo, should be BCDMIN I assume.

> +#define     BCDHOUR         0x0078
> +#define     BCDDAY          0x007C
> +#define     BCDDAYWEEK      0x0080
> +#define     BCDMON          0x0084
> +#define     BCDYEAR         0x0088

> +/*
> + * 1Hz clock handler
> + */
> +static void exynos4210_rtc_1Hz_tick(void *opaque)
> +{
> +    Exynos4210RTCState *s = (Exynos4210RTCState *)opaque;
> +
> +    rtc_next_second(&s->current_tm);
> +    /* DPRINTF("1Hz tick\n"); */
> +
> +    /* raise IRQ */
> +    if (s->reg_rtcalm & ALARM_INT_ENABLE) {
> +        check_alarm_raise(s);
> +    }
> +
> +    ptimer_set_count(s->ptimer_1Hz, RTC_BASE_FREQ);
> +    ptimer_run(s->ptimer_1Hz, 1);
> +}

You could I think structure this so that instead of
running the timer every second you only have it go
off at the alarm time (you then recalculate the right
values etc if the guest reads/writes the registers).
That would be more complicated though and I guess one
timer fire every second isn't a big deal. We seem to
do it this way in other RTCs too, so this code is OK.

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]