MOS Source Code
Loading...
Searching...
No Matches
delays.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2
3#pragma once
4
5#include <mos/mos_global.h>
6#include <mos/types.h>
7
9{
10 u64 a, d;
11 __asm__ volatile("rdtsc" : "=a"(a), "=d"(d) : : "memory");
12 return (d << 32) | a;
13}
14
16{
17 u64 end = rdtsc() + ms * 2000 * 1000;
18 while (rdtsc() < end)
19 ;
20}
21
23{
24 u64 end = rdtsc() + us * 2000;
25 while (rdtsc() < end)
26 ;
27}
should_inline void udelay(u64 us)
Definition delays.h:22
should_inline void mdelay(u64 ms)
Definition delays.h:15
should_inline u64 rdtsc(void)
Definition delays.h:8
#define should_inline
Definition mos_global.h:37
unsigned long long u64
Definition types.h:23