We don't use layer 2 interrupt for timer on baytrail actually, it will fallback to use the root arch interrupt there.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com --- src/arch/xtensa/timer.c | 35 +++++++++++++++++++++++++++++++++++ src/include/reef/timer.h | 40 ++++++++-------------------------------- 2 files changed, 43 insertions(+), 32 deletions(-)
diff --git a/src/arch/xtensa/timer.c b/src/arch/xtensa/timer.c index 9395ca9..21b65c4 100644 --- a/src/arch/xtensa/timer.c +++ b/src/arch/xtensa/timer.c @@ -57,3 +57,38 @@ void arch_timer_set(struct timer *timer, unsigned int ticks) break; } } + +int timer_register(struct timer *timer, + void (*handler)(void *arg), void *arg) +{ + return interrupt_register(timer->irq, handler, arg); +} + +void timer_unregister(struct timer *timer) +{ + interrupt_unregister(timer->irq); +} + +void timer_enable(struct timer *timer) +{ + interrupt_enable(timer->irq); +} + +void timer_disable(struct timer *timer) +{ + interrupt_disable(timer->irq); +} + +void timer_set(struct timer *timer, unsigned int ticks) +{ + arch_timer_set(timer, ticks); +} + +//void timer_set_ms(struct timer *timer, unsigned int ms); + +void timer_clear(struct timer *timer) +{ + interrupt_clear(timer->irq); +} + + diff --git a/src/include/reef/timer.h b/src/include/reef/timer.h index d10d5e2..0c0f0ea 100644 --- a/src/include/reef/timer.h +++ b/src/include/reef/timer.h @@ -32,40 +32,16 @@ #define __INCLUDE_TIMER__
#include <arch/timer.h> +#include <reef/interrupt.h> #include <stdint.h>
-static inline int timer_register(struct timer *timer, - void(*handler)(void *arg), void *arg) -{ - return arch_timer_register(timer, handler, arg); -} - -static inline void timer_unregister(struct timer *timer) -{ - arch_timer_unregister(timer); -} - -static inline void timer_enable(struct timer *timer) -{ - arch_timer_enable(timer); -} - -static inline void timer_disable(struct timer *timer) -{ - arch_timer_disable(timer); -} - -static inline void timer_set(struct timer *timer, unsigned int ticks) -{ - arch_timer_set(timer, ticks); -} - -void timer_set_ms(struct timer *timer, unsigned int ms); - -static inline void timer_clear(struct timer *timer) -{ - arch_timer_clear(timer); -} +int timer_register(struct timer *timer, + void (*handler)(void *arg), void *arg); +void timer_unregister(struct timer *timer); +void timer_enable(struct timer *timer); +void timer_disable(struct timer *timer); +void timer_set(struct timer *timer, unsigned int ticks); +void timer_clear(struct timer *timer);
unsigned int timer_get_count(struct timer *timer);