Ignore:
Timestamp:
2013-02-11T22:55:29Z (11 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0f66886
Parents:
40762c6
Message:

Improve the dmtimer modules initialization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/drivers/am335x/timer.c

    r40762c6 r4c754f6  
    5656
    5757void
    58 am335x_timer_init(am335x_timer_t *timer, am335x_timer_id_t id, unsigned hz)
     58am335x_timer_init(am335x_timer_t *timer, am335x_timer_id_t id, unsigned hz,
     59    unsigned srcclk_hz)
    5960{
    6061        uintptr_t base_addr;
     
    8687        regs->tclr |= AM335x_TIMER_TCLR_AR_FLAG;
    8788
    88         /* XXX Here we assume that the timer clock source
    89          * is running at 32 Khz but this is not always the
    90          * case; DMTIMER[2 - 7] can use the internal system 24 Mhz
    91          * clock source or an external clock also.
    92          */
    93         unsigned const count = 0xFFFFFFFE - 32768 / hz;
     89        /* Disable the emulation mode */
     90        regs->tiocp_cfg |= AM335x_TIMER_TIOCPCFG_EMUFREE_FLAG;
     91
     92        unsigned const count = 0xFFFFFFFE - (srcclk_hz / hz);
    9493        regs->tcrr = count;
    9594        regs->tldr = count;
Note: See TracChangeset for help on using the changeset viewer.