timer_at91.h

Go to the documentation of this file.
00001 
00040 #ifndef DRV_AT91_TIMER_H
00041 #define DRV_AT91_TIMER_H
00042 
00043 #include <appconfig.h>     /* CONFIG_TIMER */
00044 #include <cfg/compiler.h>  /* uint8_t */
00045 #include <hw_cpu.h>        /* CLOCK_FREQ */
00046 
00054 #define TIMER_ON_PIT 1  
00055 
00056 #define TIMER_DEFAULT TIMER_ON_PIT  
00057 /* \} */
00058 
00059 /*
00060  * Hardware dependent timer initialization.
00061  */
00062 #if (CONFIG_TIMER == TIMER_ON_PIT)
00063 
00064     void timer_handler(void);
00065 
00066     #define DEFINE_TIMER_ISR     void timer_handler(void)
00067     #define TIMER_TICKS_PER_SEC  1000
00068     #define TIMER_HW_CNT         (CLOCK_FREQ / (16 * TIMER_TICKS_PER_SEC) - 1)
00069 
00071     #define TIMER_HW_HPTICKS_PER_SEC (CLOCK_FREQ / 16)
00072 
00074     typedef uint32_t hptime_t;
00075 #else
00076 
00077     #error Unimplemented value for CONFIG_TIMER
00078 #endif /* CONFIG_TIMER */
00079 
00080 
00081 #endif /* DRV_TIMER_AT91_H */