summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2014-06-12 16:17:10 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-06-13 05:35:12 +0000
commit9e7cca1625d0c88322cce21b08f838c3fec4b99a (patch)
treefe1d97293a15610c6e64d4dfac731411620d2c4d
parent9359462f4429aea1748184fc2d2508aefe6e06b7 (diff)
downloadchrome-ec-9e7cca1625d0c88322cce21b08f838c3fec4b99a.tar.gz
Keyborg: remove unneeded 64-bit integer operation
The timer on Keyborg is only of 32-bit width, so we should always use get_time().le.lo instead of get_time().val to avoid unneeded 64-bit integer operations. This saves about 0.66 us per call to master_slave_sync(), which is called about 500 times per frame. BUG=None TEST=Measure the time used on master_slave_sync(). TEST=Boot and check touch scanning still works. BRANCH=None Change-Id: I6668cda3c6c00d1af971fc55fcc8d643b83a4578 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/203670 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/keyborg/master_slave.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/board/keyborg/master_slave.c b/board/keyborg/master_slave.c
index 564bc502d6..cc3c15d5a3 100644
--- a/board/keyborg/master_slave.c
+++ b/board/keyborg/master_slave.c
@@ -23,10 +23,10 @@ int master_slave_is_master(void)
static int wait_sync_signal(int mask, int v, int timeout_ms)
{
- uint32_t start = get_time().val;
+ uint32_t start = get_time().le.lo;
while ((!!(STM32_GPIO_IDR(GPIO_I) & mask)) != v) {
- if ((get_time().val - start) >= timeout_ms * MSEC)
+ if ((get_time().le.lo - start) >= timeout_ms * MSEC)
return EC_ERROR_TIMEOUT;
}
return EC_SUCCESS;