comparison target-utils/buzplayer/timer.c @ 78:e3d40f49d8c4

buzplayer timer implementation finished
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 27 Oct 2016 04:04:38 +0000
parents 0f11da299b7d
children
comparison
equal deleted inserted replaced
77:0f11da299b7d 78:e3d40f49d8c4
9 */ 9 */
10 10
11 #include "types.h" 11 #include "types.h"
12 #include "timer.h" 12 #include "timer.h"
13 13
14 void
14 timer_init() 15 timer_init()
15 { 16 {
16 TIMER1_REGS.cntl = CNTL_CLOCK_ENABLE; 17 TIMER1_REGS.cntl = CNTL_CLOCK_ENABLE;
17 TIMER1_REGS.load = 1875; 18 TIMER1_REGS.load = 1875;
18 TIMER1_REGS.cntl = CNTL_CLOCK_ENABLE | CNTL_AUTO_RELOAD | CNTL_START; 19 TIMER1_REGS.cntl = CNTL_CLOCK_ENABLE | CNTL_AUTO_RELOAD | CNTL_START;
19 } 20 }
21
22 void
23 wait_for_tdma_frame()
24 {
25 u16 read1, read2;
26
27 read1 = TIMER1_REGS.read;
28 for (;;) {
29 read2 = TIMER1_REGS.read;
30 if (read2 > read1)
31 return;
32 read1 = read2;
33 }
34 }