FreeCalypso > hg > freecalypso-tools
changeset 78:e3d40f49d8c4
buzplayer timer implementation finished
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 27 Oct 2016 04:04:38 +0000 |
parents | 0f11da299b7d |
children | 49d2684805b1 |
files | target-utils/buzplayer/timer.c |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/target-utils/buzplayer/timer.c Thu Oct 27 04:01:16 2016 +0000 +++ b/target-utils/buzplayer/timer.c Thu Oct 27 04:04:38 2016 +0000 @@ -11,9 +11,24 @@ #include "types.h" #include "timer.h" +void timer_init() { TIMER1_REGS.cntl = CNTL_CLOCK_ENABLE; TIMER1_REGS.load = 1875; TIMER1_REGS.cntl = CNTL_CLOCK_ENABLE | CNTL_AUTO_RELOAD | CNTL_START; } + +void +wait_for_tdma_frame() +{ + u16 read1, read2; + + read1 = TIMER1_REGS.read; + for (;;) { + read2 = TIMER1_REGS.read; + if (read2 > read1) + return; + read1 = read2; + } +}