On 15.01.2013 10:26, Ganbold Tsagaankhuu wrote:
> Author: ganbold (doc committer)
> Date: Tue Jan 15 08:26:16 2013
> New Revision: 245450
> URL: http://svnweb.freebsd.org/changeset/base/245450
> 
> Log:
>   Initial support for Allwinner A10 SoC (Cubieboard)
>       Add simple console driver
>       Add interrupt handling and timer codes
>       Add kernel config file
>       Add dts file
>   Approved by: gonzo

> +        /* Set desired frequency in event timer and timecounter */
> +     sc->et.et_frequency = (uint64_t)freq;
> +     sc->clkfreq = (uint64_t)freq;
> +     sc->et.et_name = "a10_timer Eventtimer";
> +     sc->et.et_flags = ET_FLAGS_ONESHOT | ET_FLAGS_PERIODIC;
> +     sc->et.et_quality = 1000;
> +     sc->et.et_min_period.sec = 0;
> +     sc->et.et_min_period.frac =
> +         ((0x00000002LLU << 32) / sc->et.et_frequency) << 32;
> +     sc->et.et_max_period.sec = 0xfffffff0U / sc->et.et_frequency;
> +     sc->et.et_max_period.frac =
> +         ((0xfffffffeLLU << 32) / sc->et.et_frequency) << 32;
> +     sc->et.et_start = a10_timer_timer_start;
> +     sc->et.et_stop = a10_timer_timer_stop;
> +     sc->et.et_priv = sc;
> +     et_register(&sc->et);


> +static int
> +a10_timer_timer_start(struct eventtimer *et, struct bintime *first,
> +    struct bintime *period)
> +{
> +     struct a10_timer_softc *sc;
> +     uint32_t clo, count;
> +
> +     sc = (struct a10_timer_softc *)et->et_priv;
> +
> +     if (first != NULL) {
> +             count = (sc->et.et_frequency * (first->frac >> 32)) >> 32;
> +             if (first->sec != 0)
> +                     count += sc->et.et_frequency * first->sec;
> +
> +             /* clear */
> +             timer_write_4(sc, SW_TIMER0_CUR_VALUE_REG, 0);
> +             clo = timer_read_4(sc, SW_TIMER0_CUR_VALUE_REG);
> +             clo += count;
> +             timer_write_4(sc, SW_TIMER0_CUR_VALUE_REG, clo);
> +
> +             return (0);
> +     }
> +
> +     return (EINVAL);
> +}

It seems like you've announced periodic mode support above, but haven't
implemented it here.

-- 
Alexander Motin
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to