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
8
should_inline
u64
rdtsc
(
void
)
9
{
10
u64
a, d;
11
__asm__
volatile
(
"rdtsc"
:
"=a"
(a),
"=d"
(d) : :
"memory"
);
12
return
(d << 32) | a;
13
}
14
15
should_inline
void
mdelay
(
u64
ms)
16
{
17
u64
end =
rdtsc
() + ms * 2000 * 1000;
18
while
(
rdtsc
() < end)
19
;
20
}
21
22
should_inline
void
udelay
(
u64
us)
23
{
24
u64
end =
rdtsc
() + us * 2000;
25
while
(
rdtsc
() < end)
26
;
27
}
udelay
should_inline void udelay(u64 us)
Definition
delays.h:22
mdelay
should_inline void mdelay(u64 ms)
Definition
delays.h:15
rdtsc
should_inline u64 rdtsc(void)
Definition
delays.h:8
mos_global.h
should_inline
#define should_inline
Definition
mos_global.h:37
types.h
u64
unsigned long long u64
Definition
types.h:23
kernel
arch
x86_64
include
private
mos
x86
delays.h
Generated on Sun Sep 1 2024 18:22:52 for MOS Source Code by
1.12.0