mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-22 06:33:03 +00:00
utils.h: add poll32
Signed-off-by: Sven Peter <sven@svenpeter.dev>
This commit is contained in:
parent
bf3830ee6d
commit
95b1cb39fc
1 changed files with 12 additions and 0 deletions
12
src/utils.h
12
src/utils.h
|
@ -313,4 +313,16 @@ void reboot(void) __attribute__((noreturn));
|
|||
reboot(); \
|
||||
} while (0)
|
||||
|
||||
static inline int poll32(u64 addr, u32 mask, u32 target, u32 timeout)
|
||||
{
|
||||
while (--timeout > 0) {
|
||||
u32 value = read32(addr) & mask;
|
||||
if (value == target)
|
||||
return 0;
|
||||
udelay(1);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue