Search
lxdream.org :: lxdream/test/timer.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/timer.c
changeset 272:fb6be85235e8
prev262:bc96e0b79308
next731:ee2e929cca3a
author nkeynes
date Thu Jan 31 09:35:01 2008 +0000 (12 years ago)
permissions -rw-r--r--
last change Update release notes for 0.8.3
file annotate diff log raw
1.1 --- a/test/timer.c Wed Jan 03 09:03:50 2007 +0000
1.2 +++ b/test/timer.c Thu Jan 31 09:35:01 2008 +0000
1.3 @@ -12,13 +12,21 @@
1.4 * Initialize the on-chip timer controller. We snag TMU channel 2 in its
1.5 * highest resolution mode, and start it counting down from max_int.
1.6 */
1.7 -void timer_start() {
1.8 +void timer_init() {
1.9 unsigned int val = byte_read(TSTR);
1.10 byte_write( TSTR, val & (~(1<<TMU_CHANNEL)) ); /* Stop counter */
1.11 long_write( TCOR(TMU_CHANNEL), 0xFFFFFFFF );
1.12 long_write( TCNT(TMU_CHANNEL), 0xFFFFFFFF );
1.13 word_write( TCR(TMU_CHANNEL), 0x00000000 );
1.14 - byte_write( TSTR, val | (1<<TMU_CHANNEL) );
1.15 +}
1.16 +
1.17 +void timer_run() {
1.18 + byte_write( TSTR, byte_read(TSTR) | (1<<TMU_CHANNEL) );
1.19 +}
1.20 +
1.21 +void timer_start() {
1.22 + timer_init();
1.23 + timer_run();
1.24 }
1.25
1.26 /**
.