#include "lib.h" #define TMU_CHANNEL 2 #define BASE_TICKS_PER_US 200 #define CLOCK_DIVIDER 16 #define TOCR 0xFFD80000 /* Output control register */ #define TSTR 0xFFD80004 /* Start register */ #define TCOR(c) (0xFFD80008 + (c*12)) /* Constant register */ #define TCNT(c) (0xFFD8000C + (c*12)) /* Count register */ #define TCR(c) (0xFFD80010 + (c*12)) /* Control register */ /** * Initialize the on-chip timer controller. We snag TMU channel 2 in its * highest resolution mode, and start it counting down from max_int. */ void timer_init() { unsigned int val = byte_read(TSTR); byte_write( TSTR, val & (~(1<