export MSDN clock() function

TPM implementation requires a free running clock with granularity
better than a 10 us. clock_t definition comes from the toolchain
includes.

BRANCH=none
BUG=chrome-os-partner:43025
TEST=none yet

Change-Id: Id3de5fd055aa598afe15657011b88d2c6be4cdfb
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/289953
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Vadim Bendebury
2015-07-30 14:36:32 -07:00
committed by ChromeOS Commit Bot
parent 26984c7de4
commit 73a8098d79
2 changed files with 14 additions and 0 deletions

View File

@@ -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;

View File

@@ -8,6 +8,8 @@
#ifndef __CROS_EC_TIMER_H
#define __CROS_EC_TIMER_H
#include <sys/types.h>
#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 */