Commit 994c8cfb authored by Adnan Rahman Chowdhury's avatar Adnan Rahman Chowdhury Committed by Anup Patel
Browse files

lib: sbi_timer: Added a conditional wait function which can timeout



Motivation: Suppose a peripheral needs to be configured to transmit
data. There is an SFR bit which indicates that the peripheral is ready
to transmit. The firmware should check the bit and will only transmit
data when the peripheral is ready. When the firmware starts polling the
SFR, the peripheral could be busy transmitting/receiving other data so
the firmware must wait till that completes. Assuming that there is no
other way, the firmware shouldn't wait indefinitely.

The function sbi_timer_waitms_until() will constantly check whether a
certain condition is satisfied, or timeout occurs. It can be used for
the cases when a timeout is required.

Signed-off-by: default avatarAdnan Rahman Chowdhury <adnan.chowdhury@sifive.com>
Reviewed-by: default avatarXiang W <wxjstz@126.com>
Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
parent 4489876e
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment