diff --git a/common/timer.c b/common/timer.c index 8538635218..4fa2e6b93b 100644 --- a/common/timer.c +++ b/common/timer.c @@ -184,6 +184,11 @@ timestamp_t get_time(void) return ts; } +clock_t clock(void) +{ + return (clock_t) __hw_clock_source_read(); +} + void force_time(timestamp_t ts) { clksrc_high = ts.le.hi; diff --git a/include/timer.h b/include/timer.h index ddeb79a318..2c439e959e 100644 --- a/include/timer.h +++ b/include/timer.h @@ -8,6 +8,8 @@ #ifndef __CROS_EC_TIMER_H #define __CROS_EC_TIMER_H +#include + #include "common.h" #include "task_id.h" @@ -146,4 +148,11 @@ static inline unsigned time_since32(timestamp_t start) return get_time().le.lo - start.le.lo; } +/** + * Returns a free running high resolution (ten us or better) clock. + * + * Used by third party libraries requiring MSDN services. + */ +clock_t clock(void); + #endif /* __CROS_EC_TIMER_H */