Introduce timeout_init_us/timeout_elapsed() delay tracking with CNTPCT.
authorYann Gautier <yann.gautier@st.com>
Thu, 14 Feb 2019 10:14:18 +0000 (11:14 +0100)
committerYann Gautier <yann.gautier@st.com>
Thu, 14 Feb 2019 10:20:23 +0000 (11:20 +0100)
commit6f4572bd7857122e65bd6d9bce9e39fc572d7c56
treeeb76813de48ffe83f96674f7aec53ffbb3987935
parente0a8ce5d0d1395da3b442c7c019ba62d1361e92b
Introduce timeout_init_us/timeout_elapsed() delay tracking with CNTPCT.

timeout_init_us(some_timeout_us); returns a reference to detect
timeout for the provided microsecond delay value from current time.

timeout_elapsed(reference) return true/false whether the reference
timeout is elapsed.

This change is inspired by the OP-TEE OS timeout resources [1].

 [1] https://github.com/OP-TEE/optee_os/blob/3.4.0/core/arch/arm/include/kernel/delay.h#L45

Change-Id: Id81ff48aa49693f555dc621064878417101d5587
Signed-off-by: Yann Gautier <yann.gautier@st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
plat/st/common/include/stm32mp_common.h