BeRTOS
|
00001 00039 #warning FIXME:This module is obsolete, yuo must refactor it. 00040 00041 #if 0 00042 #include <hw/hw_cpufreq.h> 00043 #include "timer_simple_avr.h" 00044 #include <drv/wdt.h> 00045 #include <cfg/compiler.h> 00046 #include <cfg/macros.h> /* BV() */ 00047 00048 #include <avr/io.h> 00049 00050 00051 #define MS_PER_SEC 1000UL 00052 #define TIMER_PRESCALER 64UL 00053 #define TIMER_DELAY_1MS (255 - CPU_FREQ / TIMER_PRESCALER / MS_PER_SEC) 00054 00059 void timer_delay(mtime_t time) 00060 { 00061 /* Set timer clock to clock_freq/64 */ 00062 TCCR0 = BV(CS02); 00063 00064 while (time--) 00065 { 00066 /* Initialize timer counter register */ 00067 TCNT0 = TIMER_DELAY_1MS; 00068 /* Clear overflow bit. */ 00069 TIFR |= BV(TOV0); 00070 /* Wait overflow. */ 00071 while (!(TIFR & BV(TOV0))); 00072 #if CONFIG_WATCHDOG 00073 wdt_reset(); 00074 #endif 00075 } 00076 } 00077 #endif 00078