On some platforms(e.g. APL, CNL), the external timer(wall clock) uses the external interrupt bits, here change the common timer logic to call interrupt APIs, which give a chance to handle for different cases.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com --- Test on GPMRB with: SOF master: 019637ab250daa53c15da0a0a98c54f1c58d8ca3 SOF-Tool master: 33e4b0cc6f6a44e3e7ee849c04c515a5537242c7 https://github.com/plbossart/sound/tree/topic/sof-v4.14: 6fa721a8b7c6567eea0a2181bf9a3d2a12c31b00
src/arch/xtensa/timer.c | 16 ++++++++++++++++ src/include/reef/timer.h | 18 +++--------------- 2 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/src/arch/xtensa/timer.c b/src/arch/xtensa/timer.c index 9408eb8..ee01d08 100644 --- a/src/arch/xtensa/timer.c +++ b/src/arch/xtensa/timer.c @@ -217,3 +217,19 @@ int arch_timer_set(struct timer *timer, uint64_t ticks) arch_interrupt_global_enable(flags); return 0; } + +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); +} + diff --git a/src/include/reef/timer.h b/src/include/reef/timer.h index 613cb8b..50d0825 100644 --- a/src/include/reef/timer.h +++ b/src/include/reef/timer.h @@ -36,21 +36,9 @@
int timer_register(struct timer *timer, void(*handler)(void *arg), void *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); -} +void timer_unregister(struct timer *timer); +void timer_enable(struct timer *timer); +void timer_disable(struct timer *timer);
static inline int timer_set(struct timer *timer, uint64_t ticks) {