Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 24697c3 in mainline


Ignore:
Timestamp:
2010-07-16T14:07:48Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
4d0f97d, ec08286
Parents:
dfd735a1
Message:

Program timer with the right frequency. (Expect HZ to be 100 Hz for now.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/src/mach/gta02/gta02.c

    rdfd735a1 r24697c3  
    225225         */
    226226
    227         /* Set prescaler values to zero. (no pre-divison), no dead zone. */
    228         pio_write_32(&timer->tcfg0, 0);
     227        /*
     228         * GTA02 PCLK should be 100 MHz.
     229         * Timer input freq. = PCLK / divider / (1+prescaler)
     230         * 100 MHz / 2 / (1+7) / 62500 ~= 100 Hz
     231         */
     232#if HZ != 100
     233#warning Other HZ than 100 not suppored.
     234#endif
     235
     236        /* Set prescaler values. No pre-divison, no dead zone. */
     237        pio_write_32(&timer->tcfg0, 7); /* prescale 1/8 */
    229238
    230239        /* No DMA request, divider value = 2 for all timers. */
     
    235244
    236245        /* Start counting from 64k-1. Compare value is irrelevant. */
    237         pio_write_32(&timer->timer[0].cntb, 0xffff);
     246        pio_write_32(&timer->timer[0].cntb, 62500);
    238247        pio_write_32(&timer->timer[0].cmpb, 0);
    239248
Note: See TracChangeset for help on using the changeset viewer.