MCPcopy Create free account
hub / github.com/F-Stack/f-stack / a10_timer_eventtimer_setup

Function a10_timer_eventtimer_setup

freebsd/arm/allwinner/a10_timer.c:293–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291
292#if defined(__arm__)
293static void
294a10_timer_eventtimer_setup(struct a10_timer_softc *sc)
295{
296 uint32_t val;
297
298 /* Set clock source to OSC24M, 1 pre-division, continuous mode */
299 val = timer_read_4(sc, TIMER_CTRL_REG(0));
300 val &= ~TIMER_CTRL_PRESCALAR_MASK | ~TIMER_CTRL_MODE_MASK | ~TIMER_CTRL_CLKSRC_MASK;
301 val |= TIMER_CTRL_PRESCALAR(1) | TIMER_CTRL_OSC24M;
302 timer_write_4(sc, TIMER_CTRL_REG(0), val);
303
304 /* Enable timer0 */
305 val = timer_read_4(sc, TIMER_IRQ_EN_REG);
306 val |= TIMER_IRQ_ENABLE(0);
307 timer_write_4(sc, TIMER_IRQ_EN_REG, val);
308
309 /* Set desired frequency in event timer and timecounter */
310 sc->et.et_frequency = sc->timer0_freq;
311 sc->et.et_name = "a10_timer Eventtimer";
312 sc->et.et_flags = ET_FLAGS_ONESHOT | ET_FLAGS_PERIODIC;
313 sc->et.et_quality = 1000;
314 sc->et.et_min_period = (0x00000005LLU << 32) / sc->et.et_frequency;
315 sc->et.et_max_period = (0xfffffffeLLU << 32) / sc->et.et_frequency;
316 sc->et.et_start = a10_timer_timer_start;
317 sc->et.et_stop = a10_timer_timer_stop;
318 sc->et.et_priv = sc;
319 et_register(&sc->et);
320}
321
322static int
323a10_timer_timer_start(struct eventtimer *et, sbintime_t first,

Callers 1

a10_timer_attachFunction · 0.85

Calls 1

et_registerFunction · 0.85

Tested by

no test coverage detected