summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2021-10-13 16:57:12 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-03-28 18:17:27 +0000
commitb052c5d9ffebc48646a76922ed5711bf9a8d41dc (patch)
tree90f3205f896abe5987b7434bb91a81f49a2210be
parent8fee5eff7ed8bb22b8c0f9337b2f7ea373de7cc7 (diff)
downloadchrome-ec-b052c5d9ffebc48646a76922ed5711bf9a8d41dc.tar.gz
timer: Make udelay overridable
This patch defines udelay as overridable so that individual projects can implement customized versions. CONFIG_HW_SPECIFIC_UDELAY is no longer needed. BUG=b:218982018,b:200593658 BRANCH=None TEST=buildall; zmake testall (cherry picked from commit 5b4d9332d123f1c7dfca81b1ccaa5a4a39d72572) Change-Id: I291151755c3d714db6863749d66579007eb73ecd Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3508421
-rw-r--r--common/timer.c4
-rw-r--r--include/config.h3
-rw-r--r--include/timer.h2
3 files changed, 2 insertions, 7 deletions
diff --git a/common/timer.c b/common/timer.c
index 117cea4b71..6f31d93b09 100644
--- a/common/timer.c
+++ b/common/timer.c
@@ -94,8 +94,7 @@ void process_timers(int overflow)
} while (next.val <= get_time().val);
}
-#ifndef CONFIG_HW_SPECIFIC_UDELAY
-void udelay(unsigned us)
+__overridable void udelay(unsigned us)
{
unsigned t0 = __hw_clock_source_read();
@@ -112,7 +111,6 @@ void udelay(unsigned us)
while (__hw_clock_source_read() - t0 <= us)
;
}
-#endif
int timer_arm(timestamp_t tstamp, task_id_t tskid)
{
diff --git a/include/config.h b/include/config.h
index ba40443870..a090cfe7ec 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1964,9 +1964,6 @@
*/
#undef CONFIG_HIBERNATE_PSL
-/* Use a hardware specific udelay(). */
-#undef CONFIG_HW_SPECIFIC_UDELAY
-
/*****************************************************************************/
/* I2C configuration */
diff --git a/include/timer.h b/include/timer.h
index 35e63686d2..26d39a975d 100644
--- a/include/timer.h
+++ b/include/timer.h
@@ -71,7 +71,7 @@ int timestamp_expired(timestamp_t deadline, const timestamp_t *now);
*
* @param us Number of microseconds to delay.
*/
-void udelay(unsigned us);
+__override_proto void udelay(unsigned us);
/**
* Sleep.